public override bool BlockActivated(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { if (blockMaterial == net.minecraft.src.Material.iron) { return(true); } int l = world.GetBlockMetadata(i, j, k); if ((l & 8) != 0) { if (world.GetBlockId(i, j - 1, k) == ID) { BlockActivated(world, i, j - 1, k, entityplayer); } return(true); } if (world.GetBlockId(i, j + 1, k) == ID) { world.SetBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8); } world.SetBlockMetadataWithNotify(i, j, k, l ^ 4); world.MarkBlocksDirty(i, j - 1, k, i, j, k); world.SendSoundEffectToAllPlayersWithin64(entityplayer, 1003, i, j, k, 0); return(true); }
public virtual void Func_272_a(net.minecraft.src.World world, int i, int j, int k , bool flag) { int l = world.GetBlockMetadata(i, j, k); if ((l & 8) != 0) { if (world.GetBlockId(i, j - 1, k) == ID) { Func_272_a(world, i, j - 1, k, flag); } return; } bool flag1 = (world.GetBlockMetadata(i, j, k) & 4) > 0; if (flag1 == flag) { return; } if (world.GetBlockId(i, j + 1, k) == ID) { world.SetBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8); } world.SetBlockMetadataWithNotify(i, j, k, l ^ 4); world.MarkBlocksDirty(i, j - 1, k, i, j, k); world.SendSoundEffectToAllPlayersWithin64(null, 1003, i, j, k, 0); }
public override bool BlockActivated(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { if (blockMaterial == net.minecraft.src.Material.iron) { return(true); } else { int l = world.GetBlockMetadata(i, j, k); world.SetBlockMetadataWithNotify(i, j, k, l ^ 4); world.SendSoundEffectToAllPlayersWithin64(entityplayer, 1003, i, j, k, 0); return(true); } }
public virtual void Func_28040_a(net.minecraft.src.World world, int i, int j, int k, bool flag) { int l = world.GetBlockMetadata(i, j, k); bool flag1 = (l & 4) > 0; if (flag1 == flag) { return; } else { world.SetBlockMetadataWithNotify(i, j, k, l ^ 4); world.SendSoundEffectToAllPlayersWithin64(null, 1003, i, j, k, 0); return; } }
public virtual void Func_28035_b_(net.minecraft.src.World world, int i, int j, int k) { if (world.singleplayerWorld) { return; } net.minecraft.src.TileEntityRecordPlayer tileentityrecordplayer = (net.minecraft.src.TileEntityRecordPlayer)world.GetBlockTileEntity(i, j, k); if (tileentityrecordplayer == null) { return; // CRAFTBUKKIT } int l = tileentityrecordplayer.field_28009_a; if (l == 0) { return; } else { world.SendSoundEffectToAllPlayersWithin64(1005, i, j, k, 0); world.PlayRecord(null, i, j, k); tileentityrecordplayer.field_28009_a = 0; tileentityrecordplayer.OnInventoryChanged(); world.SetBlockMetadataWithNotify(i, j, k, 0); int i1 = l; float f = 0.7F; double d = (double)(world.rand.NextFloat() * f) + (double)(1.0F - f) * 0.5D; double d1 = (double)(world.rand.NextFloat() * f) + (double)(1.0F - f) * 0.20000000000000001D + 0.59999999999999998D; double d2 = (double)(world.rand.NextFloat() * f) + (double)(1.0F - f) * 0.5D; net.minecraft.src.EntityItem entityitem = new net.minecraft.src.EntityItem(world, (double)i + d, (double)j + d1, (double)k + d2, new net.minecraft.src.ItemStack(i1 , 1, 0)); entityitem.delayBeforeCanPickup = 10; world.AddEntity(entityitem); return; } }
public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer entityplayer, net.minecraft.src.World world, int i, int j, int k, int l) { if (world.GetBlockId(i, j, k) == net.minecraft.src.Block.JUKEBOX.ID && world .GetBlockMetadata(i, j, k) == 0) { if (world.singleplayerWorld) { return(true); } else { ((net.minecraft.src.BlockJukeBox)net.minecraft.src.Block.JUKEBOX).EjectRecord(world , i, j, k, ID); world.SendSoundEffectToAllPlayersWithin64(null, 1005, i, j, k, ID); itemstack.stackSize--; return(true); } } else { return(false); } }
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); } }