public boolean interactWith( ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { if (world.isClientSide) { return true; } else { blockposition = blockposition.shift(enumdirection); if (!entityhuman.a(blockposition, enumdirection, itemstack)) { return false; } else { if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR) { world.makeSound( (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (ItemFireball.g.nextFloat() - ItemFireball.g.nextFloat()) * 0.2F + 1.0F); world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); } if (!entityhuman.abilities.canInstantlyBuild) { --itemstack.count; } return true; } } }
protected UseResult a( ItemStack var1, EntityHuman var2, World var3, BlockPosition var4, IBlockData var5) { var3.a( (double) ((float) var4.getX() + 0.5F), (double) ((float) var4.getY() + 0.5F), (double) ((float) var4.getZ() + 0.5F), var5.getBlock().stepSound.getStepSound(), (var5.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, var5.getBlock().stepSound.getPitch() * 0.8F); if (var3.isClientSide) { return UseResult.SUCCESS; } else { var3.setTypeUpdate(var4, var5); var1.a(1, (EntityLiving) var2); return UseResult.SUCCESS; } }
protected boolean a( ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, IBlockData iblockdata) { world.makeSound( (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), iblockdata.getBlock().stepSound.getStepSound(), (iblockdata.getBlock().stepSound.getVolume1() + 1.0F) / 2.0F, iblockdata.getBlock().stepSound.getVolume2() * 0.8F); if (world.isClientSide) { return true; } else { world.setTypeUpdate(blockposition, iblockdata); itemstack.damage(1, entityhuman); return true; } }
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { org.bukkit.World bworld = world.getWorld(); Server server = world.getServer(); org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); int i = ((Integer) iblockdata.get(LEVEL)).intValue(); byte b0 = 1; if ((this.material == Material.LAVA) && (!world.worldProvider.n())) { b0 = 2; } int j = a(world); if (i > 0) { int l = -100; this.a = 0; EnumDirection enumdirection; for (Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); iterator.hasNext(); l = a(world, blockposition.shift(enumdirection), l)) { enumdirection = (EnumDirection) iterator.next(); } int i1 = l + b0; if ((i1 >= 8) || (l < 0)) { i1 = -1; } if (e(world, blockposition.up()) >= 0) { int k = e(world, blockposition.up()); if (k >= 8) { i1 = k; } else { i1 = k + 8; } } if ((this.a >= 2) && (this.material == Material.WATER)) { IBlockData iblockdata1 = world.getType(blockposition.down()); if (iblockdata1.getBlock().getMaterial().isBuildable()) { i1 = 0; } else if ((iblockdata1.getBlock().getMaterial() == this.material) && (((Integer) iblockdata1.get(LEVEL)).intValue() == 0)) { i1 = 0; } } if ((this.material == Material.LAVA) && (i < 8) && (i1 < 8) && (i1 > i) && (random.nextInt(4) != 0)) { j *= 4; } if (i1 == i) { f(world, blockposition, iblockdata); } else { i = i1; if (i1 < 0) { world.setAir(blockposition); } else { iblockdata = iblockdata.set(LEVEL, Integer.valueOf(i1)); world.setTypeAndData(blockposition, iblockdata, 2); world.a(blockposition, this, j); world.applyPhysics(blockposition, this); } } } else { f(world, blockposition, iblockdata); } IBlockData iblockdata2 = world.getType(blockposition.down()); if (h(world, blockposition.down(), iblockdata2)) { BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); if (server != null) { server.getPluginManager().callEvent(event); } if (!event.isCancelled()) { if ((this.material == Material.LAVA) && (world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER)) { world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData()); fizz(world, blockposition.down()); return; } if (i >= 8) { flow(world, blockposition.down(), iblockdata2, i); } else { flow(world, blockposition.down(), iblockdata2, i + 8); } } } else if ((i >= 0) && ((i == 0) || (g(world, blockposition.down(), iblockdata2)))) { Set set = f(world, blockposition); int k = i + b0; if (i >= 8) { k = 1; } if (k >= 8) { return; } Iterator iterator1 = set.iterator(); while (iterator1.hasNext()) { EnumDirection enumdirection1 = (EnumDirection) iterator1.next(); BlockFromToEvent event = new BlockFromToEvent(source, CraftBlock.notchToBlockFace(enumdirection1)); if (server != null) { server.getPluginManager().callEvent(event); } if (!event.isCancelled()) { flow( world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k); } } } }
public boolean generate(World world, Random random, int i, int j, int k) { while (world.isEmpty(i, j, k) && j > 2) { --j; } if (world.getType(i, j, k) != Blocks.SNOW_BLOCK) { return false; } else { j += random.nextInt(4); int l = random.nextInt(4) + 7; int i1 = l / 4 + random.nextInt(2); if (i1 > 1 && random.nextInt(60) == 0) { j += 10 + random.nextInt(30); } int j1; int k1; int l1; for (j1 = 0; j1 < l; ++j1) { float f = (1.0F - (float) j1 / (float) l) * (float) i1; k1 = MathHelper.f(f); for (l1 = -k1; l1 <= k1; ++l1) { float f1 = (float) MathHelper.a(l1) - 0.25F; for (int i2 = -k1; i2 <= k1; ++i2) { float f2 = (float) MathHelper.a(i2) - 0.25F; if ((l1 == 0 && i2 == 0 || f1 * f1 + f2 * f2 <= f * f) && (l1 != -k1 && l1 != k1 && i2 != -k1 && i2 != k1 || random.nextFloat() <= 0.75F)) { Block block = world.getType(i + l1, j + j1, k + i2); if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { world.setTypeUpdate(i + l1, j + j1, k + i2, Blocks.PACKED_ICE); // Spigot } if (j1 != 0 && k1 > 1) { block = world.getType(i + l1, j - j1, k + i2); if (block.getMaterial() == Material.AIR || block == Blocks.DIRT || block == Blocks.SNOW_BLOCK || block == Blocks.ICE) { world.setTypeUpdate(i + l1, j - j1, k + i2, Blocks.PACKED_ICE); // Spigot } } } } } } j1 = i1 - 1; if (j1 < 0) { j1 = 0; } else if (j1 > 1) { j1 = 1; } for (int j2 = -j1; j2 <= j1; ++j2) { k1 = -j1; while (k1 <= j1) { l1 = j - 1; int k2 = 50; if (Math.abs(j2) == 1 && Math.abs(k1) == 1) { k2 = random.nextInt(5); } while (true) { if (l1 > 50) { Block block1 = world.getType(i + j2, l1, k + k1); if (block1.getMaterial() == Material.AIR || block1 == Blocks.DIRT || block1 == Blocks.SNOW_BLOCK || block1 == Blocks.ICE || block1 == Blocks.PACKED_ICE) { world.setTypeUpdate(i + j2, l1, k + k1, Blocks.PACKED_ICE); // Spigot --l1; --k2; if (k2 <= 0) { l1 -= random.nextInt(5) + 1; k2 = random.nextInt(5); } continue; } } ++k1; break; } } } return true; } }