Program: 166024
Project: 166024
Buggy source:
public void toBytes(ByteBuf buf){
  ByteBufTools.writeEnum(buf,terrainType,TerrainType.TERRAIN_VOID);
  ByteBufTools.writeEnumCollection(buf,featureTypes);
  ByteBufTools.writeEnumCollection(buf,structureTypes);
  ByteBufTools.writeEnumCollection(buf,effectTypes);
  buf.writeInt(biomes.size());
  for (  BiomeGenBase entry : biomes) {
    buf.writeInt(entry.biomeID);
  }
  ByteBufTools.writeEnum(buf,controllerType,ControllerType.CONTROLLER_DEFAULT);
  ByteBufTools.writeString(buf,digitString);
  buf.writeLong(forcedDimensionSeed);
  buf.writeInt(worldVersion);
  buf.writeInt(Block.blockRegistry.getIDForObject(baseBlockForTerrain.getBlock()));
  buf.writeInt(baseBlockForTerrain.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(tendrilBlock.getBlock()));
  buf.writeInt(tendrilBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(sphereBlock.getBlock()));
  buf.writeInt(sphereBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(liquidSphereBlock.getBlock()));
  buf.writeInt(liquidSphereBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(liquidSphereFluid));
  buf.writeInt(Block.blockRegistry.getIDForObject(canyonBlock.getBlock()));
  buf.writeInt(canyonBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(fluidForTerrain));
  buf.writeInt(extraOregen.length);
  for (  BlockMeta block : extraOregen) {
    buf.writeInt(Block.blockRegistry.getIDForObject(block.getBlock()));
    buf.writeInt(block.getMeta());
  }
  buf.writeInt(fluidsForLakes.length);
  for (  Block block : fluidsForLakes) {
    buf.writeInt(Block.blockRegistry.getIDForObject(block));
  }
  buf.writeBoolean(peaceful);
  buf.writeBoolean(shelter);
  ByteBufTools.writeFloat(buf,celestialAngle);
  ByteBufTools.writeFloat(buf,timeSpeed);
  buf.writeInt(probeCounter);
  buf.writeInt(actualRfCost);
  skyDescriptor.toBytes(buf);
  buf.writeInt(extraMobs.size());
  for (  MobDescriptor mob : extraMobs) {
    if (mob != null) {
      if (mob.getEntityClass() != null) {
        ByteBufTools.writeString(buf,mob.getEntityClass().getName());
        buf.writeInt(mob.getSpawnChance());
        buf.writeInt(mob.getMinGroup());
        buf.writeInt(mob.getMaxGroup());
        buf.writeInt(mob.getMaxLoaded());
      }
    }
  }
}

Fixed version (ground truth):
public void toBytes(ByteBuf buf){
  ByteBufTools.writeEnum(buf,terrainType,TerrainType.TERRAIN_VOID);
  ByteBufTools.writeEnumCollection(buf,featureTypes);
  ByteBufTools.writeEnumCollection(buf,structureTypes);
  ByteBufTools.writeEnumCollection(buf,effectTypes);
  buf.writeInt(biomes.size());
  for (  BiomeGenBase entry : biomes) {
    buf.writeInt(entry.biomeID);
  }
  ByteBufTools.writeEnum(buf,controllerType,ControllerType.CONTROLLER_DEFAULT);
  ByteBufTools.writeString(buf,digitString);
  buf.writeLong(forcedDimensionSeed);
  buf.writeLong(baseSeed);
  buf.writeInt(worldVersion);
  buf.writeInt(Block.blockRegistry.getIDForObject(baseBlockForTerrain.getBlock()));
  buf.writeInt(baseBlockForTerrain.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(tendrilBlock.getBlock()));
  buf.writeInt(tendrilBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(sphereBlock.getBlock()));
  buf.writeInt(sphereBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(liquidSphereBlock.getBlock()));
  buf.writeInt(liquidSphereBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(liquidSphereFluid));
  buf.writeInt(Block.blockRegistry.getIDForObject(canyonBlock.getBlock()));
  buf.writeInt(canyonBlock.getMeta());
  buf.writeInt(Block.blockRegistry.getIDForObject(fluidForTerrain));
  buf.writeInt(extraOregen.length);
  for (  BlockMeta block : extraOregen) {
    buf.writeInt(Block.blockRegistry.getIDForObject(block.getBlock()));
    buf.writeInt(block.getMeta());
  }
  buf.writeInt(fluidsForLakes.length);
  for (  Block block : fluidsForLakes) {
    buf.writeInt(Block.blockRegistry.getIDForObject(block));
  }
  buf.writeBoolean(peaceful);
  buf.writeBoolean(shelter);
  ByteBufTools.writeFloat(buf,celestialAngle);
  ByteBufTools.writeFloat(buf,timeSpeed);
  buf.writeInt(probeCounter);
  buf.writeInt(actualRfCost);
  skyDescriptor.toBytes(buf);
  buf.writeInt(extraMobs.size());
  for (  MobDescriptor mob : extraMobs) {
    if (mob != null) {
      if (mob.getEntityClass() != null) {
        ByteBufTools.writeString(buf,mob.getEntityClass().getName());
        buf.writeInt(mob.getSpawnChance());
        buf.writeInt(mob.getMinGroup());
        buf.writeInt(mob.getMaxGroup());
        buf.writeInt(mob.getMaxLoaded());
      }
    }
  }
}