diff --git a/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java b/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java index 74e57502..22951fc2 100644 --- a/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java +++ b/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java @@ -1,5 +1,7 @@ package tconstruct.tools.blocks; +import java.util.Random; + import mantle.blocks.abstracts.InventorySlab; import mantle.blocks.iface.IActiveLogic; import mantle.blocks.iface.IFacingLogic; @@ -132,4 +134,50 @@ public class FurnaceSlab extends InventorySlab } return null; } + + @SideOnly(Side.CLIENT) + @Override + public void randomDisplayTick (World world, int x, int y, int z, Random random) + { + TileEntity logic = world.getTileEntity(x, y, z); + short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0; + int meta = world.getBlockMetadata(x, y, z); + int metaType = meta % 8; + int metaPos = meta / 8; + + if (metaType == 0) + { + if (((IActiveLogic) logic).getActive()) + { + float offset = random.nextFloat() * 0.6F - 0.3F; + float offsetY = random.nextFloat() * 6.0F / 16.0F; + + if (metaPos == 1) + { + offsetY += 0.5F; + } + + if (direction == 4) + { + world.spawnParticle("smoke", x - 0.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x - 0.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + } + else if (direction == 5) + { + world.spawnParticle("smoke", x + 1.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 1.02F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + } + else if (direction == 2) + { + world.spawnParticle("smoke", x + offset + 0.5F, y + offsetY, z - 0.02F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z - 0.02F, 0.0D, 0.0D, 0.0D); + } + else if (direction == 3) + { + world.spawnParticle("smoke", x + offset + 0.5F, y + offsetY, z + 1.02F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z + 1.02F, 0.0D, 0.0D, 0.0D); + } + } + } + } } diff --git a/src/main/java/tconstruct/tools/logic/FurnaceLogic.java b/src/main/java/tconstruct/tools/logic/FurnaceLogic.java index 8c5c14c5..78c25501 100644 --- a/src/main/java/tconstruct/tools/logic/FurnaceLogic.java +++ b/src/main/java/tconstruct/tools/logic/FurnaceLogic.java @@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.GameRegistry; public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacingLogic, ISidedInventory { - boolean active; + boolean active = false; public int fuel; public int fuelGague; public int progress; @@ -51,7 +51,6 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin public FurnaceLogic() { super(3); - active = false; } @Override @@ -274,7 +273,6 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin public void writeToNBT (NBTTagCompound tags) { super.writeToNBT(tags); - tags.setBoolean("Active", active); tags.setInteger("Fuel", fuel); tags.setInteger("FuelGague", fuelGague); writeNetworkNBT(tags); @@ -282,11 +280,13 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin public void readNetworkNBT (NBTTagCompound tags) { + active = tags.getBoolean("Active"); direction = tags.getByte("Direction"); } public void writeNetworkNBT (NBTTagCompound tags) { + tags.setBoolean("Active", active); tags.setByte("Direction", direction); }