Yatopia/patches/server/0014-lithium-enum_values.patch

127 lines
5.3 KiB
Diff
Raw Normal View History

[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
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
2020-08-06 23:02:30 +02:00
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..3d6f8d948d293ca57bf158bcd1f58e289d937fb5 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -127,9 +127,9 @@ public class BlockPiston extends BlockDirectional {
}
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
- EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
int j;
@@ -146,12 +146,11 @@ public class BlockPiston extends BlockDirectional {
return true;
} else {
BlockPosition blockposition1 = blockposition.up();
- EnumDirection[] aenumdirection1 = EnumDirection.values();
- j = aenumdirection1.length;
+ j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
- EnumDirection enumdirection2 = aenumdirection1[k];
+ EnumDirection enumdirection2 = aenumdirection[k];
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 a4123c2c7dc84803194459895f29d35643b71d04..173d04df808d9ed1fdd4767c25c2ebe130303d7f 100644
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2020-08-07 02:59:57 +02:00
@@ -2566,11 +2566,14 @@ public abstract class EntityLiving extends Entity {
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
}
}
+ /**
+ * @reason Avoid cloning enum values
+ */
+ private final static EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
@Nullable
private Map<EnumItemSlot, ItemStack> r() {
Map<EnumItemSlot, ItemStack> map = null;
- EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
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..ccfa23af36f66618f4ef18b0d86c86a73de9ea9f 100644
--- a/src/main/java/net/minecraft/server/EnumAxisCycle.java
+++ b/src/main/java/net/minecraft/server/EnumAxisCycle.java
@@ -26,12 +26,21 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- 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();
}
@Override
public EnumAxisCycle a() {
- return null.BACKWARD;
+ return BACKWARD;
}
},
BACKWARD {
@@ -42,12 +51,21 @@ public enum EnumAxisCycle {
@Override
public EnumDirection.EnumAxis a(EnumDirection.EnumAxis enumdirection_enumaxis) {
- 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();
}
@Override
public EnumAxisCycle a() {
- return null.FORWARD;
+ return FORWARD;
}
};
diff --git a/src/main/java/net/minecraft/server/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
index 89385896af6f6088a9749a13ad5c1d0c581fa502..4fd1a98e8309bec2ef270ac70c4d79d143002b86 100644
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
@@ -166,10 +166,10 @@ public class PistonExtendsChecker {
this.f.addAll(list1);
this.f.addAll(list2);
}
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // Yatopia - don't recreate
private boolean a(BlockPosition blockposition) {
IBlockData iblockdata = this.a.getType(blockposition);
- EnumDirection[] aenumdirection = EnumDirection.values();
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {