Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2025-01-07 05:40:11 +01:00
65 Zeilen
3.1 KiB
Diff
65 Zeilen
3.1 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||
|
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 2767d6f97e8b314d23a8e62f22dfd396f5660d31..7362d471f9c1858e0dd7832e1ff59e3e51d7f249 100644
|
||
|
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||
|
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||
|
@@ -161,7 +161,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
|
||
|
@@ -171,7 +171,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
|
||
|
@@ -181,7 +181,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
|
||
|
@@ -191,7 +191,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
|
||
|
@@ -201,7 +201,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
|
||
|
@@ -211,7 +211,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
|