Skip to content

Commit

Permalink
override getUpdateTag correctly. was calling writeToNBT with the supe…
Browse files Browse the repository at this point in the history
…rclass' desc tag as parent, which writes the desc tag!

If the whole NBT _IS_ needed in the update tag, it should be called with a BLANK Compound.

This should fix rwtema#101 properly.
  • Loading branch information
thiakil committed May 9, 2017
1 parent b19bc50 commit c1abacb
Showing 1 changed file with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ public TileMovingServer() {
@Override
@Nonnull
public NBTTagCompound getUpdateTag() {
if (desc == null)
return super.getUpdateTag();
NBTTagCompound updateTag = super.getUpdateTag();

super.writeToNBT(desc);

desc.setInteger("Time", time);
desc.setInteger("MaxTime", maxTime);
desc.setByte("Dir", (byte) dir);
updateTag.setInteger("Time", time);
updateTag.setInteger("MaxTime", maxTime);
updateTag.setByte("Dir", (byte) dir);

if (lightLevel > 0)
desc.setByte("Light", (byte) lightLevel);
updateTag.setByte("Light", (byte) lightLevel);
if (lightOpacity > 0)
desc.setShort("Opacity", (short) lightOpacity);
updateTag.setShort("Opacity", (short) lightOpacity);

if (collisions.length > 0) {
desc.setTag("Collisions", TagsAxis(collisions));
updateTag.setTag("Collisions", TagsAxis(collisions));
}

return desc;
return updateTag;
}

@Override
Expand Down

0 comments on commit c1abacb

Please sign in to comment.