Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.freefourms.geforce.securitycraft.blocks;
- import net.minecraft.block.Block;
- import net.minecraft.block.BlockChest;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.world.World;
- import org.freefourms.geforce.securitycraft.main.mod_SecurityCraft;
- import org.freefourms.geforce.securitycraft.tileentity.TileEntityKeypadChest;
- public class BlockKeypadChest extends BlockChest{
- public BlockKeypadChest(int par1) {
- super(par1);
- }
- /**
- * Called upon block activation (right click on the block.)
- */
- public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
- {
- if (par1World.isRemote)
- {
- return true;
- }
- else
- {
- IInventory iinventory = this.func_149951_m(par1World, par2, par3, par4);
- if (iinventory != null)
- {
- if(par1World.getTileEntity(par2, par3, par4) != null && par1World.getTileEntity(par2, par3, par4) instanceof TileEntityKeypadChest){
- if(((TileEntityKeypadChest) par1World.getTileEntity(par2, par3, par4)).getKeypadCode() != 0){
- par5EntityPlayer.openGui(mod_SecurityCraft.instance, 13, par1World, par2, par3, par4);
- }else{
- par5EntityPlayer.openGui(mod_SecurityCraft.instance, 12, par1World, par2, par3, par4);
- }
- }
- }
- return true;
- }
- }
- /**
- * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
- * their own) Args: x, y, z, neighbor Block
- */
- public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block)
- {
- super.onNeighborBlockChange(par1World, par2, par3, par4, par5Block);
- TileEntityKeypadChest tileentitychest = (TileEntityKeypadChest)par1World.getTileEntity(par2, par3, par4);
- if (tileentitychest != null)
- {
- tileentitychest.updateContainingBlockInfo();
- }
- }
- /**
- * Returns a new instance of a block's tile entity class. Called on placing the block.
- */
- public TileEntity createNewTileEntity(World par1World, int par2)
- {
- return new TileEntityKeypadChest();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment