if (saveNBT == null)
{
saveNBT = new NBTTagCompound();
}
NBTTagList list;
if (saveNBT.hasKey(NBT_FIELD_BLOCK_LIST))
{
list = (NBTTagList) saveNBT.getTag(NBT_FIELD_BLOCK_LIST);
}
else
{
list = new NBTTagList();
}
for (int x = minPoint.intX(); x <= maxPoint.intX(); x++)
{
for (int y = minPoint.intY(); y <= maxPoint.intY(); y++)
{
for (int z = minPoint.intZ(); z <= maxPoint.intZ(); z++)
{
Vector3 position = new Vector3(x, y, z);
Vector3 targetCheck = midPoint.clone().translate(position);
int blockID = targetCheck.getBlockID(world);
if (blockID > 0)
{
if (!nbt.getBoolean(NBT_MODE))
{
NBTTagCompound vectorTag = new NBTTagCompound();
position.writeToNBT(vectorTag);
vectorTag.setInteger(NBT_FIELD_BLOCK_ID, blockID);
vectorTag.setInteger(NBT_FIELD_BLOCK_METADATA, targetCheck.getBlockMetadata(world));
list.appendTag(vectorTag);
}
else
{
for (int i = 0; i < list.tagCount(); i++)
{
Vector3 vector = new Vector3((NBTTagCompound) list.tagAt(i));
if (vector.equals(position))
{
list.removeTag(i);
}
}
}
}
}
}
}
saveNBT.setTag(NBT_FIELD_BLOCK_LIST, list);
nbt.setInteger(NBT_FIELD_SIZE, list.tagCount());
NBTUtility.saveData(getSaveDirectory(), NBT_FILE_SAVE_PREFIX + getModeID(itemStack), saveNBT);
this.clearCache();