From 3defa421ce2bea916e04c6690e979051c64506a2 Mon Sep 17 00:00:00 2001 From: Toffikk Date: Thu, 17 Jun 2021 00:26:43 +0200 Subject: [PATCH] Ported 0005-lithium-MixinDirection.patch --- .../0010-lithium-MixinDirection.patch | 56 ------------------- ...patch => 0003-Yatopia-configuration.patch} | 5 +- ...04-Add-NBT-API-as-a-first-class-lib.patch} | 0 .../server/0005-lithium-MixinDirection.patch | 39 +++++++++++++ 4 files changed, 41 insertions(+), 59 deletions(-) delete mode 100644 patches/server-remap-in-progress/remap in progress/0010-lithium-MixinDirection.patch rename patches/server/{0004-Yatopia-configuration.patch => 0003-Yatopia-configuration.patch} (99%) rename patches/server/{0006-Add-NBT-API-as-a-first-class-lib.patch => 0004-Add-NBT-API-as-a-first-class-lib.patch} (100%) create mode 100644 patches/server/0005-lithium-MixinDirection.patch diff --git a/patches/server-remap-in-progress/remap in progress/0010-lithium-MixinDirection.patch b/patches/server-remap-in-progress/remap in progress/0010-lithium-MixinDirection.patch deleted file mode 100644 index eb7d78e0..00000000 --- a/patches/server-remap-in-progress/remap in progress/0010-lithium-MixinDirection.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JellySquid -Date: Mon, 11 May 2020 21:00:44 +0200 -Subject: [PATCH] lithium MixinDirection - -Original code by JellySquid, licensed under GNU Lesser General Public License v3.0 -you can find the original code on https://github.com/CaffeineMC/lithium-fabric/ (Yarn mappings) - -diff --git a/src/main/java/net/minecraft/core/EnumDirection.java b/src/main/java/net/minecraft/core/EnumDirection.java -index 9f1ea11d0bc15b8b0069fcf46ea2f6751c5e3064..b8fe75b8c37ef1968519e69e078444b1a3c5c359 100644 ---- a/src/main/java/net/minecraft/core/EnumDirection.java -+++ b/src/main/java/net/minecraft/core/EnumDirection.java -@@ -24,13 +24,13 @@ public enum EnumDirection implements INamable { - DOWN(0, 1, -1, "down", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.Y, new BaseBlockPosition(0, -1, 0)), UP(1, 0, -1, "up", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.Y, new BaseBlockPosition(0, 1, 0)), NORTH(2, 3, 2, "north", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.Z, new BaseBlockPosition(0, 0, -1)), SOUTH(3, 2, 0, "south", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.Z, new BaseBlockPosition(0, 0, 1)), WEST(4, 5, 1, "west", EnumDirection.EnumAxisDirection.NEGATIVE, EnumDirection.EnumAxis.X, new BaseBlockPosition(-1, 0, 0)), EAST(5, 4, 3, "east", EnumDirection.EnumAxisDirection.POSITIVE, EnumDirection.EnumAxis.X, new BaseBlockPosition(1, 0, 0)); - - private final int g; -- private final int h; -+ private final int h; // Yatopia this is idOpposit(yarn) - private final int i; - private final String j; - private final EnumDirection.EnumAxis k; - private final EnumDirection.EnumAxisDirection l; - private final BaseBlockPosition m; -- private static final EnumDirection[] n = values(); -+ private static final EnumDirection[] n = values(); private static final EnumDirection[] ALL = n;// Yatopia OBF HELPER - private static final Map o = (Map) Arrays.stream(EnumDirection.n).collect(Collectors.toMap(EnumDirection::m, (enumdirection) -> { - return enumdirection; - })); -@@ -112,8 +112,12 @@ public enum EnumDirection implements INamable { - return this.l; - } - -+ /** -+ * @reason Avoid the modulo/abs operations -+ * @author JellySquid -+ */ - public EnumDirection opposite() { -- return fromType1(this.h); -+ return ALL[this.h]; - } - - public EnumDirection rotateCW() { return g(); } // Purpur - OBFHELPER -@@ -214,8 +218,12 @@ public enum EnumDirection implements INamable { - return (float) ((this.i & 3) * 90); - } - -+ /** -+ * @reason Do not allocate an excessive number of Direction arrays -+ * @author JellySquid -+ */ - public static EnumDirection a(Random random) { -- return (EnumDirection) SystemUtils.a((Object[]) EnumDirection.n, random); -+ return ALL[random.nextInt(ALL.length)]; - } - - public static EnumDirection a(double d0, double d1, double d2) { diff --git a/patches/server/0004-Yatopia-configuration.patch b/patches/server/0003-Yatopia-configuration.patch similarity index 99% rename from patches/server/0004-Yatopia-configuration.patch rename to patches/server/0003-Yatopia-configuration.patch index a1f70200..462fd839 100644 --- a/patches/server/0004-Yatopia-configuration.patch +++ b/patches/server/0003-Yatopia-configuration.patch @@ -1,9 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: tr7zw -Date: Wed, 5 Aug 2020 08:05:10 -0500 +From: Toffikk +Date: Wed, 16 Jun 2021 23:42:17 +0200 Subject: [PATCH] Yatopia configuration -also some basic settings that dont deserve a patch diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java index 2ff4d4921e2076abf415bd3c8f5173ecd6222168..5984517724249825c637332647ca83c87cc4d264 100644 diff --git a/patches/server/0006-Add-NBT-API-as-a-first-class-lib.patch b/patches/server/0004-Add-NBT-API-as-a-first-class-lib.patch similarity index 100% rename from patches/server/0006-Add-NBT-API-as-a-first-class-lib.patch rename to patches/server/0004-Add-NBT-API-as-a-first-class-lib.patch diff --git a/patches/server/0005-lithium-MixinDirection.patch b/patches/server/0005-lithium-MixinDirection.patch new file mode 100644 index 00000000..4c2c42b9 --- /dev/null +++ b/patches/server/0005-lithium-MixinDirection.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Toffikk +Date: Thu, 17 Jun 2021 00:01:47 +0200 +Subject: [PATCH] lithium MixinDirection + + +diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java +index 593d6251c75ec337175d08b85000239ba7da1af2..586be472a0482c7344c38fdcd155b3dc1f7a270e 100644 +--- a/src/main/java/net/minecraft/core/Direction.java ++++ b/src/main/java/net/minecraft/core/Direction.java +@@ -171,8 +171,12 @@ public enum Direction implements StringRepresentable { + } + } + ++ /** ++ * @reason Avoid the modulo/abs operations ++ * @author JellySquid ++ */ + public Direction getOpposite() { +- return from3DDataValue(this.oppositeIndex); ++ return VALUES[this.oppositeIndex]; + } + + public Direction getClockWise(Direction.Axis axis) { +@@ -386,8 +390,13 @@ public enum Direction implements StringRepresentable { + return (float)((this.data2d & 3) * 90); + } + ++ /** ++ * ++ * @reason Do not allocate an excessive number of Direction arrays ++ * @author JellySquid ++ */ + public static Direction getRandom(Random random) { +- return Util.getRandom(VALUES, random); ++ return VALUES[random.nextInt(VALUES.length)]; + } + + public static Direction getNearest(double x, double y, double z) {