Merge pull request #958 from Qowyn/furnace-slab

Fixes #572
This commit is contained in:
boni committed 2014-09-08 17:58:05 +02:00
commit 010b1b80c7
2 files changed
+51 -3

No files matched your search

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