Skip to content

Commit

Permalink
Fixes #176
Browse files Browse the repository at this point in the history
  • Loading branch information
planetguy32 committed Oct 11, 2015
1 parent 8a44f84 commit 3f7ba64
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void registerBlockIcons(IIconRegister IconRegister) {
Registry.RegisterIcon(IconRegister, "DirectedSide1"),
Registry.RegisterIcon(IconRegister, "DirectedSide2"),
Types.Adapter.NormalIcon);

TileEntityCarriageRotator.onRegisterIcons(IconRegister);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,18 @@ 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 ( ) ;

return (Blocks.iron_block.getIcon(0, 0));
}
}

public SidedIcons getIconHelper() {
return helper;
}

public void setConfiguration(long flags, EntityPlayerMP changer){
setConfigurationSuper(flags, changer);
pointedDir=Directions.values()[(int) (flags&7)];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
Expand All @@ -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()) {
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

public class TileEntityCarriageRotator extends TileEntityCarriageDirected implements ISpecialMoveBehavior {

static IIcon[][] icons;

public boolean alreadyMoving;

@Override
Expand Down Expand Up @@ -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];
}
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3f7ba64

Please sign in to comment.