Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 3
0
 public override bool interact(EntityPlayer entityplayer)
 {
     if (minecartType == 0)
     {
         if (riddenByEntity != null && (riddenByEntity is EntityPlayer) && riddenByEntity != entityplayer)
         {
             return(true);
         }
         if (!worldObj.singleplayerWorld)
         {
             entityplayer.mountEntity(this);
         }
     }
     else if (minecartType == 1)
     {
         if (!worldObj.singleplayerWorld)
         {
             entityplayer.displayGUIChest(this);
         }
     }
     else if (minecartType == 2)
     {
         ItemStack itemstack = entityplayer.inventory.getCurrentItem();
         if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
         {
             if (--itemstack.stackSize == 0)
             {
                 entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null);
             }
             fuel += 1200;
         }
         pushX = posX - entityplayer.posX;
         pushZ = posZ - entityplayer.posZ;
     }
     return(true);
 }
Ejemplo n.º 4
0
 public override bool interact(EntityPlayer entityplayer)
 {
     if (minecartType == 0)
     {
         if (riddenByEntity != null && (riddenByEntity is EntityPlayer) && riddenByEntity != entityplayer)
         {
             return true;
         }
         if (!worldObj.singleplayerWorld)
         {
             entityplayer.mountEntity(this);
         }
     }
     else if (minecartType == 1)
     {
         if (!worldObj.singleplayerWorld)
         {
             entityplayer.displayGUIChest(this);
         }
     }
     else if (minecartType == 2)
     {
         ItemStack itemstack = entityplayer.inventory.getCurrentItem();
         if (itemstack != null && itemstack.itemID == Item.coal.shiftedIndex)
         {
             if (--itemstack.stackSize == 0)
             {
                 entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, null);
             }
             fuel += 1200;
         }
         pushX = posX - entityplayer.posX;
         pushZ = posZ - entityplayer.posZ;
     }
     return true;
 }