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

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

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

@ -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

View file

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

View file

@ -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

View file

@ -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

View file

@ -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