1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-02-21 12:17:23 +01:00

Change base variables in BlockPos to force diff

This commit is contained in:
Techcable 2016-12-16 19:53:35 -06:00
parent b17aa5f5ba
commit e0ada11f1e

View file

@ -33,33 +33,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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) {
@@ -0,0 +0,0 @@ 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
@ -76,9 +95,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
- 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 0000000000000000000000000000000000000000..00000000000000000000000000000000
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() {