mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 14:15:43 +01:00
3770a43472
Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 33b3f86 Updated Upstream (Paper) 4743c34 Updated Upstream (Paper) Purpur Changes: 5c0dbf1 [ci-skip] Easier way to remove tuinity's revert of MC-4 424fcf1 Updated Upstream (Paper & Tuinity) b3644cc Fix rotating UP/DOWN CW and CCW fbb74cd Updated Upstream (Paper) AirplaneLite Changes: 5e8ebc0 Updated Upstream (Tuinity)
57 lines
3.0 KiB
Diff
57 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: JellySquid <jellysquid+atwork@protonmail.com>
|
|
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/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
index 343eb3e9ab37730b55baeea839db6e882c3e50ae..9edc9f8eb820ba17559e796c6b42d78f038ba1db 100644
|
|
--- a/src/main/java/net/minecraft/server/EnumDirection.java
|
|
+++ b/src/main/java/net/minecraft/server/EnumDirection.java
|
|
@@ -20,13 +20,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<String, EnumDirection> o = (Map) Arrays.stream(EnumDirection.n).collect(Collectors.toMap(EnumDirection::m, (enumdirection) -> {
|
|
return enumdirection;
|
|
}));
|
|
@@ -98,8 +98,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 g() {
|
|
@@ -197,8 +201,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) {
|