diff --git a/src/main/java/techreborn/blocks/machine/BlockGrinder.java b/src/main/java/techreborn/blocks/machine/BlockGrinder.java index efd0cba72..ee84683cd 100644 --- a/src/main/java/techreborn/blocks/machine/BlockGrinder.java +++ b/src/main/java/techreborn/blocks/machine/BlockGrinder.java @@ -10,10 +10,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import techreborn.Core; import techreborn.blocks.BlockMachineBase; import techreborn.client.GuiHandler; +import techreborn.tiles.TileCentrifuge; import techreborn.tiles.TileGrinder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,9 +24,15 @@ public class BlockGrinder extends BlockMachineBase{ @SideOnly(Side.CLIENT) private IIcon iconFront; + + @SideOnly(Side.CLIENT) + private IIcon iconFrontOn; @SideOnly(Side.CLIENT) private IIcon iconTop; + + @SideOnly(Side.CLIENT) + private IIcon iconTopOn; @SideOnly(Side.CLIENT) private IIcon iconBottom; @@ -57,18 +65,39 @@ public class BlockGrinder extends BlockMachineBase{ { this.blockIcon = icon.registerIcon("techreborn:machine/machine_side"); this.iconFront = icon.registerIcon("techreborn:machine/industrial_grinder_front_off"); + this.iconFrontOn = icon.registerIcon("techreborn:machine/industrial_grinder_front_on"); this.iconTop = icon.registerIcon("techreborn:machine/industrial_grinder_top_off"); + this.iconTopOn = icon.registerIcon("techreborn:machine/industrial_grinder_top_on"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); } - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int metadata) - { + @Override + public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { + int metadata = blockAccess.getBlockMetadata(x, y, z); + TileGrinder tileGrinder = (TileGrinder) blockAccess.getTileEntity(x, y, z); + if(side >= 2 && tileGrinder.crafter.isActive()){ + return this.iconFrontOn; + } + + if(side == 1 && tileGrinder.crafter.isActive()){ + return this.iconTopOn; + } + return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : side == 0 ? this.iconBottom: (side == 0 ? this.iconTop - : (side == metadata ? this.iconFront : this.blockIcon)); + : (side == metadata ? this.iconFront : this.iconFront)); + + } + + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int metadata) + { + return metadata == 0 && side == 3 ? this.iconFront + : side == 1 ? this.iconTop : + side == 0 ? this.iconBottom: (side == 0 ? this.iconTop + : (side == metadata ? this.iconFront : this.iconFront)); }