private static bool CanPushBlock(int i, net.minecraft.src.World world, int j, int k, int l, bool flag) { if (i == net.minecraft.src.Block.OBSIDIAN.ID) { return(false); } if (i == net.minecraft.src.Block.PISTON.ID || i == net.minecraft.src.Block .PISTON_STICKY.ID) { if (IsExtended(world.GetBlockMetadata(j, k, l))) { return(false); } } else { if (net.minecraft.src.Block.blocksList[i].GetHardness() == -1F) { return(false); } if (net.minecraft.src.Block.blocksList[i].GetMobilityFlag() == 2) { return(false); } if (!flag && net.minecraft.src.Block.blocksList[i].GetMobilityFlag() == 1) { return(false); } } net.minecraft.src.TileEntity tileentity = world.GetBlockTileEntity(j, k, l); return(tileentity == null); }
public static void UpdateFurnaceBlockState(bool flag, net.minecraft.src.World world , int i, int j, int k) { int l = world.GetBlockMetadata(i, j, k); net.minecraft.src.TileEntity tileentity = world.GetBlockTileEntity(i, j, k); if (tileentity == null) { return; // CRAFTBUKKIT } field_28034_c = true; if (flag) { world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.BURNING_FURNACE.ID ); } else { world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.FURNACE.ID); } field_28034_c = false; world.SetBlockMetadataWithNotify(i, j, k, l); tileentity.Validate(); world.SetBlockTileEntity(i, j, k, tileentity); }
public override void OnBlockAdded(net.minecraft.src.World world, int i, int j, int k) { if (!world.singleplayerWorld && world.GetBlockTileEntity(i, j, k) == null) { UpdatePistonState(world, i, j, k); } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (!world.singleplayerWorld) { if (world.GetBlockTileEntity(i, j, k) != null) { } } }
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 (l == 0) { return(false); } if (!world.GetBlockMaterial(i, j, k).IsSolid()) { return(false); } if (l == 1) { j++; } if (l == 2) { k--; } if (l == 3) { k++; } if (l == 4) { i--; } if (l == 5) { i++; } if (!net.minecraft.src.Block.SIGN_POST.CanPlaceBlockAt(world, i, j, k)) { return(false); } if (l == 1) { world.SetBlockAndMetadataWithNotify( i, j, k, net.minecraft.src.Block.SIGN_POST.ID, net.minecraft.src.MathHelper.Floor_double((double)(((entityplayer.rotationYaw + 180F) * 16F) / 360F) + 0.5D) & 0xf); } else { world.SetBlockAndMetadataWithNotify(i, j, k, net.minecraft.src.Block.WALL_SIGN.ID, l); } itemstack.stackSize--; net.minecraft.src.TileEntitySign tileentitysign = (net.minecraft.src.TileEntitySign )world.GetBlockTileEntity(i, j, k); if (tileentitysign != null) { entityplayer.DisplayGUIEditSign(tileentitysign); } return(true); }
public override bool BlockActivated(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { if (!world.singleplayerWorld && world.GetBlockTileEntity(i, j, k) == null) { world.SetBlockWithNotify(i, j, k, 0); return(true); } else { return(false); } }
public override void OnBlockRemoval(net.minecraft.src.World world, int i, int j, int k) { net.minecraft.src.TileEntity tileentity = world.GetBlockTileEntity(i, j, k); if (tileentity != null && (tileentity is net.minecraft.src.TileEntityPiston)) { ((net.minecraft.src.TileEntityPiston)tileentity).ClearPistonTileEntity(); } else { base.OnBlockRemoval(world, i, j, k); } }
public override void OnBlockClicked(net.minecraft.src.World world, int i, int j, int k, net.minecraft.src.EntityPlayer entityplayer) { if (world.singleplayerWorld) { return; } else { net.minecraft.src.TileEntityNote tileentitynote = (net.minecraft.src.TileEntityNote )world.GetBlockTileEntity(i, j, k); tileentitynote.TriggerNote(world, i, j, k); return; } }
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 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.TileEntityNote tileentitynote = (net.minecraft.src.TileEntityNote )world.GetBlockTileEntity(i, j, k); tileentitynote.ChangePitch(); tileentitynote.TriggerNote(world, i, j, k); return(true); } }
public virtual void EjectRecord(net.minecraft.src.World world, int i, int j, int k, int l) { if (world.singleplayerWorld) { return; } else { net.minecraft.src.TileEntityRecordPlayer tileentityrecordplayer = (net.minecraft.src.TileEntityRecordPlayer )world.GetBlockTileEntity(i, j, k); tileentityrecordplayer.field_28009_a = l; tileentityrecordplayer.OnInventoryChanged(); world.SetBlockMetadataWithNotify(i, j, k, 1); return; } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower()) { bool flag = world.IsBlockGettingPowered(i, j, k); net.minecraft.src.TileEntityNote tileentitynote = (net.minecraft.src.TileEntityNote )world.GetBlockTileEntity(i, j, k); if (tileentitynote.previousRedstoneState != flag) { if (flag) { tileentitynote.TriggerNote(world, i, j, k); } tileentitynote.previousRedstoneState = flag; } } }
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 override void PlayBlock(net.minecraft.src.World world, int i, int j, int k , int l, int i1) { ignoreUpdates = true; int j1 = i1; if (l == 0) { if (TryExtend(world, i, j, k, j1)) { world.SetBlockMetadataWithNotify(i, j, k, j1 | 8); world.PlaySoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "tile.piston.out" , 0.5F, world.rand.NextFloat() * 0.25F + 0.6F); } } else { if (l == 1) { net.minecraft.src.TileEntity tileentity = world.GetBlockTileEntity(i + net.minecraft.src.PistonBlockTextures .field_31051_b[j1], j + net.minecraft.src.PistonBlockTextures.field_31054_c[j1], k + net.minecraft.src.PistonBlockTextures.field_31053_d[j1]); if (tileentity != null && (tileentity is net.minecraft.src.TileEntityPiston)) { ((net.minecraft.src.TileEntityPiston)tileentity).ClearPistonTileEntity(); } world.SetBlockAndMetadata(i, j, k, net.minecraft.src.Block.PISTON_MOVING.ID, j1); world.SetBlockTileEntity(i, j, k, net.minecraft.src.BlockPistonMoving.GetTileEntity (ID, j1, j1, false, true)); if (isSticky) { int k1 = i + net.minecraft.src.PistonBlockTextures.field_31051_b[j1] * 2; int l1 = j + net.minecraft.src.PistonBlockTextures.field_31054_c[j1] * 2; int i2 = k + net.minecraft.src.PistonBlockTextures.field_31053_d[j1] * 2; int j2 = world.GetBlockId(k1, l1, i2); int k2 = world.GetBlockMetadata(k1, l1, i2); bool flag = false; if (j2 == net.minecraft.src.Block.PISTON_MOVING.ID) { net.minecraft.src.TileEntity tileentity1 = world.GetBlockTileEntity(k1, l1, i2); if (tileentity1 != null && (tileentity1 is net.minecraft.src.TileEntityPiston)) { net.minecraft.src.TileEntityPiston tileentitypiston = (net.minecraft.src.TileEntityPiston )tileentity1; if (tileentitypiston.Func_31008_d() == j1 && tileentitypiston.Func_31010_c()) { tileentitypiston.ClearPistonTileEntity(); j2 = tileentitypiston.GetStoredBlockID(); k2 = tileentitypiston.Func_31005_e(); flag = true; } } } if (!flag && j2 > 0 && CanPushBlock(j2, world, k1, l1, i2, false) && (net.minecraft.src.Block .blocksList[j2].GetMobilityFlag() == 0 || j2 == net.minecraft.src.Block.PISTON .ID || j2 == net.minecraft.src.Block.PISTON_STICKY.ID)) { ignoreUpdates = false; world.SetBlockWithNotify(k1, l1, i2, 0); ignoreUpdates = true; i += net.minecraft.src.PistonBlockTextures.field_31051_b[j1]; j += net.minecraft.src.PistonBlockTextures.field_31054_c[j1]; k += net.minecraft.src.PistonBlockTextures.field_31053_d[j1]; world.SetBlockAndMetadata(i, j, k, net.minecraft.src.Block.PISTON_MOVING.ID, k2); world.SetBlockTileEntity(i, j, k, net.minecraft.src.BlockPistonMoving.GetTileEntity (j2, k2, j1, false, false)); } else { if (!flag) { ignoreUpdates = false; world.SetBlockWithNotify(i + net.minecraft.src.PistonBlockTextures.field_31051_b[ j1], j + net.minecraft.src.PistonBlockTextures.field_31054_c[j1], k + net.minecraft.src.PistonBlockTextures .field_31053_d[j1], 0); ignoreUpdates = true; } } } else { ignoreUpdates = false; world.SetBlockWithNotify(i + net.minecraft.src.PistonBlockTextures.field_31051_b[ j1], j + net.minecraft.src.PistonBlockTextures.field_31054_c[j1], k + net.minecraft.src.PistonBlockTextures .field_31053_d[j1], 0); ignoreUpdates = true; } world.PlaySoundEffect((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "tile.piston.in" , 0.5F, world.rand.NextFloat() * 0.15F + 0.6F); } } ignoreUpdates = 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); } }
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; } }
// Referenced classes of package net.minecraft.src: // WorldGenerator, World, Material, Block, // TileEntityChest, TileEntityMobSpawner, ItemStack, Item public override bool Generate(net.minecraft.src.World world, SharpBukkitLive.SharpBukkit.SharpRandom random , int i, int j, int k) { byte byte0 = 3; int l = random.Next(2) + 2; int i1 = random.Next(2) + 2; int j1 = 0; for (int k1 = i - l - 1; k1 <= i + l + 1; k1++) { for (int j2 = j - 1; j2 <= j + byte0 + 1; j2++) { for (int i3 = k - i1 - 1; i3 <= k + i1 + 1; i3++) { net.minecraft.src.Material material = world.GetBlockMaterial(k1, j2, i3); if (j2 == j - 1 && !material.IsSolid()) { return(false); } if (j2 == j + byte0 + 1 && !material.IsSolid()) { return(false); } if ((k1 == i - l - 1 || k1 == i + l + 1 || i3 == k - i1 - 1 || i3 == k + i1 + 1) && j2 == j && world.IsAirBlock(k1, j2, i3) && world.IsAirBlock(k1, j2 + 1, i3)) { j1++; } } } } if (j1 < 1 || j1 > 5) { return(false); } for (int l1 = i - l - 1; l1 <= i + l + 1; l1++) { for (int k2 = j + byte0; k2 >= j - 1; k2--) { for (int j3 = k - i1 - 1; j3 <= k + i1 + 1; j3++) { if (l1 == i - l - 1 || k2 == j - 1 || j3 == k - i1 - 1 || l1 == i + l + 1 || k2 == j + byte0 + 1 || j3 == k + i1 + 1) { if (k2 >= 0 && !world.GetBlockMaterial(l1, k2 - 1, j3).IsSolid()) { world.SetBlockWithNotify(l1, k2, j3, 0); continue; } if (!world.GetBlockMaterial(l1, k2, j3).IsSolid()) { continue; } if (k2 == j - 1 && random.Next(4) != 0) { world.SetBlockWithNotify(l1, k2, j3, net.minecraft.src.Block.MOSSY_COBBLESTONE.ID ); } else { world.SetBlockWithNotify(l1, k2, j3, net.minecraft.src.Block.COBBLESTONE.ID); } } else { world.SetBlockWithNotify(l1, k2, j3, 0); } } } } for (int i2 = 0; i2 < 2; i2++) { for (int l2 = 0; l2 < 3; l2++) { int k3 = (i + random.Next(l * 2 + 1)) - l; int l3 = j; int i4 = (k + random.Next(i1 * 2 + 1)) - i1; if (!world.IsAirBlock(k3, l3, i4)) { continue; } int j4 = 0; if (world.GetBlockMaterial(k3 - 1, l3, i4).IsSolid()) { j4++; } if (world.GetBlockMaterial(k3 + 1, l3, i4).IsSolid()) { j4++; } if (world.GetBlockMaterial(k3, l3, i4 - 1).IsSolid()) { j4++; } if (world.GetBlockMaterial(k3, l3, i4 + 1).IsSolid()) { j4++; } if (j4 != 1) { continue; } world.SetBlockWithNotify(k3, l3, i4, net.minecraft.src.Block.CHEST.ID); net.minecraft.src.TileEntityChest tileentitychest = (net.minecraft.src.TileEntityChest )world.GetBlockTileEntity(k3, l3, i4); int k4 = 0; do { if (k4 >= 8) { goto label0_break; } net.minecraft.src.ItemStack itemstack = PickCheckLootItem(random); if (itemstack != null) { tileentitychest.SetInventorySlotContents(random.Next(tileentitychest.GetSizeInventory ()), itemstack); } k4++; }while (true); label0_continue :; } label0_break :; } world.SetBlockWithNotify(i, j, k, net.minecraft.src.Block.MOB_SPAWNER.ID); net.minecraft.src.TileEntityMobSpawner tileentitymobspawner = (net.minecraft.src.TileEntityMobSpawner )world.GetBlockTileEntity(i, j, k); tileentitymobspawner.SetMobID(PickMobSpawner(random)); 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); } }