From 32107198d1aef5adc0d07d37bc40da22e9330bd5 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Mon, 6 Jul 2020 22:48:48 -0700 Subject: [PATCH] Manually inline methods in BlockPosition --- .../net/minecraft/core/BlockPos.java.patch | 36 +++++++++++++++++++ .../net/minecraft/core/Vec3i.java.patch | 13 +++++++ 2 files changed, 49 insertions(+) diff --git a/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch b/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch index c09ee91b80..7858f6cef1 100644 --- a/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch +++ b/paper-server/patches/sources/net/minecraft/core/BlockPos.java.patch @@ -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; + } + diff --git a/paper-server/patches/sources/net/minecraft/core/Vec3i.java.patch b/paper-server/patches/sources/net/minecraft/core/Vec3i.java.patch index 5949fb4018..8c19b63ae6 100644 --- a/paper-server/patches/sources/net/minecraft/core/Vec3i.java.patch +++ b/paper-server/patches/sources/net/minecraft/core/Vec3i.java.patch @@ -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 offsetCodec(int maxAbsValue) { + return CODEC.validate( @@ -35,12 +35,12 @@ }