From b2cab705947963e8280bfd711f1648340b23280d Mon Sep 17 00:00:00 2001 From: Kyle Wood Date: Wed, 16 Jun 2021 20:43:30 -0500 Subject: [PATCH] Minor patch cleanup --- build-data/paper.at | 6 +- .../Fix-MC-117075-TE-Unload-Lag-Spike.patch | 2 +- ...n-prefixes-using-Log4J-configuration.patch | 13 - patches/server/Implement-Mob-Goal-API.patch | 18 - ...ecompile-fixes.patch => Remap-fixes.patch} | 49 +- patches/server/Setup-Gradle-project.patch | 478 ++++++++++++++++++ .../Use-asynchronous-Log4j-2-loggers.patch | 18 - 7 files changed, 500 insertions(+), 84 deletions(-) rename patches/server/{Decompile-fixes.patch => Remap-fixes.patch} (87%) diff --git a/build-data/paper.at b/build-data/paper.at index f486c0ba68..8767263493 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -6,6 +6,9 @@ # Leave out the member and it will apply to the class itself # More info, see here https://mcforge.readthedocs.io/en/latest/advanced/accesstransformers/#access-modifiers +# Remap/Decompile fix (unclear why this is happening) +public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/TickTask;)V + # Paper config files public org.spigotmc.SpigotWorldConfig getBoolean(Ljava/lang/String;Z)Z public org.spigotmc.SpigotWorldConfig getDouble(Ljava/lang/String;)D @@ -178,9 +181,6 @@ public net.minecraft.util.thread.BlockableEventLoop runAllTasks()V public net.minecraft.server.level.ChunkMap entitiesInLevel public net.minecraft.server.level.ServerLevel players -# Improve block entity unload performance -public net.minecraft.Util$IdentityStrategy - # Chunk priority urgency system public net.minecraft.server.level.ChunkMap$ChunkDistanceManager diff --git a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch index d3eb17f0d8..215029b650 100644 --- a/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/patches/server/Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start // Iterator iterator = this.blockEntityTickers.iterator(); int tilesThisCycle = 0; -+ it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet(net.minecraft.Util.IdentityStrategy.INSTANCE); // Paper - use removeAll ++ var toRemove = new it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet(net.minecraft.Util.identityStrategy()); // Paper - use removeAll + toRemove.add(null); for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; diff --git a/patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch index cb0d00462b..708e0afffa 100644 --- a/patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -27,19 +27,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - com.googlecode.json-simple - json-simple - 1.1.1 -- runtime -+ compile - - - org.xerial diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/patches/server/Implement-Mob-Goal-API.patch b/patches/server/Implement-Mob-Goal-API.patch index 663b9030d9..97adb19da3 100644 --- a/patches/server/Implement-Mob-Goal-API.patch +++ b/patches/server/Implement-Mob-Goal-API.patch @@ -16,24 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 testImplementation("junit:junit:4.13.1") testImplementation("org.hamcrest:hamcrest-library:1.3") } -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - 1.3 - test - -+ -+ -+ io.github.classgraph -+ classgraph -+ 4.8.47 -+ test -+ - - - diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/server/Decompile-fixes.patch b/patches/server/Remap-fixes.patch similarity index 87% rename from patches/server/Decompile-fixes.patch rename to patches/server/Remap-fixes.patch index b4f26f1348..1998d582c6 100644 --- a/patches/server/Decompile-fixes.patch +++ b/patches/server/Remap-fixes.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Kyle Wood Date: Fri, 11 Jun 2021 05:25:03 -0500 -Subject: [PATCH] Decompile fixes +Subject: [PATCH] Remap fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - int j = center.getX(); - int k = center.getY(); - int l = center.getZ(); -+ // Paper start - rename variables to fix conflict with anonymous class (decompile fix) ++ // Paper start - rename variables to fix conflict with anonymous class (remap fix) + int centerX = center.getX(); + int centerY = center.getY(); + int centerZ = center.getZ(); @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.zMirror) { this.zMirror = false; - this.cursor.setZ(l - (this.cursor.getZ() - l)); -+ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - decompile fix ++ this.cursor.setZ(centerZ - (this.cursor.getZ() - centerZ)); // Paper - remap fix return this.cursor; } else { BlockPos blockPos; @@ -37,23 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (k <= rangeZ) { this.zMirror = k != 0; - blockPos = this.cursor.set(j + i, k + j, l + k); -+ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - decompile fix ++ blockPos = this.cursor.set(centerX + i, centerY + j, centerZ + k); // Paper - remap fix } } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot()); - return entity1; -+ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - decomp fix -+ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - decomp fix -+ return loadedEntity; // Paper - decomp fix ++ Entity entity1 = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (loadedEntity) -> { // Paper - remap fix ++ loadedEntity.moveTo(pos.x, pos.y, pos.z, loadedEntity.getYRot(), loadedEntity.getXRot()); // Paper - remap fix ++ return loadedEntity; // Paper - remap fix }); if (entity1 == null) { @@ -81,8 +68,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return ((ServerLevel) entity.level).getEntity(uuid); - }).map((entity) -> { - return entity instanceof LivingEntity ? (LivingEntity) entity : null; -+ }).map((entity2) -> { // Paper - decomp fix -+ return entity2 instanceof LivingEntity ? (LivingEntity) entity2 : null; // Paper - decomp fix ++ }).map((entity2) -> { // Paper - remap fix ++ return entity2 instanceof LivingEntity ? (LivingEntity) entity2 : null; // Paper - remap fix }); } @@ -95,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!list.isEmpty()) { - list.sort(Comparator.comparing(Entity::getY).reversed()); -+ list.sort(Comparator.comparing(Entity::getY).reversed()); // Paper - decomp fix ++ list.sort(Comparator.comparing(Entity::getY).reversed()); // Paper - remap fix Iterator iterator = list.iterator(); while (iterator.hasNext()) { @@ -108,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 recipes.forEach((irecipe) -> { - Map> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> { -+ Map> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - decomp fix ++ Map> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes_) -> { // Paper - remap fix return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit }); Recipe irecipe1 = (Recipe) map1.put(irecipe.getId(), irecipe); @@ -129,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void checkColor() { Color color = this.dye.getColor(); - float[] nmsColorArray = DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors(); -+ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors(); ++ float[] nmsColorArray = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getTextureDiffuseColors(); // Paper - remap fix Color nmsColor = Color.fromRGB((int) (nmsColorArray[0] * 255), (int) (nmsColorArray[1] * 255), (int) (nmsColorArray[2] * 255)); assertThat(color, is(nmsColor)); } @@ -138,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void checkFireworkColor() { Color color = this.dye.getFireworkColor(); - int nmsColor = DyeColor.byId(this.dye.getWoolData()).getFireworkColor(); -+ int nmsColor = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getFireworkColor(); ++ int nmsColor = net.minecraft.world.item.DyeColor.byId(this.dye.getWoolData()).getFireworkColor(); // Paper - remap fix assertThat(color, is(Color.fromRGB(nmsColor))); } } @@ -151,7 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 assertThat(this.material.isInteractable(), is(!CraftMagicNumbers.getBlock(material).getClass() - .getMethod("interact", BlockState.class, net.minecraft.world.level.Level.class, BlockPos.class, Player.class, InteractionHand.class, BlockHitResult.class) -+ .getMethod("use", BlockState.class, net.minecraft.world.level.Level.class, BlockPos.class, Player.class, InteractionHand.class, BlockHitResult.class) ++ .getMethod("use", BlockState.class, net.minecraft.world.level.Level.class, BlockPos.class, Player.class, InteractionHand.class, BlockHitResult.class) // Paper - remap fix .getDeclaringClass().equals(BlockBehaviour.class))); } else { assertFalse(this.material.isInteractable()); @@ -173,8 +160,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - for (EntityType nms : Registry.ENTITY_TYPE) { - ResourceLocation key = EntityType.getKey(nms); -+ for (net.minecraft.world.entity.EntityType nms : Registry.ENTITY_TYPE) { -+ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); ++ for (net.minecraft.world.entity.EntityType nms : Registry.ENTITY_TYPE) { // Paper - remap fix ++ ResourceLocation key = net.minecraft.world.entity.EntityType.getKey(nms); // Paper - remap fix org.bukkit.entity.EntityType bukkit = org.bukkit.entity.EntityType.fromName(key.getPath()); Assert.assertNotNull("Missing nms->bukkit " + key, bukkit); @@ -194,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void testBukkit() { for (Panda.Gene gene : Panda.Gene.values()) { - Panda.Gene nms = CraftPanda.toNms(gene); -+ net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); ++ net.minecraft.world.entity.animal.Panda.Gene nms = CraftPanda.toNms(gene); // Paper - remap fix Assert.assertNotNull("NMS gene null for " + gene, nms); Assert.assertEquals("Recessive status did not match " + gene, gene.isRecessive(), nms.isRecessive()); @@ -203,7 +190,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Test public void testNMS() { - for (Panda.Gene gene : Panda.Gene.values()) { -+ for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { ++ for (net.minecraft.world.entity.animal.Panda.Gene gene : net.minecraft.world.entity.animal.Panda.Gene.values()) { // Paper - remap fix org.bukkit.entity.Panda.Gene bukkit = CraftPanda.fromNms(gene); Assert.assertNotNull("Bukkit gene null for " + gene, bukkit); diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index 8ace742c0b..8c692860c5 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -155,3 +155,481 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return PLUGIN_CACHE_FILE == element.name || element.name == "Log4j2Plugins.dat" + } +} +diff --git a/pom.xml b/pom.xml +deleted file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- a/pom.xml ++++ /dev/null +@@ -0,0 +0,0 @@ +- +- 4.0.0 +- org.spigotmc +- spigot +- jar +- 1.17-R0.1-SNAPSHOT +- Spigot +- https://www.spigotmc.org/ +- +- +- true +- UTF-8 +- unknown +- git +- 1_17_R1 +- 1.8 +- 1.8 +- +- +- +- org.spigotmc +- spigot-parent +- dev-SNAPSHOT +- ../pom.xml +- +- +- +- +- org.spigotmc +- spigot-api +- ${project.version} +- compile +- +- +- org.spigotmc +- minecraft-server +- ${project.version} +- compile +- +- +- jline +- jline +- 2.12.1 +- compile +- +- +- org.apache.logging.log4j +- log4j-iostreams +- 2.14.1 +- compile +- +- +- +- org.apache.logging.log4j +- log4j-api +- +- +- +- +- org.ow2.asm +- asm +- 9.1 +- compile +- +- +- +- com.googlecode.json-simple +- json-simple +- 1.1.1 +- runtime +- +- +- org.xerial +- sqlite-jdbc +- 3.34.0 +- runtime +- +- +- mysql +- mysql-connector-java +- 5.1.49 +- runtime +- +- +- +- org.apache.maven +- maven-resolver-provider +- 3.8.1 +- runtime +- +- +- org.apache.maven.resolver +- maven-resolver-connector-basic +- 1.7.0 +- runtime +- +- +- org.apache.maven.resolver +- maven-resolver-transport-http +- 1.7.0 +- runtime +- +- +- +- junit +- junit +- 4.13.1 +- test +- +- +- org.hamcrest +- hamcrest-library +- 1.3 +- test +- +- +- +- +- +- +- +- net.md-5 +- scriptus +- 0.4.1 +- +- +- ex-spigot +- +- ${bt.name}-Spigot-%s +- ../ +- spigot.desc +- +- initialize +- +- describe +- +- +- +- ex-craftbukkit +- +- -%s +- ../../CraftBukkit +- craftbukkit.desc +- +- initialize +- +- describe +- +- +- +- +- +- org.apache.maven.plugins +- maven-clean-plugin +- 3.1.0 +- +- +- initialize +- +- clean +- +- +- +- +- +- org.apache.maven.plugins +- maven-jar-plugin +- 3.2.0 +- +- +- +- false +- +- +- org.bukkit.craftbukkit.Main +- CraftBukkit +- ${spigot.desc}${craftbukkit.desc} +- ${project.build.outputTimestamp} +- Bukkit +- ${api.version} +- Bukkit Team +- true +- +- +- +- net/bukkit/ +- +- true +- +- +- +- com/bukkit/ +- +- true +- +- +- +- org/bukkit/ +- +- true +- +- +- +- +- +- +- +- org.apache.maven.plugins +- maven-shade-plugin +- 3.2.4 +- +- +- org.ow2.asm +- asm +- 9.1 +- +- +- org.ow2.asm +- asm-commons +- 9.1 +- +- +- +- +- package +- +- shade +- +- +- ${shadeSourcesJar} +- +- +- org.spigotmc:minecraft-server +- +- com/google/common/** +- com/google/gson/** +- com/google/thirdparty/** +- +- +- +- org.eclipse.sisu:org.eclipse.sisu.inject +- +- META-INF/services/javax.annotation.processing.Processor +- +- +- +- +- +- +- +- jline +- org.bukkit.craftbukkit.libs.jline +- +- +- it.unimi +- org.bukkit.craftbukkit.libs.it.unimi +- +- +- org.apache.commons.codec +- org.bukkit.craftbukkit.libs.org.apache.commons.codec +- +- +- org.apache.commons.io +- org.bukkit.craftbukkit.libs.org.apache.commons.io +- +- +- org.apache.commons.lang3 +- org.bukkit.craftbukkit.libs.org.apache.commons.lang3 +- +- +- org.apache.http +- org.bukkit.craftbukkit.libs.org.apache.http +- +- +- org.apache.maven +- org.bukkit.craftbukkit.libs.org.apache.maven +- +- +- org.codehaus.plexus +- org.bukkit.craftbukkit.libs.org.codehaus.plexus +- +- +- org.eclipse.aether +- org.bukkit.craftbukkit.libs.org.eclipse.aether +- +- +- org.eclipse.sisu +- org.bukkit.craftbukkit.libs.org.eclipse.sisu +- +- +- org.objectweb.asm +- org.bukkit.craftbukkit.libs.org.objectweb.asm +- +- +- org.bukkit.craftbukkit +- org.bukkit.craftbukkit.v${minecraft_version} +- +- org.bukkit.craftbukkit.Main* +- +- +- +- +- +- META-INF/services/java.sql.Driver +- +- +- +- +- +- +- +- net.md-5 +- specialsource-maven-plugin +- 1.2.2 +- +- +- package +- +- remap +- +- remap-fields +- +- org.spigotmc:minecraft-server:${project.version}:csrg:maps-spigot-fields +- true +- +- +- +- +- +- org.apache.maven.plugins +- maven-compiler-plugin +- 3.8.1 +- +- +- eclipse +- +- +- +- org.codehaus.plexus +- plexus-compiler-eclipse +- 2.8.8 +- +- +- org.eclipse.jdt +- ecj +- 3.24.0 +- +- +- +- +- org.apache.maven.plugins +- maven-surefire-plugin +- 2.12.4 +- +- ${basedir}/target/test-server +- +- org/bukkit/craftbukkit/inventory/ItemStack*Test.java +- +- +- +- +- +- +- +- +- shadeSourcesJar +- +- true +- true +- +- +- +- development +- +- false +- +- +- +- +- org.apache.maven.plugins +- maven-checkstyle-plugin +- 3.1.1 +- +- +- process-classes +- +- check +- +- +- +- +- checkstyle.xml +- true +- +- +- +- com.puppycrawl.tools +- checkstyle +- 8.39 +- +- +- +- +- org.codehaus.mojo +- animal-sniffer-maven-plugin +- 1.20 +- +- +- process-classes +- +- check +- +- +- +- +- +- org.codehaus.mojo.signature +- java18 +- 1.0 +- +- +- +- +- +- +- +- remapped +- +- +- +- net.md-5 +- specialsource-maven-plugin +- +- +- package +- +- remap +- +- remap-obf +- +- org.spigotmc:minecraft-server:${project.version}:csrg:maps-spigot +- true +- true +- remapped-obf +- +- +- +- package +- +- remap +- +- remap-mojang +- +- ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar +- org.spigotmc:minecraft-server:${project.version}:txt:maps-mojang +- true +- remapped-mojang +- +- +- +- +- +- +- +- +- diff --git a/patches/server/Use-asynchronous-Log4j-2-loggers.patch b/patches/server/Use-asynchronous-Log4j-2-loggers.patch index d884f4461e..2e4b7dd4b4 100644 --- a/patches/server/Use-asynchronous-Log4j-2-loggers.patch +++ b/patches/server/Use-asynchronous-Log4j-2-loggers.patch @@ -16,24 +16,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.1") runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.0") -diff --git a/pom.xml b/pom.xml -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - - - -+ -+ -+ com.lmax -+ disruptor -+ 3.4.2 -+ runtime -+ - - org.ow2.asm - asm diff --git a/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java b/src/main/java/com/destroystokyo/paper/log/LogFullPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000