Yatopia/patches/server/0012-lithium-enum_values.patch
Simon Gardling 22be9f2d6f
Upstream (#502)
* Updated Upstream and Sidestream(s) (Paper/Purpur/Origami)

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:
2299159bb Add option to fix items merging through blocks (#5334)
d8c20ddc7 Fix PlayerBucketEmptyEvent result itemstack (#5698)
ceb3762fb Add PufferFishStateChangeEvent (#5606)
cd4defec0 [CI-SKIP] Update version checker to use V2 downloads API (#5728)
b9f2a673d Limit item frame cursors on maps (#5730)
81a537c1f Add PlayerKickEvent causes (#5648)
b7976b956 Add More Lidded Block API (#5707)

Purpur Changes:
b88aef3a Fix Paper#4748 - Shulkerbox allow oversized stacks
9fec1bae Updated Upstream (Paper)
2aacc766 Update Toothpick to 1.1.0-SNAPSHOT
a08d7470 Configurable anvil cumulative cost (#352)

Origami Changes:
3b8adab Fix importing of classes not working if their directory doesn't exist

* Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Empirecraft/Origami)

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:
525d0e3d3 fix beacon activate/deactivate events (#5646)
e403d6aaf [Auto] Updated Upstream (CraftBukkit)
6bcd8b57c Updated Upstream (CraftBukkit) (#5742)
501cc9448 Reset villager inventory on cancelled pickup event (#5738)
3f72a549b Exit with non-zero exit code when killed by watchdog (#5732)
a8d7ad099 Updated Upstream (Bukkit/CraftBukkit) (#5735)

Tuinity Changes:
e9c8348 Revert entity ticking chunk map for tracker

Purpur Changes:
687936be Updated Upstream (Paper)
4c2d7e56 Fix advancement triggers on entity death
49a0fb90 Fix oversized shulker box dupe
e92d259e Fix raid captains not giving voluntary exile advancement
a97fdc48 Config to broadcast the death message to the affected player (#363)
9bf8e165 Add burn in daylight API for LivingEntity (#331)
96460068 Fix dupe bug caused by SPIGOT-6452
2618c24f Revert "allow disabling offline mode message on an ONLINE MODE proxy"
aa79fa5c allow disabling offline mode message on an ONLINE MODE proxy
830141ca Bee can work when raining or at night (#365)
ae6ca468 Updated Upstream (Paper)
d99cc6e8 [ci-skip] Add better issue templates (#360)

Empirecraft Changes:
12009c31 Updated Paper
5305540d Updated Paper
1043bd94 Revert "Call EntityPickupItemEvent for villagers" CB commit
820b9bdf Updated Paper

Origami Changes:
64fba4f Fix importing of classes not working if their directory doesn't exist
3b8adab Fix importing of classes not working if their directory doesn't exist

* rebuild Patches
2021-05-29 19:17:00 -04:00

134 lines
6.0 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/CaffeineMC/lithium-fabric/ (Yarn mappings)
diff --git a/src/main/java/net/minecraft/core/EnumAxisCycle.java b/src/main/java/net/minecraft/core/EnumAxisCycle.java
index 8078e4f5b79eaada03508265ba6b81db636e822a..b2d26289a6f501b093ec229394f75864531c978a 100644
--- a/src/main/java/net/minecraft/core/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/core/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/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 3158511eca5467b3891de08bca503f65d3f27154..7b8a2332b0992c4e4b20eedacef4347dd5dc929e 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -2779,10 +2779,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/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java
index 8aa51fb207820a7629d50b80ea821ec6cccf8b54..96ec55a705cf372ba1943710362898b73a1464de 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java
@@ -156,9 +156,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;
@@ -175,12 +176,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/world/level/block/piston/PistonExtendsChecker.java b/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
index cbe34059659e0f80ff384508b01e516cd7c5e28a..5813075cd3f2abf53c8a8ed3fa45be89586f25ea 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
@@ -173,10 +173,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) {