Skip to content

Commit

Permalink
Fix potential errors on nbt serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
darkevilmac committed Sep 4, 2017
1 parent 51bbac1 commit b6eb450
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,13 @@ public NBTTagCompound writeToNBT(NBTTagCompound tag) {
} else {
tag.removeTag("colour");
}
tag.setUniqueId("buffer", bufferID);
tag.setUniqueId("filter", filterID);

if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
if(bufferData == null || filterData == null)
validate();
tag.setUniqueId("buffer", bufferData.getId());
tag.setUniqueId("filter", filterData.getId());

tag.setInteger("databaseID", getWorld().provider.getDimension());
if (networkTile.getNode() == null)
getNetworkAssistant(ItemStack.class).onNodePlaced(world, pos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ public boolean canFitItemsInBuffer() {
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
if (FMLCommonHandler.instance().getEffectiveSide().isServer() && !(this instanceof TileFilter)) {
if(bufferData == null)
validate();
tag.setUniqueId("buffer", bufferData.getId());

tag.setInteger("databaseID", getWorld().provider.getDimension());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,13 @@ public NBTTagCompound writeToNBT(NBTTagCompound tag) {
}
}
tag.setTag("colours", coloursTag);
tag.setUniqueId("buffer", bufferID);
tag.setUniqueId("filter", filterID);

if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
if(bufferData == null || filterData == null)
validate();
tag.setUniqueId("buffer", bufferData.getId());
tag.setUniqueId("filter", filterData.getId());

tag.setInteger("databaseID", getWorld().provider.getDimension());
if (inputTile.getNode() == null || outputTile.getNode() == null)
getNetworkAssistant(ItemStack.class).onNodePlaced(world, pos);
Expand Down

0 comments on commit b6eb450

Please sign in to comment.