Manually inline methods in BlockPosition

This commit is contained in:
Spottedleaf 2020-07-06 22:48:48 -07:00
parent 37bc4f0b04
commit 32107198d1
2 changed files with 49 additions and 0 deletions

View File

@ -148,3 +148,39 @@
}
}
};
@@ -569,9 +588,9 @@
}
public BlockPos.MutableBlockPos set(int x, int y, int z) {
- this.setX(x);
- this.setY(y);
- this.setZ(z);
+ this.x = x; // Paper - Perf: Manually inline methods in BlockPosition
+ this.y = y; // Paper - Perf: Manually inline methods in BlockPosition
+ this.z = z; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@@ -636,19 +655,19 @@
@Override
public BlockPos.MutableBlockPos setX(int i) {
- super.setX(i);
+ this.x = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@Override
public BlockPos.MutableBlockPos setY(int i) {
- super.setY(i);
+ this.y = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}
@Override
public BlockPos.MutableBlockPos setZ(int i) {
- super.setZ(i);
+ this.z = i; // Paper - Perf: Manually inline methods in BlockPosition
return this;
}

View File

@ -1,5 +1,18 @@
--- a/net/minecraft/core/Vec3i.java
+++ b/net/minecraft/core/Vec3i.java
@@ -16,9 +16,9 @@
vec -> IntStream.of(vec.getX(), vec.getY(), vec.getZ())
);
public static final Vec3i ZERO = new Vec3i(0, 0, 0);
- private int x;
- private int y;
- private int z;
+ protected int x; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected
+ protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected
public static Codec<Vec3i> offsetCodec(int maxAbsValue) {
return CODEC.validate(
@@ -35,12 +35,12 @@
}