mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-22 18:46:27 +01:00
drop jafama fastmath
This commit is contained in:
parent
76556f1a80
commit
5b3dd1573b
@ -387,7 +387,6 @@ # Patches
|
||||
| server | Zombie horse naturally spawn | William Blake Galbreath | |
|
||||
| server | add config for logging login location | Simon Gardling | |
|
||||
| server | dont load chunks for physics | Aikar | |
|
||||
| server | jafama fast math | Simon Gardling | |
|
||||
| server | lithium DataTrackerMixin | JellySquid | tr7zw |
|
||||
| server | lithium HashedList | JellySquid | |
|
||||
| server | lithium MixinBox | JellySquid | |
|
||||
@ -399,4 +398,3 @@ # Patches
|
||||
| server | lithium enum_values | JellySquid | |
|
||||
| server | lithium reduce allocations | JellySquid | Mykyta Komarnytskyy |
|
||||
| server | lithium: cache chunk gen sea level | SuperCoder7979 | |
|
||||
| server | replace Math.sin and Math.cos with MathHelper | Simon Gardling | |
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Modify POM
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 02bbe784d0a062dd643e37f3ad04b77a78144828..0a298ff510f45a5e52d618427cf6e2e5c904cb86 100644
|
||||
index 02bbe784d0a062dd643e37f3ad04b77a78144828..ac2d01ce61a890469867e0b422f953e9652e5a95 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,11 +1,11 @@
|
||||
@ -112,7 +112,7 @@ index 02bbe784d0a062dd643e37f3ad04b77a78144828..0a298ff510f45a5e52d618427cf6e2e5
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- for optimized protocol handling -->
|
||||
@@ -168,6 +177,18 @@
|
||||
@@ -168,6 +177,12 @@
|
||||
<version>master-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
@ -121,17 +121,11 @@ index 02bbe784d0a062dd643e37f3ad04b77a78144828..0a298ff510f45a5e52d618427cf6e2e5
|
||||
+ <groupId>org.apache.commons</groupId>
|
||||
+ <artifactId>commons-math3</artifactId>
|
||||
+ <version>3.6.1</version>
|
||||
+ </dependency>
|
||||
+ <!-- Fast Math -->
|
||||
+ <dependency>
|
||||
+ <groupId>net.jafama</groupId>
|
||||
+ <artifactId>jafama</artifactId>
|
||||
+ <version>2.3.2</version>
|
||||
+ </dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
@@ -186,6 +207,19 @@
|
||||
@@ -186,6 +201,19 @@
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
@ -151,7 +145,7 @@ index 02bbe784d0a062dd643e37f3ad04b77a78144828..0a298ff510f45a5e52d618427cf6e2e5
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
@@ -197,15 +231,15 @@
|
||||
@@ -197,15 +225,15 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
|
@ -8,23 +8,6 @@ This patch includes all utilities required by the Yatopia project and its patche
|
||||
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
||||
Co-authored-by: Ivan Pekov <ivan@mrivanplays.com>
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 0a298ff510f45a5e52d618427cf6e2e5c904cb86..cb7f0e2532b8f26cf924e19d056bbcb41c0e4865 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -189,6 +189,12 @@
|
||||
<artifactId>jafama</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
+ <!-- Fast Random -->
|
||||
+ <dependency>
|
||||
+ <groupId>org.apache.commons</groupId>
|
||||
+ <artifactId>commons-rng-core</artifactId>
|
||||
+ <version>1.3</version>
|
||||
+ </dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
diff --git a/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java b/src/main/java/org/yatopiamc/yatopia/server/util/Constants.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac5235155eb1b5515165fc9648b7c9d7a0713b44
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add NBT API as a first-class lib
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index cb7f0e2532b8f26cf924e19d056bbcb41c0e4865..c48503c42e37545ed606f6a6088ca06d057787ce 100644
|
||||
index ac2d01ce61a890469867e0b422f953e9652e5a95..c080f9410953d1be02c8719382f398114e9222cb 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -375,6 +375,10 @@
|
||||
@@ -363,6 +363,10 @@
|
||||
<pattern>net.minecraft.server</pattern>
|
||||
<shadedPattern>net.minecraft.server.v${minecraft_version}</shadedPattern>
|
||||
</relocation>
|
||||
|
@ -1,196 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Gardling <titaniumtown@gmail.com>
|
||||
Date: Fri, 12 Feb 2021 16:20:23 -0500
|
||||
Subject: [PATCH] replace Math.sin and Math.cos with MathHelper
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
index 0d8fba494ed11ad79201dfd1c7f3ad5b288ca0ca..48dd107f39572c33ff99a8e1362ae801930823d5 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java
|
||||
@@ -387,8 +387,8 @@ public class EnderDragonBattle {
|
||||
private void n() {
|
||||
if (!this.gateways.isEmpty()) {
|
||||
int i = (Integer) this.gateways.remove(this.gateways.size() - 1);
|
||||
- int j = MathHelper.floor(96.0D * Math.cos(2.0D * (-3.141592653589793D + 0.15707963267948966D * (double) i)));
|
||||
- int k = MathHelper.floor(96.0D * Math.sin(2.0D * (-3.141592653589793D + 0.15707963267948966D * (double) i)));
|
||||
+ int j = MathHelper.floor(96.0D * MathHelper.cos(2.0D * (-3.141592653589793D + 0.15707963267948966D * (double) i))); // Yatopia
|
||||
+ int k = MathHelper.floor(96.0D * MathHelper.sin(2.0D * (-3.141592653589793D + 0.15707963267948966D * (double) i))); // Yatopia
|
||||
|
||||
this.a(new BlockPosition(j, 75, k));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
index fcb4936e78d56907b0e56d0aaf7f8361513d0a4e..068095faeb42874a347ee1e6628dd304cca6762e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
@@ -365,7 +365,7 @@ public class EntityBoat extends Entity {
|
||||
|
||||
this.aC = MathHelper.a(this.aC, 0.0F, 1.0F);
|
||||
this.aE = this.aD;
|
||||
- this.aD = 10.0F * (float) Math.sin((double) (0.5F * (float) this.world.getTime())) * this.aC;
|
||||
+ this.aD = 10.0F * (float) MathHelper.sin((double) (0.5F * (float) this.world.getTime())) * this.aC; // Yatopia
|
||||
} else {
|
||||
if (!this.aA) {
|
||||
this.d(0);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderSignal.java b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
index 132fa358b844a609a9ede3032e98f991c5eac65a..b7e60a672d67b083253d68fc6addf93de4f47f6e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
@@ -91,7 +91,7 @@ public class EntityEnderSignal extends Entity {
|
||||
|
||||
int i = this.locY() < this.targetY ? 1 : -1;
|
||||
|
||||
- vec3d = new Vec3D(Math.cos((double) f2) * d5, d6 + ((double) i - d6) * 0.014999999664723873D, Math.sin((double) f2) * d5);
|
||||
+ vec3d = new Vec3D(MathHelper.cos((double) f2) * d5, d6 + ((double) i - d6) * 0.014999999664723873D, MathHelper.sin((double) f2) * d5); // Yatopia
|
||||
this.setMot(vec3d);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
index ff78bd607f19a1b9f37281946db3f705c844f7cc..29035d14656393faddc82936dbf2dbe04f492f49 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
@@ -1094,8 +1094,8 @@ public class EntityFox extends EntityAnimal {
|
||||
private void j() {
|
||||
double d0 = 6.283185307179586D * EntityFox.this.getRandom().nextDouble();
|
||||
|
||||
- this.c = Math.cos(d0);
|
||||
- this.d = Math.sin(d0);
|
||||
+ this.c = MathHelper.cos(d0); // Yatopia
|
||||
+ this.d = MathHelper.sin(d0); // Yatopia
|
||||
this.e = 80 + EntityFox.this.getRandom().nextInt(20);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
index 476f692df79e98779271cc5a395276ab9c755a58..75b89fbbc8bce25a8a0edebe6a6d0d2e26281f3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
@@ -362,10 +362,10 @@ public class EntityGuardian extends EntityMonster {
|
||||
float f2 = MathHelper.g(0.125F, this.i.dN(), f1);
|
||||
|
||||
this.i.q(f2);
|
||||
- double d4 = Math.sin((double) (this.i.ticksLived + this.i.getId()) * 0.5D) * 0.05D;
|
||||
- double d5 = Math.cos((double) (this.i.yaw * 0.017453292F));
|
||||
- double d6 = Math.sin((double) (this.i.yaw * 0.017453292F));
|
||||
- double d7 = Math.sin((double) (this.i.ticksLived + this.i.getId()) * 0.75D) * 0.05D;
|
||||
+ double d4 = MathHelper.sin((double) (this.i.ticksLived + this.i.getId()) * 0.5D) * 0.05D; // Yatopia
|
||||
+ double d5 = MathHelper.cos((double) (this.i.yaw * 0.017453292F)); // Yatopia
|
||||
+ double d6 = MathHelper.sin((double) (this.i.yaw * 0.017453292F)); // Yatopia
|
||||
+ double d7 = MathHelper.sin((double) (this.i.ticksLived + this.i.getId()) * 0.75D) * 0.05D; // Yatopia
|
||||
|
||||
this.i.setMot(this.i.getMot().add(d4 * d5, d7 * (d6 + d5) * 0.25D + (double) f2 * d2 * 0.1D, d4 * d6));
|
||||
ControllerLook controllerlook = this.i.getControllerLook();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 1730108aa67802ed15407c45542b6223ca86634f..348d7c093014ed4e26c6c08553892aaeb8c38dad 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -610,7 +610,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
float f5 = this.random.nextFloat() * 6.2831855F;
|
||||
float f6 = 0.02F * this.random.nextFloat();
|
||||
|
||||
- entityitem.setMot((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
|
||||
+ entityitem.setMot((double) (-f3 * f2 * 0.3F) + MathHelper.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + MathHelper.sin((double) f5) * (double) f6); // Yatopia
|
||||
}
|
||||
|
||||
// CraftBukkit start - fire PlayerDropItemEvent
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index ee27b814e0ae4eb9867df7fef31671fb23193cb7..81b3082a4499b983dbbd68a98fa80ba91a409662 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -160,15 +160,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
// Paper start
|
||||
public BlockPosition getPointInFront(double inFront) {
|
||||
double rads = Math.toRadians(MCUtil.normalizeYaw(this.yaw+90)); // MC rotates yaw 90 for some odd reason
|
||||
- final double x = locX() + inFront * Math.cos(rads);
|
||||
- final double z = locZ() + inFront * Math.sin(rads);
|
||||
+ final double x = locX() + inFront * MathHelper.cos(rads); // Yatopia
|
||||
+ final double z = locZ() + inFront * MathHelper.sin(rads); // Yatopia
|
||||
return new BlockPosition(x, locY(), z);
|
||||
}
|
||||
|
||||
public ChunkCoordIntPair getChunkInFront(double inFront) {
|
||||
double rads = Math.toRadians(MCUtil.normalizeYaw(this.yaw+90)); // MC rotates yaw 90 for some odd reason
|
||||
- final double x = locX() + (inFront * 16) * Math.cos(rads);
|
||||
- final double z = locZ() + (inFront * 16) * Math.sin(rads);
|
||||
+ final double x = locX() + (inFront * 16) * MathHelper.cos(rads); // Yatopia
|
||||
+ final double z = locZ() + (inFront * 16) * MathHelper.sin(rads); // Yatopia
|
||||
return new ChunkCoordIntPair(MathHelper.floor(x) >> 4, MathHelper.floor(z) >> 4);
|
||||
}
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityRavager.java b/src/main/java/net/minecraft/server/EntityRavager.java
|
||||
index 3606440e41ab3193fadebb455c0967dbc0ccbb63..b160e0886d431be7b281fd3d7d30e822cd26234c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityRavager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityRavager.java
|
||||
@@ -182,9 +182,9 @@ public class EntityRavager extends EntityRaider {
|
||||
|
||||
private void eX() {
|
||||
if (this.random.nextInt(6) == 0) {
|
||||
- double d0 = this.locX() - (double) this.getWidth() * Math.sin((double) (this.aA * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D);
|
||||
+ double d0 = this.locX() - (double) this.getWidth() * MathHelper.sin((double) (this.aA * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D); // Yatopia
|
||||
double d1 = this.locY() + (double) this.getHeight() - 0.3D;
|
||||
- double d2 = this.locZ() + (double) this.getWidth() * Math.cos((double) (this.aA * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D);
|
||||
+ double d2 = this.locZ() + (double) this.getWidth() * MathHelper.cos((double) (this.aA * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D); // Yatopia
|
||||
|
||||
this.world.addParticle(Particles.ENTITY_EFFECT, d0, d1, d2, 0.4980392156862745D, 0.5137254901960784D, 0.5725490196078431D);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
index 918cd774bc7e9f84ddbc1e65b4cb4d661eb127a5..d35ac0a170e4213be007147e3674645455feb3cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
|
||||
@@ -44,8 +44,8 @@ public class EntitySquid extends EntityWaterAnimal {
|
||||
|
||||
private void rotateVectorAroundY(org.bukkit.util.Vector vector, double degrees) {
|
||||
double rad = Math.toRadians(degrees);
|
||||
- double cos = Math.cos(rad);
|
||||
- double sine = Math.sin(rad);
|
||||
+ double cos = MathHelper.cos(rad); // Yatopia
|
||||
+ double sine = MathHelper.sin(rad); // Yatopia
|
||||
double x = vector.getX();
|
||||
double z = vector.getZ();
|
||||
vector.setX(cos * x - sine * z);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 6e77dc89f5441f0f483571fee9aa9f34b6d1dd1c..9271efb508a1b73fff8dd7f5d8c685a9f92d6a35 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -24,7 +24,7 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.setPosition(d0, d1, d2);
|
||||
double d3 = world.random.nextDouble() * 6.2831854820251465D;
|
||||
|
||||
- this.setMot(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D);
|
||||
+ this.setMot(-MathHelper.sin(d3) * 0.02D, 0.20000000298023224D, -MathHelper.cos(d3) * 0.02D); // Yatopia
|
||||
this.setFuseTicks(80);
|
||||
this.lastX = d0;
|
||||
this.lastY = d1;
|
||||
diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
index 1b7cc2fc9a9636a245c5570e2e326973129d095b..770fe8bf9bad092357bf24361acab98516d188aa 100644
|
||||
--- a/src/main/java/net/minecraft/server/MathHelper.java
|
||||
+++ b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
@@ -29,6 +29,14 @@ public class MathHelper {
|
||||
return CompactSineLUT.cos(f); // Yatopia - CompactSineLUT
|
||||
}
|
||||
|
||||
+ public static float sin(double f) {
|
||||
+ return CompactSineLUT.sin((float)f); // Yatopia - CompactSineLUT
|
||||
+ }
|
||||
+
|
||||
+ public static float cos(double f) {
|
||||
+ return CompactSineLUT.cos((float)f); // Yatopia - CompactSineLUT
|
||||
+ }
|
||||
+
|
||||
public static float c(float f) {
|
||||
return (float) Math.sqrt((double) f);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
index aaa89a39bf697bd0f3354005b428d858f065f66b..1f6606165a45c30eddca8d06ea14067b0bb09f8b 100644
|
||||
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
@@ -155,8 +155,8 @@ public class RandomPositionGenerator {
|
||||
double d1 = MathHelper.d(vec3d.z, vec3d.x) - 1.5707963705062866D;
|
||||
double d2 = d1 + (double) (2.0F * random.nextFloat() - 1.0F) * d0;
|
||||
double d3 = Math.sqrt(random.nextDouble()) * (double) MathHelper.a * (double) i;
|
||||
- double d4 = -d3 * Math.sin(d2);
|
||||
- double d5 = d3 * Math.cos(d2);
|
||||
+ double d4 = -d3 * MathHelper.sin(d2); // Yatopia
|
||||
+ double d5 = d3 * MathHelper.cos(d2); // Yatopia
|
||||
|
||||
if (Math.abs(d4) <= (double) i && Math.abs(d5) <= (double) i) {
|
||||
int l = random.nextInt(2 * j + 1) - j + k;
|
@ -1,391 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Gardling <titaniumtown@gmail.com>
|
||||
Date: Fri, 12 Feb 2021 15:18:15 -0500
|
||||
Subject: [PATCH] jafama fast math
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
index de469f9b4f0fecc05dca7a5aacd1308db6f80a18..8f2e2c8d7d852ef13352d90930de691d901eb326 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java
|
||||
@@ -40,7 +40,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator {
|
||||
private static final float[] j = (float[]) SystemUtils.a((new float[25]), (afloat) -> { // CraftBukkit - decompile error
|
||||
for (int i = -2; i <= 2; ++i) {
|
||||
for (int j = -2; j <= 2; ++j) {
|
||||
- float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F);
|
||||
+ float f = 10.0F / MathHelper.sqrtVanilla((float) (i * i + j * j) + 0.2F); // Yatopia
|
||||
|
||||
afloat[i + 2 + (j + 2) * 5] = f;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/CommandSpreadPlayers.java b/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
index c9f4b69874e693c8e5c3346f09db7b5014dcfb63..47e8603f13d81b74cf234ad633398dc4df64793b 100644
|
||||
--- a/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
+++ b/src/main/java/net/minecraft/server/CommandSpreadPlayers.java
|
||||
@@ -219,7 +219,7 @@ public class CommandSpreadPlayers {
|
||||
double d0 = this.a - commandspreadplayers_a.a;
|
||||
double d1 = this.b - commandspreadplayers_a.b;
|
||||
|
||||
- return Math.sqrt(d0 * d0 + d1 * d1);
|
||||
+ return net.jafama.FastMath.sqrt(d0 * d0 + d1 * d1); // Yatopia
|
||||
}
|
||||
|
||||
void a() {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index 9e27d3ccfd6a5ee00cac72c3137189b1be1f81fb..3a798c763d42af9d995b42fa62caef43787f540e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -659,7 +659,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
- double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double deltaLength = net.jafama.FastMath.sqrt(distanceSquared); // Yatopia
|
||||
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1028, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true));
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderSignal.java b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
index b7e60a672d67b083253d68fc6addf93de4f47f6e..0404bf980bc33dbb2c11c864ae461ab5c90a63c6 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderSignal.java
|
||||
@@ -79,7 +79,7 @@ public class EntityEnderSignal extends Entity {
|
||||
if (!this.world.isClientSide) {
|
||||
double d3 = this.targetX - d0;
|
||||
double d4 = this.targetZ - d2;
|
||||
- float f1 = (float) Math.sqrt(d3 * d3 + d4 * d4);
|
||||
+ float f1 = (float) net.jafama.FastMath.sqrt(d3 * d3 + d4 * d4); // Yatopia
|
||||
float f2 = (float) MathHelper.d(d4, d3);
|
||||
double d5 = MathHelper.d(0.0025D, (double) f, (double) f1);
|
||||
double d6 = vec3d.y;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
index 4aee11c980105a523bdcb35470053aae51b002df..1a8b6e0cefe4d3725e0ca9ea2f4ac565e4d091fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
@@ -149,7 +149,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
double d1 = vec3d.g();
|
||||
|
||||
if (d1 < 64.0D) {
|
||||
- double d2 = 1.0D - Math.sqrt(d1) / 8.0D;
|
||||
+ double d2 = 1.0D - net.jafama.FastMath.sqrt(d1) / 8.0D; // Yatopia
|
||||
|
||||
this.setMot(this.getMot().e(vec3d.d().a(d2 * d2 * 0.1D)));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
index e4c2bf2de6c032332b7557c240bb458297bdd33f..fe1281b8fdbc90ebec272f02d693002bd22c970e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
|
||||
@@ -232,7 +232,7 @@ public class EntityFireworks extends IProjectile {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
- float f1 = f * (float) Math.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D);
|
||||
+ float f1 = f * (float) net.jafama.FastMath.sqrt((5.0D - (double) this.g((Entity) entityliving)) / 5.0D); // Yatopia
|
||||
|
||||
CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entityliving.damageEntity(DamageSource.a(this, this.getShooter()), f1);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index f0502c7f5419f637641b48d8c87f5df206e4f922..0b9df5dc24096bbc63436711e2296147462538bf 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -471,7 +471,7 @@ public class EntityFishingHook extends IProjectile {
|
||||
|
||||
// Paper start, entity item can be null, so we need to check against this
|
||||
if (entityitem != null) {
|
||||
- entityitem.setMot(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
|
||||
+ entityitem.setMot(d0 * 0.1D, d1 * 0.1D + net.jafama.FastMath.sqrt(net.jafama.FastMath.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D); // Yatopia
|
||||
this.world.addEntity(entityitem);
|
||||
}
|
||||
// Paper end
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
index 29035d14656393faddc82936dbf2dbe04f492f49..cdd283a0f417e4be93712d48dffc9f82b8d6f747 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
@@ -842,7 +842,7 @@ public class EntityFox extends EntityAnimal {
|
||||
if (vec3d.y * vec3d.y < 0.029999999329447746D && EntityFox.this.pitch != 0.0F) {
|
||||
EntityFox.this.pitch = MathHelper.j(EntityFox.this.pitch, 0.0F, 0.2F);
|
||||
} else {
|
||||
- double d0 = Math.sqrt(Entity.c(vec3d));
|
||||
+ double d0 = net.jafama.FastMath.sqrt(Entity.c(vec3d)); // Yatopia
|
||||
double d1 = Math.signum(-vec3d.y) * Math.acos(d0 / vec3d.f()) * 57.2957763671875D;
|
||||
|
||||
EntityFox.this.pitch = (float) d1;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
index 75b89fbbc8bce25a8a0edebe6a6d0d2e26281f3a..b48ae1e9dda61feff2a5180be3750fc38982ae49 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
@@ -242,7 +242,7 @@ public class EntityGuardian extends EntityMonster {
|
||||
double d1 = entityliving.locX() - this.locX();
|
||||
double d2 = entityliving.e(0.5D) - this.getHeadY();
|
||||
double d3 = entityliving.locZ() - this.locZ();
|
||||
- double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
+ double d4 = net.jafama.FastMath.sqrt(d1 * d1 + d2 * d2 + d3 * d3); // Yatopia
|
||||
|
||||
d1 /= d4;
|
||||
d2 /= d4;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
index 5200b0396ee41edb42ff727c78cf3b5fce091d6b..6622c35e081014cb7cc3796551513798a16330d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
|
||||
@@ -78,7 +78,7 @@ public class EntityLightning extends Entity {
|
||||
|
||||
// Paper end
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
- double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double deltaLength = net.jafama.FastMath.sqrt(distanceSquared); // Yatopia
|
||||
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, relativeX, this.locY(), relativeZ, 10000.0F, pitch));
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 5745ac2e932ba934604072951a33edf2fa16b3cb..ed08bd34b66a336f71055c09a07c309b9c0136fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2347,8 +2347,8 @@ public abstract class EntityLiving extends Entity {
|
||||
Vec3D vec3d5 = this.getLookDirection();
|
||||
|
||||
f = this.pitch * 0.017453292F;
|
||||
- double d2 = Math.sqrt(vec3d5.x * vec3d5.x + vec3d5.z * vec3d5.z);
|
||||
- double d3 = Math.sqrt(c(vec3d4));
|
||||
+ double d2 = net.jafama.FastMath.sqrt(vec3d5.x * vec3d5.x + vec3d5.z * vec3d5.z); // Yatopia
|
||||
+ double d3 = net.jafama.FastMath.sqrt(c(vec3d4)); // Yatopia
|
||||
double d4 = vec3d5.f();
|
||||
float f3 = MathHelper.cos(f);
|
||||
|
||||
@@ -2373,7 +2373,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.setMot(vec3d4.d(0.9900000095367432D, 0.9800000190734863D, 0.9900000095367432D));
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
if (this.positionChanged && !this.world.isClientSide) {
|
||||
- d5 = Math.sqrt(c(this.getMot()));
|
||||
+ d5 = net.jafama.FastMath.sqrt(c(this.getMot())); // Yatopia
|
||||
double d6 = d3 - d5;
|
||||
float f4 = (float) (d6 * 10.0D - 3.0D);
|
||||
|
||||
@@ -2558,7 +2558,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (f > 0.0025000002F) {
|
||||
f3 = 1.0F;
|
||||
- f2 = (float) Math.sqrt((double) f) * 3.0F;
|
||||
+ f2 = (float) net.jafama.FastMath.sqrt((double) f) * 3.0F; // Yatopia
|
||||
float f4 = (float) MathHelper.d(d1, d0) * 57.295776F - 90.0F;
|
||||
float f5 = MathHelper.e(MathHelper.g(this.yaw) - f4);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
index 4de2877f30a9b231a5c8bbd1739416991e9d7633..911940176ad53e3c97f331a14a22dc98ec62f6b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
@@ -556,7 +556,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
BaseBlockPosition baseblockposition1 = (BaseBlockPosition) pair.getSecond();
|
||||
double d4 = (double) (baseblockposition1.getX() - baseblockposition.getX());
|
||||
double d5 = (double) (baseblockposition1.getZ() - baseblockposition.getZ());
|
||||
- double d6 = Math.sqrt(d4 * d4 + d5 * d5);
|
||||
+ double d6 = net.jafama.FastMath.sqrt(d4 * d4 + d5 * d5); // Yatopia
|
||||
double d7 = vec3d1.x * d4 + vec3d1.z * d5;
|
||||
|
||||
if (d7 < 0.0D) {
|
||||
@@ -564,7 +564,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
d5 = -d5;
|
||||
}
|
||||
|
||||
- double d8 = Math.min(2.0D, Math.sqrt(c(vec3d1)));
|
||||
+ double d8 = Math.min(2.0D, net.jafama.FastMath.sqrt(c(vec3d1))); // Yatopia
|
||||
|
||||
vec3d1 = new Vec3D(d8 * d4 / d6, vec3d1.y, d8 * d5 / d6);
|
||||
this.setMot(vec3d1);
|
||||
@@ -584,7 +584,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
double d11;
|
||||
|
||||
if (flag1) {
|
||||
- d11 = Math.sqrt(c(this.getMot()));
|
||||
+ d11 = net.jafama.FastMath.sqrt(c(this.getMot())); // Yatopia
|
||||
if (d11 < 0.03D) {
|
||||
this.setMot(Vec3D.ORIGIN);
|
||||
} else {
|
||||
@@ -635,7 +635,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
double d19 = (vec3d.y - vec3d3.y) * 0.05D;
|
||||
|
||||
vec3d4 = this.getMot();
|
||||
- d18 = Math.sqrt(c(vec3d4));
|
||||
+ d18 = net.jafama.FastMath.sqrt(c(vec3d4)); // Yatopia
|
||||
if (d18 > 0.0D) {
|
||||
this.setMot(vec3d4.d((d18 + d19) / d18, 1.0D, (d18 + d19) / d18));
|
||||
}
|
||||
@@ -648,13 +648,13 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
|
||||
if (i != blockposition.getX() || j != blockposition.getZ()) {
|
||||
vec3d4 = this.getMot();
|
||||
- d18 = Math.sqrt(c(vec3d4));
|
||||
+ d18 = net.jafama.FastMath.sqrt(c(vec3d4)); // Yatopia
|
||||
this.setMot(d18 * (double) (i - blockposition.getX()), vec3d4.y, d18 * (double) (j - blockposition.getZ()));
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
vec3d4 = this.getMot();
|
||||
- d18 = Math.sqrt(c(vec3d4));
|
||||
+ d18 = net.jafama.FastMath.sqrt(c(vec3d4)); // Yatopia
|
||||
if (d18 > 0.01D) {
|
||||
double d20 = 0.06D;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
|
||||
index dfc0538cc8cb8015fe79978ee360c86127118330..aae4d6370dae8980e7997a5ebf0fd3f7301f8618 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPotion.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
|
||||
@@ -126,7 +126,7 @@ public class EntityPotion extends EntityProjectileThrowable {
|
||||
double d0 = this.h(entityliving);
|
||||
|
||||
if (d0 < 16.0D) {
|
||||
- double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
|
||||
+ double d1 = 1.0D - net.jafama.FastMath.sqrt(d0) / 4.0D; // Yatopia
|
||||
|
||||
if (entityliving == entity) {
|
||||
d1 = 1.0D;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
index e238352bd41069936da2860b707f071c9aef0062..7b475523096119c318b1eb183b8df6f563d5a612 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityWither.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityWither.java
|
||||
@@ -345,7 +345,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if ( world.spigotConfig.witherSpawnSoundRadius > 0 && distanceSquared > world.spigotConfig.witherSpawnSoundRadius * world.spigotConfig.witherSpawnSoundRadius ) continue; // Spigot
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
- double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double deltaLength = net.jafama.FastMath.sqrt(distanceSquared); // Yatopia
|
||||
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1023, new BlockPosition((int) relativeX, (int) this.locY(), (int) relativeZ), 0, true));
|
||||
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
|
||||
index 5ca4d03215c979a4d122a32178a1859b4d9c3334..14e952fdeccb6b1ab36f6f36eb40f3893a2c2afe 100644
|
||||
--- a/src/main/java/net/minecraft/server/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/server/Explosion.java
|
||||
@@ -112,7 +112,7 @@ public class Explosion {
|
||||
double d0 = (double) ((float) k / 15.0F * 2.0F - 1.0F);
|
||||
double d1 = (double) ((float) i / 15.0F * 2.0F - 1.0F);
|
||||
double d2 = (double) ((float) j / 15.0F * 2.0F - 1.0F);
|
||||
- double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
+ double d3 = net.jafama.FastMath.sqrt(d0 * d0 + d1 * d1 + d2 * d2); // Yatopia
|
||||
|
||||
d0 /= d3;
|
||||
d1 /= d3;
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemEnderEye.java b/src/main/java/net/minecraft/server/ItemEnderEye.java
|
||||
index 3296d888a66e8d0ad861ed093cd62b0d2da6ff0b..1db486fcc25ae47d30e68ca40ccd6427df51053a 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemEnderEye.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemEnderEye.java
|
||||
@@ -44,7 +44,7 @@ public class ItemEnderEye extends Item {
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
if (world.spigotConfig.endPortalSoundRadius > 0 && distanceSquared > world.spigotConfig.endPortalSoundRadius * world.spigotConfig.endPortalSoundRadius) continue; // Spigot
|
||||
if (distanceSquared > viewDistance * viewDistance) {
|
||||
- double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double deltaLength = net.jafama.FastMath.sqrt(distanceSquared); // Yatopia
|
||||
double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1038, new BlockPosition((int) relativeX, (int) soundPos.getY(), (int) relativeZ), 0, true));
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 5100314050dbbc633e6379eb1a523242623cfa8f..f23745a286850a7c691f9849120f5116c9ea13be 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -419,7 +419,7 @@ public final class MCUtil {
|
||||
* @return
|
||||
*/
|
||||
public static double distance(Entity e1, Entity e2) {
|
||||
- return Math.sqrt(distanceSq(e1, e2));
|
||||
+ return net.jafama.FastMath.sqrt(distanceSq(e1, e2)); // Yatopia
|
||||
}
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ public final class MCUtil {
|
||||
* @return
|
||||
*/
|
||||
public static double distance(BlockPosition e1, BlockPosition e2) {
|
||||
- return Math.sqrt(distanceSq(e1, e2));
|
||||
+ return net.jafama.FastMath.sqrt(distanceSq(e1, e2)); // Yatopia
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,7 +444,7 @@ public final class MCUtil {
|
||||
* @return
|
||||
*/
|
||||
public static double distance(double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||
- return Math.sqrt(distanceSq(x1, y1, z1, x2, y2, z2));
|
||||
+ return net.jafama.FastMath.sqrt(distanceSq(x1, y1, z1, x2, y2, z2)); // Yatopia
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
index 770fe8bf9bad092357bf24361acab98516d188aa..6a72d49a4b00d120e463671cec643916df3b8f30 100644
|
||||
--- a/src/main/java/net/minecraft/server/MathHelper.java
|
||||
+++ b/src/main/java/net/minecraft/server/MathHelper.java
|
||||
@@ -37,14 +37,25 @@ public class MathHelper {
|
||||
return CompactSineLUT.cos((float)f); // Yatopia - CompactSineLUT
|
||||
}
|
||||
|
||||
+ // Yatopia start - jafama fast math
|
||||
+ public static float sqrt(float f) { return MathHelper.c(f); } // Yatopia - OBFHELPER
|
||||
public static float c(float f) {
|
||||
- return (float) Math.sqrt((double) f);
|
||||
+ return (float) net.jafama.FastMath.sqrt((double) f); // Yatopia
|
||||
}
|
||||
|
||||
public static float sqrt(double d0) {
|
||||
+ return (float) net.jafama.FastMath.sqrt(d0);
|
||||
+ }
|
||||
+
|
||||
+ public static float sqrtVanilla(double d0) {
|
||||
return (float) Math.sqrt(d0);
|
||||
}
|
||||
|
||||
+ public static float sqrtVanilla(float f) {
|
||||
+ return (float) Math.sqrt((double) f);
|
||||
+ }
|
||||
+ // Yatopia end
|
||||
+
|
||||
public static int d(float f) {
|
||||
int i = (int) f;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java
|
||||
index da15615a19474d5db9bd46c3d772f467ec58b133..a4c42e6892271cdb5b432420a01061d599b9c5fe 100644
|
||||
--- a/src/main/java/net/minecraft/server/Navigation.java
|
||||
+++ b/src/main/java/net/minecraft/server/Navigation.java
|
||||
@@ -116,7 +116,7 @@ public class Navigation extends NavigationAbstract {
|
||||
if (d2 < 1.0E-8D) {
|
||||
return false;
|
||||
} else {
|
||||
- double d3 = 1.0D / Math.sqrt(d2);
|
||||
+ double d3 = 1.0D / net.jafama.FastMath.sqrt(d2); // Yatopia
|
||||
|
||||
d0 *= d3;
|
||||
d1 *= d3;
|
||||
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
index 013bdfe5540ae594a7f9cbe3ef8dc54dfb25afd4..a21b4785c4267cb6956ec798c67382993806da6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java
|
||||
@@ -68,7 +68,7 @@ public class NavigationFlying extends NavigationAbstract {
|
||||
if (d3 < 1.0E-8D) {
|
||||
return false;
|
||||
} else {
|
||||
- double d4 = 1.0D / Math.sqrt(d3);
|
||||
+ double d4 = 1.0D / net.jafama.FastMath.sqrt(d3); // Yatopia
|
||||
|
||||
d0 *= d4;
|
||||
d1 *= d4;
|
||||
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
index 1f6606165a45c30eddca8d06ea14067b0bb09f8b..1b6205db44c03b5c3f3ed7f651e03ec1d9fab84f 100644
|
||||
--- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
||||
@@ -154,7 +154,7 @@ public class RandomPositionGenerator {
|
||||
if (vec3d != null && d0 < 3.141592653589793D) {
|
||||
double d1 = MathHelper.d(vec3d.z, vec3d.x) - 1.5707963705062866D;
|
||||
double d2 = d1 + (double) (2.0F * random.nextFloat() - 1.0F) * d0;
|
||||
- double d3 = Math.sqrt(random.nextDouble()) * (double) MathHelper.a * (double) i;
|
||||
+ double d3 = net.jafama.FastMath.sqrt(random.nextDouble()) * (double) MathHelper.a * (double) i; // Yatopia
|
||||
double d4 = -d3 * MathHelper.sin(d2); // Yatopia
|
||||
double d5 = d3 * MathHelper.cos(d2); // Yatopia
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java
|
||||
index 70924c2942f6cc668eb4d11afdb42a966bd5edc8..ca641ae922aaf6dbd4d598122fda3c7bc2d8e724 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java
|
||||
+++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java
|
||||
@@ -82,7 +82,7 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager {
|
||||
int i1 = i % 2;
|
||||
int j1 = j % 2;
|
||||
// Paper start - cast ints to long to avoid integer overflow
|
||||
- float f = 100.0F - MathHelper.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F;
|
||||
+ float f = 100.0F - MathHelper.sqrtVanilla((long) i * (long) i + (long) j * (long) j) * 8.0F; // Yatopia
|
||||
// Paper end
|
||||
|
||||
f = MathHelper.a(f, -100.0F, 80.0F);
|
Loading…
Reference in New Issue
Block a user