public override bool Interact(net.minecraft.src.EntityPlayer entityplayer) { if (minecartType == 0) { if (riddenByEntity != null && (riddenByEntity is net.minecraft.src.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) { net.minecraft.src.ItemStack itemstack = entityplayer.inventory.GetCurrentItem(); if (itemstack != null && itemstack.itemID == net.minecraft.src.Item.COAL.ID) { if (--itemstack.stackSize == 0) { entityplayer.inventory.SetInventorySlotContents(entityplayer.inventory.currentItem , null); } fuel += 1200; } pushX = posX - entityplayer.posX; pushZ = posZ - entityplayer.posZ; } } } return(true); }
public override bool BlockActivated(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { object obj = (net.minecraft.src.TileEntityChest)world.GetBlockTileEntity(i, j, k); if (world.IsBlockNormalCube(i, j + 1, k)) { return(true); } if (world.GetBlockId(i - 1, j, k) == ID && world.IsBlockNormalCube(i - 1, j + 1, k)) { return(true); } if (world.GetBlockId(i + 1, j, k) == ID && world.IsBlockNormalCube(i + 1, j + 1, k)) { return(true); } if (world.GetBlockId(i, j, k - 1) == ID && world.IsBlockNormalCube(i, j + 1, k - 1)) { return(true); } if (world.GetBlockId(i, j, k + 1) == ID && world.IsBlockNormalCube(i, j + 1, k + 1)) { return(true); } if (world.GetBlockId(i - 1, j, k) == ID) { obj = new net.minecraft.src.InventoryLargeChest("Large chest", (net.minecraft.src.TileEntityChest )world.GetBlockTileEntity(i - 1, j, k), ((net.minecraft.src.IInventory)(obj))); } if (world.GetBlockId(i + 1, j, k) == ID) { obj = new net.minecraft.src.InventoryLargeChest("Large chest", ((net.minecraft.src.IInventory )(obj)), (net.minecraft.src.TileEntityChest)world.GetBlockTileEntity(i + 1, j, k )); } if (world.GetBlockId(i, j, k - 1) == ID) { obj = new net.minecraft.src.InventoryLargeChest("Large chest", (net.minecraft.src.TileEntityChest )world.GetBlockTileEntity(i, j, k - 1), ((net.minecraft.src.IInventory)(obj))); } if (world.GetBlockId(i, j, k + 1) == ID) { obj = new net.minecraft.src.InventoryLargeChest("Large chest", ((net.minecraft.src.IInventory )(obj)), (net.minecraft.src.TileEntityChest)world.GetBlockTileEntity(i, j, k + 1 )); } if (world.singleplayerWorld) { return(true); } else { entityplayer.DisplayGUIChest(((net.minecraft.src.IInventory)(obj))); return(true); } }