Program: 10330
Project: 10330
Buggy source:
/** 
 * Writes the given chunk, creating an NBT compound tag. Note that this does <b>not</b> override the private method  {@link AnvilChunkLoader#writeChunkToNBT(Chunk,World,NBTCompoundTag)}. That method is private and cannot be overridden; plus, this version returns a tag rather than modifying the one passed as an argument. However, that method
 * @param chunk The chunk to write
 * @param world The world the chunk is in, used to determine the modified time.
 * @return A new NBTTagCompound
 */
private NBTTagCompound writeChunkToNBT(Chunk chunk,World world){
  NBTTagCompound compound=new NBTTagCompound();
  compound.setByte("String_Node_Str",(byte)1);
  compound.setInteger("String_Node_Str",chunk.xPosition);
  compound.setInteger("String_Node_Str",chunk.zPosition);
  compound.setLong("String_Node_Str",world.getTotalWorldTime());
  compound.setIntArray("String_Node_Str",chunk.getHeightMap());
  compound.setBoolean("String_Node_Str",true);
  compound.setBoolean("String_Node_Str",chunk.isLightPopulated());
  compound.setLong("String_Node_Str",chunk.getInhabitedTime());
  ExtendedBlockStorage[] blockStorageArray=chunk.getBlockStorageArray();
  NBTTagList blockStorageList=new NBTTagList();
  boolean hasSky=VersionedProperties.hasSkyLight(world);
  for (  ExtendedBlockStorage blockStorage : blockStorageArray) {
    if (blockStorage != null) {
      for (int y=0; y < 16; y++) {
        for (int z=0; z < 16; z++) {
          for (int x=0; x < 16; x++) {
            IBlockState state=blockStorage.get(x,y,z);
            int id=Block.getStateId(state);
            id=(id & 0xFFF) << 4 | (id & 0xF000) >> 12;
            if (state.getBlock() instanceof BlockTripWire) {
              logger.info(String.format("String_Node_Str",chunk.xPosition,chunk.zPosition,blockStorage.getYLocation(),x,y,z,state,id));
            }
          }
        }
      }
      NBTTagCompound blockData=new NBTTagCompound();
      blockData.setByte("String_Node_Str",(byte)(blockStorage.getYLocation() >> 4 & 255));
      byte[] buffer=new byte[4096];
      NibbleArray nibblearray=new NibbleArray();
      NibbleArray nibblearray1=blockStorage.getData().getDataForNBT(buffer,nibblearray);
      blockData.setByteArray("String_Node_Str",buffer);
      blockData.setByteArray("String_Node_Str",nibblearray.getData());
      if (nibblearray1 != null) {
        blockData.setByteArray("String_Node_Str",nibblearray1.getData());
      }
      NibbleArray blocklightArray=blockStorage.getBlocklightArray();
      int lightArrayLen=blocklightArray.getData().length;
      blockData.setByteArray("String_Node_Str",blocklightArray.getData());
      if (hasSky) {
        NibbleArray skylightArray=blockStorage.getSkylightArray();
        if (skylightArray != null) {
          blockData.setByteArray("String_Node_Str",skylightArray.getData());
        }
 else {
          logger.error("String_Node_Str" + chunk.xPosition + "String_Node_Str"+ chunk.zPosition+ "String_Node_Str"+ "String_Node_Str");
          blockData.setByteArray("String_Node_Str",new byte[lightArrayLen]);
        }
      }
 else {
        blockData.setByteArray("String_Node_Str",new byte[lightArrayLen]);
      }
      blockStorageList.appendTag(blockData);
    }
  }
  compound.setTag("String_Node_Str",blockStorageList);
  compound.setByteArray("String_Node_Str",chunk.getBiomeArray());
  chunk.setHasEntities(false);
  NBTTagList entityList=getEntityList(chunk);
  compound.setTag("String_Node_Str",entityList);
  NBTTagList tileEntityList=getTileEntityList(chunk);
  compound.setTag("String_Node_Str",tileEntityList);
  List<NextTickListEntry> updateList=world.getPendingBlockUpdates(chunk,false);
  if (updateList != null) {
    long worldTime=world.getTotalWorldTime();
    NBTTagList entries=new NBTTagList();
    for (    NextTickListEntry entry : updateList) {
      NBTTagCompound entryTag=new NBTTagCompound();
      ResourceLocation location=(ResourceLocation)Block.REGISTRY.getNameForObject(entry.getBlock());
      entryTag.setString("String_Node_Str",location == null ? "String_Node_Str" : location.toString());
      entryTag.setInteger("String_Node_Str",entry.position.getX());
      entryTag.setInteger("String_Node_Str",entry.position.getY());
      entryTag.setInteger("String_Node_Str",entry.position.getZ());
      entryTag.setInteger("String_Node_Str",(int)(entry.scheduledTime - worldTime));
      entryTag.setInteger("String_Node_Str",entry.priority);
      entries.appendTag(entryTag);
    }
    compound.setTag("String_Node_Str",entries);
  }
  return compound;
}

Fixed version (ground truth):
/** 
 * Writes the given chunk, creating an NBT compound tag. Note that this does <b>not</b> override the private method  {@link AnvilChunkLoader#writeChunkToNBT(Chunk,World,NBTCompoundTag)}. That method is private and cannot be overridden; plus, this version returns a tag rather than modifying the one passed as an argument. However, that method
 * @param chunk The chunk to write
 * @param world The world the chunk is in, used to determine the modified time.
 * @return A new NBTTagCompound
 */
private NBTTagCompound writeChunkToNBT(Chunk chunk,World world){
  NBTTagCompound compound=new NBTTagCompound();
  compound.setByte("String_Node_Str",(byte)1);
  compound.setInteger("String_Node_Str",chunk.x);
  compound.setInteger("String_Node_Str",chunk.z);
  compound.setLong("String_Node_Str",world.getTotalWorldTime());
  compound.setIntArray("String_Node_Str",chunk.getHeightMap());
  compound.setBoolean("String_Node_Str",true);
  compound.setBoolean("String_Node_Str",chunk.isLightPopulated());
  compound.setLong("String_Node_Str",chunk.getInhabitedTime());
  ExtendedBlockStorage[] blockStorageArray=chunk.getBlockStorageArray();
  NBTTagList blockStorageList=new NBTTagList();
  boolean hasSky=VersionedProperties.hasSkyLight(world);
  for (  ExtendedBlockStorage blockStorage : blockStorageArray) {
    if (blockStorage != null) {
      for (int y=0; y < 16; y++) {
        for (int z=0; z < 16; z++) {
          for (int x=0; x < 16; x++) {
            IBlockState state=blockStorage.get(x,y,z);
            int id=Block.getStateId(state);
            id=(id & 0xFFF) << 4 | (id & 0xF000) >> 12;
            if (state.getBlock() instanceof BlockTripWire) {
              logger.info(String.format("String_Node_Str",chunk.x,chunk.z,blockStorage.getYLocation(),x,y,z,state,id));
            }
          }
        }
      }
      NBTTagCompound blockData=new NBTTagCompound();
      blockData.setByte("String_Node_Str",(byte)(blockStorage.getYLocation() >> 4 & 255));
      byte[] buffer=new byte[4096];
      NibbleArray nibblearray=new NibbleArray();
      NibbleArray nibblearray1=blockStorage.getData().getDataForNBT(buffer,nibblearray);
      blockData.setByteArray("String_Node_Str",buffer);
      blockData.setByteArray("String_Node_Str",nibblearray.getData());
      if (nibblearray1 != null) {
        blockData.setByteArray("String_Node_Str",nibblearray1.getData());
      }
      NibbleArray blocklightArray=blockStorage.getBlockLight();
      int lightArrayLen=blocklightArray.getData().length;
      blockData.setByteArray("String_Node_Str",blocklightArray.getData());
      if (hasSky) {
        NibbleArray skylightArray=blockStorage.getSkyLight();
        if (skylightArray != null) {
          blockData.setByteArray("String_Node_Str",skylightArray.getData());
        }
 else {
          logger.error("String_Node_Str" + chunk.x + "String_Node_Str"+ chunk.z+ "String_Node_Str"+ "String_Node_Str");
          blockData.setByteArray("String_Node_Str",new byte[lightArrayLen]);
        }
      }
 else {
        blockData.setByteArray("String_Node_Str",new byte[lightArrayLen]);
      }
      blockStorageList.appendTag(blockData);
    }
  }
  compound.setTag("String_Node_Str",blockStorageList);
  compound.setByteArray("String_Node_Str",chunk.getBiomeArray());
  chunk.setHasEntities(false);
  NBTTagList entityList=getEntityList(chunk);
  compound.setTag("String_Node_Str",entityList);
  NBTTagList tileEntityList=getTileEntityList(chunk);
  compound.setTag("String_Node_Str",tileEntityList);
  List<NextTickListEntry> updateList=world.getPendingBlockUpdates(chunk,false);
  if (updateList != null) {
    long worldTime=world.getTotalWorldTime();
    NBTTagList entries=new NBTTagList();
    for (    NextTickListEntry entry : updateList) {
      NBTTagCompound entryTag=new NBTTagCompound();
      ResourceLocation location=(ResourceLocation)Block.REGISTRY.getNameForObject(entry.getBlock());
      entryTag.setString("String_Node_Str",location == null ? "String_Node_Str" : location.toString());
      entryTag.setInteger("String_Node_Str",entry.position.getX());
      entryTag.setInteger("String_Node_Str",entry.position.getY());
      entryTag.setInteger("String_Node_Str",entry.position.getZ());
      entryTag.setInteger("String_Node_Str",(int)(entry.scheduledTime - worldTime));
      entryTag.setInteger("String_Node_Str",entry.priority);
      entries.appendTag(entryTag);
    }
    compound.setTag("String_Node_Str",entries);
  }
  return compound;
}