From 5e14f2410c3f8390c1a7f27a1e34afd87abb8a31 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 23 Jul 2018 13:10:06 -0400 Subject: [PATCH] Put the decompile fixes into MC Dev Fixes patch --- .../Add-BeaconEffectEvent.patch | 4 +- .../Add-PlayerLocaleChangeEvent.patch | 4 +- .../Add-player-view-distance-API.patch | 4 +- Spigot-Server-Patches/MC-Dev-fixes.patch | 51 +++++++++++++++++-- .../Optimize-RegistryID.c.patch | 49 ++++-------------- 5 files changed, 66 insertions(+), 46 deletions(-) diff --git a/Spigot-API-Patches/Add-BeaconEffectEvent.patch b/Spigot-API-Patches/Add-BeaconEffectEvent.patch index e82f5fe3bf..a0c68bceeb 100644 --- a/Spigot-API-Patches/Add-BeaconEffectEvent.patch +++ b/Spigot-API-Patches/Add-BeaconEffectEvent.patch @@ -91,4 +91,6 @@ index 00000000..6579ae99 + return handlers; + } +} --- \ No newline at end of file +-- +2.17.0 (Apple Git-106) + diff --git a/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch b/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch index ee8cf9b974..39e7e9a6bd 100644 --- a/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch +++ b/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch @@ -60,4 +60,6 @@ index 00000000..29dd763a + return handlers; + } +} --- \ No newline at end of file +-- +2.17.0 (Apple Git-106) + diff --git a/Spigot-API-Patches/Add-player-view-distance-API.patch b/Spigot-API-Patches/Add-player-view-distance-API.patch index 2319b13df5..f4fed10e48 100644 --- a/Spigot-API-Patches/Add-player-view-distance-API.patch +++ b/Spigot-API-Patches/Add-player-view-distance-API.patch @@ -29,4 +29,6 @@ index 25e44028..7f215f1a 100644 // Spigot start public class Spigot extends Entity.Spigot { --- \ No newline at end of file +-- +2.17.0 (Apple Git-106) + diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 61c39a92e2..798c3c42ed 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index e8f7b7292..a0ebc1eaa 100644 +index e8f7b729..a0ebc1ea 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { @@ -15,7 +15,7 @@ index e8f7b7292..a0ebc1eaa 100644 + } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 002da2a19..121a137f3 100644 +index 002da2a1..121a137f 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @@ -57,7 +57,7 @@ index 002da2a19..121a137f3 100644 } diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index 65910508f..15c7cc170 100644 +index a661789c..785a1a21 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java @@ -0,0 +0,0 @@ public class DefinedStructure { @@ -111,4 +111,47 @@ index 65910508f..15c7cc170 100644 } public Iterator iterator() { --- \ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java +index 3b8f6ec1..bde5714d 100644 +--- a/src/main/java/net/minecraft/server/RegistryID.java ++++ b/src/main/java/net/minecraft/server/RegistryID.java +@@ -0,0 +0,0 @@ import java.util.Arrays; + import java.util.Iterator; + import javax.annotation.Nullable; + +-public class RegistryID implements Registry { ++public class RegistryID implements Registry { // Paper - decompile fix + + private static final Object a = null; + private K[] b; +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { + + public RegistryID(int i) { + i = (int) ((float) i / 0.8F); +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + } + + public int getId(@Nullable K k0) { +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { + } + + private void d(int i) { +- Object[] aobject = this.b; ++ K[] aobject = this.b; // Paper - decompile fix + int[] aint = this.c; + +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.e = 0; + this.f = 0; + +-- +2.17.0 (Apple Git-106) + diff --git a/Spigot-Server-Patches/Optimize-RegistryID.c.patch b/Spigot-Server-Patches/Optimize-RegistryID.c.patch index 2d3854aacb..414eba0e64 100644 --- a/Spigot-Server-Patches/Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/Optimize-RegistryID.c.patch @@ -1,24 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn -Date: Mon, 23 Jul 2018 12:50:18 -0400 +Date: Mon, 23 Jul 2018 13:08:19 -0400 Subject: [PATCH] Optimize RegistryID.c() This is a frequent hotspot for world loading/saving. diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 3b8f6ec1..163da432 100644 +index bde5714d..a01cda9d 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -0,0 +0,0 @@ import java.util.Arrays; - import java.util.Iterator; - import javax.annotation.Nullable; - --public class RegistryID implements Registry { -+public class RegistryID implements Registry { // Paper - decompile fix - - private static final Object a = null; - private K[] b; -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix private K[] d; private int e; private int f; @@ -26,16 +17,14 @@ index 3b8f6ec1..163da432 100644 public RegistryID(int i) { i = (int) ((float) i / 0.8F); -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.b = (K[]) (new Object[i]); // Paper - decompile fix this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.usedIds = new java.util.BitSet(); // Paper } public int getId(@Nullable K k0) { -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix } private int c() { @@ -50,33 +39,15 @@ index 3b8f6ec1..163da432 100644 return this.e; } - - private void d(int i) { -- Object[] aobject = this.b; -+ K[] aobject = this.b; // Paper - decompile fix - int[] aint = this.c; - -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix + this.d = (K[]) (new Object[i]); // Paper - decompile fix this.e = 0; this.f = 0; + this.usedIds.clear(); // Paper for (int j = 0; j < aobject.length; ++j) { if (aobject[j] != null) { -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { - } - - public void a(K k0, int i) { -- int j = Math.max(i, this.f + 1); -+ int j = this.usedIds.size(); // Paper - int k; - - if ((float) j >= (float) this.b.length * 0.8F) { -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix this.b[k] = k0; this.c[k] = i; this.d[i] = k0; @@ -84,7 +55,7 @@ index 3b8f6ec1..163da432 100644 ++this.f; if (i == this.e) { ++this.e; -@@ -0,0 +0,0 @@ public class RegistryID implements Registry { +@@ -0,0 +0,0 @@ public class RegistryID implements Registry { // Paper - decompile fix Arrays.fill(this.d, (Object) null); this.e = 0; this.f = 0;