2015-04-11 12:30:16 +02:00
|
|
|
package techreborn.blocks;
|
|
|
|
|
|
|
|
import net.minecraft.block.BlockContainer;
|
|
|
|
import net.minecraft.block.material.Material;
|
2015-04-11 18:20:53 +02:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
2015-04-11 12:30:16 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2015-04-11 18:20:53 +02:00
|
|
|
import net.minecraft.util.IIcon;
|
2015-04-11 12:30:16 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import techreborn.Core;
|
|
|
|
import techreborn.client.GuiHandler;
|
|
|
|
import techreborn.tiles.TileQuantumChest;
|
2015-04-24 15:20:09 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-04-11 12:30:16 +02:00
|
|
|
|
2015-04-28 17:18:32 +02:00
|
|
|
public class BlockQuantumChest extends BlockMachineBase {
|
2015-04-11 12:30:16 +02:00
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-05-03 23:15:39 +02:00
|
|
|
private IIcon iconFront;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon iconTop;
|
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-05-03 23:15:39 +02:00
|
|
|
private IIcon iconBottom;
|
2015-04-24 15:20:09 +02:00
|
|
|
|
|
|
|
public BlockQuantumChest()
|
|
|
|
{
|
2015-04-28 17:07:26 +02:00
|
|
|
super(Material.rock);
|
2015-04-24 15:20:09 +02:00
|
|
|
setHardness(2f);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_)
|
|
|
|
{
|
|
|
|
return new TileQuantumChest();
|
|
|
|
}
|
|
|
|
|
|
|
|
@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.quantumChestID, world, x,
|
|
|
|
y, z);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerBlockIcons(IIconRegister icon)
|
|
|
|
{
|
2015-05-03 23:15:39 +02:00
|
|
|
this.blockIcon = icon.registerIcon("techreborn:machine/qchest_side");
|
|
|
|
this.iconFront = icon.registerIcon("techreborn:machine/quantum_chest");
|
|
|
|
this.iconTop = icon.registerIcon("techreborn:machine/quantum_top");
|
|
|
|
this.iconBottom = icon.registerIcon("techreborn:machine/machine_bottom");
|
2015-04-24 15:20:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2015-05-03 23:15:39 +02:00
|
|
|
public IIcon getIcon(int side, int metadata)
|
2015-04-24 15:20:09 +02:00
|
|
|
{
|
2015-05-03 23:15:39 +02:00
|
|
|
|
|
|
|
return metadata == 0 && side == 3 ? this.iconFront
|
2015-05-03 23:27:19 +02:00
|
|
|
: side == 1 ? this.iconTop :
|
2015-05-03 23:43:27 +02:00
|
|
|
side == 0 ? this.iconBottom: (side == 0 ? this.iconTop
|
2015-05-03 23:15:39 +02:00
|
|
|
: (side == metadata ? this.iconFront : this.blockIcon));
|
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
}
|
2015-04-11 12:30:16 +02:00
|
|
|
}
|