protected static float a(Block var0, World var1, BlockPosition var2) { float var3 = 1.0F; BlockPosition var4 = var2.down(); for (int var5 = -1; var5 <= 1; ++var5) { for (int var6 = -1; var6 <= 1; ++var6) { float var7 = 0.0F; IBlockData var8 = var1.getType(var4.a(var5, 0, var6)); if (var8.getBlock() == Blocks.FARMLAND) { var7 = 1.0F; if (((Integer) var8.get(BlockSoil.MOISTURE)).intValue() > 0) { var7 = 3.0F; } } if (var5 != 0 || var6 != 0) { var7 /= 4.0F; } var3 += var7; } } BlockPosition var12 = var2.north(); BlockPosition var13 = var2.south(); BlockPosition var15 = var2.west(); BlockPosition var14 = var2.east(); boolean var9 = var0 == var1.getType(var15).getBlock() || var0 == var1.getType(var14).getBlock(); boolean var10 = var0 == var1.getType(var12).getBlock() || var0 == var1.getType(var13).getBlock(); if (var9 && var10) { var3 /= 2.0F; } else { boolean var11 = var0 == var1.getType(var15.north()).getBlock() || var0 == var1.getType(var14.north()).getBlock() || var0 == var1.getType(var14.south()).getBlock() || var0 == var1.getType(var15.south()).getBlock(); if (var11) { var3 /= 2.0F; } } return var3; }
protected void a(BlockPosition var1, IBlockData var2) { this.fallDistance = 0.0F; Vec3D var3 = this.k(this.locX, this.locY, this.locZ); this.locY = (double) var1.getY(); boolean var4 = false; boolean var5 = false; BlockMinecartTrackAbstract var6 = (BlockMinecartTrackAbstract) var2.getBlock(); if (var6 == Blocks.GOLDEN_RAIL) { var4 = ((Boolean) var2.get(BlockPoweredRail.POWERED)).booleanValue(); var5 = !var4; } double var7 = 0.0078125D; BlockMinecartTrackAbstract.EnumTrackPosition var9 = (BlockMinecartTrackAbstract.EnumTrackPosition) var2.get(var6.n()); switch (EntityMinecartAbstract.SyntheticClass_1.b[var9.ordinal()]) { case 1: this.motX -= 0.0078125D; ++this.locY; break; case 2: this.motX += 0.0078125D; ++this.locY; break; case 3: this.motZ += 0.0078125D; ++this.locY; break; case 4: this.motZ -= 0.0078125D; ++this.locY; } int[][] var10 = matrix[var9.a()]; double var11 = (double) (var10[1][0] - var10[0][0]); double var13 = (double) (var10[1][2] - var10[0][2]); double var15 = Math.sqrt(var11 * var11 + var13 * var13); double var17 = this.motX * var11 + this.motZ * var13; if (var17 < 0.0D) { var11 = -var11; var13 = -var13; } double var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); if (var19 > 2.0D) { var19 = 2.0D; } this.motX = var19 * var11 / var15; this.motZ = var19 * var13 / var15; double var21; double var23; double var25; double var27; if (this.passenger instanceof EntityLiving) { var21 = (double) ((EntityLiving) this.passenger).ba; if (var21 > 0.0D) { var23 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F)); var25 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F)); var27 = this.motX * this.motX + this.motZ * this.motZ; if (var27 < 0.01D) { this.motX += var23 * 0.1D; this.motZ += var25 * 0.1D; var5 = false; } } } if (var5) { var21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); if (var21 < 0.03D) { this.motX *= 0.0D; this.motY *= 0.0D; this.motZ *= 0.0D; } else { this.motX *= 0.5D; this.motY *= 0.0D; this.motZ *= 0.5D; } } var21 = 0.0D; var23 = (double) var1.getX() + 0.5D + (double) var10[0][0] * 0.5D; var25 = (double) var1.getZ() + 0.5D + (double) var10[0][2] * 0.5D; var27 = (double) var1.getX() + 0.5D + (double) var10[1][0] * 0.5D; double var29 = (double) var1.getZ() + 0.5D + (double) var10[1][2] * 0.5D; var11 = var27 - var23; var13 = var29 - var25; double var31; double var33; if (var11 == 0.0D) { this.locX = (double) var1.getX() + 0.5D; var21 = this.locZ - (double) var1.getZ(); } else if (var13 == 0.0D) { this.locZ = (double) var1.getZ() + 0.5D; var21 = this.locX - (double) var1.getX(); } else { var31 = this.locX - var23; var33 = this.locZ - var25; var21 = (var31 * var11 + var33 * var13) * 2.0D; } this.locX = var23 + var11 * var21; this.locZ = var25 + var13 * var21; this.setPosition(this.locX, this.locY, this.locZ); var31 = this.motX; var33 = this.motZ; if (this.passenger != null) { var31 *= 0.75D; var33 *= 0.75D; } double var35 = this.m(); var31 = MathHelper.a(var31, -var35, var35); var33 = MathHelper.a(var33, -var35, var35); this.move(var31, 0.0D, var33); if (var10[0][1] != 0 && MathHelper.floor(this.locX) - var1.getX() == var10[0][0] && MathHelper.floor(this.locZ) - var1.getZ() == var10[0][2]) { this.setPosition(this.locX, this.locY + (double) var10[0][1], this.locZ); } else if (var10[1][1] != 0 && MathHelper.floor(this.locX) - var1.getX() == var10[1][0] && MathHelper.floor(this.locZ) - var1.getZ() == var10[1][2]) { this.setPosition(this.locX, this.locY + (double) var10[1][1], this.locZ); } this.o(); Vec3D var37 = this.k(this.locX, this.locY, this.locZ); if (var37 != null && var3 != null) { double var38 = (var3.b - var37.b) * 0.05D; var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); if (var19 > 0.0D) { this.motX = this.motX / var19 * (var19 + var38); this.motZ = this.motZ / var19 * (var19 + var38); } this.setPosition(this.locX, var37.b, this.locZ); } int var44 = MathHelper.floor(this.locX); int var39 = MathHelper.floor(this.locZ); if (var44 != var1.getX() || var39 != var1.getZ()) { var19 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); this.motX = var19 * (double) (var44 - var1.getX()); this.motZ = var19 * (double) (var39 - var1.getZ()); } if (var4) { double var40 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ); if (var40 > 0.01D) { double var42 = 0.06D; this.motX += this.motX / var40 * var42; this.motZ += this.motZ / var40 * var42; } else if (var9 == BlockMinecartTrackAbstract.EnumTrackPosition.EAST_WEST) { if (this.world.getType(var1.west()).getBlock().isOccluding()) { this.motX = 0.02D; } else if (this.world.getType(var1.east()).getBlock().isOccluding()) { this.motX = -0.02D; } } else if (var9 == BlockMinecartTrackAbstract.EnumTrackPosition.NORTH_SOUTH) { if (this.world.getType(var1.north()).getBlock().isOccluding()) { this.motZ = 0.02D; } else if (this.world.getType(var1.south()).getBlock().isOccluding()) { this.motZ = -0.02D; } } } }