public boolean canSpawn() { if (this.world.random.nextInt(3) == 0) { return false; } else { if (this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox)) { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); if (j < 63) { return false; } Block block = this.world.getType(i, j - 1, k); if (block == Blocks.GRASS || block.getMaterial() == Material.LEAVES) { return true; } } return false; } }
public boolean d() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id && this.world.k(i, j, k) > 8 && super.d(); }
public boolean a() { if (this.a.world.r()) { return false; } else { Village village = this.a.world.villages.getClosestVillage( MathHelper.floor(this.a.locX), MathHelper.floor(this.a.locY), MathHelper.floor(this.a.locZ), 16); if (village == null) { return false; } else { this.b = village.b( MathHelper.floor(this.a.locX), MathHelper.floor(this.a.locY), MathHelper.floor(this.a.locZ)); return this.b == null ? false : (double) this.b.c( MathHelper.floor(this.a.locX), MathHelper.floor(this.a.locY), MathHelper.floor(this.a.locZ)) < 2.25D; } } }
public boolean g() { Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); return (this.getSize() == 1 || this.world.difficulty > 0) && this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D ? super.g() : false; }
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 PathEntity a(double d0, double d1, double d2) { return !this.j() ? null : this.b.a( this.a, MathHelper.floor(d0), (int) d1, MathHelper.floor(d2), this.e, this.j, this.k, this.l, this.m); }
public boolean b() { EntityLiving entityliving = this.b.getGoalTarget(); return entityliving == null ? false : (!entityliving.isAlive() ? false : (!this.e ? !this.b.getNavigation().g() : this.b.b( MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ)))); }
private void l() { if (!this.b.isChunkLoaded( MathHelper.floor(this.a.locX), (int) (this.a.boundingBox.b + 0.5D), MathHelper.floor(this.a.locZ))) { for (int i = 0; i < this.c.d(); ++i) { PathPoint pathpoint = this.c.a(i); if (this.b.isChunkLoaded(pathpoint.a, pathpoint.b, pathpoint.c)) { this.c.b(i - 1); return; } } } }
@Override public boolean canContinue() { EntityLiving entityTarget = NMSUtil.getGoalTarget(this.getEntityHandle()); EntityLiving entity = this.getEntityHandle(); if (entityTarget == null) return false; if (!this.m_target.isAlive()) return false; if (!this.m_ignoreSight) return !this.getNavigation().g(); else return NMSUtil.isInHomeArea( entity, MathHelper.floor(this.m_target.locX), MathHelper.floor(this.m_target.locY), MathHelper.floor(this.m_target.locZ)); }
public boolean canSpawn() { Chunk chunk = this.world.getChunkAtWorldCoords(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); if (this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1) { return false; } else { if (this.getSize() == 1 || this.world.difficulty > 0) { BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < e[this.world.w()] && this.world.getLightLevel( MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) { return super.canSpawn(); } if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) { return super.canSpawn(); } } return false; } }
public void F_() { if (this.id == 0) { this.die(); } else { this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; ++this.b; this.motY -= 0.03999999910593033D; this.move(this.motX, this.motY, this.motZ); this.motX *= 0.9800000190734863D; this.motY *= 0.9800000190734863D; this.motZ *= 0.9800000190734863D; int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY); int k = MathHelper.floor(this.locZ); if (this.b == 1 && this.world.getTypeId(i, j, k) == this.id) { this.world.setTypeId(i, j, k, 0); } else if (!this.world.isStatic && this.b == 1) { this.die(); } if (this.onGround) { this.motX *= 0.699999988079071D; this.motZ *= 0.699999988079071D; this.motY *= -0.5D; if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) { this.die(); // CraftBukkit - setTypeId => setTypeIdAndData if ((!this.world.mayPlace(this.id, i, j, k, true, 1) || BlockSand.canFall(this.world, i, j - 1, k) || !this.world.setTypeIdAndData(i, j, k, this.id, this.data)) && !this.world.isStatic) { this.b(this.id, 1); } } } else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) { this.b(this.id, 1); this.die(); } } }
private int i() { if (this.a.aT() && this.m) { int i = (int) this.a.boundingBox.b; int j = this.b.getTypeId(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ)); int k = 0; do { if (j != Block.WATER.id && j != Block.STATIONARY_WATER.id) { return i; } ++i; j = this.b.getTypeId(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ)); ++k; } while (k <= 16); return (int) this.a.boundingBox.b; } else { return (int) (this.a.boundingBox.b + 0.5D); } }
protected boolean j_() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); if (this.world.b(EnumSkyBlock.SKY, i, j, k) > this.random.nextInt(32)) { return false; } else { int l = this.world.getLightLevel(i, j, k); if (this.world.O()) { int i1 = this.world.j; this.world.j = 10; l = this.world.getLightLevel(i, j, k); this.world.j = i1; } return l <= this.random.nextInt(8); } }
@SuppressWarnings("unchecked") public List getBlockBBsInBB(World world, AxisAlignedBB axisalignedbb) { UnsafeList unsafeList = new UnsafeList(); int minX = MathHelper.floor(axisalignedbb.a); int maxX = MathHelper.floor(axisalignedbb.d + 1.0D); int minY = MathHelper.floor(axisalignedbb.b); int maxY = MathHelper.floor(axisalignedbb.e + 1.0D); int minZ = MathHelper.floor(axisalignedbb.c); int maxZ = MathHelper.floor(axisalignedbb.f + 1.0D); for (int x = minX; x < maxX; x++) { for (int z = minZ; z < maxZ; z++) { if (world.isChunkLoaded(x >> 4, z >> 4)) { for (int y = minY - 1; y < maxY; y++) { Block block = CraftMagicNumbers.getBlock(world.getBlockAt(x, y, z)); if (block != null && block.getBlockData().getMaterial().isSolid()) { block.a( block.getBlockData(), ((CraftWorld) world).getHandle(), new BlockPosition(x, y, z), axisalignedbb, unsafeList, null); } } } } } return unsafeList; }
@Override public void h() { super.h(); this.C(); npc.onTick(); if (world .getType(MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ)) .getMaterial() == Material.FIRE) { setOnFire(15); } // Apply velocity etc. this.motY = onGround ? Math.max(0.0, motY) : motY; move(motX, motY, motZ); this.motX *= 0.800000011920929; this.motY *= 0.800000011920929; this.motZ *= 0.800000011920929; if (gravity && !this.onGround) { this.motY -= 0.1; // Most random value, don't judge. } }
protected void bp() { if (--profession <= 0) { world.villages.a(MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ)); profession = 70 + random.nextInt(50); village = world.villages.getClosestVillage( MathHelper.floor(locX), MathHelper.floor(locY), MathHelper.floor(locZ), 32); if (village == null) { bV(); } else { ChunkCoordinates chunkcoordinates = village.getCenter(); a( chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) village.getSize() * 0.6F)); if (bz) { bz = false; village.b(5); } } } if (!ca() && bv > 0) { bv--; if (bv <= 0) { if (bw) { if (bu.size() > 1) { Iterator iterator = bu.iterator(); do { if (!iterator.hasNext()) break; MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); if (merchantrecipe.g()) merchantrecipe.a(random.nextInt(6) + random.nextInt(6) + 2); } while (true); } t(1); bw = false; if (village != null && by != null) { world.broadcastEntityEffect(this, (byte) 14); village.a(by, 1); } } addEffect(new MobEffect(MobEffectList.REGENERATION.id, 200, 0)); } } super.bp(); }
public void postPlace( World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) { int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3; int i1 = world.getData(i, j, k) >> 2; ++l; l %= 4; if (l == 0) { world.setData(i, j, k, 2 | i1 << 2, 2); } if (l == 1) { world.setData(i, j, k, 3 | i1 << 2, 2); } if (l == 2) { world.setData(i, j, k, 0 | i1 << 2, 2); } if (l == 3) { world.setData(i, j, k, 1 | i1 << 2, 2); } }
public static List getBlockBBsInBB(World world, AxisAlignedBB axisalignedbb) { UnsafeList unsafeList = new UnsafeList(); int minX = MathHelper.floor(axisalignedbb.a); int maxX = MathHelper.floor(axisalignedbb.d + 1.0D); int minY = MathHelper.floor(axisalignedbb.b); int maxY = MathHelper.floor(axisalignedbb.e + 1.0D); int minZ = MathHelper.floor(axisalignedbb.c); int maxZ = MathHelper.floor(axisalignedbb.f + 1.0D); for (int x = minX; x < maxX; x++) { for (int z = minZ; z < maxZ; z++) { if (world.isChunkLoaded(x, z)) { for (int y = minY - 1; y < maxY; y++) { Block block = Block.e(world.getBlockAt(x, y, z).getTypeId()); if (block != null) { block.a(((CraftWorld) world).getHandle(), x, y, z, axisalignedbb, unsafeList, null); } } } } } return unsafeList; }
/** * Cosinus calculation using a table.<br> * For double-precision cos values, use the MathHelper cos function.<br> * <br> * <b>No interpolation is performed:</b> Accuracy is up to the 5th decimal place. * * @param angle the angle in radians. * @return the cosinus of the angle. */ public static float cos(float angle) { return cosRaw(MathHelper.floor(angle * SIN_CONVERSION_FACTOR)); }
public boolean b() { return this.a.world.r() ? false : !this.b.g && this.b.a(MathHelper.floor(this.a.locX), MathHelper.floor(this.a.locZ)); }
/** * Tangent calculations using a table.<br> * <i>sin(angle) / cos(angle)</i><br> * <br> * <b>No interpolation is performed:</b> Accuracy is up to the 5th decimal place. * * @param angle in radians. * @return the tangent of the angle. */ public static float tan(float angle) { int idx = MathHelper.floor(angle * SIN_CONVERSION_FACTOR); return sinRaw(idx) / cosRaw(idx); }
private PathEntity a(Entity entity, double d0, double d1, double d2, float f) { this.b.a(); this.c.c(); boolean flag = this.g; int i = MathHelper.floor(entity.boundingBox.b + 0.5D); if (this.h && entity.G()) { i = (int) entity.boundingBox.b; for (int j = this.a.getTypeId(MathHelper.floor(entity.locX), i, MathHelper.floor(entity.locZ)); j == Block.WATER.id || j == Block.STATIONARY_WATER.id; j = this.a.getTypeId(MathHelper.floor(entity.locX), i, MathHelper.floor(entity.locZ))) { ++i; } flag = this.g; this.g = false; } else { i = MathHelper.floor(entity.boundingBox.b + 0.5D); } PathPoint pathpoint = this.a(MathHelper.floor(entity.boundingBox.a), i, MathHelper.floor(entity.boundingBox.c)); PathPoint pathpoint1 = this.a( MathHelper.floor(d0 - (double) (entity.width / 2.0F)), MathHelper.floor(d1), MathHelper.floor(d2 - (double) (entity.width / 2.0F))); PathPoint pathpoint2 = new PathPoint( MathHelper.d(entity.width + 1.0F), MathHelper.d(entity.length + 1.0F), MathHelper.d(entity.width + 1.0F)); PathEntity pathentity = this.a(entity, pathpoint, pathpoint1, pathpoint2, f); this.g = flag; return pathentity; }
/** * WASD Control. * * @param sideMot * @param forMot */ @Override public void g(float sideMot, float forMot) { if (!CustomEntities.customEntities.contains(this)) { super.g(sideMot, forMot); return; } if (getSize() != 3) setSize(3); if (this.passenger != null && this.passenger instanceof EntityHuman && CustomEntities.customEntities.contains(this)) { this.lastYaw = this.yaw = this.passenger.yaw; this.pitch = this.passenger.pitch * 0.5F; this.setYawPitch(this.yaw, this.pitch); // Update the pitch and yaw this.aI = this.aG = this.yaw; sideMot = ((EntityLiving) this.passenger).aZ * 0.5F; forMot = ((EntityLiving) this.passenger).ba; Field jump = null; // Jumping try { jump = EntityLiving.class.getDeclaredField("aY"); } catch (NoSuchFieldException | SecurityException e1) { e1.printStackTrace(); } jump.setAccessible(true); if (jump != null && BlockUtils.isOnGround(this.getBukkitEntity())) { try { if (jump.getBoolean(this.passenger)) { double jumpHeight = 0.3D; this.motY = jumpHeight; } } catch (IllegalAccessException e) { e.printStackTrace(); } } this.S = 1.0F; this.aK = this.yaw; if (!this.world.isClientSide) { this.k(0.2f); if (bM()) { if (V()) { double d0 = locY; float f3 = 0.8F; float f4 = 0.02F; float f2 = EnchantmentManager.b(this); if (f2 > 3.0F) { f2 = 3.0F; } if (f2 > 0.0F) { f3 += (0.5460001F - f3) * f2 / 3.0F; f4 += (bI() * 1.0F - f4) * f2 / 3.0F; } a(sideMot, forMot, f4); move(motX, motY, motZ); motX *= f3; motY *= 0.800000011920929D; motZ *= f3; motY -= 0.02D; if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) motY = 0.300000011920929D; } else if (ab()) { double d0 = locY; a(sideMot, forMot, 0.02F); move(motX, motY, motZ); motX *= 0.5D; motY *= 0.5D; motZ *= 0.5D; motY -= 0.02D; if ((positionChanged) && (c(motX, motY + 0.6000000238418579D - locY + d0, motZ))) motY = 0.300000011920929D; } else { float f5 = world .getType( new BlockPosition( MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))) .getBlock() .frictionFactor * 0.91F; float f6 = 0.1627714F / (f5 * f5 * f5); float f3 = bI() * f6; a(sideMot, forMot, f3); f5 = world .getType( new BlockPosition( MathHelper.floor(locX), MathHelper.floor(getBoundingBox().b) - 1, MathHelper.floor(locZ))) .getBlock() .frictionFactor * 0.91F; if (k_()) { float f4 = 0.15F; motX = MathHelper.a(motX, -f4, f4); motZ = MathHelper.a(motZ, -f4, f4); fallDistance = 0.0F; if (motY < -0.15D) { motY = -0.15D; } if (motY < 0.0D) { motY = 0.0D; } } move(motX, motY, motZ); if ((positionChanged) && (k_())) { motY = 0.2D; } if ((world.isClientSide) && ((!world.isLoaded(new BlockPosition((int) locX, 0, (int) locZ))) || (!world .getChunkAtWorldCoords(new BlockPosition((int) locX, 0, (int) locZ)) .o()))) { if (locY > 0.0D) motY = -0.1D; else motY = 0.0D; } else { motY += 0D; } motY *= 0.9800000190734863D; motX *= f5; motZ *= f5; } } ay = az; double d0 = locX - lastX; double d1 = locZ - lastZ; float f2 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; if (f2 > 1.0F) { f2 = 1.0F; } az += (f2 - az) * 0.4F; aA += az; super.g(sideMot, forMot); } this.ay = this.az; double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; if (f4 > 1.0F) { f4 = 1.0F; } this.az += (f4 - this.az) * 0.4F; this.aA += this.az; } else { this.S = 0.5F; this.aK = 0.02F; super.g(sideMot, forMot); } }
public int getFloorX() { return MathHelper.floor(x); }
public static int a( Entity entity, int i, int j, int k, PathPoint pathpoint, boolean flag, boolean flag1, boolean flag2) { boolean flag3 = false; for (int l = i; l < i + pathpoint.a; ++l) { for (int i1 = j; i1 < j + pathpoint.b; ++i1) { for (int j1 = k; j1 < k + pathpoint.c; ++j1) { int k1 = entity.world.getTypeId(l, i1, j1); if (k1 > 0) { if (k1 == Block.TRAP_DOOR.id) { flag3 = true; } else if (k1 != Block.WATER.id && k1 != Block.STATIONARY_WATER.id) { if (!flag2 && k1 == Block.WOODEN_DOOR.id) { return 0; } } else { if (flag) { return -1; } flag3 = true; } Block block = Block.byId[k1]; int l1 = block.d(); if (entity.world.e(l, i1, j1) == 9) { int i2 = MathHelper.floor(entity.locX); int j2 = MathHelper.floor(entity.locY); int k2 = MathHelper.floor(entity.locZ); if (entity.world.e(i2, j2, k2) != 9 && entity.world.e(i2, j2 - 1, k2) != 9) { return -3; } } else if (!block.b((IBlockAccess) entity.world, l, i1, j1) && (!flag1 || k1 != Block.WOODEN_DOOR.id)) { if (l1 == 11 || k1 == Block.FENCE_GATE.id || l1 == 32) { return -3; } if (k1 == Block.TRAP_DOOR.id) { return -4; } Material material = block.material; if (material != Material.LAVA) { return 0; } if (!entity.I()) { return -2; } } } } } } return flag3 ? 2 : 1; }
public int getFloorY() { return MathHelper.floor(y); }
public int getFloorZ() { return MathHelper.floor(z); }
@Override public boolean update() { EntityHuman passenger = (EntityHuman) this.getEntityHandle().passenger; EntityLiving entity = this.getEntityHandle(); float f = MathHelper.g(passenger.yaw - entity.yaw) * 0.5f; if (f > 5) f = 5; if (f < -5) f = -5; entity.yaw = MathHelper.g(entity.yaw + f); if (this.m_currentSpeed < this.m_maxSpeed) this.m_currentSpeed += (this.m_maxSpeed - this.m_currentSpeed) * 0.01; if (this.m_currentSpeed > this.m_maxSpeed) this.m_currentSpeed = this.m_maxSpeed; int x = MathHelper.floor(entity.locX); int y = MathHelper.floor(entity.locY); int z = MathHelper.floor(entity.locZ); float speed = this.m_currentSpeed; if (this.m_speedBoosted) { if (this.m_speedBoostTime++ > this.m_maxSpeedBoostTime) this.m_speedBoosted = false; speed += speed * 1.15 * MathHelper.sin( (float) (this.m_speedBoostTime / this.m_maxSpeedBoostTime * Math.PI)); } float f2 = 0.91f; if (entity.onGround) { f2 = 0.54600006F; Block block = entity.world.getType(MathHelper.d(x), MathHelper.d(y) - 1, MathHelper.d(z)); if (block.getMaterial() != Material.AIR) f2 = block.frictionFactor * 0.91f; } float f3 = 0.16277136F / (f2 * f2 * f2); float f4 = MathHelper.sin(entity.yaw * 3.1415927F / 180.0F); float f5 = MathHelper.cos(entity.yaw * 3.1415927F / 180.0F); float f6 = entity.bl() * f3; float f7 = Math.max(speed, 1.0F); f7 = f6 / f7; float f8 = speed * f7; float f9 = -(f8 * f4); float f10 = f8 * f5; if (MathHelper.abs(f9) > MathHelper.abs(f10)) { if (f9 < 0.0F) { f9 -= entity.width / 2.0F; } if (f9 > 0.0F) { f9 += entity.width / 2.0F; } f10 = 0.0F; } else { f9 = 0.0F; if (f10 < 0.0F) { f10 -= entity.width / 2.0F; } if (f10 > 0.0F) { f10 += entity.width / 2.0F; } } int nextX = MathHelper.floor(entity.locX + f9); int nextZ = MathHelper.floor(entity.locZ + f10); PathPoint point = new PathPoint( MathHelper.d(entity.width + 1), MathHelper.d(entity.length + passenger.length + 1), MathHelper.d(entity.width + 1)); if (x != nextX || z != nextZ) { Block type1 = entity.world.getType(x, y, z); Block type2 = entity.world.getType(x, y - 1, z); boolean isStep = this.isStep(type1) || type1 == null && this.isStep(type2); if (!isStep && Pathfinder.a(entity, nextX, y, nextZ, point, false, false, true) == 0 && Pathfinder.a(entity, x, y + 1, z, point, false, false, true) == 1 && Pathfinder.a(entity, nextX, y + 1, nextZ, point, false, false, true) == 1) NMSUtil.getControllerLook(entity).a(); } if (!passenger.abilities.canInstantlyBuild && this.m_currentSpeed >= this.m_maxSpeed * 0.5 && entity.aI().nextFloat() < 0.006f && !this.m_speedBoosted) { ItemStack item = passenger.be(); if (item != null && item.getItem() == Items.CARROT_STICK) { item.damage(1, passenger); if (item.count == 0) { ItemStack newItem = new ItemStack(Items.FISHING_ROD); newItem.setTag(item.tag); passenger.inventory.items[passenger.inventory.itemInHandIndex] = newItem; } } } entity.e(0, speed); return true; }
public void e(float f, float f1) { if (this.H()) { this.a(f, f1, 0.02F); this.move(this.motX, this.motY, this.motZ); this.motX *= 0.800000011920929D; this.motY *= 0.800000011920929D; this.motZ *= 0.800000011920929D; } else if (this.J()) { this.a(f, f1, 0.02F); this.move(this.motX, this.motY, this.motZ); this.motX *= 0.5D; this.motY *= 0.5D; this.motZ *= 0.5D; } else { float f2 = 0.91F; if (this.onGround) { f2 = 0.54600006F; int i = this.world.getTypeId( MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)); if (i > 0) { f2 = Block.byId[i].frictionFactor * 0.91F; } } float f3 = 0.16277136F / (f2 * f2 * f2); this.a(f, f1, this.onGround ? 0.1F * f3 : 0.02F); f2 = 0.91F; if (this.onGround) { f2 = 0.54600006F; int j = this.world.getTypeId( MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)); if (j > 0) { f2 = Block.byId[j].frictionFactor * 0.91F; } } this.move(this.motX, this.motY, this.motZ); this.motX *= (double) f2; this.motY *= (double) f2; this.motZ *= (double) f2; } this.bg = this.bh; double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f4 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F; if (f4 > 1.0F) { f4 = 1.0F; } this.bh += (f4 - this.bh) * 0.4F; this.bi += this.bh; }
public void h() { super.h(); if (this.c > 0) { --this.c; } this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; this.motY -= 0.029999999329447746D; if (this.world .getType( MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) .getMaterial() == Material.LAVA) { this.motY = 0.20000000298023224D; this.motX = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F); this.motZ = (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F); this.makeSound("random.fizz", 0.4F, 2.0F + this.random.nextFloat() * 0.4F); } this.j(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ); double d0 = 8.0D; if (this.targetTime < this.a - 20 + this.getId() % 100) { if (this.targetPlayer == null || this.targetPlayer.f(this) > d0 * d0) { this.targetPlayer = this.world.findNearbyPlayer(this, d0); } this.targetTime = this.a; } if (this.targetPlayer != null) { double d1 = (this.targetPlayer.locX - this.locX) / d0; double d2 = (this.targetPlayer.locY + (double) this.targetPlayer.getHeadHeight() - this.locY) / d0; double d3 = (this.targetPlayer.locZ - this.locZ) / d0; double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); double d5 = 1.0D - d4; if (d5 > 0.0D) { d5 *= d5; this.motX += d1 / d4 * d5 * 0.1D; this.motY += d2 / d4 * d5 * 0.1D; this.motZ += d3 / d4 * d5 * 0.1D; } } this.move(this.motX, this.motY, this.motZ); float f = 0.98F; if (this.onGround) { f = this.world.getType( MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)) .frictionFactor * 0.98F; } this.motX *= (double) f; this.motY *= 0.9800000190734863D; this.motZ *= (double) f; if (this.onGround) { this.motY *= -0.8999999761581421D; } ++this.a; ++this.b; if (this.b >= 6000) { this.die(); } }