From 3f7ba64a144dfa261be8c3599b51bc03ebb83833 Mon Sep 17 00:00:00 2001 From: Planetguy Date: Sun, 11 Oct 2015 13:53:48 -0700 Subject: [PATCH] Fixes #176 --- .../base/TileEntityCamouflageable.java | 15 +++++++++++++++ .../remaininmotion/drive/BlockCarriageDrive.java | 2 +- .../drive/TileEntityCarriageDirected.java | 6 +++++- .../drive/TileEntityCarriageDrive.java | 8 ++++++++ .../drive/TileEntityCarriageRotator.java | 6 +++--- .../spectre/TileEntityMotiveSpectre.java | 3 ++- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/planetguy/remaininmotion/base/TileEntityCamouflageable.java b/src/main/java/me/planetguy/remaininmotion/base/TileEntityCamouflageable.java index a2f1724..e59251f 100644 --- a/src/main/java/me/planetguy/remaininmotion/base/TileEntityCamouflageable.java +++ b/src/main/java/me/planetguy/remaininmotion/base/TileEntityCamouflageable.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; public class TileEntityCamouflageable extends TileEntityRiM { @@ -30,5 +31,19 @@ public int getDecorationMeta() { public boolean isSideCamouflaged(int side) { return false; } + + @Override + public void ReadCommonRecord(NBTTagCompound TagCompound) { + Decoration = Block.getBlockById(TagCompound.getInteger("DecorationId")); + + DecorationMeta = TagCompound.getInteger("DecorationMeta"); + } + + @Override + public void WriteCommonRecord(NBTTagCompound TagCompound) { + TagCompound.setInteger("DecorationId", Block.getIdFromBlock(Decoration)); + + TagCompound.setInteger("DecorationMeta", DecorationMeta); + } } diff --git a/src/main/java/me/planetguy/remaininmotion/drive/BlockCarriageDrive.java b/src/main/java/me/planetguy/remaininmotion/drive/BlockCarriageDrive.java index 4ada539..418b953 100644 --- a/src/main/java/me/planetguy/remaininmotion/drive/BlockCarriageDrive.java +++ b/src/main/java/me/planetguy/remaininmotion/drive/BlockCarriageDrive.java @@ -128,7 +128,7 @@ public void registerBlockIcons(IIconRegister IconRegister) { Registry.RegisterIcon(IconRegister, "DirectedSide1"), Registry.RegisterIcon(IconRegister, "DirectedSide2"), Types.Adapter.NormalIcon); - + TileEntityCarriageRotator.onRegisterIcons(IconRegister); } diff --git a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDirected.java b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDirected.java index 0ef96ea..4c8bc05 100644 --- a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDirected.java +++ b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDirected.java @@ -100,7 +100,7 @@ public IIcon getIcon(int side, int meta) { if(SideClosed[side]) return super.getIcon(side, meta); else - return helper.getIcon(ForgeDirection.values()[pointedDir.ordinal()], side); + return getIconHelper().getIcon(ForgeDirection.values()[pointedDir.ordinal()], side); } catch (Throwable Throwable) { Throwable . printStackTrace ( ) ; @@ -108,6 +108,10 @@ public IIcon getIcon(int side, int meta) { } } + public SidedIcons getIconHelper() { + return helper; + } + public void setConfiguration(long flags, EntityPlayerMP changer){ setConfigurationSuper(flags, changer); pointedDir=Directions.values()[(int) (flags&7)]; diff --git a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDrive.java b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDrive.java index 319f9b4..1263827 100644 --- a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDrive.java +++ b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageDrive.java @@ -79,6 +79,8 @@ public abstract class TileEntityCarriageDrive extends TileEntityCamouflageable i @Override public void WriteCommonRecord(NBTTagCompound tag) { + super.WriteCommonRecord(tag); + tag.setBoolean("Continuous", Continuous); for (Directions Direction : Directions.values()) { @@ -104,6 +106,8 @@ public void WriteCommonRecord(NBTTagCompound tag) { @Override public void WriteServerRecord(NBTTagCompound tag) { + super.WriteServerRecord(tag); + tag.setBoolean("Signalled", Signalled); tag.setInteger("CooldownRemaining", CooldownRemaining); @@ -115,6 +119,8 @@ public void WriteServerRecord(NBTTagCompound tag) { @Override public void ReadCommonRecord(NBTTagCompound tag) { + super.ReadCommonRecord(tag); + Continuous = tag.getBoolean("Continuous"); for (Directions Direction : Directions.values()) { @@ -141,6 +147,8 @@ public void ReadCommonRecord(NBTTagCompound tag) { @Override public void ReadServerRecord(NBTTagCompound tag) { + super.ReadServerRecord(tag); + Signalled = tag.getBoolean("Signalled"); CooldownRemaining = tag.getInteger("CooldownRemaining"); diff --git a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageRotator.java b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageRotator.java index 1e48474..dbec9bb 100644 --- a/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageRotator.java +++ b/src/main/java/me/planetguy/remaininmotion/drive/TileEntityCarriageRotator.java @@ -30,6 +30,8 @@ public class TileEntityCarriageRotator extends TileEntityCarriageDirected implements ISpecialMoveBehavior { + static IIcon[][] icons; + public boolean alreadyMoving; @Override @@ -114,7 +116,7 @@ public void EstablishSpectre(CarriagePackage Package) { public IIcon getIcon(int side, int meta) { try { if (drawSideClosed(side)) { - return BlockCarriageDrive.InactiveIcon; + return super.getIcon(side, meta); } else { return icons[pointedDir.ordinal()][side]; } @@ -123,8 +125,6 @@ public IIcon getIcon(int side, int meta) { } } - public static IIcon[][] icons; - public static void onRegisterIcons(IIconRegister iconRegister) { IIcon pivotCCW = Registry.RegisterIcon(iconRegister, "RotatorArrowCCW"); IIcon pivotCW = new IconFlipped(pivotCCW, true, false); diff --git a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java index 6b31db5..7a9970e 100644 --- a/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java +++ b/src/main/java/me/planetguy/remaininmotion/spectre/TileEntityMotiveSpectre.java @@ -207,7 +207,8 @@ public void doRelease() { } for (BlockRecord record : body) { - EventPool.postCancelableOnBlockAddedEvent(worldObj,record.X,record.Y,record.Z); + //If we don't onBlockAdded() anyway, why post events? + //EventPool.postCancelableOnBlockAddedEvent(worldObj,record.X,record.Y,record.Z); //if(!event.isCanceled()) // record.block.onBlockAdded(worldObj,record.X,record.Y,record.Z); EventPool.postMotionFinalizeEvent(record);