Inital port to tile based meta

This commit is contained in:
Modmuss50 2015-09-05 09:17:58 +01:00
parent 2c863d9e11
commit d3e860edb2
34 changed files with 198 additions and 246 deletions

View file

@ -136,7 +136,7 @@ public class RecipeCrafter {
setCurrentRecipe(recipe);//Sets the current recipe then syncs setCurrentRecipe(recipe);//Sets the current recipe then syncs
this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier)); this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier));
this.currentTickTime = -1; this.currentTickTime = -1;
syncIsActive(); setIsActive();
} else { } else {
this.currentTickTime = -0; this.currentTickTime = -0;
} }
@ -146,7 +146,7 @@ public class RecipeCrafter {
if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset
currentRecipe = null; currentRecipe = null;
currentTickTime = 0; currentTickTime = 0;
syncIsActive(); setIsActive();
} }
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
boolean canGiveInvAll = true; boolean canGiveInvAll = true;
@ -166,7 +166,7 @@ public class RecipeCrafter {
useAllInputs();//this uses all the inputs useAllInputs();//this uses all the inputs
currentRecipe = null;//resets currentRecipe = null;//resets
currentTickTime = 0; currentTickTime = 0;
syncIsActive(); setIsActive();
} }
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) { } else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
if (energy.canUseEnergy(getEuPerTick())) {//This uses the power if (energy.canUseEnergy(getEuPerTick())) {//This uses the power
@ -325,18 +325,13 @@ public class RecipeCrafter {
} }
public void syncIsActive() { public void setIsActive() {
if (!parentTile.getWorldObj().isRemote) { if(isActiveServer()){
PacketHandler.sendPacketToAllPlayers(getSyncPacket(), parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2);
parentTile.getWorldObj()); } else {
} parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2);
} }
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
public Packet getSyncPacket() {
NBTTagCompound nbtTag = new NBTTagCompound();
writeToNBT(nbtTag);
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
this.parentTile.zCoord, 1, nbtTag);
} }
public void setCurrentRecipe(IBaseRecipeType recipe) { public void setCurrentRecipe(IBaseRecipeType recipe) {

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
@ -51,14 +52,13 @@ public class BlockChunkLoader extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockComputerCube extends BlockMachineBase { public class BlockComputerCube extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockComputerCube extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/computer_cube"); this.iconBottom = icon.registerIcon("techreborn:machine/computer_cube");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.client.GuiHandler; import techreborn.client.GuiHandler;
@ -51,13 +52,12 @@ public class BlockDigitalChest extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockElectricCraftingTable extends BlockMachineBase { public class BlockElectricCraftingTable extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockElectricCraftingTable extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFusionCoil extends BlockMachineBase { public class BlockFusionCoil extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockFusionCoil extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/fusion_coil"); this.iconBottom = icon.registerIcon("techreborn:machine/fusion_coil");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFusionControlComputer extends BlockMachineBase { public class BlockFusionControlComputer extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockFusionControlComputer extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off"); this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockHighlyAdvancedMachine extends BlockMachineBase { public class BlockHighlyAdvancedMachine extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockHighlyAdvancedMachine extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/highlyadvancedmachine"); this.iconBottom = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -11,8 +11,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.client.TechRebornCreativeTab; import techreborn.client.TechRebornCreativeTab;
import techreborn.tiles.TileMachineBase;
import java.util.Random; import java.util.Random;
@ -61,6 +64,7 @@ public class BlockMachineBase extends BlockContainer {
} }
world.setBlockMetadataWithNotify(x, y, z, b, 2); world.setBlockMetadataWithNotify(x, y, z, b, 2);
setTileMeta(world, x, y, z, b);
} }
@ -73,16 +77,16 @@ public class BlockMachineBase extends BlockContainer {
.floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3; .floor_double((double) (player.rotationYaw * 4.0F / 360F) + 0.5D) & 3;
if (l == 0) { if (l == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2); setTileMeta(world, x, y, z, 2);
} }
if (l == 1) { if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2); setTileMeta(world, x, y, z, 5);
} }
if (l == 2) { if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2); setTileMeta(world, x, y, z, 3);
} }
if (l == 3) { if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2); setTileMeta(world, x, y, z, 4);
} }
super.onBlockPlacedBy(world, x, y, z, player, itemstack); super.onBlockPlacedBy(world, x, y, z, player, itemstack);
} }
@ -137,4 +141,21 @@ public class BlockMachineBase extends BlockContainer {
} }
} }
} }
public void setTileMeta(World world, int x, int y, int z, int meta){
if(world.getTileEntity(x, y, z) instanceof TileMachineBase){
((TileMachineBase) world.getTileEntity(x, y, z)).setMeta(meta);
}
}
public int getTileMeta(World world, int x, int y, int z){
if(world.getTileEntity(x, y, z) instanceof TileMachineBase){
return ((TileMachineBase) world.getTileEntity(x, y, z)).getMeta();
}
return 0;
}
public int getTileMeta(IBlockAccess blockAccess, int x, int y, int z){
return getTileMeta(blockAccess.getTileEntity(x, y,z).getWorldObj(), x, y, z);
}
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockMetalShelf extends BlockMachineBase { public class BlockMetalShelf extends BlockMachineBase {
@ -40,13 +42,13 @@ public class BlockMetalShelf extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFrontEmpty return metadata == 0 && side == 3 ? this.iconFrontEmpty
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFrontEmpty : this.blockIcon)); : (side == metadata ? this.iconFrontEmpty : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockSupercondensator extends BlockMachineBase { public class BlockSupercondensator extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockSupercondensator extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/supercondensator_side"); this.iconBottom = icon.registerIcon("techreborn:machine/supercondensator_side");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockWoodenshelf extends BlockMachineBase { public class BlockWoodenshelf extends BlockMachineBase {
@ -31,14 +33,13 @@ public class BlockWoodenshelf extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side"); this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -56,13 +57,17 @@ public class BlockAlloyFurnace extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -62,10 +62,10 @@ public class BlockAlloySmelter extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileAlloySmelter tileAlloySmelter = (TileAlloySmelter) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileAlloySmelter.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
@ -74,14 +74,6 @@ public class BlockAlloySmelter extends BlockMachineBase {
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@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.blockIcon));
}
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) { public Item getItemDropped(int meta, Random random, int fortune) {

View file

@ -62,26 +62,16 @@ public class BlockAssemblingMachine extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileAssemblingMachine tileAssemblingMachine = (TileAssemblingMachine) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileAssemblingMachine.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -60,14 +61,17 @@ public class BlockBlastFurnace extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side"); this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -65,32 +65,16 @@ public class BlockCentrifuge extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileCentrifuge tileCentrifuge = (TileCentrifuge) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side >= 2 && tileCentrifuge.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
if (side == 1 && tileCentrifuge.crafter.isActive()) {
return this.iconTopOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.iconFront)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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));
} }
@Override @Override

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -55,13 +56,17 @@ public class BlockChargeBench extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
return this.iconFrontOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
} }

View file

@ -62,27 +62,16 @@ public class BlockChemicalReactor extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileChemicalReactor tileChemicalReactor = (TileChemicalReactor) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileChemicalReactor.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -7,6 +7,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
import java.util.Random; import java.util.Random;
@ -36,14 +38,14 @@ public class BlockDistillationTower extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side"); this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -66,32 +66,16 @@ public class BlockGrinder extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileGrinder tileGrinder = (TileGrinder) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileGrinder.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
if (side == 1 && tileGrinder.crafter.isActive()) {
return this.iconTopOn;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -62,28 +62,18 @@ public class BlockImplosionCompressor extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileImplosionCompressor.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@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.blockIcon));
}
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) { public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem(); return IC2Items.getItem("advancedMachine").getItem();

View file

@ -63,28 +63,16 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileIndustrialElectrolyzer tileIndustrialElectrolyzer = (TileIndustrialElectrolyzer) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileIndustrialElectrolyzer.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -62,28 +62,16 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileIndustrialSawmill tileIndustrialSawmill = (TileIndustrialSawmill) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileIndustrialSawmill.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -62,27 +62,16 @@ public class BlockLathe extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TileLathe tileLathe = (TileLathe) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tileLathe.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -52,24 +53,16 @@ public class BlockMatterFabricator extends BlockMachineBase {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister icon) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
this.blockIcon = icon.registerIcon("techreborn:machine/matterfab_off"); int metadata = getTileMeta(blockAccess, x, y, z);
this.iconFront = icon.registerIcon("techreborn:machine/matterfab_off"); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
this.iconFrontOn = icon.registerIcon("techreborn:machine/matterfab_on"); return this.iconFrontOn;
this.iconTop = icon.registerIcon("techreborn:machine/matterfab_off"); }
this.iconBottom = icon.registerIcon("techreborn:machine/matterfab_off");
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) {
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override
public Item getItemDropped(int meta, Random random, int fortune) { public Item getItemDropped(int meta, Random random, int fortune) {
return IC2Items.getItem("advancedMachine").getItem(); return IC2Items.getItem("advancedMachine").getItem();

View file

@ -62,26 +62,16 @@ public class BlockPlateCuttingMachine extends BlockMachineBase {
} }
@Override @Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = blockAccess.getBlockMetadata(x, y, z); int metadata = getTileMeta(blockAccess, x, y, z);
TilePlateCuttingMachine tilePlateCuttingMachine = (TilePlateCuttingMachine) blockAccess.getTileEntity(x, y, z); if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
if (side == metadata && tilePlateCuttingMachine.crafter.isActive()) {
return this.iconFrontOn; return this.iconFrontOn;
} }
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
}
@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.blockIcon));
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -56,13 +57,14 @@ public class BlockRollingMachine extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -7,6 +7,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
import java.util.Random; import java.util.Random;
@ -36,14 +38,14 @@ public class BlockVacuumFreezer extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom"); this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta(blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -55,10 +56,13 @@ public class BlockAesu extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/aesu_side"); this.iconBottom = icon.registerIcon("techreborn:machine/aesu_side");
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
if (side == metadata) int metadata = getTileMeta(blockAccess, x, y, z);
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
return this.iconFront; return this.iconFront;
}
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -40,13 +41,13 @@ public class BlockIDSU extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side"); this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.Core; import techreborn.Core;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
@ -38,10 +39,9 @@ public class BlockLesu extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_side"); this.iconBottom = icon.registerIcon("techreborn:machine/lesu_side");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
if (side == metadata) int metadata = getTileMeta((World) blockAccess, x, y, z);
return this.iconFront;
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop

View file

@ -9,6 +9,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import techreborn.blocks.BlockMachineBase; import techreborn.blocks.BlockMachineBase;
import techreborn.tiles.lesu.TileLesuStorage; import techreborn.tiles.lesu.TileLesuStorage;
@ -38,14 +39,13 @@ public class BlockLesuStorage extends BlockMachineBase {
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_block"); this.iconBottom = icon.registerIcon("techreborn:machine/lesu_block");
} }
@SideOnly(Side.CLIENT) @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
int metadata = getTileMeta((World) blockAccess, x, y, z);
return metadata == 0 && side == 3 ? this.iconFront return metadata == 0 && side == 3 ? this.iconFront
: side == 1 ? this.iconTop : : side == 1 ? this.iconTop :
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
: (side == metadata ? this.iconFront : this.blockIcon)); : (side == metadata ? this.iconFront : this.blockIcon));
} }
@Override @Override

View file

@ -13,6 +13,8 @@ import java.util.List;
public abstract class TileMachineBase extends TileEntity { public abstract class TileMachineBase extends TileEntity {
int meta;
public void syncWithAll() { public void syncWithAll() {
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(), PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
@ -39,4 +41,27 @@ public abstract class TileMachineBase extends TileEntity {
readFromNBT(packet.func_148857_g()); readFromNBT(packet.func_148857_g());
} }
public int getMeta() {
return meta;
}
public void setMeta(int meta) {
this.meta = meta;
syncWithAll();
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
meta = tagCompound.getInteger("meta");
}
@Override
public void writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
tagCompound.setInteger("meta", meta);
}
} }