Exemple #1
0
        public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
        {
            object obj = world.getBlockTileEntity(i, j, k);

            if (world.isBlockOpaqueCube(i, j + 1, k))
            {
                return(true);
            }
            if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockOpaqueCube(i - 1, j + 1, k))
            {
                return(true);
            }
            if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockOpaqueCube(i + 1, j + 1, k))
            {
                return(true);
            }
            if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k - 1))
            {
                return(true);
            }
            if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k + 1))
            {
                return(true);
            }
            if (world.getBlockId(i - 1, j, k) == blockID)
            {
                obj = new InventoryLargeChest("Large chest", (TileEntityChest)world.getBlockTileEntity(i - 1, j, k),
                                              ((IInventory)(obj)));
            }
            if (world.getBlockId(i + 1, j, k) == blockID)
            {
                obj = new InventoryLargeChest("Large chest", ((IInventory)(obj)),
                                              (TileEntityChest)world.getBlockTileEntity(i + 1, j, k));
            }
            if (world.getBlockId(i, j, k - 1) == blockID)
            {
                obj = new InventoryLargeChest("Large chest", (TileEntityChest)world.getBlockTileEntity(i, j, k - 1),
                                              ((IInventory)(obj)));
            }
            if (world.getBlockId(i, j, k + 1) == blockID)
            {
                obj = new InventoryLargeChest("Large chest", ((IInventory)(obj)),
                                              (TileEntityChest)world.getBlockTileEntity(i, j, k + 1));
            }
            if (world.singleplayerWorld)
            {
                return(true);
            }
            else
            {
                entityplayer.displayGUIChest(((IInventory)(obj)));
                return(true);
            }
        }
Exemple #2
0
 public override bool blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
 {
     object obj = world.getBlockTileEntity(i, j, k);
     if (world.isBlockOpaqueCube(i, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockOpaqueCube(i - 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockOpaqueCube(i + 1, j + 1, k))
     {
         return true;
     }
     if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k - 1))
     {
         return true;
     }
     if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockOpaqueCube(i, j + 1, k + 1))
     {
         return true;
     }
     if (world.getBlockId(i - 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i - 1, j, k),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i + 1, j, k) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i + 1, j, k));
     }
     if (world.getBlockId(i, j, k - 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", (TileEntityChest) world.getBlockTileEntity(i, j, k - 1),
                                       ((IInventory) (obj)));
     }
     if (world.getBlockId(i, j, k + 1) == blockID)
     {
         obj = new InventoryLargeChest("Large chest", ((IInventory) (obj)),
                                       (TileEntityChest) world.getBlockTileEntity(i, j, k + 1));
     }
     if (world.singleplayerWorld)
     {
         return true;
     }
     else
     {
         entityplayer.displayGUIChest(((IInventory) (obj)));
         return true;
     }
 }