From 9ccc21d8a936b011a2df4099aadc75bb857f2b26 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sat, 6 Jul 2024 04:09:46 +0300 Subject: [PATCH] Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@d5c06b4 fix summon_entity effect attempting to add incorrect entity, closes #1545 PurpurMC/Purpur@faa1f93 add PlayerSetTrialSpawnerTypeWithEggEvent, fixes #1546 (#1547) PurpurMC/Purpur@1ab7990 Updated Upstream (Paper) PurpurMC/Purpur@8b987b1 fix infinityWorksWithoutArrows not working PurpurMC/Purpur@de2e7a7 Updated Upstream (Paper) --- gradle.properties | 2 +- patches/api/0001-Divine-Branding.patch | 17 ++++++++ patches/api/0006-DivineMC-API-Publish.patch | 8 ++-- ...ide-unnecessary-compilation-warnings.patch | 35 ---------------- patches/server/0001-Divine-Branding.patch | 19 +++++++-- .../server/0002-Divine-Configuration.patch | 6 +-- patches/server/0009-Fix-MC-172801.patch | 4 +- patches/server/0010-Fix-MC-2025.patch | 6 +-- ...skip-entity-move-if-movement-is-zero.patch | 8 ++-- ...ast_elytra_check-entity.fast_hand_sw.patch | 6 +-- .../0025-Remove-Spigot-tick-limiter.patch | 4 +- patches/server/0028-Delete-Timings.patch | 26 ++++++------ patches/server/0046-Async-Pathfinding.patch | 41 +++++++++++-------- patches/server/0049-No-chat-sign.patch | 4 +- 14 files changed, 94 insertions(+), 92 deletions(-) delete mode 100644 patches/api/0007-Hide-unnecessary-compilation-warnings.patch diff --git a/gradle.properties b/gradle.properties index 1b4b578..0aa4ff2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group = space.bxteam.divinemc mcVersion = 1.21 version = 1.21-R0.1-SNAPSHOT -purpurRef = d5c06b4e5464969e285706c50efe50ab6a450f67 +purpurRef = de2e7a796716a50fbfda37ae2739e31df1a285b1 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0001-Divine-Branding.patch b/patches/api/0001-Divine-Branding.patch index 63bc1e8..9d3104b 100644 --- a/patches/api/0001-Divine-Branding.patch +++ b/patches/api/0001-Divine-Branding.patch @@ -4,6 +4,23 @@ Date: Sat, 18 May 2024 01:10:38 +0300 Subject: [PATCH] Divine Branding +diff --git a/build.gradle.kts b/build.gradle.kts +index ea3ad97909de951efa0ad322df766689339b8af6..ae3e7dca42037cfe0f90981724a9ecb217e8e4b7 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -223,3 +223,12 @@ tasks.check { + dependsOn(scanJarForOldGeneratedCode) + } + // Paper end ++ ++// DivineMC start - Hide unnecessary compilation warnings ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("-Xlint:-module") ++ compilerArgs.add("-Xlint:-removal") ++ compilerArgs.add("-Xlint:-dep-ann") ++} ++// DivineMC end diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java index 7107eabf02d9d9b69d97c978ba421ad52031ec3f..f6005cb48750fdcf903609f3fb693895df229bc2 100644 --- a/src/main/java/io/papermc/paper/ServerBuildInfo.java diff --git a/patches/api/0006-DivineMC-API-Publish.patch b/patches/api/0006-DivineMC-API-Publish.patch index 88eac8d..b1719b1 100644 --- a/patches/api/0006-DivineMC-API-Publish.patch +++ b/patches/api/0006-DivineMC-API-Publish.patch @@ -5,13 +5,13 @@ Subject: [PATCH] DivineMC API Publish diff --git a/build.gradle.kts b/build.gradle.kts -index 6aef83558a5ef7e84873b127c3bb43a6468c9a24..78cae5a080f65646494e7d1d8a52df969db6d3b1 100644 +index ae3e7dca42037cfe0f90981724a9ecb217e8e4b7..9b9eafd38572317816553646ea38d0057a8c22fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -222,3 +222,14 @@ tasks.check { - dependsOn(scanJarForOldGeneratedCode) +@@ -232,3 +232,14 @@ tasks.withType { + compilerArgs.add("-Xlint:-dep-ann") } - // Paper end + // DivineMC end + +// DivineMC start - publish to GitHub Packages +publishing { diff --git a/patches/api/0007-Hide-unnecessary-compilation-warnings.patch b/patches/api/0007-Hide-unnecessary-compilation-warnings.patch deleted file mode 100644 index 2104f82..0000000 --- a/patches/api/0007-Hide-unnecessary-compilation-warnings.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Mon, 20 May 2024 07:14:21 +0300 -Subject: [PATCH] Hide unnecessary compilation warnings - - -diff --git a/build.gradle.kts b/build.gradle.kts -index 78cae5a080f65646494e7d1d8a52df969db6d3b1..e33a4bd94cbaf07ed10f0b160ca0e65ec2383b66 100644 ---- a/build.gradle.kts -+++ b/build.gradle.kts -@@ -130,6 +130,15 @@ val generateApiVersioningFile by tasks.registering { - } - } - -+// DivineMC start - Hide unnecessary compilation warnings -+tasks.withType { -+ val compilerArgs = options.compilerArgs -+ compilerArgs.add("-Xlint:-module") -+ compilerArgs.add("-Xlint:-removal") -+ compilerArgs.add("-Xlint:-dep-ann") -+} -+// DivineMC end -+ - tasks.jar { - from(generateApiVersioningFile.map { it.outputs.files.singleFile }) { - into("META-INF/maven/${project.group}/${project.name}") -@@ -189,6 +198,8 @@ tasks.withType { - into("build/docs/javadoc") - } - } -+ -+ options.addStringOption("Xdoclint:none", "-quiet") // DivineMC - Hide unnecessary compilation warnings - } - - tasks.test { diff --git a/patches/server/0001-Divine-Branding.patch b/patches/server/0001-Divine-Branding.patch index b0ebc6a..63b73e1 100644 --- a/patches/server/0001-Divine-Branding.patch +++ b/patches/server/0001-Divine-Branding.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Divine Branding diff --git a/build.gradle.kts b/build.gradle.kts -index 0635aacceec1ba9c753b4dde057876b91336d416..dffee3fdef02135233bc9a915eebbb714830b889 100644 +index 42fa7df2badca3fe26258ce0db934ba33f9cec80..435e8c4674399114bd085d7362d03d79a203e13f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -37,6 +37,19 @@ index 0635aacceec1ba9c753b4dde057876b91336d416..dffee3fdef02135233bc9a915eebbb71 "Build-Number" to (build ?: ""), "Build-Time" to Instant.now().toString(), "Git-Branch" to gitBranch, // Paper +@@ -227,3 +227,12 @@ tasks.registerRunTask("runReobfPaperclip") { + classpath(rootProject.tasks.named("createReobfPaperclipJar").flatMap { it.outputZip }) + mainClass.set(null as String?) + } ++ ++// DivineMC start - Hide irrelevant compilation warnings ++tasks.withType { ++ val compilerArgs = options.compilerArgs ++ compilerArgs.add("-Xlint:-module") ++ compilerArgs.add("-Xlint:-removal") ++ compilerArgs.add("-Xlint:-dep-ann") ++} ++// DivineMC end diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8b06174a9c42ea1d5a1cc5a423a0d6f7304a06c4 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java @@ -196,10 +209,10 @@ index 710477ae27ebc5afdf0012ef0867d05efd293c24..972391f88d9a5fbf6e28ddbf853d610b public CrashReport(String message, Throwable cause) { io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6dbea75748021ecc950888213a431ab2495c4a18..6699b0dadaf7ac49f8c7ec6605bb64472b52361e 100644 +index e6a23507b69a128aabf4f811d6099281b24583fd..f516cf66635938a57cbe623112a38efbb4877286 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -969,7 +969,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here -@@ -387,8 +385,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -392,8 +390,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl }); // CraftBukkit end this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/server/0028-Delete-Timings.patch b/patches/server/0028-Delete-Timings.patch index 55e310b..9933626 100644 --- a/patches/server/0028-Delete-Timings.patch +++ b/patches/server/0028-Delete-Timings.patch @@ -826,7 +826,7 @@ index 0c8fe5b2500480c3a9e9ab3285ad22e0e599d953..f7197f1347251a37dd0f6d9ffa2f09bc } catch (Exception exception) { if (exception instanceof ReportedException) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6699b0dadaf7ac49f8c7ec6605bb64472b52361e..3df813c086c2a8dfc29c08cb884c099ee698f412 100644 +index f516cf66635938a57cbe623112a38efbb4877286..3e5368dbf43e2cc7e01cfd376e0651f681d5d844 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,7 +3,6 @@ package net.minecraft.server; @@ -846,7 +846,7 @@ index 6699b0dadaf7ac49f8c7ec6605bb64472b52361e..3df813c086c2a8dfc29c08cb884c099e public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, ChunkIOErrorReporter, CommandSource, AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer { // Paper - rewrite chunk system private static MinecraftServer SERVER; // Paper -@@ -985,7 +982,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -@@ -384,7 +383,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -389,7 +388,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1081,7 +1081,7 @@ index 20d9b85fdf6bcf570c97c9bbf9787918d81cc9be..37f63cb756030f41f3d6f535469c0c6b this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : com.destroystokyo.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray } -@@ -1016,9 +1014,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1028,9 +1026,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 diff --git a/patches/server/0046-Async-Pathfinding.patch b/patches/server/0046-Async-Pathfinding.patch index e2d66e1..68acb2c 100644 --- a/patches/server/0046-Async-Pathfinding.patch +++ b/patches/server/0046-Async-Pathfinding.patch @@ -9,13 +9,13 @@ You can find the original code on https://github.com/Bloom-host/Petal Makes most pathfinding-related work happen asynchronously diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index 2638c5502016da62c54ec02a1d62834cba8e69d3..66dc3f0bcd0fd3961b6a867e34ce9af5ee3c2a29 100644 +index ecd1bbd17cb0134cf1f4e99a3fea9e205d38f46b..42eaa860860890b90dfa1b4deeee396ae87e00cf 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -76,21 +76,54 @@ public class AcquirePoi { - ) - .limit(5L) - .collect(Collectors.toSet()); +@@ -76,23 +76,56 @@ public class AcquirePoi { + io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur + Set, BlockPos>> set = new java.util.HashSet<>(poiposes); + // Paper end - optimise POI access - Path path = findPathToPois(entity, set); - if (path != null && path.canReach()) { - BlockPos blockPos = path.getTarget(); @@ -25,7 +25,7 @@ index 2638c5502016da62c54ec02a1d62834cba8e69d3..66dc3f0bcd0fd3961b6a867e34ce9af5 - entityStatus.ifPresent(status -> world.broadcastEntityEvent(entity, status)); - long2ObjectMap.clear(); - DebugPackets.sendPoiTicketCountPacket(world, blockPos); -+ // DivineMC start - petal - Async Pathfinding ++ // DivineMC start - Async path processing + if (space.bxteam.divinemc.configuration.DivineConfig.asyncPathfinding) { + // await on path async + Path possiblePath = findPathToPois(entity, set); @@ -78,8 +78,11 @@ index 2638c5502016da62c54ec02a1d62834cba8e69d3..66dc3f0bcd0fd3961b6a867e34ce9af5 + ); + } } - } +- } ++ } // DivineMC + return true; + } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java index 2a7a26ca447cc78f24e61a2bf557411c31eb16b2..b7fa1c3c564d3c45ac559fd4ec73c3f9f6911576 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java @@ -506,22 +509,23 @@ index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..c37ec1c55b5104456788b270c1ceee7c } diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -index 222c87e80cb089867ce9a7d2dceebe21b4bfe0de..7ef25a0627c4217caa40c67ee45f5b40c0525501 100644 +index 9104d7010bda6f9f73b478c11490ef9c53f76da2..4ff94a69f44df3582173be8254754484dca1936a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -@@ -57,15 +57,35 @@ public class NearestBedSensor extends Sensor { - holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), world.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY - ) - .collect(Collectors.toSet()); -- Path path = AcquirePoi.findPathToPois(entity, set); +@@ -57,17 +57,37 @@ public class NearestBedSensor extends Sensor { + java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); + // don't ask me why it's unbounded. ask mojang. + io.papermc.paper.util.PoiAccess.findAnyPoiPositions(poiManager, type -> type.is(PoiTypes.HOME), predicate, entity.blockPosition(), world.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY, false, Integer.MAX_VALUE, poiposes); // Purpur +- Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes)); +- // Paper end - optimise POI access - if (path != null && path.canReach()) { - BlockPos blockPos = path.getTarget(); - Optional> optional = poiManager.getType(blockPos); - if (optional.isPresent()) { - entity.getBrain().setMemory(MemoryModuleType.NEAREST_BED, blockPos); -+ // DivineMC start - Async Pathfinding ++ // DivineMC start - await on async path processing + if (space.bxteam.divinemc.configuration.DivineConfig.asyncPathfinding) { -+ Path possiblePath = AcquirePoi.findPathToPois(entity, set); ++ Path possiblePath = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes)); + space.bxteam.divinemc.pathfinding.AsyncPathProcessor.awaitProcessing(entity, possiblePath, path -> { + // read canReach check + if ((path == null || !path.canReach()) && this.triedCount < 5) { @@ -538,7 +542,8 @@ index 222c87e80cb089867ce9a7d2dceebe21b4bfe0de..7ef25a0627c4217caa40c67ee45f5b40 + }); + } else { + // DivineMC end -+ Path path = AcquirePoi.findPathToPois(entity, set); ++ Path path = AcquirePoi.findPathToPois(entity, new java.util.HashSet<>(poiposes)); ++ // Paper end - optimise POI access + if (path != null && path.canReach()) { + BlockPos blockPos = path.getTarget(); + Optional> optional = poiManager.getType(blockPos); @@ -550,9 +555,11 @@ index 222c87e80cb089867ce9a7d2dceebe21b4bfe0de..7ef25a0627c4217caa40c67ee45f5b40 } - } else if (this.triedCount < 5) { - this.batchCache.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < this.lastUpdate); - } +- } ++ } // DivineMC } } + } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java index 5f228ea02b8912283dfb9a7bd18b33802b1d77ab..b9945658239589ad840a2712db6c08175c9c8dc6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java diff --git a/patches/server/0049-No-chat-sign.patch b/patches/server/0049-No-chat-sign.patch index 055c12e..f50ee30 100644 --- a/patches/server/0049-No-chat-sign.patch +++ b/patches/server/0049-No-chat-sign.patch @@ -147,10 +147,10 @@ index fac2fb82c381d245f77b7288c34920660ac2c3af..b3ca62843b17c536840cb4edb700f9c2 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 969a5461316401950c8fba6ed6347164235a5af9..ba8b4da77156e241f8dbf48af3bc716bca775ee3 100644 +index 95dcf7743e69559bc99487f6b57986bbbb2512c6..d4541b7b3123c4be2af06152bc527ce35eecef68 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1436,7 +1436,7 @@ public abstract class PlayerList { +@@ -1437,7 +1437,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public