public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) { Object object = (TileEntityChest) world.getTileEntity(i, j, k); if (object == null) { return true; } else if (world.e(i, j + 1, k)) { return true; } else if (world.getTypeId(i - 1, j, k) == this.id && world.e(i - 1, j + 1, k)) { return true; } else if (world.getTypeId(i + 1, j, k) == this.id && world.e(i + 1, j + 1, k)) { return true; } else if (world.getTypeId(i, j, k - 1) == this.id && world.e(i, j + 1, k - 1)) { return true; } else if (world.getTypeId(i, j, k + 1) == this.id && world.e(i, j + 1, k + 1)) { return true; } else { if (world.getTypeId(i - 1, j, k) == this.id) { object = new InventoryLargeChest( "Large chest", (TileEntityChest) world.getTileEntity(i - 1, j, k), (IInventory) object); } if (world.getTypeId(i + 1, j, k) == this.id) { object = new InventoryLargeChest( "Large chest", (IInventory) object, (TileEntityChest) world.getTileEntity(i + 1, j, k)); } if (world.getTypeId(i, j, k - 1) == this.id) { object = new InventoryLargeChest( "Large chest", (TileEntityChest) world.getTileEntity(i, j, k - 1), (IInventory) object); } if (world.getTypeId(i, j, k + 1) == this.id) { object = new InventoryLargeChest( "Large chest", (IInventory) object, (TileEntityChest) world.getTileEntity(i, j, k + 1)); } if (world.isStatic) { return true; } else { entityhuman.a((IInventory) object); return true; } } }
private boolean g(World world, int i, int j, int k) { if (!a(world, i, j, k)) { a_(world, i, j, k, world.b(i, j, k)); world.e(i, j, k, 0); return false; } else { return true; } }
public void doPhysics(World world, int i, int j, int k, int l) { boolean flag = false; if (!world.e(i, j - 1, k) && world.getTypeId(i, j - 1, k) != Block.FENCE.id) { flag = true; } if (flag) { this.b(world, i, j, k, world.getData(i, j, k), 0); world.setTypeId(i, j, k, 0); } }
public void a(World world, int i, int j, int k, int l) { int i1 = world.getData(i, j, k); if ((i1 & 8) != 0) { if (world.getTypeId(i, j - 1, k) != this.id) { world.e(i, j, k, 0); } if (l > 0 && Block.byId[l].c()) { this.a(world, i, j - 1, k, l); } } else { boolean flag = false; if (world.getTypeId(i, j + 1, k) != this.id) { world.e(i, j, k, 0); flag = true; } if (!world.d(i, j - 1, k)) { world.e(i, j, k, 0); flag = true; if (world.getTypeId(i, j + 1, k) == this.id) { world.e(i, j + 1, k, 0); } } if (flag) { if (!world.isStatic) { this.a_(world, i, j, k, i1); } } else if (l > 0 && Block.byId[l].c()) { boolean flag1 = world.p(i, j, k) || world.p(i, j + 1, k); this.a(world, i, j, k, flag1); } } }
public void g(World world, int i, int j, int k, int l) { int i1 = Item.aB.ba; float f = 0.7F; double d1 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d2 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d3 = (double) (world.l.nextFloat() * f) + (double) (1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem( world, (double) i + d1, (double) j + d2, (double) k + d3, new ItemStack(i1, 1, 0)); entityitem.c = 10; world.a(((Entity) (entityitem))); world.e(i, j, k, 0); }
public void a(World world, int i, int j, int k, int l) { boolean flag = false; if (this.b) { if (!world.getMaterial(i, j - 1, k).isBuildable()) { flag = true; } } else { int i1 = world.getData(i, j, k); flag = true; if (i1 == 2 && world.getMaterial(i, j, k + 1).isBuildable()) { flag = false; } if (i1 == 3 && world.getMaterial(i, j, k - 1).isBuildable()) { flag = false; } if (i1 == 4 && world.getMaterial(i + 1, j, k).isBuildable()) { flag = false; } if (i1 == 5 && world.getMaterial(i - 1, j, k).isBuildable()) { flag = false; } } if (flag) { this.a_(world, i, j, k, world.getData(i, j, k)); world.e(i, j, k, 0); } super.a(world, i, j, k, l); // CraftBukkit start if (net.minecraft.server.Block.byId[l] != null && net.minecraft.server.Block.byId[l].c()) { CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftServer server = ((WorldServer) world).getServer(); Block block = craftWorld.getBlockAt(i, j, k); int power = block.getBlockPower(); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, power, power); server.getPluginManager().callEvent(eventRedstone); } // CraftBukkit end }
public boolean a( ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { if (l == 0) { --j; } if (l == 1) { ++j; } if (l == 2) { --k; } if (l == 3) { ++k; } if (l == 4) { --i; } if (l == 5) { ++i; } int i1 = world.a(i, j, k); if (i1 == 0) { world.a( (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F); world.e(i, j, k, Block.FIRE.bi); } itemstack.b(1); return true; }
public boolean canPlace(World world, int i, int j, int k) { return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id; }
public void a(World world, int i, int j, int k, Random random) { if (world.a(EnumSkyBlock.b, i, j, k) > 11) { a_(world, i, j, k, world.b(i, j, k)); world.e(i, j, k, 0); } }
public void a(World world, int i, int j, int k, Random random) { int l = this.g(world, i, j, k); byte b0 = 1; if (this.material == Material.LAVA && !world.m.d) { b0 = 2; } boolean flag = true; int i1; if (l > 0) { byte b1 = -100; this.a = 0; int j1 = this.e(world, i - 1, j, k, b1); j1 = this.e(world, i + 1, j, k, j1); j1 = this.e(world, i, j, k - 1, j1); j1 = this.e(world, i, j, k + 1, j1); i1 = j1 + b0; if (i1 >= 8 || j1 < 0) { i1 = -1; } if (this.g(world, i, j + 1, k) >= 0) { int k1 = this.g(world, i, j + 1, k); if (k1 >= 8) { i1 = k1; } else { i1 = k1 + 8; } } if (this.a >= 2 && this.material == Material.WATER) { if (world.d(i, j - 1, k)) { i1 = 0; } else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j, k) == 0) { i1 = 0; } } if (this.material == Material.LAVA && l < 8 && i1 < 8 && i1 > l && random.nextInt(4) != 0) { i1 = l; flag = false; } if (i1 != l) { l = i1; if (i1 < 0) { world.e(i, j, k, 0); } else { world.c(i, j, k, i1); world.c(i, j, k, this.id, this.b()); world.h(i, j, k, this.id); } } else if (flag) { this.i(world, i, j, k); } } else { this.i(world, i, j, k); } if (this.l(world, i, j - 1, k)) { if (l >= 8) { world.b(i, j - 1, k, this.id, l); } else { world.b(i, j - 1, k, this.id, l + 8); } } else if (l >= 0 && (l == 0 || this.k(world, i, j - 1, k))) { boolean[] aboolean = this.j(world, i, j, k); i1 = l + b0; if (l >= 8) { i1 = 1; } if (i1 >= 8) { return; } if (aboolean[0]) { this.f(world, i - 1, j, k, i1); } if (aboolean[1]) { this.f(world, i + 1, j, k, i1); } if (aboolean[2]) { this.f(world, i, j, k - 1, i1); } if (aboolean[3]) { this.f(world, i, j, k + 1, i1); } } }
private void a(World world, int i, int j, int k, int l, int i1, int j1) { int k1 = world.getData(i, j, k); int l1 = 0; this.a = false; boolean flag = world.isBlockIndirectlyPowered(i, j, k); this.a = true; int i2; int j2; int k2; if (flag) { l1 = 15; } else { for (i2 = 0; i2 < 4; ++i2) { j2 = i; k2 = k; if (i2 == 0) { j2 = i - 1; } if (i2 == 1) { ++j2; } if (i2 == 2) { k2 = k - 1; } if (i2 == 3) { ++k2; } if (j2 != l || j != i1 || k2 != j1) { l1 = this.getPower(world, j2, j, k2, l1); } if (world.t(j2, j, k2) && !world.t(i, j + 1, k)) { if (j2 != l || j + 1 != i1 || k2 != j1) { l1 = this.getPower(world, j2, j + 1, k2, l1); } } else if (!world.t(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) { l1 = this.getPower(world, j2, j - 1, k2, l1); } } if (l1 > 0) { --l1; } else { l1 = 0; } } // CraftBukkit start if (k1 != l1) { BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(i, j, k), k1, l1); world.getServer().getPluginManager().callEvent(event); l1 = event.getNewCurrent(); } // CraftBukkit end if (k1 != l1) { world.suppressPhysics = true; world.setData(i, j, k, l1); world.e(i, j, k, i, j, k); world.suppressPhysics = false; for (i2 = 0; i2 < 4; ++i2) { j2 = i; k2 = k; int l2 = j - 1; if (i2 == 0) { j2 = i - 1; } if (i2 == 1) { ++j2; } if (i2 == 2) { k2 = k - 1; } if (i2 == 3) { ++k2; } if (world.t(j2, j, k2)) { l2 += 2; } boolean flag1 = false; int i3 = this.getPower(world, j2, j, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { --l1; } if (i3 >= 0 && i3 != l1) { this.a(world, j2, j, k2, i, j, k); } i3 = this.getPower(world, j2, l2, k2, -1); l1 = world.getData(i, j, k); if (l1 > 0) { --l1; } if (i3 >= 0 && i3 != l1) { this.a(world, j2, l2, k2, i, j, k); } } if (k1 < l1 || l1 == 0) { this.b.add(new ChunkPosition(i, j, k)); this.b.add(new ChunkPosition(i - 1, j, k)); this.b.add(new ChunkPosition(i + 1, j, k)); this.b.add(new ChunkPosition(i, j - 1, k)); this.b.add(new ChunkPosition(i, j + 1, k)); this.b.add(new ChunkPosition(i, j, k - 1)); this.b.add(new ChunkPosition(i, j, k + 1)); } } }