mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-22 18:46:27 +01:00
delete akarin patches
This commit is contained in:
parent
b07adf23b1
commit
d73cef781e
@ -1,63 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: tsao chi <tsao-chi@the-lingo.org>
|
||||
Date: Fri, 31 Jul 2020 22:11:10 -0500
|
||||
Subject: [PATCH] Akarin Updated Save json list async
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
|
||||
index 9213bfb78e92b838189161045e3945588251b486..6d7452d05c648cdee50b2077aec6f100449b8229 100644
|
||||
--- a/src/main/java/net/minecraft/server/JsonList.java
|
||||
+++ b/src/main/java/net/minecraft/server/JsonList.java
|
||||
@@ -20,6 +20,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
+
|
||||
+import org.apache.commons.io.IOUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -146,6 +148,7 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
+ Runnable runnable = () -> { // Akarin - Save json list async
|
||||
this.removeStaleEntries(); // Paper - remove expired values before saving
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
|
||||
@@ -155,29 +158,20 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> {
|
||||
jsonlistentry.getClass();
|
||||
return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
|
||||
}).forEach(jsonarray::add);
|
||||
- BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
+ BufferedWriter bufferedwriter = null;
|
||||
Throwable throwable = null;
|
||||
|
||||
try {
|
||||
+ bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
JsonList.b.toJson(jsonarray, bufferedwriter);
|
||||
} catch (Throwable throwable1) {
|
||||
- throwable = throwable1;
|
||||
- throw throwable1;
|
||||
+ throw new RuntimeException(throwable1);
|
||||
} finally {
|
||||
- if (bufferedwriter != null) {
|
||||
- if (throwable != null) {
|
||||
- try {
|
||||
- bufferedwriter.close();
|
||||
- } catch (Throwable throwable2) {
|
||||
- throwable.addSuppressed(throwable2);
|
||||
- }
|
||||
- } else {
|
||||
- bufferedwriter.close();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ IOUtils.closeQuietly(bufferedwriter);
|
||||
}
|
||||
|
||||
+ }; // Akarin - Save json list async
|
||||
+ MCUtil.scheduleAsyncTask(runnable); // Akarin - Save json list async
|
||||
}
|
||||
|
||||
public void load() throws IOException {
|
@ -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