From 3de0e62b1e3a8e4f2e32b6d5c15d89f8861a7781 Mon Sep 17 00:00:00 2001 From: Qowyn Date: Sat, 6 Sep 2014 19:58:54 +0200 Subject: [PATCH 1/2] Fixes #572 Adds particles to active FurnaceSlab --- .../tconstruct/tools/blocks/FurnaceSlab.java | 48 +++++++++++++++++++ .../tconstruct/tools/logic/FurnaceLogic.java | 6 +-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java b/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java index 74e57502..2b5f9b66 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, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + } + else if (direction == 5) + { + world.spawnParticle("smoke", x + 1.0F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + 1.0F, 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.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z, 0.0D, 0.0D, 0.0D); + } + else if (direction == 3) + { + world.spawnParticle("smoke", x + offset + 0.5F, y + offsetY, z + 1.0F, 0.0D, 0.0D, 0.0D); + world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z + 1.0F, 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); } From f03ed7be076564580c538ceef76dbbb63a522760 Mon Sep 17 00:00:00 2001 From: Qowyn Date: Sat, 6 Sep 2014 20:39:11 +0200 Subject: [PATCH 2/2] Derp, thats what i get for not just copying Minecraft code. Makes particles appear actually in front of the furnace and not at the block boundry. --- .../tconstruct/tools/blocks/FurnaceSlab.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java b/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java index 2b5f9b66..22951fc2 100644 --- a/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java +++ b/src/main/java/tconstruct/tools/blocks/FurnaceSlab.java @@ -159,23 +159,23 @@ public class FurnaceSlab extends InventorySlab if (direction == 4) { - world.spawnParticle("smoke", x, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", x, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + 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.0F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", x + 1.0F, y + offsetY, z + offset + 0.5F, 0.0D, 0.0D, 0.0D); + 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.0D, 0.0D, 0.0D); - world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z, 0.0D, 0.0D, 0.0D); + 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.0F, 0.0D, 0.0D, 0.0D); - world.spawnParticle("flame", x + offset + 0.5F, y + offsetY, z + 1.0F, 0.0D, 0.0D, 0.0D); + 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); } } }