2014-12-03 22:33:46 +01:00
|
|
|
package ellpeck.gemification.blocks;
|
2014-12-03 21:55:53 +01:00
|
|
|
|
|
|
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
2014-12-20 21:34:07 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2014-12-03 22:33:46 +01:00
|
|
|
import ellpeck.gemification.Gemification;
|
2014-12-18 19:24:06 +01:00
|
|
|
import ellpeck.gemification.creative.CreativeTab;
|
|
|
|
import ellpeck.gemification.inventory.GuiHandler;
|
2014-12-03 22:33:46 +01:00
|
|
|
import ellpeck.gemification.tile.TileEntityCrucible;
|
2014-12-20 21:34:07 +01:00
|
|
|
import ellpeck.gemification.tile.TileEntityInventoryBase;
|
2014-12-18 19:24:06 +01:00
|
|
|
import ellpeck.gemification.util.Util;
|
2014-12-03 21:55:53 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.init.Blocks;
|
2014-12-20 21:34:07 +01:00
|
|
|
import net.minecraft.item.ItemBlock;
|
2014-12-03 21:55:53 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2014-12-20 21:34:07 +01:00
|
|
|
import net.minecraft.util.StatCollector;
|
2014-12-03 21:55:53 +01:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2014-12-20 21:34:07 +01:00
|
|
|
import java.util.List;
|
2014-12-03 21:55:53 +01:00
|
|
|
|
2014-12-20 21:34:07 +01:00
|
|
|
public class BlockCrucible extends BlockContainerBase{
|
2014-12-03 21:55:53 +01:00
|
|
|
|
|
|
|
protected BlockCrucible(){
|
|
|
|
super(Material.rock);
|
|
|
|
this.setBlockName("blockCrucible");
|
2014-12-03 22:33:46 +01:00
|
|
|
this.setCreativeTab(CreativeTab.instance);
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public TileEntity createNewTileEntity(World world, int i){
|
|
|
|
return new TileEntityCrucible();
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("static-access")
|
|
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
|
|
|
|
if (!world.isRemote){
|
2014-12-18 19:24:06 +01:00
|
|
|
player.openGui(Gemification.instance, GuiHandler.guiCrucible, world, x, y, z);
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getRenderType(){
|
|
|
|
return RenderingRegistry.getNextAvailableRenderId();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isOpaqueCube(){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean renderAsNormalBlock(){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void registerBlockIcons(IIconRegister iconReg){
|
|
|
|
this.blockIcon = Blocks.hopper.getIcon(0, 0);
|
|
|
|
}
|
|
|
|
|
2014-12-20 21:34:07 +01:00
|
|
|
public TileEntityInventoryBase dropInventory(World world, int x, int y, int z){
|
|
|
|
TileEntityCrucible tileEntity = (TileEntityCrucible)super.dropInventory(world, x, y, z);
|
|
|
|
if(tileEntity.currentFluid != Util.fluidNone) world.setBlock(x, y, z, Blocks.flowing_water);
|
|
|
|
return tileEntity;
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
|
|
|
|
2014-12-20 21:34:07 +01:00
|
|
|
public static class ItemBlockCrucible extends ItemBlock {
|
|
|
|
|
|
|
|
public ItemBlockCrucible(Block block){
|
|
|
|
super(block);
|
|
|
|
setHasSubtypes(false);
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|
|
|
|
|
2014-12-20 21:34:07 +01:00
|
|
|
public String getUnlocalizedName(ItemStack stack) {
|
|
|
|
return this.getUnlocalizedName();
|
|
|
|
}
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
|
|
|
if(Util.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + this.getUnlocalizedName().substring(5) + ".desc"));
|
|
|
|
else list.add(Util.shiftForInfo());
|
|
|
|
}
|
|
|
|
}
|
2014-12-03 21:55:53 +01:00
|
|
|
}
|