public void d(World world, BlockPosition blockposition) { if (!world.worldProvider.o()) { IBlockData iblockdata = world.getType(blockposition); int i = world.b(EnumSkyBlock.SKY, blockposition) - world.ab(); float f = world.d(1.0F); float f1 = f < 3.1415927F ? 0.0F : 6.2831855F; f += (f1 - f) * 0.2F; i = Math.round((float) i * MathHelper.cos(f)); i = MathHelper.clamp(i, 0, 15); if (this.b) { i = 15 - i; } if (((Integer) iblockdata.get(BlockDaylightDetector.POWER)).intValue() != i) { i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange( world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), ((Integer) iblockdata.get(POWER)), i) .getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent world.setTypeAndData( blockposition, iblockdata.set(BlockDaylightDetector.POWER, Integer.valueOf(i)), 3); } } }
@Override public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) { WorldMap worldmap = Items.MAP.getSavedMap(itemstack, world); world = world.getServer().getServer().worlds.get(0); // CraftBukkit - use primary world for maps itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); worldmap1.scale = (byte) (worldmap.scale + 1); if (worldmap1.scale > 4) { worldmap1.scale = 4; } worldmap1.centerX = worldmap.centerX; worldmap1.centerZ = worldmap.centerZ; worldmap1.map = worldmap.map; worldmap1.c(); world.a("map_" + itemstack.getData(), worldmap1); // CraftBukkit start MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView); Bukkit.getServer().getPluginManager().callEvent(event); // CraftBukkit end } }
public WorldMap getSavedMap(ItemStack itemstack, World world) { World worldMain = world .getServer() .getServer() .worlds .get(0); // CraftBukkit - store reference to primary world String s = "map_" + itemstack.getData(); WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps if (worldmap == null && !world.isStatic) { itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); worldmap.scale = 3; int i = 128 * (1 << worldmap.scale); worldmap.centerX = Math.round((float) world.getWorldData().c() / (float) i) * i; worldmap.centerZ = Math.round(world.getWorldData().e() / i) * i; worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - fixes Bukkit multiworld maps worldmap.c(); worldMain.a(s, worldmap); // CraftBukkit - use primary world for maps // CraftBukkit start MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); Bukkit.getServer().getPluginManager().callEvent(event); // CraftBukkit end } return worldmap; }
private void i(World world, int i, int j, int k) { int l = world.getData(i, j, k); world.setTypeIdAndData(i, j, k, this.id + 1, l); world.b(i, j, k, i, j, k); world.g(i, j, k); }
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 boolean b(double d1, double d2, double d3) { AxisAlignedBB axisalignedbb = z.c(d1, d2, d3); List list = l.a(this, axisalignedbb); if (list.size() > 0) { return false; } return !l.b(axisalignedbb); }
public boolean a( ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l) { if (world.a(i, j, k) == Block.aY.bi && world.b(i, j, k) == 0) { world.c(i, j, k, (ba - Item.aY.ba) + 1); world.a(a, i, j, k); itemstack.a--; return true; } else { return false; } }
protected void b(Entity entity) { super.b(entity); this.entitiesById.d(entity.id); Entity[] aentity = entity.ao(); if (aentity != null) { for (int i = 0; i < aentity.length; ++i) { this.entitiesById.d(aentity[i].id); } } }
public MinecartTrackLogic( BlockMinecartTrack blockminecarttrack, World world, int i, int j, int k) { super(); a = blockminecarttrack; g = ((List) (new ArrayList())); b = world; c = i; d = j; e = k; f = world.b(i, j, k); a(); }
public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { itemstack.b(world.b("map")); String s = "map_" + itemstack.getData(); WorldMap worldmap = new WorldMap(s); world.a(s, (WorldMapBase) worldmap); worldmap.b = MathHelper.floor(entityhuman.locX); worldmap.c = MathHelper.floor(entityhuman.locZ); worldmap.e = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); }
public void b(World world, int i, int j, int k, Random random) { if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent( world.getWorld().getBlockAt(i, j, k), 0) .isCancelled()) { return; } // CraftBukkit end world.setTypeId(i, j, k, 0); } }
public void update() { if (world != null) { g = world.getData(x, y, z); world.b(x, y, z, this); if (q() != Blocks.AIR) { world.updateAdjacentComparators(x, y, z, q()); } // Spigot start - Called when the contents have changed, so hoppers around this // tile need updating. scheduleTicks(); // Spigot end } }
public void a(World world, int i, int j, int k, Random random) { if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent( world.getWorld().getBlockAt(i, j, k), Blocks.AIR) .isCancelled()) { return; } // CraftBukkit end this.b(world, i, j, k, world.getData(i, j, k), 0); world.setAir(i, j, k); } }
private void f(World world, int i, int j, int k, int l) { if (this.l(world, i, j, k)) { int i1 = world.getTypeId(i, j, k); if (i1 > 0) { if (this.material == Material.LAVA) { this.h(world, i, j, k); } else { Block.byId[i1].a_(world, i, j, k, world.getData(i, j, k)); } } world.b(i, j, k, this.id, l); } }
public boolean a(Material material) { double d1 = q + (double) s(); int i1 = MathHelper.b(p); int j1 = MathHelper.d(MathHelper.b(d1)); int k1 = MathHelper.b(r); int l1 = l.a(i1, j1, k1); if (l1 != 0 && Block.m[l1].bs == material) { float f1 = BlockFluids.b(l.b(i1, j1, k1)) - 0.1111111F; float f2 = (float) (j1 + 1) - f1; return d1 < (double) f2; } else { return false; } }
public WorldMap a(ItemStack itemstack, World world) { WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData()); if (worldmap == null) { itemstack.b(world.b("map")); String s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); worldmap.b = world.r().c(); worldmap.c = world.r().e(); worldmap.e = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); world.a(s, (WorldMapBase) worldmap); } return worldmap; }
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) { if (this.material == Material.ORE) { return true; } else { int l = world.getData(i, j, k); if ((l & 8) != 0) { if (world.getTypeId(i, j - 1, k) == this.id) { this.a(world, i, j - 1, k, entityhuman); } return true; } else { if (world.getTypeId(i, j + 1, k) == this.id) { world.c(i, j + 1, k, (l ^ 4) + 8); } world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { world.a( (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } else { world.a( (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } return true; } } }
public void a(World world, int i, int j, int k, boolean flag) { int l = world.getData(i, j, k); if ((l & 8) != 0) { if (world.getTypeId(i, j - 1, k) == this.id) { this.a(world, i, j - 1, k, flag); } } else { boolean flag1 = (world.getData(i, j, k) & 4) > 0; if (flag1 != flag) { if (world.getTypeId(i, j + 1, k) == this.id) { world.c(i, j + 1, k, (l ^ 4) + 8); } world.c(i, j, k, l ^ 4); world.b(i, j - 1, k, i, j, k); if (Math.random() < 0.5D) { world.a( (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_open", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } else { world.a( (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.door_close", 1.0F, world.k.nextFloat() * 0.1F + 0.9F); } } } }
private void g(World world, int i, int j, int k) { boolean flag = world.getData(i, j, k) == 1; boolean flag1 = false; float f = 0.125F; List list = null; if (this.a == EnumMobType.EVERYTHING) { list = world.b( (Entity) null, AxisAlignedBB.b( (double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } if (this.a == EnumMobType.MOBS) { list = world.a( EntityLiving.class, AxisAlignedBB.b( (double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } if (this.a == EnumMobType.PLAYERS) { list = world.a( EntityHuman.class, AxisAlignedBB.b( (double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f))); } if (list.size() > 0) { flag1 = true; } // CraftBukkit start - Interact Pressure Plate org.bukkit.World bworld = world.getWorld(); org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); if (flag != flag1) { if (flag1) { for (Object object : list) { if (object != null) { org.bukkit.event.Cancellable cancellable; if (object instanceof EntityHuman) { cancellable = CraftEventFactory.callPlayerInteractEvent( (EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); } else if (object instanceof Entity) { cancellable = new EntityInteractEvent( ((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k)); manager.callEvent((EntityInteractEvent) cancellable); } else { continue; } if (cancellable.isCancelled()) { return; } } } } BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0); manager.callEvent(eventRedstone); flag1 = eventRedstone.getNewCurrent() > 0; } // CraftBukkit end if (flag1 && !flag) { world.setData(i, j, k, 1); world.applyPhysics(i, j, k, this.id); world.applyPhysics(i, j - 1, k, this.id); world.b(i, j, k, i, j, k); world.makeSound( (double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F); } if (!flag1 && flag) { world.setData(i, j, k, 0); world.applyPhysics(i, j, k, this.id); world.applyPhysics(i, j - 1, k, this.id); world.b(i, j, k, i, j, k); world.makeSound( (double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F); } if (flag1) { world.c(i, j, k, this.id, this.d()); } }
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); } } }