diff options
author | Spottedleaf <[email protected]> | 2024-10-25 11:24:51 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-10-25 11:25:10 -0700 |
commit | a911f4a1672e52d3b558fd58d64a291e3500336d (patch) | |
tree | ba7c2feaa5d2b71c7f40ffc7f8bd51e09e1efdcc /patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch | |
parent | f1a11a6e3fc5c3b3b68df8008aab527ec92bfa6b (diff) | |
download | Paper-a911f4a1672e52d3b558fd58d64a291e3500336d.tar.gz Paper-a911f4a1672e52d3b558fd58d64a291e3500336d.zip |
Prepare rebase
Diffstat (limited to 'patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch')
-rw-r--r-- | patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch b/patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch new file mode 100644 index 0000000000..5a70b45e95 --- /dev/null +++ b/patches/server/2977-fixup-Optimize-BlockPosition-helper-methods.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +Date: Mon, 21 Oct 2024 19:13:43 -0700 +Subject: [PATCH] fixup! Optimize BlockPosition helper methods + + +diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java +index 0d51fb4be8b49e3b57c3c55aff6bcf13d5c78ddd..a1d54d978d34d75475f92dfb806113586e7e449c 100644 +--- a/src/main/java/net/minecraft/core/BlockPos.java ++++ b/src/main/java/net/minecraft/core/BlockPos.java +@@ -162,7 +162,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos above(int distance) { +- return distance == 0 ? this : new BlockPos(this.getX(), this.getY() + distance, this.getZ()); // Paper - Perf: Optimize BlockPosition ++ return distance == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() + distance, this.getZ()); // Paper - Perf: Optimize BlockPosition + } + + @Override +@@ -172,7 +172,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos below(int i) { +- return i == 0 ? this : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Perf: Optimize BlockPosition ++ return i == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Perf: Optimize BlockPosition + } + + @Override +@@ -182,7 +182,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos north(int distance) { +- return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() - distance); // Paper - Perf: Optimize BlockPosition ++ return distance == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY(), this.getZ() - distance); // Paper - Perf: Optimize BlockPosition + } + + @Override +@@ -192,7 +192,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos south(int distance) { +- return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() + distance); // Paper - Perf: Optimize BlockPosition ++ return distance == 0 ? this.immutable() : new BlockPos(this.getX(), this.getY(), this.getZ() + distance); // Paper - Perf: Optimize BlockPosition + } + + @Override +@@ -202,7 +202,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos west(int distance) { +- return distance == 0 ? this : new BlockPos(this.getX() - distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition ++ return distance == 0 ? this.immutable() : new BlockPos(this.getX() - distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition + } + + @Override +@@ -212,7 +212,7 @@ public class BlockPos extends Vec3i { + + @Override + public BlockPos east(int distance) { +- return distance == 0 ? this : new BlockPos(this.getX() + distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition ++ return distance == 0 ? this.immutable() : new BlockPos(this.getX() + distance, this.getY(), this.getZ()); // Paper - Perf: Optimize BlockPosition + } + + @Override |