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
|
|
|
|
|
|
|
public class BlockQuantumChest extends BlockContainer {
|
|
|
|
|
2015-04-24 15:20:09 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon top;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
private IIcon other;
|
|
|
|
|
|
|
|
public BlockQuantumChest()
|
|
|
|
{
|
|
|
|
super(Material.piston);
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
top = icon.registerIcon("techreborn:machine/quantum_top");
|
|
|
|
other = icon.registerIcon("techreborn:machine/quantum_chest");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public IIcon getIcon(int currentSide, int meta)
|
|
|
|
{
|
|
|
|
// TODO chest rotation
|
|
|
|
if (currentSide == 1)
|
|
|
|
{
|
|
|
|
return top;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
return other;
|
|
|
|
}
|
|
|
|
}
|
2015-04-11 12:30:16 +02:00
|
|
|
}
|