Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package noahc3.abilitystones.blocks;
- import net.minecraft.block.BlockContainer;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.inventory.InventoryHelper;
- import net.minecraft.item.ItemStack;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.BlockPos;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.EnumWorldBlockLayer;
- import net.minecraft.world.World;
- import noahc3.abilitystones.AbilityStones;
- import noahc3.abilitystones.gui.ASGuiHandler;
- import noahc3.abilitystones.tileentity.StonesChestTileEntity;
- public class BlockStonesChest extends BlockContainer
- {
- public BlockStonesChest(Material materialIn) {
- super(materialIn);
- }
- @Override
- public TileEntity createNewTileEntity(World worldIn, int meta) {
- return (TileEntity) new StonesChestTileEntity();
- }
- @Override
- public EnumWorldBlockLayer getBlockLayer() {
- return EnumWorldBlockLayer.CUTOUT;
- }
- public boolean isOpaqueCube() {
- return true;
- }
- public int getRenderType()
- {
- return 3;
- }
- @Override
- public void breakBlock(World world, BlockPos pos, IBlockState blockstate) {
- StonesChestTileEntity te = (StonesChestTileEntity) world.getTileEntity(pos);
- InventoryHelper.dropInventoryItems(world, pos, te);
- super.breakBlock(world, pos, blockstate);
- }
- @Override
- public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
- if (stack.hasDisplayName()) {
- ((StonesChestTileEntity) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName());
- }
- }
- @Override
- public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
- if (!world.isRemote) {
- player.openGui(AbilityStones.instance, ASGuiHandler.MOD_TILE_ENTITY_GUI, world, pos.getX(), pos.getY(), pos.getZ());
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement