2015-05-08 01:39:17 +02:00
|
|
|
package techreborn.blocks.machine;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-07-02 20:51:24 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-05-04 00:25:16 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.util.IIcon;
|
2015-09-05 10:17:58 +02:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2015-05-04 00:25:16 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import techreborn.Core;
|
2015-05-08 01:39:17 +02:00
|
|
|
import techreborn.blocks.BlockMachineBase;
|
2015-05-04 00:25:16 +02:00
|
|
|
import techreborn.client.GuiHandler;
|
2015-05-10 20:00:58 +02:00
|
|
|
import techreborn.tiles.TileAlloyFurnace;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
|
|
|
public class BlockAlloyFurnace extends BlockMachineBase {
|
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon iconFront;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon iconFrontOn;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon iconTop;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon iconBottom;
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public BlockAlloyFurnace(Material material) {
|
|
|
|
super(material);
|
|
|
|
setBlockName("techreborn.alloyfurnace");
|
|
|
|
}
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
|
|
|
|
return new TileAlloyFurnace();
|
|
|
|
}
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public boolean onBlockActivated(World world, int x, int y, int z,
|
|
|
|
EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
|
|
|
if (!player.isSneaking())
|
|
|
|
player.openGui(Core.INSTANCE, GuiHandler.alloyFurnaceID, world, x, y,
|
|
|
|
z);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerBlockIcons(IIconRegister icon) {
|
|
|
|
this.blockIcon = icon.registerIcon("techreborn:machine/alloy_furnace_side");
|
|
|
|
this.iconFront = icon.registerIcon("techreborn:machine/alloy_furnace_front_off");
|
|
|
|
this.iconFrontOn = icon.registerIcon("techreborn:machine/alloy_furnace_front_on");
|
|
|
|
this.iconTop = icon.registerIcon("techreborn:machine/alloy_furnace_top");
|
|
|
|
this.iconBottom = icon.registerIcon("techreborn:machine/alloy_furnace_bottom");
|
|
|
|
}
|
|
|
|
|
2015-09-05 10:17:58 +02:00
|
|
|
@Override
|
2015-08-09 12:05:32 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-09-05 10:17:58 +02:00
|
|
|
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;
|
|
|
|
}
|
2015-08-09 12:05:32 +02:00
|
|
|
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));
|
|
|
|
}
|
2015-05-04 00:25:16 +02:00
|
|
|
|
2015-09-14 22:23:07 +02:00
|
|
|
@Override
|
|
|
|
public IIcon getIcon(int side, int meta) {
|
|
|
|
if(side == 1){
|
|
|
|
return this.iconTop;
|
|
|
|
} else if(side == 3){
|
|
|
|
return this.iconFront;
|
|
|
|
} else {
|
|
|
|
return this.blockIcon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-04 00:25:16 +02:00
|
|
|
}
|