public void l(Entity entity) { double d0 = entity.locX; double d1 = entity.boundingBox.b + (double) entity.length; double d2 = entity.locZ; byte b0 = 3; for (int i = -b0; i <= b0; ++i) { for (int j = -b0; j < b0; ++j) { if (i != 0 || j != 0) { int k = (int) (this.locX + (double) i); int l = (int) (this.locZ + (double) j); AxisAlignedBB axisalignedbb = this.boundingBox.c((double) i, 1.0D, (double) j); if (this.world.a(axisalignedbb).isEmpty()) { if (World.a((IBlockAccess) this.world, k, (int) this.locY, l)) { this.enderTeleportTo( this.locX + (double) i, this.locY + 1.0D, this.locZ + (double) j); return; } if (World.a((IBlockAccess) this.world, k, (int) this.locY - 1, l) || this.world.getType(k, (int) this.locY - 1, l).getMaterial() == Material.WATER) { d0 = this.locX + (double) i; d1 = this.locY + 1.0D; d2 = this.locZ + (double) j; } } } } } this.enderTeleportTo(d0, d1, d2); }
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 boolean a(int i, int j, int k) { if (b.a(i, j, k) == a.bi) { return true; } if (b.a(i, j + 1, k) == a.bi) { return true; } return b.a(i, j - 1, k) == a.bi; }
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; } }
public void scanBlockAndBreak(World var1, ItemStack var2, int var3, int var4, int var5) { int var6 = var1.getTypeId(var3, var4, var5); int var7 = var1.getData(var3, var4, var5); ArrayList var8 = Block.byId[var6].getBlockDropped(var1, var3, var4, var5, var7, 0); ItemStack var10; for (Iterator var9 = var8.iterator(); var9.hasNext(); addToDroplist(var2, var10)) var10 = (ItemStack) var9.next(); var1.setTypeId(var3, var4, var5, 0); if (var1.random.nextInt(8) == 0) var1.a("largesmoke", var3, var4, var5, 0.0D, 0.0D, 0.0D); if (var1.random.nextInt(8) == 0) var1.a("explode", var3, var4, var5, 0.0D, 0.0D, 0.0D); }
private MinecartTrackLogic a(ChunkPosition chunkposition) { if (b.a(chunkposition.a, chunkposition.b, chunkposition.c) == a.bi) { return new MinecartTrackLogic(a, b, chunkposition.a, chunkposition.b, chunkposition.c); } if (b.a(chunkposition.a, chunkposition.b + 1, chunkposition.c) == a.bi) { return new MinecartTrackLogic(a, b, chunkposition.a, chunkposition.b + 1, chunkposition.c); } if (b.a(chunkposition.a, chunkposition.b - 1, chunkposition.c) == a.bi) { return new MinecartTrackLogic(a, b, chunkposition.a, chunkposition.b - 1, chunkposition.c); } else { return null; } }
public boolean interactWith( ItemStack var1, EntityHuman var2, World var3, int var4, int var5, int var6, int var7) { if (EEProxy.isClient(var3)) return false; boolean var8 = true; if (chargeLevel(var1) > 0) { cleanDroplist(var1); var2.C_(); var3.makeSound(var2, "flash", 0.8F, 1.5F); for (int var9 = -(chargeLevel(var1) * (var7 != 5 ? (byte) (var7 != 4 ? 1 : 0) : 2)); var9 <= chargeLevel(var1) * (var7 != 5 ? var7 != 4 ? 1 : 2 : 0); var9++) { for (int var10 = -(chargeLevel(var1) * (var7 != 1 ? (byte) (var7 != 0 ? 1 : 0) : 2)); var10 <= chargeLevel(var1) * (var7 != 1 ? var7 != 0 ? 1 : 2 : 0); var10++) { for (int var11 = -(chargeLevel(var1) * (var7 != 3 ? (byte) (var7 != 2 ? 1 : 0) : 2)); var11 <= chargeLevel(var1) * (var7 != 3 ? var7 != 2 ? 1 : 2 : 0); var11++) { int var12 = var4 + var9; int var13 = var5 + var10; int var14 = var6 + var11; int var15 = var3.getTypeId(var12, var13, var14); int var16 = var3.getData(var12, var13, var14); if (canBreak(var15, var16) && attemptBreak(var2, var12, var13, var14)) { if (getFuelRemaining(var1) < 1) { ConsumeReagent(var1, var2, var8); var8 = false; } if (getFuelRemaining(var1) > 0) { ArrayList var17 = Block.byId[var15].getBlockDropped(var3, var12, var13, var14, var16, 0); ItemStack var19; for (Iterator var18 = var17.iterator(); var18.hasNext(); addToDroplist(var1, var19)) var19 = (ItemStack) var18.next(); var3.setTypeId(var12, var13, var14, 0); if (var3.random.nextInt(8) == 0) var3.a("largesmoke", var12, var13, var14, 0.0D, 0.0D, 0.0D); if (var3.random.nextInt(8) == 0) var3.a("explode", var12, var13, var14, 0.0D, 0.0D, 0.0D); setShort(var1, "fuelRemaining", getFuelRemaining(var1) - 1); } } } } } ejectDropList(var3, var1, var4, var5, var6); } return false; }
public EntityItem a(int i1, int j1, float f1) { EntityItem entityitem = new EntityItem(l, p, q + (double) f1, r, new ItemStack(i1, j1)); entityitem.c = 10; l.a(entityitem); return entityitem; }
@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 IBlockData getPlacedState( World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2, int i, EntityLiving entityliving) { IBlockData iblockdata = getBlockData().set(POWERED, Boolean.valueOf(false)); if (a(world, blockposition, enumdirection.opposite())) { return iblockdata.set( FACING, EnumLeverPosition.a(enumdirection, entityliving.getDirection())); } Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); EnumDirection enumdirection1; do { if (!iterator.hasNext()) { if (World.a(world, blockposition.down())) { return iblockdata.set( FACING, EnumLeverPosition.a(EnumDirection.UP, entityliving.getDirection())); } return iblockdata; } enumdirection1 = (EnumDirection) iterator.next(); } while ((enumdirection1 == enumdirection) || (!a(world, blockposition, enumdirection1.opposite()))); return iblockdata.set(FACING, EnumLeverPosition.a(enumdirection1, entityliving.getDirection())); }
public void dropRecord(World world, int i, int j, int k) { if (!world.isStatic) { TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k); if (tileentityrecordplayer != null) { ItemStack itemstack = tileentityrecordplayer.record; if (itemstack != null) { world.triggerEffect(1005, i, j, k, 0); world.a((String) null, i, j, k); tileentityrecordplayer.record = null; tileentityrecordplayer.update(); world.setData(i, j, k, 0); float f = 0.7F; double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D; double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D; double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D; ItemStack itemstack1 = itemstack.cloneItemStack(); EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack1); entityitem.pickupDelay = 10; world.addEntity(entityitem); } } } }
public void a( World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { if (!world.isClientSide) { if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { EntityTNTPrimed entitytntprimed = new EntityTNTPrimed( world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); world.addEntity(entitytntprimed); world.a( (EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gV, SoundCategory.BLOCKS, 1.0F, 1.0F); } } }
public EnumInteractionResult a( EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { IBlockData iblockdata = world.getType(blockposition); if (iblockdata.getBlock() == Blocks.JUKEBOX && !((Boolean) iblockdata.get(BlockJukeBox.HAS_RECORD)).booleanValue()) { if (!world.isClientSide) { if (true) return EnumInteractionResult.SUCCESS; // CraftBukkit - handled in ItemStack ItemStack itemstack = entityhuman.b(enumhand); ((BlockJukeBox) Blocks.JUKEBOX).a(world, blockposition, iblockdata, itemstack); world.a((EntityHuman) null, 1010, blockposition, Item.getId(this)); itemstack.subtract(1); entityhuman.b(StatisticList.Z); } return EnumInteractionResult.SUCCESS; } else { return EnumInteractionResult.PASS; } }
private void d(MinecartTrackLogic minecarttracklogic) { g.add(((new ChunkPosition(minecarttracklogic.c, minecarttracklogic.d, minecarttracklogic.e)))); boolean flag = b(c, d, e - 1); boolean flag1 = b(c, d, e + 1); boolean flag2 = b(c - 1, d, e); boolean flag3 = b(c + 1, d, e); byte byte0 = -1; if (flag || flag1) { byte0 = 0; } if (flag2 || flag3) { byte0 = 1; } if (flag1 && flag3 && !flag && !flag2) { byte0 = 6; } if (flag1 && flag2 && !flag && !flag3) { byte0 = 7; } if (flag && flag2 && !flag1 && !flag3) { byte0 = 8; } if (flag && flag3 && !flag1 && !flag2) { byte0 = 9; } if (byte0 == 0) { if (b.a(c, d + 1, e - 1) == a.bi) { byte0 = 4; } if (b.a(c, d + 1, e + 1) == a.bi) { byte0 = 5; } } if (byte0 == 1) { if (b.a(c + 1, d + 1, e) == a.bi) { byte0 = 2; } if (b.a(c - 1, d + 1, e) == a.bi) { byte0 = 3; } } if (byte0 < 0) { byte0 = 0; } b.c(c, d, e, ((int) (byte0))); }
public static EntityItem getEntityItemAt(World world, double d0, double d1, double d2) { List list = world.a( EntityItem.class, AxisAlignedBB.a().a(d0, d1, d2, d0 + 1.0D, d1 + 1.0D, d2 + 1.0D), IEntitySelector.a); return list.size() > 0 ? (EntityItem) list.get(0) : null; }
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(World world, int i, int j, int k) { int l = world.a(i, j - 1, k); if (l == 0 || !Block.m[l].a()) { return false; } else { return world.c(i, j - 1, k).c(); } }
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( 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; }
protected void a(Entity entity) { super.a(entity); this.entitiesById.a(entity.id, entity); Entity[] aentity = entity.ao(); if (aentity != null) { for (int i = 0; i < aentity.length; ++i) { this.entitiesById.a(aentity[i].id, aentity[i]); } } }
public EntityMinecart(World world) { super(world); this.items = new ItemStack[36]; this.e = 0; this.f = false; this.h = true; this.m = true; this.a(0.98F, 0.7F); this.height = this.length / 2.0F; this.g = world != null ? world.a(this) : null; }
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 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 ItemStack b(IBlockSource iblocksource, ItemStack itemstack) { EnumFacing enumfacing = BlockDispenser.j_(iblocksource.h()); World world = iblocksource.k(); double d0 = iblocksource.a() + (double) ((float) enumfacing.c() * 1.125F); double d1 = iblocksource.b() + (double) ((float) enumfacing.d() * 1.125F); double d2 = iblocksource.c() + (double) ((float) enumfacing.e() * 1.125F); int i0 = iblocksource.d() + enumfacing.c(); int i1 = iblocksource.e() + enumfacing.d(); int i2 = iblocksource.f() + enumfacing.e(); int i3 = world.a(i0, i1, i2); double d3; if (BlockRailBase.d_(i3)) { d3 = 0.0D; } else { if (i3 != 0 || !BlockRailBase.d_(world.a(i0, i1 - 1, i2))) { return this.b.a(iblocksource, itemstack); } d3 = -1.0D; } EntityMinecart entityminecart = EntityMinecart.a(world, d0, d1 + d3, d2, ((ItemMinecart) itemstack.b()).a); // CanaryMod: Dispense DispenseHook hook = new DispenseHook( ((TileEntityDispenser) iblocksource.j()).getCanaryDispenser(), entityminecart.getCanaryEntity()); Canary.hooks().callHook(hook); if (!hook.isCanceled()) { world.d((Entity) entityminecart); itemstack.a(1); } // return itemstack; }
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, 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); } } } }
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; } }
protected void a(WorldSettings worldsettings) { if (this.entitiesById == null) { this.entitiesById = new IntHashMap(); } if (this.L == null) { this.L = new HashSet(); } if (this.M == null) { this.M = new TreeSet(); } this.b(worldsettings); super.a(worldsettings); }
public boolean interactWith( ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { IBlockData iblockdata = world.getType(blockposition); Block block = iblockdata.getBlock(); if (!block.a(world, blockposition)) { blockposition = blockposition.shift(enumdirection); } if (itemstack.count == 0) { return false; } else if (!entityhuman.a(blockposition, enumdirection, itemstack)) { return false; } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { int i = this.filterData(itemstack.getData()); IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); if (world.setTypeAndData(blockposition, iblockdata1, 3)) { iblockdata1 = world.getType(blockposition); if (iblockdata1.getBlock() == this.a) { a(world, entityhuman, blockposition, itemstack); this.a.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack); } world.makeSound( (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), this.a.stepSound.getPlaceSound(), (this.a.stepSound.getVolume1() + 1.0F) / 2.0F, this.a.stepSound.getVolume2() * 0.8F); --itemstack.count; } return true; } else { return false; } }
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; } }