mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-26 12:45:52 +01:00
commit
320186f1fc
@ -706,34 +706,30 @@ index cc8866ec1ccbc131e8491c50eda4f85590bb667b..00000000000000000000000000000000
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
|
||||
deleted file mode 100644
|
||||
index bada470cba41cce9beb9eb04227b42c1d489d731..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java.rej
|
||||
+++ /dev/null
|
||||
@@ -1,22 +0,0 @@
|
||||
-diff a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java (rejected hunks)
|
||||
-@@ -10,7 +11,19 @@ import org.bukkit.entity.HumanEntity;
|
||||
-
|
||||
- public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
|
||||
-
|
||||
-- private static final int[] a = IntStream.range(0, 27).toArray();
|
||||
-+ private static final int[] a;
|
||||
-+
|
||||
-+ static {
|
||||
-+ int[] arr = new int[10];
|
||||
-+ int count = 0;
|
||||
-+ for (int i1 = 0; i1 < 27; i1++) {
|
||||
-+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
|
||||
-+ arr[count++] = i1;
|
||||
-+ }
|
||||
-+ arr = Arrays.copyOfRange(arr, 0, count);
|
||||
-+ a = arr;
|
||||
-+ }
|
||||
-+
|
||||
- private NonNullList<ItemStack> contents;
|
||||
- private int c;
|
||||
- private TileEntityShulkerBox.AnimationPhase i;
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
||||
index 7fe085e48b6ad625a510edf33b112bef24f7d7ad..9459efde54d507231b4aacb7cba14e9905ebb4d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityShulkerBox.java
|
||||
@@ -11,7 +11,18 @@ import org.bukkit.entity.HumanEntity;
|
||||
|
||||
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory, ITickable {
|
||||
|
||||
- private static final int[] a = IntStream.range(0, 27).toArray();
|
||||
+ private static final int[] a;
|
||||
+
|
||||
+ static {
|
||||
+ int[] arr = new int[10];
|
||||
+ int count = 0;
|
||||
+ for (int i1 = 0; i1 < 27; i1++) {
|
||||
+ if (arr.length == count) arr = Arrays.copyOf(arr, count * 2);
|
||||
+ arr[count++] = i1;
|
||||
+ }
|
||||
+ arr = Arrays.copyOfRange(arr, 0, count);
|
||||
+ a = arr;
|
||||
+ }
|
||||
private NonNullList<ItemStack> contents;
|
||||
public int c; // PAIL private -> public, rename viewerCount
|
||||
private TileEntityShulkerBox.AnimationPhase i;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0890bca50858ec8d544be2e1ff4ac2da73c7d830..44af511da96b265a8441052cc87e356e630699a6 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
|
@ -1,87 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Bud Gidiere <sgidiere@gmail.com>
|
||||
Date: Wed, 5 Aug 2020 14:33:51 -0500
|
||||
Subject: [PATCH] Akarin updated Cache hashcode for BlockPosition
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
index e69b7dbc7a954374f9e2374ffe7faebfed2b0644..531bad98fecee11fd149e15974dfd58eb3acc6bb 100644
|
||||
--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java
|
||||
@@ -28,6 +28,7 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
return b < 0 || b >= 256;
|
||||
}
|
||||
// Paper end
|
||||
+ protected int hash; // Akarin - cache hashcode
|
||||
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.a = i;
|
||||
@@ -52,8 +53,20 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
}
|
||||
|
||||
public final int hashCode() { // Paper
|
||||
- return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
- }
|
||||
+ // Akarin start - cache hashcode
|
||||
+ int result = hash; // Make the situation not too bad when it is modified by multiple threads
|
||||
+ if (result == 0) {
|
||||
+ result = (this.b + this.e * 31) * 31 + this.a; // Paper
|
||||
+ hash = result;
|
||||
+ }
|
||||
+ return result;
|
||||
+ // return (this.getY() + this.getZ() * 31) * 31 + this.getX();
|
||||
+ }
|
||||
+
|
||||
+ public final void recalcHashCode() {
|
||||
+ hash = 0;
|
||||
+ }
|
||||
+ // Akarin end
|
||||
|
||||
public int compareTo(BaseBlockPosition baseblockposition) {
|
||||
return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY();
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index c77f71b6de87757900b3734feda819754e9408b1..ba4811d2018a4898a72d3654c9e75782ef69288b 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -438,7 +438,9 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition e(int i, int j, int k) {
|
||||
- return this.d(this.getX() + i, this.getY() + j, this.getZ() + k);
|
||||
+ this.d(this.getX() + i, this.getY() + j, this.getZ() + k);
|
||||
+ this.recalcHashCode();
|
||||
+ return this;
|
||||
}
|
||||
|
||||
public BlockPosition.MutableBlockPosition a(EnumDirection.EnumAxis enumdirection_enumaxis, int i, int j) {
|
||||
@@ -458,24 +460,30 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
// only expose set on the mutable blockpos
|
||||
public final void setX(int value) {
|
||||
((BaseBlockPosition)this).a = value;
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
public final void setY(int value) {
|
||||
((BaseBlockPosition)this).b = value;
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
public final void setZ(int value) {
|
||||
((BaseBlockPosition)this).e = value;
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
|
||||
public final void o(int i) {
|
||||
((BaseBlockPosition)this).a = i; // need cast thanks to name conflict
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
|
||||
public final void p(int i) {
|
||||
((BaseBlockPosition)this).b = i;
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
|
||||
public final void q(int i) {
|
||||
((BaseBlockPosition)this).e = i;
|
||||
+ this.recalcHashCode();
|
||||
}
|
||||
// Tuinity end
|
||||
|
Loading…
Reference in New Issue
Block a user