Skip to content

Commit

Permalink
Fixes #572
Browse files Browse the repository at this point in the history
Adds particles to active FurnaceSlab
  • Loading branch information
Qowyn committed Sep 6, 2014
1 parent 2342d4a commit 3de0e62
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
48 changes: 48 additions & 0 deletions 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;
Expand Down Expand Up @@ -132,4 +134,50 @@ public TileEntity createNewTileEntity (World var1, int metadata)
}
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);
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/tconstruct/tools/logic/FurnaceLogic.java
Expand Up @@ -38,7 +38,7 @@

public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacingLogic, ISidedInventory
{
boolean active;
boolean active = false;
public int fuel;
public int fuelGague;
public int progress;
Expand All @@ -51,7 +51,6 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
public FurnaceLogic()
{
super(3);
active = false;
}

@Override
Expand Down Expand Up @@ -274,19 +273,20 @@ public void readFromNBT (NBTTagCompound tags)
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
tags.setBoolean("Active", active);
tags.setInteger("Fuel", fuel);
tags.setInteger("FuelGague", fuelGague);
writeNetworkNBT(tags);
}

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

Expand Down

0 comments on commit 3de0e62

Please sign in to comment.