mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 06:05:14 +01:00
134 lines
6.0 KiB
Diff
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 4ea424511c997287ffb7c3d3cef455077d9f4be1..fec6ea84a3edaad62b7dbb8747dfa12ea931fb5d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -2753,10 +2753,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) {
|