Inital port to tile based meta
This commit is contained in:
parent
2c863d9e11
commit
d3e860edb2
34 changed files with 198 additions and 246 deletions
|
@ -136,7 +136,7 @@ public class RecipeCrafter {
|
|||
setCurrentRecipe(recipe);//Sets the current recipe then syncs
|
||||
this.currentNeededTicks = (int) (currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||
this.currentTickTime = -1;
|
||||
syncIsActive();
|
||||
setIsActive();
|
||||
} else {
|
||||
this.currentTickTime = -0;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class RecipeCrafter {
|
|||
if (inventory.hasChanged && !hasAllInputs()) {//If it doesn't have all the inputs reset
|
||||
currentRecipe = null;
|
||||
currentTickTime = 0;
|
||||
syncIsActive();
|
||||
setIsActive();
|
||||
}
|
||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
||||
boolean canGiveInvAll = true;
|
||||
|
@ -166,7 +166,7 @@ public class RecipeCrafter {
|
|||
useAllInputs();//this uses all the inputs
|
||||
currentRecipe = null;//resets
|
||||
currentTickTime = 0;
|
||||
syncIsActive();
|
||||
setIsActive();
|
||||
}
|
||||
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
|
||||
if (energy.canUseEnergy(getEuPerTick())) {//This uses the power
|
||||
|
@ -325,18 +325,13 @@ public class RecipeCrafter {
|
|||
}
|
||||
|
||||
|
||||
public void syncIsActive() {
|
||||
if (!parentTile.getWorldObj().isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getSyncPacket(),
|
||||
parentTile.getWorldObj());
|
||||
}
|
||||
}
|
||||
|
||||
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 setIsActive() {
|
||||
if(isActiveServer()){
|
||||
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 1, 2);
|
||||
} else {
|
||||
parentTile.getWorldObj().setBlockMetadataWithNotify(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, 0, 2);
|
||||
}
|
||||
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(IBaseRecipeType recipe) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.client.GuiHandler;
|
||||
|
@ -51,14 +52,13 @@ public class BlockChunkLoader extends BlockMachineBase {
|
|||
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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockComputerCube extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockComputerCube extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/computer_cube");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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.client.GuiHandler;
|
||||
|
@ -51,13 +52,12 @@ public class BlockDigitalChest extends BlockMachineBase {
|
|||
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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockElectricCraftingTable extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockElectricCraftingTable extends BlockMachineBase {
|
|||
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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFusionCoil extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockFusionCoil extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/fusion_coil");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFusionControlComputer extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockFusionControlComputer extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/plasma_generator_side_off");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockHighlyAdvancedMachine extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockHighlyAdvancedMachine extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/highlyadvancedmachine");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.ChunkCache;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.tiles.TileMachineBase;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -61,6 +64,7 @@ public class BlockMachineBase extends BlockContainer {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
if (l == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
setTileMeta(world, x, y, z, 2);
|
||||
}
|
||||
if (l == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
setTileMeta(world, x, y, z, 5);
|
||||
}
|
||||
if (l == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
setTileMeta(world, x, y, z, 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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMetalShelf extends BlockMachineBase {
|
||||
|
||||
|
@ -40,13 +42,13 @@ public class BlockMetalShelf extends BlockMachineBase {
|
|||
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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
return metadata == 0 && side == 3 ? this.iconFrontEmpty
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFrontEmpty : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockSupercondensator extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockSupercondensator extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/supercondensator_side");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockWoodenshelf extends BlockMachineBase {
|
||||
|
||||
|
@ -31,14 +33,13 @@ public class BlockWoodenshelf extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
@ -56,13 +57,17 @@ public class BlockAlloyFurnace extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,10 +62,10 @@ public class BlockAlloySmelter extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileAlloySmelter tileAlloySmelter = (TileAlloySmelter) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileAlloySmelter.crafter.isActive()) {
|
||||
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
|
||||
|
@ -74,14 +74,6 @@ public class BlockAlloySmelter extends BlockMachineBase {
|
|||
: (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
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
|
|
|
@ -62,26 +62,16 @@ public class BlockAssemblingMachine extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileAssemblingMachine tileAssemblingMachine = (TileAssemblingMachine) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileAssemblingMachine.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
@ -60,14 +61,17 @@ public class BlockBlastFurnace extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,32 +65,16 @@ public class BlockCentrifuge extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileCentrifuge tileCentrifuge = (TileCentrifuge) blockAccess.getTileEntity(x, y, z);
|
||||
if (side >= 2 && tileCentrifuge.crafter.isActive()) {
|
||||
int metadata = getTileMeta(blockAccess, x, y, z);
|
||||
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
|
||||
return this.iconFrontOn;
|
||||
}
|
||||
|
||||
if (side == 1 && tileCentrifuge.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.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));
|
||||
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
@ -55,13 +56,17 @@ public class BlockChargeBench extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,27 +62,16 @@ public class BlockChemicalReactor extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileChemicalReactor tileChemicalReactor = (TileChemicalReactor) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileChemicalReactor.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -36,14 +38,14 @@ public class BlockDistillationTower extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/advanced_machine_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,32 +66,16 @@ public class BlockGrinder extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
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 == metadata && tileGrinder.crafter.isActive()) {
|
||||
int metadata = getTileMeta(blockAccess, x, y, z);
|
||||
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
|
||||
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));
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
|
|
|
@ -62,28 +62,18 @@ public class BlockImplosionCompressor extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileImplosionCompressor tileImplosionCompressor = (TileImplosionCompressor) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileImplosionCompressor.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return IC2Items.getItem("advancedMachine").getItem();
|
||||
|
|
|
@ -63,28 +63,16 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileIndustrialElectrolyzer tileIndustrialElectrolyzer = (TileIndustrialElectrolyzer) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileIndustrialElectrolyzer.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -62,28 +62,16 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileIndustrialSawmill tileIndustrialSawmill = (TileIndustrialSawmill) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileIndustrialSawmill.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -62,27 +62,16 @@ public class BlockLathe extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TileLathe tileLathe = (TileLathe) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tileLathe.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
@ -52,24 +53,16 @@ public class BlockMatterFabricator extends BlockMachineBase {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister icon) {
|
||||
this.blockIcon = icon.registerIcon("techreborn:machine/matterfab_off");
|
||||
this.iconFront = icon.registerIcon("techreborn:machine/matterfab_off");
|
||||
this.iconFrontOn = icon.registerIcon("techreborn:machine/matterfab_on");
|
||||
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) {
|
||||
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random random, int fortune) {
|
||||
return IC2Items.getItem("advancedMachine").getItem();
|
||||
|
|
|
@ -62,26 +62,16 @@ public class BlockPlateCuttingMachine extends BlockMachineBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
||||
int metadata = blockAccess.getBlockMetadata(x, y, z);
|
||||
TilePlateCuttingMachine tilePlateCuttingMachine = (TilePlateCuttingMachine) blockAccess.getTileEntity(x, y, z);
|
||||
if (side == metadata && tilePlateCuttingMachine.crafter.isActive()) {
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (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
|
||||
|
|
|
@ -9,6 +9,7 @@ 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;
|
||||
|
@ -56,13 +57,14 @@ public class BlockRollingMachine extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,6 +7,8 @@ import net.minecraft.block.material.Material;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -36,14 +38,14 @@ public class BlockVacuumFreezer extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
|
||||
}
|
||||
|
||||
@Override
|
||||
@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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
: (side == metadata ? this.iconFront : this.blockIcon));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
@ -55,10 +56,13 @@ public class BlockAesu extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/aesu_side");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 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.iconFront;
|
||||
}
|
||||
return metadata == 0 && side == 3 ? this.iconFront
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
|
@ -40,13 +41,13 @@ public class BlockIDSU extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/idsu_side");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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;
|
||||
|
@ -38,10 +39,9 @@ public class BlockLesu extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_side");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == metadata)
|
||||
return this.iconFront;
|
||||
@Override
|
||||
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
|
||||
: side == 1 ? this.iconTop :
|
||||
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.blocks.BlockMachineBase;
|
||||
import techreborn.tiles.lesu.TileLesuStorage;
|
||||
|
@ -38,14 +39,13 @@ public class BlockLesuStorage extends BlockMachineBase {
|
|||
this.iconBottom = icon.registerIcon("techreborn:machine/lesu_block");
|
||||
}
|
||||
|
||||
@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 = getTileMeta((World) blockAccess, x, y, z);
|
||||
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
|
||||
|
|
|
@ -13,6 +13,8 @@ import java.util.List;
|
|||
|
||||
public abstract class TileMachineBase extends TileEntity {
|
||||
|
||||
int meta;
|
||||
|
||||
public void syncWithAll() {
|
||||
if (!worldObj.isRemote) {
|
||||
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||
|
@ -39,4 +41,27 @@ public abstract class TileMachineBase extends TileEntity {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue