3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 02:50:09 +01:00
Paper/Spigot-Server-Patches/0668-Inline-shift-direction-fields.patch
Josh Roy be13705177
Updated Upstream (CraftBukkit) (#5484)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
6b8cd9a7 SPIGOT-6207: forcibly drop the items of a converted zombie villager
2021-04-12 02:03:08 +01:00

56 Zeilen
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Andrew Steinborn <git@steinborn.me>
Date: Mon, 18 Jan 2021 20:45:25 -0500
Subject: [PATCH] Inline shift direction fields
Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is in the
critical section for much of the server, including the lighting engine.
diff --git a/src/main/java/net/minecraft/core/EnumDirection.java b/src/main/java/net/minecraft/core/EnumDirection.java
index a699005582293326076eaa80655c5343e6c22ff0..703bdefeb615ef8d15b428a893b5e4939d726f13 100644
--- a/src/main/java/net/minecraft/core/EnumDirection.java
+++ b/src/main/java/net/minecraft/core/EnumDirection.java
@@ -53,6 +53,11 @@ public enum EnumDirection implements INamable {
}, (enumdirection, enumdirection1) -> {
throw new IllegalArgumentException("Duplicate keys");
}, Long2ObjectOpenHashMap::new));
+ // Paper start
+ private final int adjX;
+ private final int adjY;
+ private final int adjZ;
+ // Paper end
private EnumDirection(int i, int j, int k, String s, EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis, BaseBlockPosition baseblockposition) {
this.g = i;
@@ -62,6 +67,11 @@ public enum EnumDirection implements INamable {
this.k = enumdirection_enumaxis;
this.l = enumdirection_enumaxisdirection;
this.m = baseblockposition;
+ // Paper start
+ this.adjX = baseblockposition.getX();
+ this.adjY = baseblockposition.getY();
+ this.adjZ = baseblockposition.getZ();
+ // Paper end
}
public static EnumDirection[] a(Entity entity) {
@@ -137,15 +147,15 @@ public enum EnumDirection implements INamable {
}
public int getAdjacentX() {
- return this.m.getX();
+ return this.adjX; // Paper
}
public int getAdjacentY() {
- return this.m.getY();
+ return this.adjY; // Paper
}
public int getAdjacentZ() {
- return this.m.getZ();
+ return this.adjZ; // Paper
}
public String m() {