Change base variables in BlockPos to force diff
This commit is contained in:
parent
7c567d6ed4
commit
bf86516043
|
@ -1,4 +1,4 @@
|
|||
From becc6261143f3bf64f526ae038f9b6d54bf9ed83 Mon Sep 17 00:00:00 2001
|
||||
From e6ca9b9355a59603d65f824ac1c396844ad87f46 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Wed, 30 Nov 2016 20:56:58 -0600
|
||||
Subject: [PATCH] Speedup BlockPos by fixing inlining
|
||||
|
@ -21,10 +21,10 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt
|
|||
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index f772c7c..f5dc144 100644
|
||||
index f772c7c..bfb47e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -7,11 +7,12 @@ import javax.annotation.concurrent.Immutable;
|
||||
@@ -7,22 +7,23 @@ import javax.annotation.concurrent.Immutable;
|
||||
public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
|
||||
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
|
||||
|
@ -33,40 +33,59 @@ index f772c7c..f5dc144 100644
|
|||
- private final int c;
|
||||
- // Paper start
|
||||
- public boolean isValidLocation() {
|
||||
- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
|
||||
+ // Paper start - Make mutable and protected for MutableBlockPos and PooledBlockPos
|
||||
+ protected int a;
|
||||
+ protected int b;
|
||||
+ protected int c;
|
||||
+ protected int x;
|
||||
+ protected int y;
|
||||
+ protected int z;
|
||||
+
|
||||
+ public final boolean isValidLocation() {
|
||||
return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256;
|
||||
+ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256;
|
||||
}
|
||||
public boolean isInvalidYLocation() {
|
||||
- return b < 0 || b >= 256;
|
||||
+ return y < 0 || y >= 256;
|
||||
}
|
||||
// Paper end
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
- this.a = i;
|
||||
- this.b = j;
|
||||
- this.c = k;
|
||||
+ this.x = i;
|
||||
+ this.y = j;
|
||||
+ this.z = k;
|
||||
}
|
||||
|
||||
public BaseBlockPosition(double d0, double d1, double d2) {
|
||||
@@ -49,17 +50,19 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
}
|
||||
|
||||
- public int getX() {
|
||||
- return this.a;
|
||||
+ // Paper start - Only allow a single implementation
|
||||
+ public final int getX() {
|
||||
return this.a;
|
||||
+ return this.x;
|
||||
}
|
||||
|
||||
- public int getY() {
|
||||
- return this.b;
|
||||
+ public final int getY() {
|
||||
return this.b;
|
||||
+ return this.y;
|
||||
}
|
||||
|
||||
- public int getZ() {
|
||||
- return this.c;
|
||||
+ public final int getZ() {
|
||||
return this.c;
|
||||
+ return this.z;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
||||
return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX());
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 6c14061..c258331 100644
|
||||
index 6c14061..9757f09 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -254,9 +254,9 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
@ -76,9 +95,9 @@ index 6c14061..c258331 100644
|
|||
- this.b.b = i;
|
||||
- this.b.c = j;
|
||||
- this.b.d = k;
|
||||
+ ((BaseBlockPosition) this.b).a = i;
|
||||
+ ((BaseBlockPosition) this.b).b = j;
|
||||
+ ((BaseBlockPosition) this.b).c = k;
|
||||
+ ((BaseBlockPosition) this.b).x = i;
|
||||
+ ((BaseBlockPosition) this.b).y = j;
|
||||
+ ((BaseBlockPosition) this.b).z = k;
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +126,9 @@ index 6c14061..c258331 100644
|
|||
- this.c = j;
|
||||
- this.d = k;
|
||||
+ // Paper start - Modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).b = j;
|
||||
+ ((BaseBlockPosition) this).c = k;
|
||||
+ ((BaseBlockPosition) this).x = i;
|
||||
+ ((BaseBlockPosition) this).y = j;
|
||||
+ ((BaseBlockPosition) this).z = k;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
|
@ -136,9 +155,9 @@ index 6c14061..c258331 100644
|
|||
- this.c = j;
|
||||
- this.d = k;
|
||||
+ // Paper start - Modify base position variables
|
||||
+ ((BaseBlockPosition) this).a = i;
|
||||
+ ((BaseBlockPosition) this).b = j;
|
||||
+ ((BaseBlockPosition) this).c = k;
|
||||
+ ((BaseBlockPosition) this).x = i;
|
||||
+ ((BaseBlockPosition) this).y = j;
|
||||
+ ((BaseBlockPosition) this).z = k;
|
||||
+ // Paper end
|
||||
return this;
|
||||
}
|
||||
|
@ -153,7 +172,7 @@ index 6c14061..c258331 100644
|
|||
|
||||
public void p(int i) {
|
||||
- this.c = i;
|
||||
+ ((BaseBlockPosition) this).b = i; // Paper - Modify base variable
|
||||
+ ((BaseBlockPosition) this).y = i; // Paper - Modify base variable
|
||||
}
|
||||
|
||||
public BlockPosition h() {
|
||||
|
|
Loading…
Reference in New Issue