Change base variables in BlockPos to force diff
Dieser Commit ist enthalten in:
Ursprung
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>
|
From: Techcable <Techcable@outlook.com>
|
||||||
Date: Wed, 30 Nov 2016 20:56:58 -0600
|
Date: Wed, 30 Nov 2016 20:56:58 -0600
|
||||||
Subject: [PATCH] Speedup BlockPos by fixing inlining
|
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.
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||||
+++ b/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 class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||||
|
|
||||||
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
|
public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0);
|
||||||
@ -33,40 +33,59 @@ index f772c7c..f5dc144 100644
|
|||||||
- private final int c;
|
- private final int c;
|
||||||
- // Paper start
|
- // Paper start
|
||||||
- public boolean isValidLocation() {
|
- 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
|
+ // Paper start - Make mutable and protected for MutableBlockPos and PooledBlockPos
|
||||||
+ protected int a;
|
+ protected int x;
|
||||||
+ protected int b;
|
+ protected int y;
|
||||||
+ protected int c;
|
+ protected int z;
|
||||||
+
|
+
|
||||||
+ public final boolean isValidLocation() {
|
+ 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() {
|
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> {
|
@@ -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();
|
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
- public int getX() {
|
- public int getX() {
|
||||||
|
- return this.a;
|
||||||
+ // Paper start - Only allow a single implementation
|
+ // Paper start - Only allow a single implementation
|
||||||
+ public final int getX() {
|
+ public final int getX() {
|
||||||
return this.a;
|
+ return this.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public int getY() {
|
- public int getY() {
|
||||||
|
- return this.b;
|
||||||
+ public final int getY() {
|
+ public final int getY() {
|
||||||
return this.b;
|
+ return this.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
- public int getZ() {
|
- public int getZ() {
|
||||||
|
- return this.c;
|
||||||
+ public final int getZ() {
|
+ public final int getZ() {
|
||||||
return this.c;
|
+ return this.z;
|
||||||
}
|
}
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
public BaseBlockPosition d(BaseBlockPosition baseblockposition) {
|
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());
|
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
|
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
|
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||||
+++ b/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 {
|
@@ -254,9 +254,9 @@ public class BlockPosition extends BaseBlockPosition {
|
||||||
@ -76,9 +95,9 @@ index 6c14061..c258331 100644
|
|||||||
- this.b.b = i;
|
- this.b.b = i;
|
||||||
- this.b.c = j;
|
- this.b.c = j;
|
||||||
- this.b.d = k;
|
- this.b.d = k;
|
||||||
+ ((BaseBlockPosition) this.b).a = i;
|
+ ((BaseBlockPosition) this.b).x = i;
|
||||||
+ ((BaseBlockPosition) this.b).b = j;
|
+ ((BaseBlockPosition) this.b).y = j;
|
||||||
+ ((BaseBlockPosition) this.b).c = k;
|
+ ((BaseBlockPosition) this.b).z = k;
|
||||||
return this.b;
|
return this.b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,9 +126,9 @@ index 6c14061..c258331 100644
|
|||||||
- this.c = j;
|
- this.c = j;
|
||||||
- this.d = k;
|
- this.d = k;
|
||||||
+ // Paper start - Modify base position variables
|
+ // Paper start - Modify base position variables
|
||||||
+ ((BaseBlockPosition) this).a = i;
|
+ ((BaseBlockPosition) this).x = i;
|
||||||
+ ((BaseBlockPosition) this).b = j;
|
+ ((BaseBlockPosition) this).y = j;
|
||||||
+ ((BaseBlockPosition) this).c = k;
|
+ ((BaseBlockPosition) this).z = k;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,9 +155,9 @@ index 6c14061..c258331 100644
|
|||||||
- this.c = j;
|
- this.c = j;
|
||||||
- this.d = k;
|
- this.d = k;
|
||||||
+ // Paper start - Modify base position variables
|
+ // Paper start - Modify base position variables
|
||||||
+ ((BaseBlockPosition) this).a = i;
|
+ ((BaseBlockPosition) this).x = i;
|
||||||
+ ((BaseBlockPosition) this).b = j;
|
+ ((BaseBlockPosition) this).y = j;
|
||||||
+ ((BaseBlockPosition) this).c = k;
|
+ ((BaseBlockPosition) this).z = k;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -153,7 +172,7 @@ index 6c14061..c258331 100644
|
|||||||
|
|
||||||
public void p(int i) {
|
public void p(int i) {
|
||||||
- this.c = i;
|
- this.c = i;
|
||||||
+ ((BaseBlockPosition) this).b = i; // Paper - Modify base variable
|
+ ((BaseBlockPosition) this).y = i; // Paper - Modify base variable
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition h() {
|
public BlockPosition h() {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren