public ContainerDispenser(net.minecraft.src.IInventory iinventory, net.minecraft.src.TileEntityDispenser tileentitydispenser) { // Referenced classes of package net.minecraft.src: // Container, Slot, TileEntityDispenser, IInventory, // EntityPlayer field_21133_a = tileentitydispenser; for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) { AddSlot(new net.minecraft.src.Slot(tileentitydispenser, l + i * 3, 62 + l * 18, 17 + i * 18)); } } for (int j = 0; j < 3; j++) { for (int i1 = 0; i1 < 9; i1++) { AddSlot(new net.minecraft.src.Slot(iinventory, i1 + j * 9 + 9, 8 + i1 * 18, 84 + j * 18)); } } for (int k = 0; k < 9; k++) { AddSlot(new net.minecraft.src.Slot(iinventory, k, 8 + k * 18, 142)); } }
public override void DisplayGUIDispenser(net.minecraft.src.TileEntityDispenser tileentitydispenser ) { GetNextWidowId(); netServerHandler.SendPacket(new net.minecraft.src.Packet100OpenWindow(currentWindowId , 3, tileentitydispenser.GetInvName(), tileentitydispenser.GetSizeInventory())); currentCraftingInventory = new net.minecraft.src.ContainerDispenser(inventory, tileentitydispenser ); currentCraftingInventory.windowId = currentWindowId; currentCraftingInventory.OnCraftGuiOpened(this); }
public override bool BlockActivated(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { if (world.singleplayerWorld) { return(true); } else { net.minecraft.src.TileEntityDispenser tileentitydispenser = (net.minecraft.src.TileEntityDispenser )world.GetBlockTileEntity(i, j, k); entityplayer.DisplayGUIDispenser(tileentitydispenser); return(true); } }
public override void OnBlockRemoval(net.minecraft.src.World world, int i, int j, int k) { net.minecraft.src.TileEntityDispenser tileentitydispenser = (net.minecraft.src.TileEntityDispenser )world.GetBlockTileEntity(i, j, k); for (int l = 0; l < tileentitydispenser.GetSizeInventory(); l++) { net.minecraft.src.ItemStack itemstack = tileentitydispenser.GetStackInSlot(l); if (itemstack == null) { continue; } float f = field_28032_a.NextFloat() * 0.8F + 0.1F; float f1 = field_28032_a.NextFloat() * 0.8F + 0.1F; float f2 = field_28032_a.NextFloat() * 0.8F + 0.1F; do { if (itemstack.stackSize <= 0) { goto label0_continue; } int i1 = field_28032_a.Next(21) + 10; if (i1 > itemstack.stackSize) { i1 = itemstack.stackSize; } itemstack.stackSize -= i1; net.minecraft.src.EntityItem entityitem = new net.minecraft.src.EntityItem(world, (float)i + f, (float)j + f1, (float)k + f2, new net.minecraft.src.ItemStack(itemstack .itemID, i1, itemstack.GetItemDamage())); float f3 = 0.05F; entityitem.motionX = (float)field_28032_a.NextGaussian() * f3; entityitem.motionY = (float)field_28032_a.NextGaussian() * f3 + 0.2F; entityitem.motionZ = (float)field_28032_a.NextGaussian() * f3; world.AddEntity(entityitem); }while (true); label0_continue :; } label0_break :; base.OnBlockRemoval(world, i, j, k); }
public void DispenseItem(net.minecraft.src.World world, int i, int j, int k, SharpBukkitLive.SharpBukkit.SharpRandom random) { //TODO: Implement dispenser fixes return; int l = world.GetBlockMetadata(i, j, k); int i1 = 0; int j1 = 0; if (l == 3) { j1 = 1; } else if (l == 2) { j1 = -1; } else if (l == 5) { i1 = 1; } else { i1 = -1; } net.minecraft.src.TileEntityDispenser tileentitydispenser = (net.minecraft.src.TileEntityDispenser)world.GetBlockTileEntity(i, j, k); net.minecraft.src.ItemStack itemstack = tileentitydispenser.GetRandomStackFromInventory(); double d = (double)i + (double)i1 * 0.59999999999999998D + 0.5D; double d1 = (double)j + 0.5D; double d2 = (double)k + (double)j1 * 0.59999999999999998D + 0.5D; if (itemstack == null) { world.SendSoundEffectToAllPlayersWithin64(1001, i, j, k, 0); } else { if (itemstack.itemID == net.minecraft.src.Item.ARROW.ID) { net.minecraft.src.EntityArrow entityarrow = new net.minecraft.src.EntityArrow(world, d, d1, d2); entityarrow.SetArrowHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F); entityarrow.field_28012_a = true; world.AddEntity(entityarrow); world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0); } else if (itemstack.itemID == net.minecraft.src.Item.EGG.ID) { net.minecraft.src.EntityEgg entityegg = new net.minecraft.src.EntityEgg(world, d, d1, d2); entityegg.SetEggHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F); world.AddEntity(entityegg); world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0); } else if (itemstack.itemID == net.minecraft.src.Item.SNOW_BALL.ID) { net.minecraft.src.EntitySnowball entitysnowball = new net.minecraft.src.EntitySnowball(world, d, d1, d2); entitysnowball.SetSnowballHeading(i1, 0.10000000149011612D, j1, 1.1F, 6F); world.AddEntity(entitysnowball); world.SendSoundEffectToAllPlayersWithin64(1002, i, j, k, 0); } else { net.minecraft.src.EntityItem entityitem = new net.minecraft.src.EntityItem(world, d, d1 - 0.29999999999999999D, d2, itemstack); double d3 = random.NextDouble() * 0.10000000000000001D + 0.20000000000000001D; entityitem.motionX = (double)i1 * d3; entityitem.motionY = 0.20000000298023224D; entityitem.motionZ = (double)j1 * d3; entityitem.motionX += random.NextGaussian() * 0.0074999998323619366D * 6D; entityitem.motionY += random.NextGaussian() * 0.0074999998323619366D * 6D; entityitem.motionZ += random.NextGaussian() * 0.0074999998323619366D * 6D; world.AddEntity(entityitem); world.SendSoundEffectToAllPlayersWithin64(1000, i, j, k, 0); } world.SendSoundEffectToAllPlayersWithin64(2000, i, j, k, i1 + 1 + (j1 + 1) * 3); } }
public virtual void DisplayGUIDispenser(net.minecraft.src.TileEntityDispenser tileentitydispenser ) { }