Fix TE syncing on login, 2 minor optimizations

This commit is contained in:
Vincent Lee committed 2016-05-19 14:07:52 -05:00
1 parent 96983a1d6b
commit 995c19c04a
3 files changed
+8 -12

No files matched your search

@@ -37,10 +37,15 @@ public class TileMod extends TileEntity implements ITickable {
return ret;
}
@Nonnull
@Override
public final NBTTagCompound getUpdateTag() {
return writeToNBT(new NBTTagCompound());
}
@Override
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
super.readFromNBT(par1nbtTagCompound);
readCustomNBT(par1nbtTagCompound);
}
@@ -53,10 +58,8 @@ public class TileMod extends TileEntity implements ITickable {
}
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeCustomNBT(nbttagcompound);
return new SPacketUpdateTileEntity(pos, -999, nbttagcompound);
public final SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(pos, -999, getUpdateTag());
}
@Override
@@ -27,9 +27,6 @@ public class Item16Colors extends ItemMod implements IColorable {
@Override
public int getColorFromItemStack(ItemStack par1ItemStack, int par2) {
if(par1ItemStack.getItemDamage() >= EnumDyeColor.values().length)
return 0xFFFFFF;
return EnumDyeColor.byMetadata(par1ItemStack.getItemDamage()).getMapColor().colorValue;
}
@@ -91,10 +91,6 @@ public class ItemSignalFlare extends ItemMod implements IColorable {
if(par2 == 0)
return 0xFFFFFF;
int colorv = getColor(par1ItemStack);
if(colorv >= EnumDyeColor.values().length || colorv < 0)
return 0xFFFFFF;
return EnumDyeColor.byMetadata(getColor(par1ItemStack)).getMapColor().colorValue;
}