From 5b9ba51b8b9c13d7e33249ce8e701ccdf38843fd Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Thu, 11 Jul 2024 22:48:42 +0300 Subject: [PATCH] Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@b3709b1 Updated Upstream (Paper) --- .github/workflows/build.yml | 1 + gradle.properties | 2 +- patches/api/0007-Bump-Dependencies.patch | 109 ++++++++++ patches/server/0001-Divine-Branding.patch | 9 +- patches/server/0009-Fix-MC-172801.patch | 4 +- ...ast_elytra_check-entity.fast_hand_sw.patch | 6 +- ...tch => 0046-Petal-Async-Pathfinding.patch} | 2 +- ...educe-work-done-by-game-event-system.patch | 189 ++++++++++++++++++ ...049-Improve-biome-temperature-cache.patch} | 0 ...hat-sign.patch => 0050-No-chat-sign.patch} | 0 ... 0051-Remove-vanilla-username-check.patch} | 0 ...karin-Save-Json-list-asynchronously.patch} | 0 patches/server/0053-Fix-MC-223153.patch | 20 ++ patches/server/0054-Fix-MC-119417.patch | 20 ++ patches/server/0055-Fix-MC-200418.patch | 24 +++ 15 files changed, 375 insertions(+), 11 deletions(-) create mode 100644 patches/api/0007-Bump-Dependencies.patch rename patches/server/{0046-Async-Pathfinding.patch => 0046-Petal-Async-Pathfinding.patch} (99%) create mode 100644 patches/server/0047-Petal-Reduce-work-done-by-game-event-system.patch rename patches/server/{0047-Improve-biome-temperature-cache.patch => 0049-Improve-biome-temperature-cache.patch} (100%) rename patches/server/{0049-No-chat-sign.patch => 0050-No-chat-sign.patch} (100%) rename patches/server/{0050-Remove-vanilla-username-check.patch => 0051-Remove-vanilla-username-check.patch} (100%) rename patches/server/{0051-Akarin-Save-Json-list-asynchronously.patch => 0052-Akarin-Save-Json-list-asynchronously.patch} (100%) create mode 100644 patches/server/0053-Fix-MC-223153.patch create mode 100644 patches/server/0054-Fix-MC-119417.patch create mode 100644 patches/server/0055-Fix-MC-200418.patch diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57d6365..0387074 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,6 +33,7 @@ jobs: run: | git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions" echo "workflow=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV + echo "BUILD_NUMBER=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV chmod +x gradlew - name: Patch diff --git a/gradle.properties b/gradle.properties index 41df4f8..c85bbc5 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 = ff19bccd8c59870090ec5de4906844a59d651986 +purpurRef = b3709b1f4d64277182029b176e2c74bd7cfe3e23 org.gradle.caching = true org.gradle.parallel = true diff --git a/patches/api/0007-Bump-Dependencies.patch b/patches/api/0007-Bump-Dependencies.patch new file mode 100644 index 0000000..446c56f --- /dev/null +++ b/patches/api/0007-Bump-Dependencies.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Thu, 11 Jul 2024 18:55:47 +0300 +Subject: [PATCH] Bump Dependencies + + +diff --git a/build.gradle.kts b/build.gradle.kts +index 9b9eafd38572317816553646ea38d0057a8c22fa..b2e5080e20df5b394b337118bb952d74447b86f7 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -12,8 +12,8 @@ java { + val annotationsVersion = "24.1.0" + val bungeeCordChatVersion = "1.20-R0.2" + val adventureVersion = "4.17.0" +-val slf4jVersion = "2.0.9" +-val log4jVersion = "2.17.1" ++val slf4jVersion = "2.0.13" // DivineMC - Bump Dependencies ++val log4jVersion = "2.23.1" // DivineMC - Bump Dependencies + val apiAndDocs: Configuration by configurations.creating { + attributes { + attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) +@@ -26,11 +26,17 @@ configurations.api { + extendsFrom(apiAndDocs) + } + ++// DivineMC start - Bump Dependencies ++repositories { ++ mavenCentral() ++} ++// DivineMC end ++ + dependencies { + api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api + // api dependencies are listed transitively to API consumers +- api("com.google.guava:guava:32.1.2-jre") +- api("com.google.code.gson:gson:2.10.1") ++ api("com.google.guava:guava:33.2.1-jre") // DivineMC - Bump Dependencies ++ api("com.google.code.gson:gson:2.11.0") // DivineMC - Bump Dependencies + // Paper start - adventure + api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.18") { + exclude("com.google.guava", "guava") +@@ -42,7 +48,7 @@ dependencies { + api("com.googlecode.json-simple:json-simple:1.1.1") { + isTransitive = false // includes junit + } +- api("it.unimi.dsi:fastutil:8.5.6") ++ api("it.unimi.dsi:fastutil:8.5.13") // DivineMC - Bump Dependencies + apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion")) + apiAndDocs("net.kyori:adventure-api") + apiAndDocs("net.kyori:adventure-text-minimessage") +@@ -57,24 +63,24 @@ dependencies { + implementation("org.ow2.asm:asm-commons:9.7") + // Paper end + +- api("org.apache.maven:maven-resolver-provider:3.9.6") // Paper - make API dependency for Paper Plugins +- compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") +- compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") ++ api("org.apache.maven:maven-resolver-provider:3.9.7") // Paper - make API dependency for Paper Plugins // DivineMC - Bump Dependencies ++ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.20") // DivineMC - Bump Dependencies ++ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.20") // DivineMC - Bump Dependencies + + val annotations = "org.jetbrains:annotations:$annotationsVersion" // Paper - we don't want Java 5 annotations... + compileOnly(annotations) + testCompileOnly(annotations) + + // Paper start - add checker +- val checkerQual = "org.checkerframework:checker-qual:3.33.0" ++ val checkerQual = "org.checkerframework:checker-qual:3.44.0" // DivineMC - Bump Dependencies + compileOnlyApi(checkerQual) + testCompileOnly(checkerQual) + // Paper end + +- testImplementation("org.apache.commons:commons-lang3:3.12.0") +- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") ++ testImplementation("org.apache.commons:commons-lang3:3.14.0") // DivineMC - Bump Dependencies ++ testImplementation("org.junit.jupiter:junit-jupiter:5.11.0-M2") // DivineMC - Bump Dependencies + testImplementation("org.hamcrest:hamcrest:2.2") +- testImplementation("org.mockito:mockito-core:5.11.0") ++ testImplementation("org.mockito:mockito-core:5.12.0") // DivineMC - Bump Dependencies + testImplementation("org.ow2.asm:asm-tree:9.7") + } + +@@ -149,12 +155,12 @@ tasks.withType { + options.use() + options.isDocFilesSubDirs = true + options.links( +- "https://guava.dev/releases/32.1.2-jre/api/docs/", ++ "https://guava.dev/releases/33.1.0-jre/api/docs/", // DivineMC - Bump Dependencies + "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/", + "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations + // "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/", // Paper - don't link to bungee chat + // Paper start - add missing javadoc links +- "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html", ++ "https://javadoc.io/doc/org.joml/joml/latest/index.html", // DivineMC - Bump Dependencies + "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1", + // Paper end + // Paper start +@@ -166,9 +172,9 @@ tasks.withType { + "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", + "https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/", + "https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/", +- "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/", ++ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/2.20.0", // DivineMC - Bump Dependencies + // Paper end +- "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper ++ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.19", // Paper // DivineMC - Bump Dependencies + ) + options.tags("apiNote:a:API Note:") + diff --git a/patches/server/0001-Divine-Branding.patch b/patches/server/0001-Divine-Branding.patch index 63b73e1..146e652 100644 --- a/patches/server/0001-Divine-Branding.patch +++ b/patches/server/0001-Divine-Branding.patch @@ -51,7 +51,7 @@ index 42fa7df2badca3fe26258ce0db934ba33f9cec80..435e8c4674399114bd085d7362d03d79 +} +// 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 +index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..d9e5756f40bbafdb1efc97039562ca7835ea3020 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java @@ -3,6 +3,7 @@ package com.destroystokyo.paper; @@ -67,14 +67,15 @@ index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8b06174a9c42ea1d5a1cc5a423a0d6f7 // Only start Metrics, if it's enabled in the config if (config.getBoolean("enabled", true)) { - Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur -+ Metrics metrics = new Metrics("DivineMC", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // DivineMC ++ Metrics metrics = new Metrics("DivineMC", serverUUID, logFailedRequests, Bukkit.getLogger()); // DivineMC metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> { String minecraftVersion = Bukkit.getVersion(); -@@ -604,6 +605,7 @@ public class Metrics { +@@ -603,7 +604,7 @@ public class Metrics { + metrics.addCustomChart(new Metrics.SingleLineChart("players", () -> Bukkit.getOnlinePlayers().size())); metrics.addCustomChart(new Metrics.SimplePie("online_mode", () -> Bukkit.getOnlineMode() ? "online" : (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() ? "bungee" : "offline"))); // Purpur - metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur +- metrics.addCustomChart(new Metrics.SimplePie("purpur_version", () -> (org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() != null) ? org.bukkit.craftbukkit.Main.class.getPackage().getImplementationVersion() : "unknown")); // Purpur + metrics.addCustomChart(new Metrics.SimplePie("divinemc_version", () -> (CraftServer.class.getPackage().getImplementationVersion() != null) ? CraftServer.class.getPackage().getImplementationVersion() : "unknown")); // DivineMC metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { diff --git a/patches/server/0009-Fix-MC-172801.patch b/patches/server/0009-Fix-MC-172801.patch index 08ce742..5432159 100644 --- a/patches/server/0009-Fix-MC-172801.patch +++ b/patches/server/0009-Fix-MC-172801.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-172801 Original post on Mojira: https://bugs.mojang.com/browse/MC-172801 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b06797b805ba52adb3f7619e8768a627911cffa0..00ad560e06d21dcb1415c00976d9957ac00a18c2 100644 +index 1b9d44b43665584a8343ffe3be3e9c36849d031d..88f4fb228edbbbb12c7d5b28c880ec531445ec5f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3163,7 +3163,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3179,7 +3179,13 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected float getFlyingSpeed() { diff --git a/patches/server/0020-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch b/patches/server/0020-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch index 266ea0c..76de9e8 100644 --- a/patches/server/0020-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch +++ b/patches/server/0020-lithium-entity.fast_elytra_check-entity.fast_hand_sw.patch @@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under LGPL v3 You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 00ad560e06d21dcb1415c00976d9957ac00a18c2..b99866f8d4737ebc5d419d69486ad88a6dcd510f 100644 +index 88f4fb228edbbbb12c7d5b28c880ec531445ec5f..36058552d429a11946387f608db3dc757274a038 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -2680,6 +2680,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2696,6 +2696,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void updateSwingTime() { @@ -18,7 +18,7 @@ index 00ad560e06d21dcb1415c00976d9957ac00a18c2..b99866f8d4737ebc5d419d69486ad88a int i = this.getCurrentSwingDuration(); if (this.swinging) { -@@ -3680,6 +3681,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3696,6 +3697,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } private void updateFallFlying() { diff --git a/patches/server/0046-Async-Pathfinding.patch b/patches/server/0046-Petal-Async-Pathfinding.patch similarity index 99% rename from patches/server/0046-Async-Pathfinding.patch rename to patches/server/0046-Petal-Async-Pathfinding.patch index 8c029e8..d53e48c 100644 --- a/patches/server/0046-Async-Pathfinding.patch +++ b/patches/server/0046-Petal-Async-Pathfinding.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sun, 14 Jan 2024 00:46:20 +0300 -Subject: [PATCH] Async Pathfinding +Subject: [PATCH] Petal: Async Pathfinding Original code by Bloom-host, licensed under GPL v3 You can find the original code on https://github.com/Bloom-host/Petal diff --git a/patches/server/0047-Petal-Reduce-work-done-by-game-event-system.patch b/patches/server/0047-Petal-Reduce-work-done-by-game-event-system.patch new file mode 100644 index 0000000..b2f03ca --- /dev/null +++ b/patches/server/0047-Petal-Reduce-work-done-by-game-event-system.patch @@ -0,0 +1,189 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Thu, 11 Jul 2024 19:28:20 +0300 +Subject: [PATCH] Petal: Reduce work done by game event system + +Original code by Bloom-host, licensed under GPL v3 +You can find the original code on https://github.com/Bloom-host/Petal + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +index a74732902c0494c67e6acf2fc04581ff9c46b832..42752cf9aa9668f4f813adc177b7ef9798dd017f 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +@@ -68,7 +68,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi + return this.catalystListener; + } + +- public static class CatalystListener implements GameEventListener { ++ public class CatalystListener implements GameEventListener { // DivineMC - static -> non-static + + public static final int PULSE_TICKS = 8; + final SculkSpreader sculkSpreader; +@@ -139,6 +139,13 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi + world.playSound((Player) null, pos, SoundEvents.SCULK_CATALYST_BLOOM, SoundSource.BLOCKS, 2.0F, 0.6F + random.nextFloat() * 0.4F); + } + ++ // DivineMC start - Petal: Reduce work done by game event system ++ @Override ++ public boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { ++ return !SculkCatalystBlockEntity.this.isRemoved() && gameEvent == GameEvent.ENTITY_DIE.value() && context.sourceEntity() instanceof LivingEntity; ++ } ++ // DivineMC end ++ + private void tryAwardItSpreadsAdvancement(Level world, LivingEntity deadEntity) { + LivingEntity entityliving1 = deadEntity.getLastHurtByMob(); + +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +index 7238f28b7d4b40359a28970a7a53018c242af6e2..109ef6440af8f5611b4570bb647052cb0b19c08e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -82,7 +82,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + private Supplier fullStatus; + @Nullable + private LevelChunk.PostLoadProcessor postLoad; +- private final Int2ObjectMap gameEventListenerRegistrySections; ++ // DivineMC start - Petal: Reduce work done by game event system ++ private final GameEventListenerRegistry[] gameEventListenerRegistrySections; ++ private static final int GAME_EVENT_DISPATCHER_RADIUS = 2; ++ ++ private static int getGameEventSectionIndex(int sectionIndex) { ++ return sectionIndex + GAME_EVENT_DISPATCHER_RADIUS; ++ } ++ ++ private static int getGameEventSectionLength(int sectionCount) { ++ return sectionCount + (GAME_EVENT_DISPATCHER_RADIUS * 2); ++ } ++ // DivineMC end + private final LevelChunkTicks blockTicks; + private final LevelChunkTicks fluidTicks; + +@@ -94,7 +105,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + super(pos, upgradeData, world, net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sectionArrayInitializer, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry + this.tickersInLevel = Maps.newHashMap(); + this.level = (ServerLevel) world; // CraftBukkit - type +- this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap(); ++ this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // DivineMC - Petal: Reduce work done by game event system + Heightmap.Types[] aheightmap_type = Heightmap.Types.values(); + int j = aheightmap_type.length; + +@@ -198,9 +209,23 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + Level world = this.level; + + if (world instanceof ServerLevel worldserver) { +- return (GameEventListenerRegistry) this.gameEventListenerRegistrySections.computeIfAbsent(ySectionCoord, (j) -> { +- return new EuclideanGameEventListenerRegistry(worldserver, ySectionCoord, this::removeGameEventListenerRegistry); +- }); ++ // DivineMC start - Petal: Reduce work done by game event system ++ int sectionIndex = getGameEventSectionIndex(this.getSectionIndexFromSectionY(ySectionCoord)); ++ ++ // drop game events that are too far away (32 blocks) from loaded sections ++ // this matches the highest radius of game events in the game ++ if (sectionIndex < 0 || sectionIndex >= this.gameEventListenerRegistrySections.length) { ++ return GameEventListenerRegistry.NOOP; ++ } ++ ++ var dispatcher = this.gameEventListenerRegistrySections[sectionIndex]; ++ ++ if (dispatcher == null) { ++ dispatcher = this.gameEventListenerRegistrySections[sectionIndex] = new EuclideanGameEventListenerRegistry(worldserver, ySectionCoord, this::removeGameEventListenerRegistry); ++ } ++ ++ return dispatcher; ++ // DivineMC end + } else { + return super.getListenerRegistry(ySectionCoord); + } +@@ -589,7 +614,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + } + + private void removeGameEventListenerRegistry(int ySectionCoord) { +- this.gameEventListenerRegistrySections.remove(ySectionCoord); ++ this.gameEventListenerRegistrySections[getGameEventSectionIndex(this.getSectionIndexFromSectionY(ySectionCoord))] = null; // DivineMC - Petal: Reduce work done by game event system + } + + private void removeBlockEntityTicker(BlockPos pos) { +diff --git a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +index 1e93f3a1b11196a431a1f5a0957036fe0c9191a4..a28b48676b459e8cfa0c3ef2d4ad6de55fc91d66 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/EuclideanGameEventListenerRegistry.java +@@ -14,8 +14,8 @@ import net.minecraft.world.phys.Vec3; + + public class EuclideanGameEventListenerRegistry implements GameEventListenerRegistry { + private final List listeners = Lists.newArrayList(); +- private final Set listenersToRemove = Sets.newHashSet(); +- private final List listenersToAdd = Lists.newArrayList(); ++ //private final Set listenersToRemove = Sets.newHashSet(); // DivineMC - unused ++ //private final List listenersToAdd = Lists.newArrayList(); // DivineMC - unused + private boolean processing; + private final ServerLevel level; + private final int sectionY; +@@ -35,7 +35,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + @Override + public void register(GameEventListener listener) { + if (this.processing) { +- this.listenersToAdd.add(listener); ++ throw new java.util.ConcurrentModificationException(); // DivineMC - Disallow concurrent modification + } else { + this.listeners.add(listener); + } +@@ -46,7 +46,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + @Override + public void unregister(GameEventListener listener) { + if (this.processing) { +- this.listenersToRemove.add(listener); ++ throw new java.util.ConcurrentModificationException(); // DivineMC - Disallow concurrent modification + } else { + this.listeners.remove(listener); + } +@@ -66,7 +66,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + + while (iterator.hasNext()) { + GameEventListener gameEventListener = iterator.next(); +- if (this.listenersToRemove.remove(gameEventListener)) { ++ if (false) { // DivineMC - Disallow concurrent modification + iterator.remove(); + } else { + Optional optional = getPostableListenerPosition(this.level, pos, gameEventListener); +@@ -80,6 +80,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + this.processing = false; + } + ++ /* // DivineMC start - Petal: Reduce work done by game event system + if (!this.listenersToAdd.isEmpty()) { + this.listeners.addAll(this.listenersToAdd); + this.listenersToAdd.clear(); +@@ -89,6 +90,7 @@ public class EuclideanGameEventListenerRegistry implements GameEventListenerRegi + this.listeners.removeAll(this.listenersToRemove); + this.listenersToRemove.clear(); + } ++ */ // DivineMC end + + return bl; + } +diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java +index df6c97be1b278c97a20390be5d3e60f429383702..a99253227677f6d68cbb2d79ea847d36e5879175 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventDispatcher.java +@@ -45,6 +45,7 @@ public class GameEventDispatcher { + int k1 = SectionPos.blockToSectionCoord(blockposition.getZ() + i); + List list = new ArrayList(); + GameEventListenerRegistry.ListenerVisitor gameeventlistenerregistry_a = (gameeventlistener, vec3d1) -> { ++ if (!gameeventlistener.listensToEvent(event.value(), emitter)) return; // DivineMC - If they don't listen, ignore + if (gameeventlistener.getDeliveryMode() == GameEventListener.DeliveryMode.BY_DISTANCE) { + list.add(new GameEvent.ListenerInfo(event, emitterPos, emitter, gameeventlistener, vec3d1)); + } else { +diff --git a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java +index 0f3a79cc644a5b89fa35fdd413ff5781987c4ef3..57e6902990e163ff80b83df30d64e5959ac9d585 100644 +--- a/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java ++++ b/src/main/java/net/minecraft/world/level/gameevent/GameEventListener.java +@@ -23,4 +23,10 @@ public interface GameEventListener { + public interface Provider { + T getListener(); + } ++ ++ // DivineMC start - Add check for seeing if this listener cares about an event ++ default boolean listensToEvent(GameEvent gameEvent, GameEvent.Context context) { ++ return true; ++ } ++ // DivineMC end + } diff --git a/patches/server/0047-Improve-biome-temperature-cache.patch b/patches/server/0049-Improve-biome-temperature-cache.patch similarity index 100% rename from patches/server/0047-Improve-biome-temperature-cache.patch rename to patches/server/0049-Improve-biome-temperature-cache.patch diff --git a/patches/server/0049-No-chat-sign.patch b/patches/server/0050-No-chat-sign.patch similarity index 100% rename from patches/server/0049-No-chat-sign.patch rename to patches/server/0050-No-chat-sign.patch diff --git a/patches/server/0050-Remove-vanilla-username-check.patch b/patches/server/0051-Remove-vanilla-username-check.patch similarity index 100% rename from patches/server/0050-Remove-vanilla-username-check.patch rename to patches/server/0051-Remove-vanilla-username-check.patch diff --git a/patches/server/0051-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0052-Akarin-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0051-Akarin-Save-Json-list-asynchronously.patch rename to patches/server/0052-Akarin-Save-Json-list-asynchronously.patch diff --git a/patches/server/0053-Fix-MC-223153.patch b/patches/server/0053-Fix-MC-223153.patch new file mode 100644 index 0000000..42dbd10 --- /dev/null +++ b/patches/server/0053-Fix-MC-223153.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Thu, 11 Jul 2024 19:11:08 +0300 +Subject: [PATCH] Fix MC-223153 + +Original bug on Mojira: https://bugs.mojang.com/browse/MC-223153 +Took here: https://github.com/Winds-Studio/Leaf/blob/ver/1.21/patches/server/0083-Fix-MC-223153.patch + +diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java +index 7d58a95f7ae8983b466b275f4f82597d38762af0..c5da55438618475bd298f947ca5ed24b5bc3cfd8 100644 +--- a/src/main/java/net/minecraft/world/level/block/Blocks.java ++++ b/src/main/java/net/minecraft/world/level/block/Blocks.java +@@ -7535,6 +7535,7 @@ public class Blocks { + .mapColor(MapColor.COLOR_ORANGE) + .instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops() ++ .sound(SoundType.COPPER) // DivineMC - Fix MC-223153 + .strength(5.0F, 6.0F) + ) + ); diff --git a/patches/server/0054-Fix-MC-119417.patch b/patches/server/0054-Fix-MC-119417.patch new file mode 100644 index 0000000..c11900d --- /dev/null +++ b/patches/server/0054-Fix-MC-119417.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Thu, 11 Jul 2024 19:12:14 +0300 +Subject: [PATCH] Fix MC-119417 + +Original bug on Mojira: https://bugs.mojang.com/browse/MC-119417 +Took here: https://github.com/Winds-Studio/Leaf/blob/ver/1.21/patches/server/0082-Fix-MC-119417.patch + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index c8ccf4b847ba3803b48c26ad6e6acecb327c76c5..3751cd99e408fe02b0c8d0a065a0129e1872a9c2 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -2254,6 +2254,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); + if (gameMode == GameType.SPECTATOR) { + this.removeEntitiesOnShoulder(); ++ this.stopSleeping(); // DivineMC - Fix MC-119417 + this.stopRiding(); + EnchantmentHelper.stopLocationBasedEffects(this); + } else { diff --git a/patches/server/0055-Fix-MC-200418.patch b/patches/server/0055-Fix-MC-200418.patch new file mode 100644 index 0000000..6f9cfe9 --- /dev/null +++ b/patches/server/0055-Fix-MC-200418.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Thu, 11 Jul 2024 19:15:23 +0300 +Subject: [PATCH] Fix MC-200418 + +Original bug on Mojira: https://bugs.mojang.com/browse/MC-200418 +Took here: https://github.com/Winds-Studio/Leaf/blob/ver/1.21/patches/server/0081-Fix-MC-200418.patch + +diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java +index 5ead916772c21d8db98e389984d531aae7f59700..e2fe70e4a1eb6a1cb4e8f11ac8138e08bd081c68 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java ++++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java +@@ -334,6 +334,11 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { + world.levelEvent((Player) null, 1027, this.blockPosition(), 0); + } + ++ // DivineMC start - Fix MC-200418 ++ if (entityvillager.isPassenger() && entityvillager.getVehicle() instanceof net.minecraft.world.entity.animal.Chicken && entityvillager.isBaby()) { ++ entityvillager.removeVehicle(); ++ } ++ // DivineMC end + } + } +