Yatopia/patches/server/0013-lithium-enum_values.patch
Simon Gardling 2e12bc7147
Upstream (#365)
* Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite)

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:
06ce05b Fix broken chunk loading while under high block update stress

AirplaneLite Changes:
1b05468 Always reset comment list
adbefaa DEAR merged! (fix comment)
6e86873 Merge branch 'perf/activation-ranges'
12c221c Merge pull request #2 from Encode42/master
6095a90 Fix webhook build status
9ec74d9 Fix compile error
b0adfa5 Hoglin support
829a3a2 Rebuild patches
553e5c4 Merge branch 'master' into perf/activation-ranges
95fb8ac Merge branch 'master' into perf/activation-ranges
4444971 ok
767e9e1 DEAR for piglins
ce074ea Merge branch 'master' into perf/activation-ranges
f12fce4 lower bound on activation prio
d9962ce Add villager dynamic EAR ticking
10929cc Spelling
21d241c Merge branch 'master' into perf/activation-ranges
8f0039a Add configuration to activation ranges
c758dfa Merge branch 'master' into perf/activation-ranges
17605f8 Raise lowest tick amount to 1s
1b604ca Fix Paper inactive tick, finish our range impl
72f27b7 Merge master
dafa5a9 Merge branch 'master' into perf/activation-ranges
55c051f Tuning, still needs config
089d995 First pass at dynamic activation range

* Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite/Purpur)

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:
06ce05b Fix broken chunk loading while under high block update stress

AirplaneLite Changes:
1b05468 Always reset comment list
adbefaa DEAR merged! (fix comment)
6e86873 Merge branch 'perf/activation-ranges'
12c221c Merge pull request #2 from Encode42/master
6095a90 Fix webhook build status
9ec74d9 Fix compile error
b0adfa5 Hoglin support
829a3a2 Rebuild patches
553e5c4 Merge branch 'master' into perf/activation-ranges
95fb8ac Merge branch 'master' into perf/activation-ranges
4444971 ok
767e9e1 DEAR for piglins
ce074ea Merge branch 'master' into perf/activation-ranges
f12fce4 lower bound on activation prio
d9962ce Add villager dynamic EAR ticking
10929cc Spelling
21d241c Merge branch 'master' into perf/activation-ranges
8f0039a Add configuration to activation ranges
c758dfa Merge branch 'master' into perf/activation-ranges
17605f8 Raise lowest tick amount to 1s
1b604ca Fix Paper inactive tick, finish our range impl
72f27b7 Merge master
dafa5a9 Merge branch 'master' into perf/activation-ranges
55c051f Tuning, still needs config
089d995 First pass at dynamic activation range

Purpur Changes:
d72b228 Updated Upstream (Paper & Tuinity)

* whoops

* Updated Upstream and Sidestream(s) (Tuinity)

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:
f8c0db4 Call queueUpdate() when scheduling chunk lighting

* Updated Upstream and Sidestream(s) (Paper/Purpur)

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.

Paper Changes:
a98d389d1 Updated Upstream (CraftBukkit/Spigot) (#5119)

Purpur Changes:
f3644e1 Updated Upstream (Paper & Tuinity)
2021-01-27 11:13:19 -05:00

134 lines
5.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Fri, 31 Jul 2020 21:44:22 -0500
Subject: [PATCH] lithium enum_values
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/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 5d3bb5f393a1e0e4a2e8b9a466530a91279697a9..7f084e7f11a829c10d113c7fb39eec0b8ad77080 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -127,9 +127,10 @@ public class BlockPiston extends BlockDirectional {
}
}
+ private static final EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
- EnumDirection[] aenumdirection = EnumDirection.values();
+ //EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
int i = aenumdirection.length;
int j;
@@ -146,12 +147,12 @@ public class BlockPiston extends BlockDirectional {
return true;
} else {
BlockPosition blockposition1 = blockposition.up();
- EnumDirection[] aenumdirection1 = EnumDirection.values();
+ //EnumDirection[] aenumdirection1 = EnumDirection.values(); // Yatopia
- j = aenumdirection1.length;
+ j = aenumdirection.length; // Yatopia
for (int k = 0; k < j; ++k) {
- EnumDirection enumdirection2 = aenumdirection1[k];
+ EnumDirection enumdirection2 = aenumdirection[k]; // Yatopia
if (enumdirection2 != EnumDirection.DOWN && world.isBlockFacePowered(blockposition1.shift(enumdirection2), enumdirection2)) {
return true;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 0985a4498fbfaa3652041627b8a4d7d6bb8165fc..5727981e59f8ebe5ae2a955313e19080fce6ecd6 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -2615,10 +2615,12 @@ public abstract class EntityLiving extends Entity {
}
+ private static final EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); // Yatopia
+
@Nullable
private Map<EnumItemSlot, ItemStack> q() {
Map<EnumItemSlot, ItemStack> map = null;
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
+ //EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); // Yatopia
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/server/EnumAxisCycle.java b/src/main/java/net/minecraft/server/EnumAxisCycle.java
index a7c2543fdd4d5f6a04c45ec42472837ccaea9619..92ab79532d29341e8840341ff5ee8f5203cb4aad 100644
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
@@ -26,12 +26,24 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ // Yatopia start - replace logic
+ //return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() + 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Y;
+ case Y:
+ return EnumDirection.EnumAxis.Z;
+ case Z:
+ return EnumDirection.EnumAxis.X;
+ }
+
+ throw new IllegalArgumentException();
+ // Yatopia end
}
@Override
public EnumAxisCycle a() {
- return null.BACKWARD;
+ return BACKWARD; // Yatopia
}
},
BACKWARD {
@@ -42,12 +54,24 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ // Yatopia start - replaced logic
+ //return null.d[Math.floorMod(enumdirection_enumaxis.ordinal() - 1, 3)];
+ switch (enumdirection_enumaxis) {
+ case X:
+ return EnumDirection.EnumAxis.Z;
+ case Y:
+ return EnumDirection.EnumAxis.X;
+ case Z:
+ return EnumDirection.EnumAxis.Y;
+ }
+
+ throw new IllegalArgumentException();
+ // Yatopia end
}
@Override
public EnumAxisCycle a() {
- return null.FORWARD;
+ return FORWARD; // Yatopia
}
};
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index ae28b1f6ef56ab2199e1cf8d4f7d3f3e12496545..b684f2b297eda2014962bed36087d08bfcddb119 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -166,10 +166,11 @@ public class PistonExtendsChecker {
this.f.addAll(list1);
this.f.addAll(list2);
}
+ private static final EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
private boolean a(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition);
- EnumDirection[] aenumdirection = EnumDirection.values();
+ //EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {