Program: 165991
Project: 165991
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.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);
  buf.writeBoolean(respawnHere);
  ByteBufTools.writeFloat(buf,celestialAngle);
  ByteBufTools.writeFloat(buf,timeSpeed);
  buf.writeInt(probeCounter);
  buf.writeInt(actualRfCost);
  skyDescriptor.toBytes(buf);
  weatherDescriptor.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());
      }
    }
  }
  buf.writeInt(dimensionTypes.length);
  for (  String type : dimensionTypes) {
    ByteBufTools.writeString(buf,type);
  }
}

Fixed version (ground truth):
public void toBytes(ByteBuf buf){
  NetworkTools.writeEnum(buf,terrainType,TerrainType.TERRAIN_VOID);
  NetworkTools.writeEnumCollection(buf,featureTypes);
  NetworkTools.writeEnumCollection(buf,structureTypes);
  NetworkTools.writeEnumCollection(buf,effectTypes);
  buf.writeInt(biomes.size());
  for (  BiomeGenBase entry : biomes) {
    buf.writeInt(entry.biomeID);
  }
  NetworkTools.writeEnum(buf,controllerType,ControllerType.CONTROLLER_DEFAULT);
  NetworkTools.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);
  buf.writeBoolean(respawnHere);
  NetworkTools.writeFloat(buf,celestialAngle);
  NetworkTools.writeFloat(buf,timeSpeed);
  buf.writeInt(probeCounter);
  buf.writeInt(actualRfCost);
  skyDescriptor.toBytes(buf);
  weatherDescriptor.toBytes(buf);
  buf.writeInt(extraMobs.size());
  for (  MobDescriptor mob : extraMobs) {
    if (mob != null) {
      if (mob.getEntityClass() != null) {
        NetworkTools.writeString(buf,mob.getEntityClass().getName());
        buf.writeInt(mob.getSpawnChance());
        buf.writeInt(mob.getMinGroup());
        buf.writeInt(mob.getMaxGroup());
        buf.writeInt(mob.getMaxLoaded());
      }
    }
  }
  buf.writeInt(dimensionTypes.length);
  for (  String type : dimensionTypes) {
    NetworkTools.writeString(buf,type);
  }
}