mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-24 14:52:50 +02:00
74 lines
3.2 KiB
Diff
74 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: tr7zw <tr7zw@live.de>
|
|
Date: Mon, 11 May 2020 21:37:44 +0200
|
|
Subject: [PATCH] lithium enum_values
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
|
|
index 4f10ca5ada741b4f5ef941bb9d92a2fa6a7c44ff..7f2ee293a0206d01e44dfffe2a0714719c86712a 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockPiston.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
|
|
@@ -128,8 +128,9 @@ public class BlockPiston extends BlockDirectional {
|
|
|
|
}
|
|
|
|
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - don't recreate
|
|
+
|
|
private boolean a(World world, BlockPosition blockposition, EnumDirection enumdirection) {
|
|
- EnumDirection[] aenumdirection = EnumDirection.values();
|
|
int i = aenumdirection.length;
|
|
|
|
int j;
|
|
@@ -146,12 +147,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 9c14854a971a8818b7fe4acca7113c1e09ad32f0..3544033ad0f9e69fd8fdf0f76f96bc453354f675 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -2566,10 +2566,14 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
}
|
|
|
|
+ /**
|
|
+ * @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/PistonExtendsChecker.java b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
|
index dd64aad1ed6c2acf360e757bf0369da5fcf6be41..18a136213565794addf35511de23e078065af5f2 100644
|
|
--- a/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
|
+++ b/src/main/java/net/minecraft/server/PistonExtendsChecker.java
|
|
@@ -167,9 +167,11 @@ public class PistonExtendsChecker {
|
|
this.f.addAll(list2);
|
|
}
|
|
|
|
+ private final static EnumDirection[] aenumdirection = EnumDirection.values(); // YAPFA - 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) {
|