diff --git a/divinemc-api/build.gradle.kts.patch b/divinemc-api/build.gradle.kts.patch index 81cb16f..25b5d9a 100644 --- a/divinemc-api/build.gradle.kts.patch +++ b/divinemc-api/build.gradle.kts.patch @@ -1,6 +1,6 @@ --- a/purpur-api/build.gradle.kts +++ b/purpur-api/build.gradle.kts -@@ -106,17 +_,21 @@ +@@ -104,17 +_,21 @@ java { srcDir(generatedApiPath) srcDir(file("../paper-api/src/main/java")) @@ -22,7 +22,7 @@ } } } -@@ -166,6 +_,15 @@ +@@ -161,6 +_,15 @@ pomProps.get().asFile.writeText("version=$projectVersion") } } diff --git a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch index 98a48de..7ff3eeb 100644 --- a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch +++ b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch @@ -1285,7 +1285,7 @@ index df142a89b8c43acb81eb383eac0ef048a1f49a6e..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java deleted file mode 100644 -index 213c89fddc9413246443d66506ba5437bdb60dce..0000000000000000000000000000000000000000 +index 627922fa5c65e9b77e79cd896c8c52889f5a0cc5..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/Timings.java +++ /dev/null @@ -1,324 +0,0 @@ @@ -1613,7 +1613,6 @@ index 213c89fddc9413246443d66506ba5437bdb60dce..00000000000000000000000000000000 - return TimingsManager.getHandler(groupName, name, groupHandler); - } -} -\ No newline at end of file diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java deleted file mode 100644 index 04d0dc27406e9f96224f88edb1c535176e84d395..0000000000000000000000000000000000000000 @@ -2107,7 +2106,7 @@ index 632c4961515f5052551f841cfa840e60bba7a257..00000000000000000000000000000000 -} diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java deleted file mode 100644 -index 6e361e97c62b93589bba834b3106ed92574ec603..0000000000000000000000000000000000000000 +index b4249da3eb26eae26ec000cc4d56cd21ac2fc6d5..0000000000000000000000000000000000000000 --- a/src/main/java/org/spigotmc/CustomTimingsHandler.java +++ /dev/null @@ -1,67 +0,0 @@ @@ -2161,7 +2160,7 @@ index 6e361e97c62b93589bba834b3106ed92574ec603..00000000000000000000000000000000 - public CustomTimingsHandler(@NotNull String name) { - Timing timing; - -- new AuthorNagException("Deprecated use of CustomTimingsHandler. Please Switch to Timings.of ASAP").printStackTrace(); +- new AuthorNagException("Deprecated use of CustomTimingsHandler. Timings has been removed.").printStackTrace(); - try { - final Method ofSafe = TimingsManager.class.getDeclaredMethod("getHandler", String.class, String.class, Timing.class); - ofSafe.setAccessible(true); diff --git a/divinemc-api/paper-patches/files/src/main/java/org/bukkit/Server.java.patch b/divinemc-api/paper-patches/files/src/main/java/org/bukkit/Server.java.patch index d21b67e..587acd0 100644 --- a/divinemc-api/paper-patches/files/src/main/java/org/bukkit/Server.java.patch +++ b/divinemc-api/paper-patches/files/src/main/java/org/bukkit/Server.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2295,6 +_,13 @@ +@@ -2342,6 +_,13 @@ } // Purpur end diff --git a/divinemc-server/build.gradle.kts.patch b/divinemc-server/build.gradle.kts.patch index 1910aee..d33fffd 100644 --- a/divinemc-server/build.gradle.kts.patch +++ b/divinemc-server/build.gradle.kts.patch @@ -1,6 +1,6 @@ --- a/purpur-server/build.gradle.kts +++ b/purpur-server/build.gradle.kts -@@ -21,6 +_,7 @@ +@@ -22,6 +_,7 @@ // gitFilePatches = true val purpur = forks.register("purpur") { @@ -8,11 +8,12 @@ upstream.patchDir("paperServer") { upstreamPath = "paper-server" excludes = setOf("src/minecraft", "patches", "build.gradle.kts") -@@ -29,7 +_,22 @@ +@@ -29,7 +_,23 @@ + outputDir = rootDirectory.dir("paper-server") } } - - activeFork = purpur ++ + val divinemc = forks.register("divinemc") { + forks = purpur + upstream.patchRepo("paperServer") { @@ -46,18 +47,18 @@ + resources { srcDir("../purpur-server/src/test/resources") } } } - val log4jPlugins = sourceSets.create("log4jPlugins") { + @@ -146,7 +_,7 @@ - // Paper end - configure mockito agent that is needed in newer java versions + } dependencies { - implementation(project(":purpur-api")) + implementation(project(":divinemc-api")) // DivineMC - implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency - // Paper start + implementation("ca.spottedleaf:concurrentutil:0.0.3") implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ -@@ -208,26 +_,35 @@ - // Paper end - spark + implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 +@@ -207,26 +_,35 @@ + implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT") } +// DivineMC start - hide irrelevant compilation warnings @@ -78,14 +79,14 @@ + val buildTime = Instant.now() // DivineMC - Build time to current, we dont have a build server rn val gitHash = git.exec(providers, "rev-parse", "--short=7", "HEAD").get().trim() val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash" - val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim() // Paper - val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() // Paper + val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim() + val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", - "Implementation-Title" to "Purpur", // Purpur + "Implementation-Title" to "DivineMC", // DivineMC "Implementation-Version" to implementationVersion, - "Implementation-Vendor" to date, // Paper + "Implementation-Vendor" to date, - "Specification-Title" to "Purpur", // Purpur + "Specification-Title" to "DivineMC", // DivineMC "Specification-Version" to project.version, @@ -97,4 +98,4 @@ + "Brand-Name" to "DivineMC", // DivineMC "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), - "Git-Branch" to gitBranch, // Paper + "Git-Branch" to gitBranch, diff --git a/divinemc-server/minecraft-patches/features/0006-Petal-Reduce-work-done-by-game-event-system.patch b/divinemc-server/minecraft-patches/features/0006-Petal-Reduce-work-done-by-game-event-system.patch index 10ce806..08ce160 100644 --- a/divinemc-server/minecraft-patches/features/0006-Petal-Reduce-work-done-by-game-event-system.patch +++ b/divinemc-server/minecraft-patches/features/0006-Petal-Reduce-work-done-by-game-event-system.patch @@ -34,7 +34,7 @@ index 1638eccef431fb68775af624110f1968f0c6dabd..2799db1223c9f279322869bdd19605e6 if (entity.getLastHurtByMob() instanceof ServerPlayer serverPlayer) { DamageSource damageSource = entity.getLastDamageSource() == null diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index c1ae7755e8d6fa8501d2210dab7605d993c55722..83eff9d2a9cdceca8b8b88410d57cc7cb9bcbfcb 100644 +index 761fdcd4a4e18f45547afd8edff44f61c6eeacb4..03264d2b170002c640cec34530909ebb34c7e54e 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -81,7 +81,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -60,7 +60,7 @@ index c1ae7755e8d6fa8501d2210dab7605d993c55722..83eff9d2a9cdceca8b8b88410d57cc7c @@ -144,7 +155,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p ) { super(pos, data, level, net.minecraft.server.MinecraftServer.getServer().registryAccess().lookupOrThrow(Registries.BIOME), inhabitedTime, sections, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry - this.level = (net.minecraft.server.level.ServerLevel) level; // CraftBukkit - type + this.level = (ServerLevel) level; // CraftBukkit - type - this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap<>(); + this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // DivineMC - Petal: Reduce work done by game event system diff --git a/divinemc-server/minecraft-patches/features/0008-C2ME-Optimize-world-gen-math.patch b/divinemc-server/minecraft-patches/features/0008-C2ME-Optimize-world-gen-math.patch index c7ac1ca..ee7030c 100644 --- a/divinemc-server/minecraft-patches/features/0008-C2ME-Optimize-world-gen-math.patch +++ b/divinemc-server/minecraft-patches/features/0008-C2ME-Optimize-world-gen-math.patch @@ -44,10 +44,10 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..e7c0de38ef689510860dc0b626f74461 private static double getBeardContribution(int x, int y, int z, int height) { diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index d77016287f5f9a0964d56f05d2d5256ef2e6e86c..40d4555607915709099a94f83df78a744d2827e7 100644 +index 65728ef17e63d71833677fdcbd5bb90794b4822b..832a26760a777fe2d62f2f5f7a885bae63f67517 100644 --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -69,8 +69,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -68,8 +68,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { Aquifer.FluidStatus fluidStatus = new Aquifer.FluidStatus(-54, Blocks.LAVA.defaultBlockState()); int seaLevel = settings.seaLevel(); Aquifer.FluidStatus fluidStatus1 = new Aquifer.FluidStatus(seaLevel, settings.defaultFluid()); diff --git a/divinemc-server/minecraft-patches/features/0010-No-chat-sign.patch b/divinemc-server/minecraft-patches/features/0010-No-chat-sign.patch index 0692b60..677f54a 100644 --- a/divinemc-server/minecraft-patches/features/0010-No-chat-sign.patch +++ b/divinemc-server/minecraft-patches/features/0010-No-chat-sign.patch @@ -106,10 +106,10 @@ index 5ec864a48aa2582458f741b9e81be8805d55913c..db08fe9ad7789876efb657c4274b84b1 } diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 9fe0f9004066522df8eaf9b77968755c9e69a6bd..84bd8a066bc5e89f657118748eee232a4a824a83 100644 +index 398c1733824b689520170de0be94006731afa5cd..b38e6837c6582e63089c67ae6450a0281ceb49b2 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -310,10 +310,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -312,10 +312,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public void send(Packet packet) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/commands/LocateCommand.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/commands/LocateCommand.java.patch deleted file mode 100644 index b512477..0000000 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/commands/LocateCommand.java.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/net/minecraft/server/commands/LocateCommand.java -+++ b/net/minecraft/server/commands/LocateCommand.java -@@ -200,8 +_,10 @@ - } - - private static float dist(int x1, int z1, int x2, int z2) { -- int i = x2 - x1; -- int i1 = z2 - z1; -- return Mth.sqrt(i * i + i1 * i1); -+ // DivineMC start - Fix MC-177381 -+ double i = x2 - x1; -+ double j = z2 - z1; -+ return (float) Math.hypot(i, j); -+ // DivineMC end - } - } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerEntity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerEntity.java.patch index 2166d2b..148bb94 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerEntity.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerEntity.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -407,7 +_,10 @@ +@@ -408,7 +_,10 @@ } if (this.entity instanceof LivingEntity) { @@ -12,7 +12,7 @@ if (!attributesToSync.isEmpty()) { // CraftBukkit start - Send scaled max health if (this.entity instanceof ServerPlayer serverPlayer) { -@@ -417,7 +_,7 @@ +@@ -418,7 +_,7 @@ this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), attributesToSync)); } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch index 6f94348..714c8df 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/Entity.java.patch @@ -21,7 +21,7 @@ final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity // Paper start - detailed watchdog information ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main"); -@@ -4253,6 +_,7 @@ +@@ -4251,6 +_,7 @@ } public final void setBoundingBox(AABB bb) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index b09a350..545cd23 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -9,7 +9,7 @@ return; } // CraftBukkit end -@@ -2664,6 +_,7 @@ +@@ -2666,6 +_,7 @@ } protected void updateSwingTime() { @@ -17,7 +17,7 @@ int currentSwingDuration = this.getCurrentSwingDuration(); if (this.swinging) { this.swingTime++; -@@ -3148,7 +_,13 @@ +@@ -3150,7 +_,13 @@ } protected float getFlyingSpeed() { @@ -32,7 +32,7 @@ } public float getSpeed() { -@@ -3615,6 +_,7 @@ +@@ -3617,6 +_,7 @@ protected void updateFallFlying() { this.checkSlowFallDistance(); if (!this.level().isClientSide) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch index 193fc82..e159043 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/player/Player.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -1872,6 +_,11 @@ +@@ -1877,6 +_,11 @@ } public void causeFoodExhaustion(float exhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason reason) { diff --git a/divinemc-server/paper-patches/features/0002-DivineMC-Configuration.patch b/divinemc-server/paper-patches/features/0002-DivineMC-Configuration.patch index 5a2c145..bcdb3ca 100644 --- a/divinemc-server/paper-patches/features/0002-DivineMC-Configuration.patch +++ b/divinemc-server/paper-patches/features/0002-DivineMC-Configuration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] DivineMC Configuration diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java -index 109e569b7ba6419d60c6490b588937579b4f6878..26f5026134e37e37236dfba9fd881021d7f8666e 100644 +index 4a9258b62db3a9d1150f0dfbe916fa549b596686..bfccf82b57c23537e83bc0b83feef5e632cabef7 100644 --- a/src/main/java/io/papermc/paper/configuration/Configurations.java +++ b/src/main/java/io/papermc/paper/configuration/Configurations.java @@ -94,7 +94,7 @@ public abstract class Configurations { @@ -59,10 +59,10 @@ index 109e569b7ba6419d60c6490b588937579b4f6878..26f5026134e37e37236dfba9fd881021 + // DivineMC end - DivineMC Configuration } diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -index 9f87f3da8e3f8cb16ea8f04cc233e143b174a709..1384abb3f98719d8f16ddb4cc48da71c18619606 100644 +index e319d6337811051de478d584a37015c450960701..6955c448adc0a995c6bbe6d507eee4232ffda5b1 100644 --- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -327,7 +327,7 @@ public class PaperConfigurations extends Configurations>> features = new Reference2LongOpenHashMap<>(); -@@ -571,9 +584,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -559,9 +572,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public int lightQueueSize = 20; diff --git a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch b/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch index 98be1f7..55e103b 100644 --- a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch +++ b/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -285,6 +_,7 @@ +@@ -286,6 +_,7 @@ protected final DedicatedPlayerList playerList; private final Map worlds = new LinkedHashMap(); // private final Map, Registry> registries = new HashMap<>(); // Paper - replace with RegistryAccess @@ -8,7 +8,7 @@ private YamlConfiguration configuration; private YamlConfiguration commandsConfiguration; private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions())); -@@ -1535,6 +_,7 @@ +@@ -1536,6 +_,7 @@ this.getLogger().log(Level.SEVERE, null, ex); } @@ -16,7 +16,7 @@ this.worlds.remove(world.getName().toLowerCase(Locale.ROOT)); this.console.removeLevel(handle); return true; -@@ -1553,6 +_,7 @@ +@@ -1554,6 +_,7 @@ @Override public World getWorld(UUID uid) { @@ -24,7 +24,7 @@ for (World world : this.worlds.values()) { if (world.getUID().equals(uid)) { return world; -@@ -1576,6 +_,7 @@ +@@ -1577,6 +_,7 @@ System.out.println("World " + world.getName() + " is a duplicate of another world and has been prevented from loading. Please delete the uid.dat file from " + world.getName() + "'s world directory if you want to be able to load the duplicate world."); return; } diff --git a/divinemc-server/paper-patches/files/src/main/resources/data/.paperassetsroot.patch b/divinemc-server/paper-patches/files/src/main/resources/data/.paperassetsroot.patch deleted file mode 100644 index b41d58b..0000000 --- a/divinemc-server/paper-patches/files/src/main/resources/data/.paperassetsroot.patch +++ /dev/null @@ -1,3 +0,0 @@ ---- a/src/main/resources/data/.paperassetsroot -+++ b/src/main/resources/data/.paperassetsroot -@@ -1,0 +_,0 @@ diff --git a/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineConfigurations.java b/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineConfigurations.java index 6ea528d..709c599 100644 --- a/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineConfigurations.java +++ b/divinemc-server/src/main/java/space/bxteam/divinemc/configuration/DivineConfigurations.java @@ -31,6 +31,7 @@ import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Reference2LongMap; import it.unimi.dsi.fastutil.objects.Reference2LongOpenHashMap; import net.minecraft.core.RegistryAccess; +import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.Registries; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; @@ -128,15 +129,17 @@ public class DivineConfigurations extends Configurations defaultGlobalOptions(registryAccess, options)); } - private static ConfigurationOptions defaultGlobalOptions(ConfigurationOptions options) { + private static ConfigurationOptions defaultGlobalOptions(RegistryAccess registryAccess, ConfigurationOptions options) { return options .header(GLOBAL_HEADER) - .serializers(builder -> builder.register(new PacketClassSerializer())); + .serializers(builder -> builder.register(new PacketClassSerializer()) + .register(new RegistryValueSerializer<>(new TypeToken>() {}, registryAccess, Registries.DATA_COMPONENT_TYPE, false)) + ); } @Override @@ -250,7 +253,7 @@ public class DivineConfigurations extends Configurations