mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 11:42:55 +01:00
64 lines
3.1 KiB
Diff
64 lines
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 a5dab9b1652ac76372d88316e2c165eed6317891..f58a94efafbc01d402cd03a108bb90f60930a316 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
|