2013-08-23 16:59:50 +02:00
|
|
|
package com.pahimar.ee3.block;
|
|
|
|
|
2013-12-16 02:26:42 +01:00
|
|
|
import com.pahimar.ee3.EquivalentExchange3;
|
|
|
|
import com.pahimar.ee3.lib.GuiIds;
|
|
|
|
import com.pahimar.ee3.lib.RenderIds;
|
|
|
|
import com.pahimar.ee3.lib.Strings;
|
|
|
|
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
2014-01-05 18:16:48 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2014-01-02 08:21:46 +01:00
|
|
|
import net.minecraft.block.ITileEntityProvider;
|
2013-08-23 16:59:50 +02:00
|
|
|
import net.minecraft.block.material.Material;
|
2014-01-05 18:16:48 +01:00
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
2013-08-23 16:59:50 +02:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2014-01-05 18:16:48 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
2013-08-23 16:59:50 +02:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
|
|
|
|
2014-01-05 18:16:48 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2013-08-23 16:59:50 +02:00
|
|
|
/**
|
|
|
|
* Equivalent-Exchange-3
|
2013-12-16 02:26:42 +01:00
|
|
|
* <p/>
|
2013-08-23 16:59:50 +02:00
|
|
|
* BlockAlchemicalChest
|
2013-12-16 02:26:42 +01:00
|
|
|
*
|
2013-08-23 16:59:50 +02:00
|
|
|
* @author pahimar
|
|
|
|
*/
|
2014-01-02 08:21:46 +01:00
|
|
|
public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
|
|
|
public BlockAlchemicalChest(int id)
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
super(id, Material.wood);
|
2013-12-31 03:41:10 +01:00
|
|
|
this.setHardness(2.5F);
|
2013-08-23 16:59:50 +02:00
|
|
|
this.setUnlocalizedName(Strings.ALCHEMICAL_CHEST_NAME);
|
2014-01-04 18:53:23 +01:00
|
|
|
this.setCreativeTab(EquivalentExchange3.tabsEE3);
|
2013-08-23 16:59:50 +02:00
|
|
|
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
|
|
|
}
|
2013-09-07 04:47:12 +02:00
|
|
|
|
2013-08-23 16:59:50 +02:00
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public TileEntity createNewTileEntity(World world)
|
|
|
|
{
|
2014-01-05 18:16:48 +01:00
|
|
|
return null;
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|
|
|
|
|
2014-01-05 05:02:06 +01:00
|
|
|
@Override
|
|
|
|
public TileEntity createTileEntity(World world, int metaData)
|
|
|
|
{
|
|
|
|
return new TileAlchemicalChest(metaData);
|
|
|
|
}
|
|
|
|
|
2014-01-05 18:16:48 +01:00
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void getSubBlocks(int id, CreativeTabs creativeTabs, List list)
|
|
|
|
{
|
|
|
|
for (int meta = 0; meta < 3; meta++)
|
|
|
|
{
|
|
|
|
list.add(new ItemStack(id, 1, meta));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-23 16:59:50 +02:00
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean renderAsNormalBlock()
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean isOpaqueCube()
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public int getRenderType()
|
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
|
2013-09-03 22:01:25 +02:00
|
|
|
return RenderIds.alchemicalChestRender;
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-12-16 02:26:42 +01:00
|
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
|
|
|
{
|
2014-01-02 08:21:46 +01:00
|
|
|
if (player.isSneaking() || world.isBlockSolidOnSide(x, y + 1, z, ForgeDirection.DOWN))
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2013-08-23 16:59:50 +02:00
|
|
|
return true;
|
2013-12-16 02:26:42 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!world.isRemote)
|
|
|
|
{
|
2014-01-02 08:21:46 +01:00
|
|
|
if (world.getBlockTileEntity(x, y, z) instanceof TileAlchemicalChest)
|
2013-12-16 02:26:42 +01:00
|
|
|
{
|
2014-01-05 05:02:06 +01:00
|
|
|
if (world.getBlockMetadata(x, y, z) == 0)
|
|
|
|
{
|
|
|
|
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST_SMALL, world, x, y, z);
|
|
|
|
}
|
|
|
|
else if (world.getBlockMetadata(x, y, z) == 1)
|
|
|
|
{
|
|
|
|
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST_MEDIUM, world, x, y, z);
|
|
|
|
}
|
|
|
|
else if (world.getBlockMetadata(x, y, z) == 2)
|
|
|
|
{
|
|
|
|
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST_LARGE, world, x, y, z);
|
|
|
|
}
|
2013-08-23 16:59:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|