mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
Updated Upstream (Purpur)
Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@b3709b1 Updated Upstream (Paper)
This commit is contained in:
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -33,6 +33,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
|
git config --global user.email "no-reply@github.com" && git config --global user.name "Github Actions"
|
||||||
echo "workflow=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
echo "workflow=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
||||||
|
echo "BUILD_NUMBER=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
|
||||||
chmod +x gradlew
|
chmod +x gradlew
|
||||||
|
|
||||||
- name: Patch
|
- name: Patch
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ group = space.bxteam.divinemc
|
|||||||
|
|
||||||
mcVersion = 1.21
|
mcVersion = 1.21
|
||||||
version = 1.21-R0.1-SNAPSHOT
|
version = 1.21-R0.1-SNAPSHOT
|
||||||
purpurRef = ff19bccd8c59870090ec5de4906844a59d651986
|
purpurRef = b3709b1f4d64277182029b176e2c74bd7cfe3e23
|
||||||
|
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
|
|||||||
109
patches/api/0007-Bump-Dependencies.patch
Normal file
109
patches/api/0007-Bump-Dependencies.patch
Normal file
@@ -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<Javadoc> {
|
||||||
|
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<Javadoc> {
|
||||||
|
"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:")
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ index 42fa7df2badca3fe26258ce0db934ba33f9cec80..435e8c4674399114bd085d7362d03d79
|
|||||||
+}
|
+}
|
||||||
+// DivineMC end
|
+// DivineMC end
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
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
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
+++ b/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;
|
@@ -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
|
// Only start Metrics, if it's enabled in the config
|
||||||
if (config.getBoolean("enabled", true)) {
|
if (config.getBoolean("enabled", true)) {
|
||||||
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur
|
- 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", () -> {
|
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||||
String minecraftVersion = Bukkit.getVersion();
|
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.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("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.SimplePie("divinemc_version", () -> (CraftServer.class.getPackage().getImplementationVersion() != null) ? CraftServer.class.getPackage().getImplementationVersion() : "unknown")); // DivineMC
|
||||||
|
|
||||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-172801
|
|||||||
Original post on Mojira: https://bugs.mojang.com/browse/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
|
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
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/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() {
|
protected float getFlyingSpeed() {
|
||||||
|
|||||||
@@ -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)
|
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
|
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
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/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() {
|
protected void updateSwingTime() {
|
||||||
@@ -18,7 +18,7 @@ index 00ad560e06d21dcb1415c00976d9957ac00a18c2..b99866f8d4737ebc5d419d69486ad88a
|
|||||||
int i = this.getCurrentSwingDuration();
|
int i = this.getCurrentSwingDuration();
|
||||||
|
|
||||||
if (this.swinging) {
|
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() {
|
private void updateFallFlying() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
|
||||||
Date: Sun, 14 Jan 2024 00:46:20 +0300
|
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
|
Original code by Bloom-host, licensed under GPL v3
|
||||||
You can find the original code on https://github.com/Bloom-host/Petal
|
You can find the original code on https://github.com/Bloom-host/Petal
|
||||||
@@ -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<FullChunkStatus> fullStatus;
|
||||||
|
@Nullable
|
||||||
|
private LevelChunk.PostLoadProcessor postLoad;
|
||||||
|
- private final Int2ObjectMap<GameEventListenerRegistry> 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<Block> blockTicks;
|
||||||
|
private final LevelChunkTicks<Fluid> 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<GameEventListener> listeners = Lists.newArrayList();
|
||||||
|
- private final Set<GameEventListener> listenersToRemove = Sets.newHashSet();
|
||||||
|
- private final List<GameEventListener> listenersToAdd = Lists.newArrayList();
|
||||||
|
+ //private final Set<GameEventListener> listenersToRemove = Sets.newHashSet(); // DivineMC - unused
|
||||||
|
+ //private final List<GameEventListener> 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<Vec3> 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<GameEvent.ListenerInfo> 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 extends GameEventListener> {
|
||||||
|
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
|
||||||
|
}
|
||||||
20
patches/server/0053-Fix-MC-223153.patch
Normal file
20
patches/server/0053-Fix-MC-223153.patch
Normal file
@@ -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)
|
||||||
|
)
|
||||||
|
);
|
||||||
20
patches/server/0054-Fix-MC-119417.patch
Normal file
20
patches/server/0054-Fix-MC-119417.patch
Normal file
@@ -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 {
|
||||||
24
patches/server/0055-Fix-MC-200418.patch
Normal file
24
patches/server/0055-Fix-MC-200418.patch
Normal file
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user