diff --git a/.github/workflows/build.yml b/.github/workflows/build-1215.yml similarity index 98% rename from .github/workflows/build.yml rename to .github/workflows/build-1215.yml index 81c67ec..a6ba67e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-1215.yml @@ -1,4 +1,4 @@ -name: DivineMC CI +name: Build DivineMC 1.21.5 on: push: diff --git a/.github/workflows/test.yml b/.github/workflows/pr.yml similarity index 88% rename from .github/workflows/test.yml rename to .github/workflows/pr.yml index f6ecade..3e31183 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/pr.yml @@ -1,15 +1,13 @@ -name: DivineMC Test CI +name: DivineMC Test Build on: - push: - branches-ignore: [ master ] pull_request: + branches: [ "master" ] workflow_dispatch: jobs: build: runs-on: blacksmith-8vcpu-ubuntu-2204 - if: "!contains(github.event.commits[0].message, '[ci-skip]')" steps: - name: Setup Action uses: actions/checkout@v4 diff --git a/README.md b/README.md index 3ad69fb..01bbfb4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ For anything else you can refer to our [contribution guide](https://bxteam.org/d org.bxteam.divinemc divinemc-api - 1.21.4-R0.1-SNAPSHOT + 1.21.5-R0.1-SNAPSHOT provided ``` @@ -70,11 +70,11 @@ repositories { ``` ```kotlin dependencies { - compileOnly("org.bxteam.divinemc:divinemc-api:1.21.4-R0.1-SNAPSHOT") + compileOnly("org.bxteam.divinemc:divinemc-api:1.21.5-R0.1-SNAPSHOT") } ``` -We also have a [Javadoc](https://repo.bxteam.org/javadoc/snapshots/org/bxteam/divinemc/divinemc-api/1.21.4-R0.1-SNAPSHOT/raw/index.html) for the API. +We also have a [Javadoc](https://repo.bxteam.org/javadoc/snapshots/org/bxteam/divinemc/divinemc-api/1.21.5-R0.1-SNAPSHOT/raw/index.html) for the API. ## ⚖️ License DivineMC is licensed under the GNU General Public License v3.0. You can find the license [here](LICENSE). diff --git a/divinemc-api/build.gradle.kts.patch b/divinemc-api/build.gradle.kts.patch index 5f14405..44b2f40 100644 --- a/divinemc-api/build.gradle.kts.patch +++ b/divinemc-api/build.gradle.kts.patch @@ -1,8 +1,19 @@ --- a/purpur-api/build.gradle.kts +++ b/purpur-api/build.gradle.kts -@@ -41,9 +_,9 @@ - dependencies { +@@ -14,8 +_,8 @@ + val adventureVersion = "4.21.0-mc1215-SNAPSHOT" // FIXME move to release asap + val adventureJavadocVersion = "4.20.0" // Fixme remove me + val bungeeCordChatVersion = "1.21-R0.2-deprecated+build.21" +-val slf4jVersion = "2.0.16" +-val log4jVersion = "2.24.1" ++val slf4jVersion = "2.0.17" // DivineMC - Bump dependencies ++val log4jVersion = "2.24.3" // DivineMC - Bump dependencies + val apiAndDocs: Configuration by configurations.creating { + attributes { +@@ -42,9 +_,9 @@ + + dependencies { // api dependencies are listed transitively to API consumers - api("com.google.guava:guava:33.3.1-jre") - api("com.google.code.gson:gson:2.11.0") @@ -13,61 +24,65 @@ api("org.joml:joml:1.10.8") { isTransitive = false // https://github.com/JOML-CI/JOML/issues/352 } -@@ -54,6 +_,7 @@ +@@ -52,6 +_,7 @@ api("org.apache.logging.log4j:log4j-api:$log4jVersion") api("org.slf4j:slf4j-api:$slf4jVersion") api("com.mojang:brigadier:1.3.10") + api("io.sentry:sentry:8.4.0") // DivineMC - Pufferfish: Sentry // Deprecate bungeecord-chat in favor of adventure - api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.19") { -@@ -77,19 +_,21 @@ - compileOnly(annotations) - testCompileOnly(annotations) + api("net.md-5:bungeecord-chat:$bungeeCordChatVersion") { +@@ -68,9 +_,11 @@ + apiAndDocs("$adventureGroup:adventure-text-serializer-plain") + apiAndDocs("$adventureGroup:adventure-text-logger-slf4j") -- val checkerQual = "org.checkerframework:checker-qual:3.33.0" -+ val checkerQual = "org.checkerframework:checker-qual:3.49.1" // DivineMC - Bump dependencies - compileOnlyApi(checkerQual) - testCompileOnly(checkerQual) - - api("org.jspecify:jspecify:1.0.0") +- api("org.apache.maven:maven-resolver-provider:3.9.6") // 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") ++ // DivineMC start - Bump dependencies ++ api("org.apache.maven:maven-resolver-provider:3.9.9") // make API dependency for Paper Plugins ++ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.22") ++ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.22") ++ // DivineMC end - Bump dependencies + // Annotations - Slowly migrate to jspecify + val annotations = "org.jetbrains:annotations:$annotationsVersion" +@@ -86,11 +_,13 @@ // Test dependencies -- 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.17.0") + testImplementation("org.junit.jupiter:junit-jupiter:5.12.2") - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.14.1") -+ // DivineMC start - Bump dependencies -+ testImplementation("org.apache.commons:commons-lang3:3.17.0") -+ testImplementation("org.junit.jupiter:junit-jupiter:5.12.1") -+ testImplementation("org.hamcrest:hamcrest:3.0") -+ testImplementation("org.mockito:mockito-core:5.16.1") -+ // DivineMC end - Bump dependencies - testImplementation("org.ow2.asm:asm-tree:9.7.1") ++ testImplementation("org.hamcrest:hamcrest:3.0") // DivineMC - Bump dependencies ++ testImplementation("org.mockito:mockito-core:5.16.1") // DivineMC - Bump dependencies + testImplementation("org.ow2.asm:asm-tree:9.8") - mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // configure mockito agent that is needed in newer java versions + mockitoAgent("org.mockito:mockito-core:5.16.1") { isTransitive = false } // configure mockito agent that is needed in newer java versions // DivineMC - Bump dependencies testRuntimeOnly("org.junit.platform:junit-platform-launcher") ++ ++ compileOnly("org.apache.commons:commons-lang3:3.17.0") // DivineMC - Required for Bukkit } + val generatedDir: java.nio.file.Path = rootProject.layout.projectDirectory.dir("paper-api/src/generated/java").asFile.toPath() @@ -104,17 +_,21 @@ java { - srcDir(generatedApiPath) + srcDir(generatedDir) srcDir(file("../paper-api/src/main/java")) -+ srcDir(file("../purpur-api/src/main/java")) ++ srcDir(file("../purpur-api/src/main/java")) // DivineMC - Rebrand } resources { srcDir(file("../paper-api/src/main/resources")) -+ srcDir(file("../purpur-api/src/main/resources")) ++ srcDir(file("../purpur-api/src/main/resources")) // DivineMC - Rebrand } } test { java { srcDir(file("../paper-api/src/test/java")) -+ srcDir(file("../purpur-api/src/test/java")) ++ srcDir(file("../purpur-api/src/test/java")) // DivineMC - Rebrand } resources { srcDir(file("../paper-api/src/test/resources")) -+ srcDir(file("../purpur-api/src/test/resources")) ++ srcDir(file("../purpur-api/src/test/resources")) // DivineMC - Rebrand } } } @@ -99,14 +114,21 @@ "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", "https://javadoc.io/doc/org.joml/joml/1.10.8/", "https://www.javadoc.io/doc/com.google.code.gson/gson/2.11.0", -@@ -201,8 +_,8 @@ - "https://jd.advntr.dev/text-serializer-plain/$adventureVersion/", - "https://jd.advntr.dev/text-logger-slf4j/$adventureVersion/", +@@ -202,7 +_,7 @@ + "https://jd.advntr.dev/text-logger-slf4j/$adventureJavadocVersion/", "https://javadoc.io/doc/org.slf4j/slf4j-api/$slf4jVersion/", -- "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/$log4jVersion/", + "https://logging.apache.org/log4j/2.x/javadoc/log4j-api/", - "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", -+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/2.20.0/", // DivineMC - Bump dependencies + "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.9.22", // DivineMC - Bump dependencies ) options.tags("apiNote:a:API Note:") +@@ -226,6 +_,8 @@ + into("build/docs/javadoc") + } + } ++ ++ options.addStringOption("Xdoclint:none", "-quiet") // DivineMC - Hide unnecessary javadoc warnings + } + + tasks.test { diff --git a/divinemc-api/paper-patches/features/0001-Rebrand.patch b/divinemc-api/paper-patches/features/0001-Rebrand.patch index 4ea15a9..d2d7e42 100644 --- a/divinemc-api/paper-patches/features/0001-Rebrand.patch +++ b/divinemc-api/paper-patches/features/0001-Rebrand.patch @@ -24,10 +24,10 @@ index fb1fe2651e53a9bf46b3632c638e13eea9dcda93..81e92d1053efd15c079e318a4ae08794 * Gets the {@code ServerBuildInfo}. * diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index c880d0010849ab733ad13bbd18fab3c864d0cf61..a76439e59eefa4b6dbd0e100d72c21055d0ca008 100644 +index ec2b71cc2023b8ec7b9567a9ab1875cafc14f40d..354bf634b45ae510bdbddb81f7b1689bd2f4dc04 100644 --- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java +++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -@@ -259,7 +259,7 @@ public class VersionCommand extends BukkitCommand { +@@ -257,7 +257,7 @@ public class VersionCommand extends BukkitCommand { // Purpur start int distance = getVersionFetcher().distance(); final Component message = Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()), diff --git a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch index f907ba1..d8b9985 100644 --- a/divinemc-api/paper-patches/features/0002-Delete-Timings.patch +++ b/divinemc-api/paper-patches/features/0002-Delete-Timings.patch @@ -736,7 +736,7 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java deleted file mode 100644 -index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..0000000000000000000000000000000000000000 +index c8287776ad585d04fb4fa3290cd73d7097035ea0..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingHistory.java +++ /dev/null @@ -1,357 +0,0 @@ @@ -1031,7 +1031,7 @@ index 6f6eb1a2e6c8d49014a7ae44540ee282bae5200e..00000000000000000000000000000000 - final TicksRecord ticksRecord = new TicksRecord(); - final PingRecord pingRecord = new PingRecord(); - final TimingData fst = TimingsManager.FULL_SERVER_TICK.minuteData.clone(); -- final double tps = 1E9 / ( System.nanoTime() - lastMinuteTime ) * ticksRecord.timed; +- final double tps = 1E9 / (System.nanoTime() - lastMinuteTime) * ticksRecord.timed; - final double usedMemory = TimingsManager.FULL_SERVER_TICK.avgUsedMemory; - final double freeMemory = TimingsManager.FULL_SERVER_TICK.avgFreeMemory; - final double loadAvg = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(); @@ -1753,7 +1753,7 @@ index 04d0dc27406e9f96224f88edb1c535176e84d395..00000000000000000000000000000000 -} diff --git a/src/main/java/co/aikar/timings/TimingsManager.java b/src/main/java/co/aikar/timings/TimingsManager.java deleted file mode 100644 -index e72ad05abada04426e32a73d02b21cb69079d268..0000000000000000000000000000000000000000 +index 83a70358e9b7d3d9ae76cf130915b3c33d09a793..0000000000000000000000000000000000000000 --- a/src/main/java/co/aikar/timings/TimingsManager.java +++ /dev/null @@ -1,192 +0,0 @@ @@ -1912,9 +1912,9 @@ index e72ad05abada04426e32a73d02b21cb69079d268..00000000000000000000000000000000 - public static Timing getCommandTiming(@Nullable String pluginName, @NotNull Command command) { - Plugin plugin = null; - final Server server = Bukkit.getServer(); -- if (!( server == null || pluginName == null || -- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || -- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) +- if (!(server == null || pluginName == null || +- "minecraft".equals(pluginName) || "bukkit".equals(pluginName) || +- "spigot".equalsIgnoreCase(pluginName) || "paper".equals(pluginName) - )) { - plugin = server.getPluginManager().getPlugin(pluginName); - } @@ -2104,6 +2104,771 @@ index 632c4961515f5052551f841cfa840e60bba7a257..00000000000000000000000000000000 - super.stopTiming(); - } -} +diff --git a/src/main/java/co/aikar/util/Counter.java b/src/main/java/co/aikar/util/Counter.java +deleted file mode 100644 +index dae84243804b4b076cafb3e1b29bdcf614efc93f..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/Counter.java ++++ /dev/null +@@ -1,39 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.collect.ForwardingMap; +- +-import java.util.HashMap; +-import java.util.Map; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-@Deprecated(forRemoval = true) +-public class Counter extends ForwardingMap { +- private final Map counts = new HashMap<>(); +- +- public long decrement(@Nullable T key) { +- return increment(key, -1); +- } +- public long increment(@Nullable T key) { +- return increment(key, 1); +- } +- public long decrement(@Nullable T key, long amount) { +- return increment(key, -amount); +- } +- public long increment(@Nullable T key, long amount) { +- Long count = this.getCount(key); +- count += amount; +- this.counts.put(key, count); +- return count; +- } +- +- public long getCount(@Nullable T key) { +- return this.counts.getOrDefault(key, 0L); +- } +- +- @NotNull +- @Override +- protected Map delegate() { +- return this.counts; +- } +-} +diff --git a/src/main/java/co/aikar/util/JSONUtil.java b/src/main/java/co/aikar/util/JSONUtil.java +deleted file mode 100644 +index 232bf09e1a7bc176bfd34b1acb5326a06a92fe79..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/JSONUtil.java ++++ /dev/null +@@ -1,138 +0,0 @@ +-package co.aikar.util; +- +-import com.google.common.base.Function; +-import com.google.common.collect.Lists; +-import com.google.common.collect.Maps; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-import java.util.LinkedHashMap; +-import java.util.List; +-import java.util.Map; +- +-/** +- * Provides Utility methods that assist with generating JSON Objects +- */ +-@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) +-@Deprecated(forRemoval = true) +-public final class JSONUtil { +- private JSONUtil() {} +- +- /** +- * Creates a key/value "JSONPair" object +- * +- * @param key Key to use +- * @param obj Value to use +- * @return JSONPair +- */ +- @NotNull +- public static JSONPair pair(@NotNull String key, @Nullable Object obj) { +- return new JSONPair(key, obj); +- } +- +- @NotNull +- public static JSONPair pair(long key, @Nullable Object obj) { +- return new JSONPair(String.valueOf(key), obj); +- } +- +- /** +- * Creates a new JSON object from multiple JSONPair key/value pairs +- * +- * @param data JSONPairs +- * @return Map +- */ +- @NotNull +- public static Map createObject(@NotNull JSONPair... data) { +- return appendObjectData(new LinkedHashMap(), data); +- } +- +- /** +- * This appends multiple key/value Obj pairs into a JSON Object +- * +- * @param parent Map to be appended to +- * @param data Data to append +- * @return Map +- */ +- @NotNull +- public static Map appendObjectData(@NotNull Map parent, @NotNull JSONPair... data) { +- for (JSONPair JSONPair : data) { +- parent.put(JSONPair.key, JSONPair.val); +- } +- return parent; +- } +- +- /** +- * This builds a JSON array from a set of data +- * +- * @param data Data to build JSON array from +- * @return List +- */ +- @NotNull +- public static List toArray(@NotNull Object... data) { +- return Lists.newArrayList(data); +- } +- +- /** +- * These help build a single JSON array using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return List +- */ +- @NotNull +- public static List toArrayMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toArrayMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static List toArrayMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- List array = Lists.newArrayList(); +- for (E e : collection) { +- Object object = mapper.apply(e); +- if (object != null) { +- array.add(object); +- } +- } +- return array; +- } +- +- /** +- * These help build a single JSON Object from a collection, using a mapper function +- * +- * @param collection Collection to apply to +- * @param mapper Mapper to apply +- * @param Element Type +- * @return Map +- */ +- @NotNull +- public static Map toObjectMapper(@NotNull E[] collection, @NotNull Function mapper) { +- return toObjectMapper(Lists.newArrayList(collection), mapper); +- } +- +- @NotNull +- public static Map toObjectMapper(@NotNull Iterable collection, @NotNull Function mapper) { +- Map object = Maps.newLinkedHashMap(); +- for (E e : collection) { +- JSONPair JSONPair = mapper.apply(e); +- if (JSONPair != null) { +- object.put(JSONPair.key, JSONPair.val); +- } +- } +- return object; +- } +- +- /** +- * Simply stores a key and a value, used internally by many methods below. +- */ +- @SuppressWarnings("PublicInnerClass") +- public static class JSONPair { +- final String key; +- final Object val; +- +- JSONPair(@NotNull String key, @NotNull Object val) { +- this.key = key; +- this.val = val; +- } +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingIntMap.java b/src/main/java/co/aikar/util/LoadingIntMap.java +deleted file mode 100644 +index 5753b9bce89db2ac378ec41f1b61907cc2e23335..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingIntMap.java ++++ /dev/null +@@ -1,77 +0,0 @@ +-/* +- * Copyright (c) 2015. Starlis LLC / dba Empire Minecraft +- * +- * This source code is proprietary software and must not be redistributed without Starlis LLC's approval +- * +- */ +-package co.aikar.util; +- +- +-import com.google.common.base.Function; +-import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exist, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingIntMap extends Int2ObjectOpenHashMap { +- private final Function loader; +- +- public LoadingIntMap(@NotNull Function loader) { +- super(); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, @NotNull Function loader) { +- super(expectedSize); +- this.loader = loader; +- } +- +- public LoadingIntMap(int expectedSize, float loadFactor, @NotNull Function loader) { +- super(expectedSize, loadFactor); +- this.loader = loader; +- } +- +- +- @Nullable +- @Override +- public V get(int key) { +- V res = super.get(key); +- if (res == null) { +- res = loader.apply(key); +- if (res != null) { +- put(key, res); +- } +- } +- return res; +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/LoadingMap.java b/src/main/java/co/aikar/util/LoadingMap.java +deleted file mode 100644 +index 1786eeb5cbeaad75602c9c5649bbcd9b2af5cf81..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/LoadingMap.java ++++ /dev/null +@@ -1,369 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import com.google.common.base.Preconditions; +-import java.lang.reflect.Constructor; +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.HashMap; +-import java.util.IdentityHashMap; +-import java.util.Map; +-import java.util.Set; +-import java.util.function.Function; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Allows you to pass a Loader function that when a key is accessed that doesn't exists, +- * automatically loads the entry into the map by calling the loader Function. +- * +- * .get() Will only return null if the Loader can return null. +- * +- * You may pass any backing Map to use. +- * +- * This class is not thread safe and should be wrapped with Collections.synchronizedMap on the OUTSIDE of the LoadingMap if needed. +- * +- * Do not wrap the backing map with Collections.synchronizedMap. +- * +- * @param Key +- * @param Value +- */ +-@Deprecated(forRemoval = true) +-public class LoadingMap extends AbstractMap { +- private final Map backingMap; +- private final java.util.function.Function loader; +- +- /** +- * Initializes an auto loading map using specified loader and backing map +- * @param backingMap Map to wrap +- * @param loader Loader +- */ +- public LoadingMap(@NotNull Map backingMap, @NotNull java.util.function.Function loader) { +- this.backingMap = backingMap; +- this.loader = loader; +- } +- +- /** +- * Creates a new LoadingMap with the specified map and loader +- * +- * @param backingMap Actual map being used. +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map backingMap, @NotNull Function loader) { +- return new LoadingMap<>(backingMap, loader); +- } +- +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, @Nullable final Class keyClass, +- @NotNull final Class valueClass) { +- return new LoadingMap<>(backingMap, new AutoInstantiatingLoader<>(keyClass, valueClass)); +- } +- /** +- * Creates a LoadingMap with an auto instantiating loader. +- * +- * Will auto construct class of of Value when not found +- * +- * Since this uses Reflection, It is more effecient to define your own static loader +- * than using this helper, but if performance is not critical, this is easier. +- * +- * @param backingMap Actual map being used. +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newAutoMap(@NotNull Map backingMap, +- @NotNull final Class valueClass) { +- return newAutoMap(backingMap, null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass) { +- return newAutoMap(new HashMap<>(), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass) { +- return newHashAutoMap(null, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param keyClass Class used for the K generic +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@Nullable final Class keyClass, @NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newAutoMap(new HashMap<>(initialCapacity, loadFactor), keyClass, valueClass); +- } +- +- /** +- * @see #newAutoMap +- * +- * new Auto initializing map using a HashMap. +- * +- * @param valueClass Class used for the V generic +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map that auto instantiates on .get() +- */ +- @NotNull +- public static Map newHashAutoMap(@NotNull final Class valueClass, int initialCapacity, float loadFactor) { +- return newHashAutoMap(null, valueClass, initialCapacity, loadFactor); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new HashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new HashMap<>(initialCapacity), loader); +- } +- /** +- * Initializes an auto loading map using a HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param loadFactor Load factor to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newHashMap(@NotNull Function loader, int initialCapacity, float loadFactor) { +- return new LoadingMap<>(new HashMap<>(initialCapacity, loadFactor), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader) { +- return new LoadingMap<>(new IdentityHashMap<>(), loader); +- } +- +- /** +- * Initializes an auto loading map using an Identity HashMap +- * +- * @param loader Loader to use +- * @param initialCapacity Initial capacity to use +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map newIdentityHashMap(@NotNull Function loader, int initialCapacity) { +- return new LoadingMap<>(new IdentityHashMap<>(initialCapacity), loader); +- } +- +- @Override +- public int size() {return backingMap.size();} +- +- @Override +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- @Override +- public boolean containsKey(@Nullable Object key) {return backingMap.containsKey(key);} +- +- @Override +- public boolean containsValue(@Nullable Object value) {return backingMap.containsValue(value);} +- +- @Nullable +- @Override +- public V get(@Nullable Object key) { +- V v = backingMap.get(key); +- if (v != null) { +- return v; +- } +- return backingMap.computeIfAbsent((K) key, loader); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) {return backingMap.put(key, value);} +- +- @Nullable +- @Override +- public V remove(@Nullable Object key) {return backingMap.remove(key);} +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- @Override +- public void clear() {backingMap.clear();} +- +- @NotNull +- @Override +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- @Override +- public Collection values() {return backingMap.values();} +- +- @Override +- public boolean equals(@Nullable Object o) {return backingMap.equals(o);} +- +- @Override +- public int hashCode() {return backingMap.hashCode();} +- +- @NotNull +- @Override +- public Set> entrySet() { +- return backingMap.entrySet(); +- } +- +- @NotNull +- public LoadingMap clone() { +- return new LoadingMap<>(backingMap, loader); +- } +- +- private static class AutoInstantiatingLoader implements Function { +- final Constructor constructor; +- private final Class valueClass; +- +- AutoInstantiatingLoader(@Nullable Class keyClass, @NotNull Class valueClass) { +- try { +- this.valueClass = valueClass; +- if (keyClass != null) { +- constructor = valueClass.getConstructor(keyClass); +- } else { +- constructor = null; +- } +- } catch (NoSuchMethodException e) { +- throw new IllegalStateException( +- valueClass.getName() + " does not have a constructor for " + (keyClass != null ? keyClass.getName() : null)); +- } +- } +- +- @NotNull +- @Override +- public V apply(@Nullable K input) { +- try { +- return (constructor != null ? constructor.newInstance(input) : valueClass.newInstance()); +- } catch (Exception e) { +- throw new ExceptionInInitializerError(e); +- } +- } +- +- @Override +- public int hashCode() { +- return super.hashCode(); +- } +- +- @Override +- public boolean equals(Object object) { +- return false; +- } +- } +- +- /** +- * Due to java stuff, you will need to cast it to (Function) for some cases +- * +- * @param Type +- */ +- public abstract static class Feeder implements Function { +- @Nullable +- @Override +- public T apply(@Nullable Object input) { +- return apply(); +- } +- +- @Nullable +- public abstract T apply(); +- } +-} +diff --git a/src/main/java/co/aikar/util/MRUMapCache.java b/src/main/java/co/aikar/util/MRUMapCache.java +deleted file mode 100644 +index 3e61a926620a67daec3af54b72a1b911eaef2ed4..0000000000000000000000000000000000000000 +--- a/src/main/java/co/aikar/util/MRUMapCache.java ++++ /dev/null +@@ -1,112 +0,0 @@ +-/* +- * This file is licensed under the MIT License (MIT). +- * +- * Copyright (c) 2014 Daniel Ennis +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +- * THE SOFTWARE. +- */ +-package co.aikar.util; +- +-import java.util.AbstractMap; +-import java.util.Collection; +-import java.util.Map; +-import java.util.Set; +-import org.jetbrains.annotations.NotNull; +-import org.jetbrains.annotations.Nullable; +- +-/** +- * Implements a Most Recently Used cache in front of a backing map, to quickly access the last accessed result. +- * +- * @param Key Type of the Map +- * @param Value Type of the Map +- */ +-@Deprecated(forRemoval = true) +-public class MRUMapCache extends AbstractMap { +- final Map backingMap; +- Object cacheKey; +- V cacheValue; +- public MRUMapCache(@NotNull final Map backingMap) { +- this.backingMap = backingMap; +- } +- +- public int size() {return backingMap.size();} +- +- public boolean isEmpty() {return backingMap.isEmpty();} +- +- public boolean containsKey(@Nullable Object key) { +- return key != null && key.equals(cacheKey) || backingMap.containsKey(key); +- } +- +- public boolean containsValue(@Nullable Object value) { +- return value != null && value == cacheValue || backingMap.containsValue(value); +- } +- +- @Nullable +- public V get(@Nullable Object key) { +- if (cacheKey != null && cacheKey.equals(key)) { +- return cacheValue; +- } +- cacheKey = key; +- return cacheValue = backingMap.get(key); +- } +- +- @Nullable +- public V put(@Nullable K key, @Nullable V value) { +- cacheKey = key; +- return cacheValue = backingMap.put(key, value); +- } +- +- @Nullable +- public V remove(@Nullable Object key) { +- if (key != null && key.equals(cacheKey)) { +- cacheKey = null; +- } +- return backingMap.remove(key); +- } +- +- public void putAll(@NotNull Map m) {backingMap.putAll(m);} +- +- public void clear() { +- cacheKey = null; +- cacheValue = null; +- backingMap.clear(); +- } +- +- @NotNull +- public Set keySet() {return backingMap.keySet();} +- +- @NotNull +- public Collection values() {return backingMap.values();} +- +- @NotNull +- public Set> entrySet() {return backingMap.entrySet();} +- +- /** +- * Wraps the specified map with a most recently used cache +- * +- * @param map Map to be wrapped +- * @param Key Type of the Map +- * @param Value Type of the Map +- * @return Map +- */ +- @NotNull +- public static Map of(@NotNull Map map) { +- return new MRUMapCache(map); +- } +-} diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java index 71eb845a4d3b8b6ec3b816a0f20ec807e0f9a86d..a43419c23aa0f6fd809caf5a841cb138f350b7ba 100644 --- a/src/main/java/org/bukkit/command/Command.java @@ -2219,18 +2984,10 @@ index 001465eedafa51ac027a4db51cba6223edfe1171..9cb0f09b821a4020d17771a5b64ddd53 // Paper start diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 065f182fbfe4541d602f57d548f286ee3c2fab19..40350504b5f7a92d834e95bb2e4e4268195ec9e7 100644 +index b23774f34a39426c7eeba9da05a75de44e603658..1ad24e0107499e4dcaad647feeb54887675d9e51 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -43,7 +43,6 @@ import org.bukkit.plugin.TimedRegisteredListener; - import org.bukkit.plugin.UnknownDependencyException; - import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; --import org.spigotmc.CustomTimingsHandler; // Spigot - import org.yaml.snakeyaml.error.YAMLException; - - /** -@@ -294,7 +293,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -291,7 +291,7 @@ public final class JavaPluginLoader implements PluginLoader { } } @@ -2239,15 +2996,15 @@ index 065f182fbfe4541d602f57d548f286ee3c2fab19..40350504b5f7a92d834e95bb2e4e4268 @Override public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException { // Paper try { -@@ -308,7 +307,7 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -305,7 +305,7 @@ public final class JavaPluginLoader implements PluginLoader { throw new EventException(t); } } - }, plugin, method, eventClass); // Paper + }; // Paper // DivineMC - Delete Timings - if (false) { // Spigot - RL handles useTimings check now - eventSet.add(new TimedRegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); - } else { + eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled())); + } + return ret; diff --git a/src/main/java/org/spigotmc/CustomTimingsHandler.java b/src/main/java/org/spigotmc/CustomTimingsHandler.java deleted file mode 100644 index b4249da3eb26eae26ec000cc4d56cd21ac2fc6d5..0000000000000000000000000000000000000000 diff --git a/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch b/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch index e367f42..6decfda 100644 --- a/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch +++ b/divinemc-api/paper-patches/features/0006-Extend-Sound-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Extend Sound API diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index b703ad820ff873097dadff9e55b53fcc6b1b8698..b35c3852a3b8e62c7d2f67fc3ff651c8e0a4d5f2 100644 +index d309e28d7e6756afed82390fd2a99a6131e29140..468e2fa5e059e19c14d095c840723f10a6aa9287 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -817,4 +817,29 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr @@ -39,10 +39,10 @@ index b703ad820ff873097dadff9e55b53fcc6b1b8698..b35c3852a3b8e62c7d2f67fc3ff651c8 + // DivineMC end - Extend Sound API } diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index be56f0f42d4ec23397f9974e158b49fcc7ed44f3..82117a1b258d43f68ff803c4c1af0a33c99065a8 100644 +index bee034fd48b567a64a152196a0b80f2f1a9661e4..1eaae9a9e2d73535ddfea355878c61db0f9aa342 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1251,4 +1251,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1279,4 +1279,35 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ void setImmuneToFire(@Nullable Boolean fireImmune); // Purpur end - Fire Immunity API diff --git a/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch b/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch index 0c33e29..72341e2 100644 --- a/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch +++ b/divinemc-api/paper-patches/features/0007-Pufferfish-Sentry.patch @@ -31,10 +31,10 @@ index 9cb0f09b821a4020d17771a5b64ddd53e7d78478..1638548b766460be65c0c008f7f19df1 callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 40350504b5f7a92d834e95bb2e4e4268195ec9e7..1450ce1ce1ecad79dd9514081190df94ceae9d52 100644 +index 1ad24e0107499e4dcaad647feeb54887675d9e51..9342ea35fb963379039ae020f9317bb02147f9c1 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -@@ -336,7 +336,13 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -330,7 +330,13 @@ public final class JavaPluginLoader implements PluginLoader { try { jPlugin.setEnabled(true); } catch (Throwable ex) { @@ -48,7 +48,7 @@ index 40350504b5f7a92d834e95bb2e4e4268195ec9e7..1450ce1ce1ecad79dd9514081190df94 } // Perhaps abort here, rather than continue going, but as it stands, -@@ -361,7 +367,9 @@ public final class JavaPluginLoader implements PluginLoader { +@@ -355,7 +361,9 @@ public final class JavaPluginLoader implements PluginLoader { try { jPlugin.setEnabled(false); } catch (Throwable ex) { diff --git a/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch b/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch index e4ca07b..58cafd0 100644 --- a/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch +++ b/divinemc-api/paper-patches/features/0008-Paper-PR-Player-standing-on-position-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Paper PR: Player standing on position API diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 82117a1b258d43f68ff803c4c1af0a33c99065a8..cb8232faed9423dd570e3a6b0ea664182074a1ac 100644 +index 1eaae9a9e2d73535ddfea355878c61db0f9aa342..0cb9d99f628a9a8b6bd53b5603bd80b176fbc4f4 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -1197,6 +1197,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -1225,6 +1225,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent void broadcastHurtAnimation(@NotNull java.util.Collection players); // Paper end - broadcast hurt animation diff --git a/divinemc-api/paper-patches/files/src/main/java/org/bukkit/map/MapPalette.java.patch b/divinemc-api/paper-patches/files/src/main/java/org/bukkit/map/MapPalette.java.patch index efa8efa..fe3a0f4 100644 --- a/divinemc-api/paper-patches/files/src/main/java/org/bukkit/map/MapPalette.java.patch +++ b/divinemc-api/paper-patches/files/src/main/java/org/bukkit/map/MapPalette.java.patch @@ -1,15 +1,15 @@ --- a/src/main/java/org/bukkit/map/MapPalette.java +++ b/src/main/java/org/bukkit/map/MapPalette.java -@@ -45,7 +_,7 @@ +@@ -35,7 +_,7 @@ } @NotNull - static final Color[] colors = { + public static final Color[] colors = { // DivineMC - Pufferfish SIMD - make public - c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), - c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29), - c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86), -@@ -216,9 +_,15 @@ + // Start generate - MapPalette#colors + // @GeneratedFrom 1.21.5 + new Color(0x00000000, true), +@@ -395,9 +_,15 @@ temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth()); byte[] result = new byte[temp.getWidth() * temp.getHeight()]; diff --git a/divinemc-server/build.gradle.kts.patch b/divinemc-server/build.gradle.kts.patch index 86da54e..8524bef 100644 --- a/divinemc-server/build.gradle.kts.patch +++ b/divinemc-server/build.gradle.kts.patch @@ -1,19 +1,13 @@ --- a/purpur-server/build.gradle.kts +++ b/purpur-server/build.gradle.kts -@@ -22,6 +_,7 @@ - // gitFilePatches = true - - val purpur = forks.register("purpur") { -+ rootDirectory = upstreamsDirectory().map { it.dir("purpur") } - upstream.patchDir("paperServer") { - upstreamPath = "paper-server" - excludes = setOf("src/minecraft", "patches", "build.gradle.kts") -@@ -29,7 +_,23 @@ +@@ -37,9 +_,27 @@ outputDir = rootDirectory.dir("paper-server") } } - activeFork = purpur -+ + // Purpur end - Rebrand + ++ // DivineMC start - Rebrand + val divinemc = forks.register("divinemc") { + forks = purpur + upstream.patchRepo("paperServer") { @@ -30,32 +24,38 @@ + } + + activeFork = divinemc - ++ // DivineMC end - Rebrand ++ spigot { - buildDataRef = "3edaf46ec1eed4115ce1b18d2846cded42577e42" -@@ -115,10 +_,14 @@ + buildDataRef = "702e1a0a5072b2c4082371d5228cb30525687efc" + packageVersion = "v1_21_R4" // also needs to be updated in MappingEnvironment +@@ -125,10 +_,18 @@ main { java { srcDir("../paper-server/src/main/java") } resources { srcDir("../paper-server/src/main/resources") } ++ // DivineMC start - Rebrand + java { srcDir("../purpur-server/src/main/java") } + resources { srcDir("../purpur-server/src/main/resources") } ++ // DivineMC end - Rebrand } test { java { srcDir("../paper-server/src/test/java") } resources { srcDir("../paper-server/src/test/resources") } ++ // DivineMC start - Rebrand + java { srcDir("../purpur-server/src/test/java") } + resources { srcDir("../purpur-server/src/test/resources") } ++ // DivineMC end - Rebrand } } - -@@ -142,10 +_,23 @@ + val log4jPlugins = sourceSets.create("log4jPlugins") { +@@ -156,10 +_,23 @@ } dependencies { -- implementation(project(":purpur-api")) -+ implementation(project(":divinemc-api")) // DivineMC +- implementation(project(":purpur-api")) // Purpur ++ implementation(project(":divinemc-api")) // DivineMC - Rebrand + -+ // DivineMC start ++ // DivineMC start - Dependencies + implementation("org.yaml:snakeyaml:2.3") + implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { + exclude(group="org.yaml", module="snakeyaml") @@ -65,7 +65,7 @@ + implementation("net.openhft:zero-allocation-hashing:0.16") + implementation("com.github.luben:zstd-jni:1.5.6-9") + implementation("org.lz4:lz4-java:1.8.0") -+ // DivineMC end ++ // DivineMC end - Dependencies + implementation("ca.spottedleaf:concurrentutil:0.0.3") - implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ @@ -73,14 +73,14 @@ + implementation("org.jline:jline-terminal-ffm:3.29.0") // use ffm on java 22+ // DivineMC - Bump dependencies + implementation("org.jline:jline-terminal-jni:3.29.0") // fall back to jni on java 21 // DivineMC - Bump dependencies implementation("net.minecrell:terminalconsoleappender:1.3.0") - implementation("net.kyori:adventure-text-serializer-ansi:4.18.0") // Keep in sync with adventureVersion from Paper-API build file - -@@ -155,16 +_,16 @@ + implementation("io.papermc.adventure:adventure-text-serializer-ansi:4.21.0-mc1215-SNAPSHOT") // Keep in sync with adventureVersion from Paper-API build file // FIXME back to release + runtimeConfiguration(sourceSets.main.map { it.runtimeClasspath }) +@@ -170,16 +_,16 @@ all its classes to check if they are plugins. Scanning takes about 1-2 seconds so adding this speeds up the server start. */ -- implementation("org.apache.logging.log4j:log4j-core:2.19.0") -- log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.19.0") // Needed to generate meta for our Log4j plugins +- implementation("org.apache.logging.log4j:log4j-core:2.24.1") +- log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.24.1") // Needed to generate meta for our Log4j plugins + implementation("org.apache.logging.log4j:log4j-core:2.24.3") // DivineMC - Bump dependencies + log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.24.3") // Needed to generate meta for our Log4j plugins // DivineMC - Bump dependencies runtimeOnly(log4jPlugins.output) @@ -89,52 +89,58 @@ implementation("com.velocitypowered:velocity-native:3.4.0-SNAPSHOT") { isTransitive = false } -- implementation("io.netty:netty-codec-haproxy:4.1.115.Final") // Add support for proxy protocol +- implementation("io.netty:netty-codec-haproxy:4.1.118.Final") // Add support for proxy protocol - implementation("org.apache.logging.log4j:log4j-iostreams:2.24.1") + implementation("io.netty:netty-codec-haproxy:4.1.119.Final") // Add support for proxy protocol // DivineMC - Bump dependencies + implementation("org.apache.logging.log4j:log4j-iostreams:2.24.3") // DivineMC - Bump dependencies - implementation("org.ow2.asm:asm-commons:9.7.1") + implementation("org.ow2.asm:asm-commons:9.8") implementation("org.spongepowered:configurate-yaml:4.2.0-20250225.064233-199") implementation("org.spongepowered:configurate-core:4.2.0-20250225.064233-204") // Pinned dependency of above pinned yaml snapshot. -@@ -173,22 +_,24 @@ - runtimeOnly("com.mysql:mysql-connector-j:9.1.0") +@@ -191,24 +_,31 @@ + // Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed + runtimeOnly("commons-lang:commons-lang:2.6") + runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0") +- runtimeOnly("com.mysql:mysql-connector-j:9.2.0") ++ // DivineMC start - Bump dependencies ++ runtimeOnly("com.mysql:mysql-connector-j:9.2.0") { ++ exclude("com.google.protobuf", "protobuf-java") // exclude outdated version ++ } ++ runtimeOnly("com.google.protobuf:protobuf-java:4.30.1") ++ // DivineMC end - Bump dependencies runtimeOnly("com.lmax:disruptor:3.4.4") + implementation("com.googlecode.json-simple:json-simple:1.1.1") { // change to runtimeOnly once Timings is removed + isTransitive = false // includes junit + } -- implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur -- implementation("org.mozilla:rhino-engine:1.7.14") // Purpur -+ implementation("org.mozilla:rhino-runtime:1.7.15") // Purpur // DivineMC - Bump dependencies -+ implementation("org.mozilla:rhino-engine:1.7.15") // Purpur // DivineMC - Bump dependencies - implementation("dev.omega24:upnp4j:1.0") // Purpur +- runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") +- runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") +- runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") ++ // DivineMC start - Bump dependencies ++ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.9") ++ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.22") ++ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.22") ++ // DivineMC end - Bump dependencies - runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6") - runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18") - runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18") - -- testImplementation("io.github.classgraph:classgraph:4.8.47") // For mob goal test -- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") -- testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0") + testImplementation("io.github.classgraph:classgraph:4.8.179") // For mob goal test + testImplementation("org.junit.jupiter:junit-jupiter:5.12.2") + testImplementation("org.junit.platform:junit-platform-suite-engine:1.12.2") - testImplementation("org.hamcrest:hamcrest:2.2") - testImplementation("org.mockito:mockito-core:5.14.1") - mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Configure mockito agent that is needed in newer java versions -+ // DivineMC start - Bump dependencies -+ testImplementation("io.github.classgraph:classgraph:4.8.179") // For mob goal test -+ testImplementation("org.junit.jupiter:junit-jupiter:5.12.1") -+ testImplementation("org.junit.platform:junit-platform-suite-engine:1.12.1") -+ testImplementation("org.hamcrest:hamcrest:3.0") -+ testImplementation("org.mockito:mockito-core:5.16.1") -+ mockitoAgent("org.mockito:mockito-core:5.16.1") { isTransitive = false } // Configure mockito agent that is needed in newer java versions -+ // DivineMC end - Bump dependencies - testImplementation("org.ow2.asm:asm-tree:9.7.1") ++ testImplementation("org.hamcrest:hamcrest:3.0") // DivineMC - Bump dependencies ++ testImplementation("org.mockito:mockito-core:5.16.1") // DivineMC - Bump dependencies ++ mockitoAgent("org.mockito:mockito-core:5.16.1") { isTransitive = false } // Configure mockito agent that is needed in newer java versions // DivineMC - Bump dependencies + testImplementation("org.ow2.asm:asm-tree:9.8") - testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // CartesianTest + testImplementation("org.junit-pioneer:junit-pioneer:2.3.0") // CartesianTest // DivineMC - Bump dependencies implementation("net.neoforged:srgutils:1.0.9") // Mappings handling implementation("net.neoforged:AutoRenamingTool:2.0.3") // Remap plugins -@@ -204,30 +_,42 @@ - implementation("me.lucko:spark-paper:1.10.119-20241121.092015-1") +@@ -224,30 +_,42 @@ + implementation("me.lucko:spark-paper:1.10.133-20250413.112336-1") } -+// DivineMC start - hide irrelevant compilation warnings ++// DivineMC start - Hide irrelevant compilation warnings +tasks.withType { + val compilerArgs = options.compilerArgs + compilerArgs.add("-Xlint:-module") @@ -142,7 +148,7 @@ + compilerArgs.add("-Xlint:-dep-ann") + compilerArgs.add("--add-modules=jdk.incubator.vector") +} -+// DivineMC end - hide irrelevant compilation warnings ++// DivineMC end - Hide irrelevant compilation warnings + tasks.jar { manifest { @@ -155,22 +161,22 @@ val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash" val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim() val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() -+ val experimental = rootProject.providers.gradleProperty("experimental").get() ++ val experimental = rootProject.providers.gradleProperty("experimental").get() // DivineMC - Experimental flag attributes( "Main-Class" to "org.bukkit.craftbukkit.Main", - "Implementation-Title" to "Purpur", // Purpur -+ "Implementation-Title" to "DivineMC", // DivineMC ++ "Implementation-Title" to "DivineMC", // DivineMC - Rebrand "Implementation-Version" to implementationVersion, "Implementation-Vendor" to date, - "Specification-Title" to "Purpur", // Purpur -+ "Specification-Title" to "DivineMC", // DivineMC ++ "Specification-Title" to "DivineMC", // DivineMC - Rebrand "Specification-Version" to project.version, - "Specification-Vendor" to "Purpur Team", // Purpur - "Brand-Id" to "purpurmc:purpur", // Purpur - "Brand-Name" to "Purpur", // Purpur -+ "Specification-Vendor" to "BX Team", // DivineMC -+ "Brand-Id" to "bxteam:divinemc", // DivineMC -+ "Brand-Name" to "DivineMC", // DivineMC ++ "Specification-Vendor" to "BX Team", // DivineMC - Rebrand ++ "Brand-Id" to "bxteam:divinemc", // DivineMC - Rebrand ++ "Brand-Name" to "DivineMC", // DivineMC - Rebrand "Build-Number" to (build ?: ""), "Build-Time" to buildTime.toString(), "Git-Branch" to gitBranch, diff --git a/divinemc-server/minecraft-patches/features/0001-Rebrand.patch b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch index d36e881..1cfd6de 100644 --- a/divinemc-server/minecraft-patches/features/0001-Rebrand.patch +++ b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch @@ -18,10 +18,10 @@ index 394443d00e661715439be1e56dddc129947699a4..480ad57a6b7b74e6b83e9c6ceb69ea1f public CrashReport(String title, Throwable exception) { io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); // Paper diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 781030cb2e0316151c20351f04347c8db63f43e1..6bb8afb3b0e92c374474c92fa44dc7b80af0bd73 100644 +index 71d28092e0c3fe6e3ab284263f657eb12ba9dc60..4e347f56c98283485f7e279322c19f899e6fd569 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1182,6 +1182,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, AutoCl + // Paper end - add paper world config - public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files + public final org.bxteam.divinemc.DivineWorldConfig divineConfig; // DivineMC - Configuration - public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -898,6 +899,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public static @Nullable BlockPos lastPhysicsProblem; // Spigot + private int tileTickPosition; + public final Map explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions +@@ -885,6 +886,14 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), env); // Purpur - Purpur config files diff --git a/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch index 58707ba..f4fd526 100644 --- a/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch +++ b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Completely remove Mojang profiler diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc01d371f6 100644 +index 5e39795860916e8e88e1fde45f71693adee3df58..07e228b620962e507b7db70e5a743daf2e5c82ca 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java @@ -55,7 +55,6 @@ import net.minecraft.server.commands.CloneCommands; @@ -40,7 +40,7 @@ index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc ContextChain contextChain = this.finishParsing(parseResults, command, commandSourceStack, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { -@@ -394,8 +390,6 @@ public class Commands { +@@ -393,8 +389,6 @@ public class Commands { commandSourceStack.sendFailure(Component.literal(Util.describeError(var12))); LOGGER.error("'/{}' threw an exception", command, var12); } @@ -49,7 +49,7 @@ index d7922847bd398d809e8b8a31bf136c804305a32b..212d2bcfd34f7cb14e18a8af2cd296fc } } -@@ -452,7 +446,7 @@ public class Commands { +@@ -451,7 +445,7 @@ public class Commands { int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH)); int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); @@ -213,10 +213,10 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02 } } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed3994793a391 100644 +index 467f9af4446168134abd8d9ee1c4e6cc3479d73c..9956405d7f9d14af7278837adeede76dea8d4bd9 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil; +@@ -113,19 +113,8 @@ import net.minecraft.util.TimeUtil; import net.minecraft.util.debugchart.RemoteDebugSampleType; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.TpsDebugDimensions; @@ -236,7 +236,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.world.Difficulty; import net.minecraft.world.RandomSequences; -@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); @@ -250,7 +250,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 private ServerConnectionListener connection; public final ChunkProgressListenerFactory progressListenerFactory; @Nullable -@@ -1005,9 +987,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1608,10 +1574,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit // Paper start - Folia scheduler API -@@ -1726,9 +1684,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - Ridables @@ -431,7 +431,7 @@ index 6bb8afb3b0e92c374474c92fa44dc7b80af0bd73..4cb26cb312802ffc00426293014ed399 try { serverLevel.tick(hasTimeLeft); } catch (Throwable var7) { -@@ -1783,34 +1734,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop true); + this.chunkMap.tick(() -> true); - gameprofilerfiller.pop(); -- this.clearCache(); -- } -- // CraftBukkit end -- + this.clearCache(); + } + // CraftBukkit end + @Override public void tick(BooleanSupplier hasTimeLeft, boolean tickChunks) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("purge"); if (this.level.tickRateManager().runsNormally() || !tickChunks || this.level.spigotConfig.unloadFrozenChunks) { // Spigot - this.distanceManager.purgeStaleTickets(); + this.ticketStorage.purgeStaleTickets(); } this.runDistanceManagerUpdates(); @@ -1212,29 +1209,17 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 this.clearCache(); } -@@ -506,34 +484,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -511,22 +500,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon long l = gameTime - this.lastInhabitedUpdate; this.lastInhabitedUpdate = gameTime; if (!this.level.isDebug()) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("pollingChunks"); if (this.level.tickRateManager().runsNormally()) { - List list = this.tickingChunks; - - try { -- profilerFiller.push("filteringTickingChunks"); - this.collectTickingChunks(list); -- profilerFiller.popPush("shuffleChunks"); - // Paper start - chunk tick iteration optimisation - this.shuffleRandom.setSeed(this.level.random.nextLong()); - if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled - // Paper end - chunk tick iteration optimisation -- this.tickChunks(profilerFiller, l, list); -- profilerFiller.pop(); -+ this.tickChunks(l, list); - } finally { - list.clear(); - } +- profilerFiller.push("tickingChunks"); +- this.tickChunks(profilerFiller, l); +- profilerFiller.pop(); ++ this.tickChunks(l); } - this.broadcastChangedChunks(profilerFiller); @@ -1250,25 +1235,20 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) { LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system if (tickingChunk != null) { -@@ -542,7 +512,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -535,11 +517,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } this.chunkHoldersToBroadcast.clear(); - profiler.pop(); } - private void collectTickingChunks(List output) { -@@ -568,8 +537,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - // Paper end - chunk tick iteration optimisation - } - -- private void tickChunks(ProfilerFiller profiler, long timeInhabited, List chunks) { +- private void tickChunks(ProfilerFiller profiler, long timeInhabited) { - profiler.popPush("naturalSpawnCount"); -+ private void tickChunks(long timeInhabited, List chunks) { ++ private void tickChunks(long timeInhabited) { int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; -@@ -594,7 +562,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -564,7 +544,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - Optional per player mob spawns this.lastSpawnState = spawnState; @@ -1276,15 +1256,33 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); List filteredSpawningCategories; -@@ -625,7 +592,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - } +@@ -586,14 +565,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + List list = this.spawningChunks; + + try { +- profiler.push("filteringSpawningChunks"); + this.chunkMap.collectSpawningChunks(list); +- profiler.popPush("shuffleSpawningChunks"); + // Paper start - chunk tick iteration optimisation + this.shuffleRandom.setSeed(this.level.random.nextLong()); + if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) Util.shuffle(list, this.shuffleRandom); // Paper - Optional per player mob spawns; do not need this when per-player is enabled + // Paper end - chunk tick iteration optimisation +- profiler.popPush("tickSpawningChunks"); + + for (LevelChunk levelChunk : list) { + this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); +@@ -602,10 +578,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + list.clear(); } +- profiler.popPush("tickTickingChunks"); + this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations +- profiler.pop(); - profiler.popPush("customSpawners"); if (_boolean) { this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); } -@@ -814,7 +780,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -814,7 +787,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @Override protected void doRunTask(Runnable task) { @@ -1293,19 +1291,19 @@ index 6540b2d6a1062d883811ce240c49d30d1925b291..8055b8552b40160732953b15876dda79 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da78ecc6020 100644 +index d8a8e6d006d18de5ec148a0d9d6f08a6a40a65bb..2bb5055f2fb1e8b95b2a5d8dba5f1fa0bb5fdec7 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -77,8 +77,6 @@ import net.minecraft.util.ProgressListener; +@@ -74,8 +74,6 @@ import net.minecraft.util.Mth; + import net.minecraft.util.ProgressListener; import net.minecraft.util.RandomSource; - import net.minecraft.util.Unit; import net.minecraft.util.datafix.DataFixTypes; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; -@@ -735,16 +733,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -725,16 +723,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void tick(BooleanSupplier hasTimeLeft) { @@ -1322,7 +1320,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); -@@ -778,41 +772,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -768,41 +762,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.tickTime(); } @@ -1338,7 +1336,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - profilerFiller.popPush("raid"); if (runsNormally) { - this.raids.tick(); + this.raids.tick(this); } - profilerFiller.popPush("chunkSource"); @@ -1350,7 +1348,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 this.handlingTick = false; - profilerFiller.pop(); - boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this if (flag) { this.resetEmptyTime(); } @@ -1364,7 +1362,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR -@@ -821,9 +804,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -811,9 +794,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity -> { if (!entity.isRemoved()) { if (!tickRateManager.isEntityFrozen(entity)) { @@ -1374,7 +1372,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 if (true) { // Paper - rewrite chunk system Entity vehicle = entity.getVehicle(); if (vehicle != null) { -@@ -834,21 +815,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -824,21 +805,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.stopRiding(); } @@ -1396,7 +1394,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 } @Override -@@ -863,9 +838,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -853,9 +828,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (this.tickTime) { long l = this.levelData.getGameTime() + 1L; this.serverLevelData.setGameTime(l); @@ -1405,26 +1403,17 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - Profiler.get().pop(); if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { // Purpur start - Configurable daylight cycle - int incrementTicks = isDay() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -@@ -966,8 +939,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - boolean isRaining = this.isRaining(); + int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; +@@ -955,8 +928,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + ChunkPos pos = chunk.getPos(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); - ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("thunder"); - if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && simpleRandom.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder // Paper - optimise random ticking - BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); - if (this.isRainingAt(blockPos)) { -@@ -1002,8 +973,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - } - } +- profilerFiller.push("iceandsnow"); -- profilerFiller.popPush("iceandsnow"); -- if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int i = 0; i < randomTickSpeed; i++) { - if (simpleRandom.nextInt(48) == 0) { // Paper - optimise random ticking -@@ -1012,12 +981,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -966,12 +937,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } // Paper - Option to disable ice and snow @@ -1436,8 +1425,26 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 - profilerFiller.pop(); } + public void tickThunder(LevelChunk chunk) { +@@ -979,8 +947,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + boolean isRaining = this.isRaining(); + int minBlockX = pos.getMinBlockX(); + int minBlockZ = pos.getMinBlockZ(); +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("thunder"); + if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder + BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); + if (this.isRainingAt(blockPos)) { +@@ -1014,8 +980,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + } + } +- +- profilerFiller.pop(); + } + @VisibleForTesting -@@ -1356,17 +1322,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1355,17 +1319,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - log detailed entity tick information entity.setOldPosAndRot(); @@ -1455,7 +1462,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 -@@ -1387,9 +1349,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1386,9 +1346,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe passengerEntity.setOldPosAndRot(); passengerEntity.tickCount++; passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities @@ -1465,7 +1472,7 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 // Paper start - EAR 2 if (isActive) { passengerEntity.rideTick(); -@@ -1401,7 +1360,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1400,7 +1357,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ridingEntity.positionRider(passengerEntity); } // Paper end - EAR 2 @@ -1474,10 +1481,10 @@ index eb6286d34a68bf6eb57877a9cfc2be09615c7e83..f4b1f45f1dc86bd077860f088cdd6da7 for (Entity entity : passengerEntity.getPassengers()) { this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2 diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0 100644 +index 55d02c1d8c4cbea2eecd82b4fdf0f609647273cb..30c6bdbcd2e33e384f4d6b67e03e7a0acad2a464 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -96,8 +96,6 @@ import net.minecraft.tags.FluidTags; +@@ -104,8 +104,6 @@ import net.minecraft.util.HashOps; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -1486,7 +1493,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; -@@ -1466,14 +1464,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1410,14 +1408,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.unsetRemoved(); */ // CraftBukkit end @@ -1501,7 +1508,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d // CraftBukkit start this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds LevelData worlddata = level.getLevelData(); -@@ -1491,7 +1485,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1435,7 +1429,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event this.connection.resetPosition(); level.addDuringTeleport(this); @@ -1510,7 +1517,7 @@ index a9f723528dd05cb9583319edcb14143b784a2fd7..21d41b477cc0e8d2476d1e3141bdf23d this.stopUsingItem(); this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9 100644 +index 66d70c330fd70009018d8d0a7441b93fcef96c97..b865c2fd503c3f0368d77d28c2f7a7c7fa7008bb 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -24,7 +24,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; @@ -1521,7 +1528,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 import org.slf4j.Logger; public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, org.bukkit.craftbukkit.entity.CraftPlayer.TransferCookieConnection { // CraftBukkit -@@ -256,7 +255,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -255,7 +254,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } protected void keepConnectionAlive() { @@ -1529,7 +1536,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 long millis = Util.getMillis(); // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings // This should effectively place the keepalive handling back to "as it was" before 1.12.2 -@@ -290,8 +288,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -289,8 +287,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack this.send(new ClientboundKeepAlivePacket(this.keepAliveChallenge)); } } @@ -1539,7 +1546,7 @@ index c089a01765945277aafc62cb3566d81162c40c1d..801dd76a2c7f76fc6fdb7167cbf3ab13 private boolean checkIfClosed(long time) { diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index 71a4a0b8535a21667261fd66d41cca1216fd9933..1e9edae4708e1b2c282a13bd6a74f71ec4116895 100644 +index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af90df14cb5 100644 --- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java @@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit; @@ -1551,15 +1558,16 @@ index 71a4a0b8535a21667261fd66d41cca1216fd9933..1e9edae4708e1b2c282a13bd6a74f71e import org.slf4j.Logger; public class ProfiledReloadInstance extends SimpleReloadInstance { -@@ -51,12 +49,9 @@ public class ProfiledReloadInstance extends SimpleReloadInstance executor.execute(() -> { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push(name); long nanos = Util.getNanos(); runnable.run(); timeTaken.addAndGet(Util.getNanos() - nanos); + timesRun.incrementAndGet(); - profilerFiller.pop(); }); } @@ -1640,10 +1648,10 @@ index 64b0508ef21952c65b0b967b756b2a4c64d96899..9682d64983d43f3c0142565e0cbb06f9 } diff --git a/net/minecraft/util/profiling/ActiveProfiler.java b/net/minecraft/util/profiling/ActiveProfiler.java deleted file mode 100644 -index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..0000000000000000000000000000000000000000 +index 365995455c5e076f145063ab9415b89139f76393..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ActiveProfiler.java +++ /dev/null -@@ -1,206 +0,0 @@ +@@ -1,207 +0,0 @@ -package net.minecraft.util.profiling; - -import com.google.common.collect.Lists; @@ -1659,6 +1667,7 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 -import java.util.List; -import java.util.Map; -import java.util.Set; +-import java.util.function.BooleanSupplier; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; -import java.util.function.Supplier; @@ -1682,15 +1691,15 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 - private boolean started; - @Nullable - private ActiveProfiler.PathEntry currentEntry; -- private final boolean warn; +- private final BooleanSupplier suppressWarnings; - private final Set> chartedPaths = new ObjectArraySet<>(); - -- public ActiveProfiler(LongSupplier startTimeNano, IntSupplier startTimeTicks, boolean warn) { -- this.startTimeNano = startTimeNano.getAsLong(); -- this.getRealTime = startTimeNano; -- this.startTimeTicks = startTimeTicks.getAsInt(); -- this.getTickTime = startTimeTicks; -- this.warn = warn; +- public ActiveProfiler(LongSupplier getRealTime, IntSupplier getTickTime, BooleanSupplier supressWarnings) { +- this.startTimeNano = getRealTime.getAsLong(); +- this.getRealTime = getRealTime; +- this.startTimeTicks = getTickTime.getAsInt(); +- this.getTickTime = getTickTime; +- this.suppressWarnings = supressWarnings; - } - - @Override @@ -1763,7 +1772,7 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 - currentEntry.count++; - currentEntry.maxDuration = Math.max(currentEntry.maxDuration, l1); - currentEntry.minDuration = Math.min(currentEntry.minDuration, l1); -- if (this.warn && l1 > WARNING_TIME_NANOS) { +- if (l1 > WARNING_TIME_NANOS && !this.suppressWarnings.getAsBoolean()) { - LOGGER.warn( - "Something's taking too long! '{}' took aprox {} ms", - LogUtils.defer(() -> ProfileResults.demanglePath(this.path)), @@ -1852,23 +1861,26 @@ index 595e0fd9bf08bcb8358bce2a46d4322f1394e7cb..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/ContinuousProfiler.java b/net/minecraft/util/profiling/ContinuousProfiler.java deleted file mode 100644 -index e96949cc279aeb4ef670ec07b6ec2407da2f68bd..0000000000000000000000000000000000000000 +index 553638f3140f2e0f2892adbf082b3af415424550..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ContinuousProfiler.java +++ /dev/null -@@ -1,35 +0,0 @@ +@@ -1,38 +0,0 @@ -package net.minecraft.util.profiling; - +-import java.util.function.BooleanSupplier; -import java.util.function.IntSupplier; -import java.util.function.LongSupplier; - -public class ContinuousProfiler { - private final LongSupplier realTime; - private final IntSupplier tickCount; +- private final BooleanSupplier suppressWarnings; - private ProfileCollector profiler = InactiveProfiler.INSTANCE; - -- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickCount) { +- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickTime, BooleanSupplier supressWarnings) { - this.realTime = realTime; -- this.tickCount = tickCount; +- this.tickCount = tickTime; +- this.suppressWarnings = supressWarnings; - } - - public boolean isEnabled() { @@ -1880,7 +1892,7 @@ index e96949cc279aeb4ef670ec07b6ec2407da2f68bd..00000000000000000000000000000000 - } - - public void enable() { -- this.profiler = new ActiveProfiler(this.realTime, this.tickCount, true); +- this.profiler = new ActiveProfiler(this.realTime, this.tickCount, this.suppressWarnings); - } - - public ProfilerFiller getFiller() { @@ -2687,7 +2699,7 @@ index 82aef3d962e8ee6bb9c49a5655a5db49c331b022..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/SingleTickProfiler.java b/net/minecraft/util/profiling/SingleTickProfiler.java deleted file mode 100644 -index 6ead9eb534103a001427ee5bec84cebe7ae97162..0000000000000000000000000000000000000000 +index 33b323b78b8210afeac1f592d36d03bf9c907a1d..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/SingleTickProfiler.java +++ /dev/null @@ -1,50 +0,0 @@ @@ -2715,7 +2727,7 @@ index 6ead9eb534103a001427ee5bec84cebe7ae97162..00000000000000000000000000000000 - } - - public ProfilerFiller startTick() { -- this.profiler = new ActiveProfiler(this.realTime, () -> this.tick, false); +- this.profiler = new ActiveProfiler(this.realTime, () -> this.tick, () -> true); - this.tick++; - return this.profiler; - } @@ -3329,7 +3341,7 @@ index 4cfaf358f9d7d07c8d58dc152a1c85d6c7824d57..00000000000000000000000000000000 -import net.minecraft.MethodsReturnNonnullByDefault; diff --git a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java b/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java deleted file mode 100644 -index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..0000000000000000000000000000000000000000 +index b26c1f0f07b38a3da8d81af915e8043d55d5060f..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/metrics/profiling/ActiveMetricsRecorder.java +++ /dev/null @@ -1,168 +0,0 @@ @@ -3390,13 +3402,13 @@ index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..00000000000000000000000000000000 - ) { - this.metricsSamplerProvider = metricsSamplerProvider; - this.wallTimeSource = wallTimeSource; -- this.taskProfiler = new ContinuousProfiler(wallTimeSource, () -> this.currentTick); +- this.taskProfiler = new ContinuousProfiler(wallTimeSource, () -> this.currentTick, () -> false); - this.ioExecutor = ioExecutor; - this.metricsPersister = metricPersister; - this.onProfilingEnd = onProfilerEnd; - this.onReportFinished = globalOnReportFinished == null ? onReportFinished : onReportFinished.andThen(globalOnReportFinished); - this.deadlineNano = wallTimeSource.getAsLong() + TimeUnit.NANOSECONDS.convert(10L, TimeUnit.SECONDS); -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); +- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, () -> true); - this.taskProfiler.enable(); - } - @@ -3452,7 +3464,7 @@ index 0cb8ee7b629cb3db348d4c050a63a79fbdcc99b2..00000000000000000000000000000000 - } - - if (!this.killSwitch && this.wallTimeSource.getAsLong() <= this.deadlineNano) { -- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, false); +- this.singleTickProfiler = new ActiveProfiler(this.wallTimeSource, () -> this.currentTick, () -> true); - } else { - this.killSwitch = false; - ProfileResults results = this.taskProfiler.getResults(); @@ -3996,10 +4008,10 @@ index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503 @Override diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616619e4bd1 100644 +index 5b0a4ef4ae5a762432dbb0def005f7505197445e..d513b82c0681fdc990af082af69278bd773225a9 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -78,8 +78,6 @@ import net.minecraft.tags.FluidTags; +@@ -82,8 +82,6 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -4008,7 +4020,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; -@@ -857,8 +855,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -844,8 +842,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end public void baseTick() { @@ -4017,7 +4029,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -921,8 +917,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -902,8 +898,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); } @@ -4026,7 +4038,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } public void setSharedFlagOnFire(boolean isOnFire) { -@@ -1141,8 +1135,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1124,8 +1118,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } @@ -4035,7 +4047,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { movement = movement.multiply(this.stuckSpeedMultiplier); this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1151,7 +1143,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1134,7 +1126,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Paper start - ignore movement changes while inactive. if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); @@ -4043,8 +4055,8 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return; } // Paper end -@@ -1173,8 +1164,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setPos(this.getX() + vec3.x, this.getY() + vec3.y, this.getZ() + vec3.z); +@@ -1169,8 +1160,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.setPos(vec31); } - profilerFiller.pop(); @@ -4052,7 +4064,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 boolean flag = !Mth.equal(movement.x, vec3.x); boolean flag1 = !Mth.equal(movement.z, vec3.z); this.horizontalCollision = flag || flag1; -@@ -1197,7 +1186,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1193,7 +1182,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (this.isRemoved()) { @@ -4061,7 +4073,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } else { if (this.horizontalCollision) { Vec3 deltaMovement = this.getDeltaMovement(); -@@ -1242,7 +1231,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1237,7 +1226,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess float blockSpeedFactor = this.getBlockSpeedFactor(); this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); @@ -4069,7 +4081,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } } // Paper start - detailed watchdog information -@@ -3325,8 +3313,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3257,8 +3245,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { @@ -4078,7 +4090,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 this.setPortalCooldown(); TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); if (portalDestination != null) { -@@ -3336,8 +3322,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3268,8 +3254,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.teleport(portalDestination); } } @@ -4087,7 +4099,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -3857,15 +3841,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3824,15 +3808,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); } @@ -4103,7 +4115,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return this; } -@@ -3881,11 +3862,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3848,11 +3829,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } @@ -4115,7 +4127,7 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 return null; } else { // Paper start - Fix item duplication and teleport issues -@@ -3908,7 +3886,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3871,7 +3849,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess level.resetEmptyTime(); teleportTransition.postTeleportTransition().onTransition(entityx); @@ -4124,10 +4136,10 @@ index 3709efe15b30e4140ba677ffdcd4634b06e34d7d..4c4bed85db28d92ca55593a19ac23616 } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef83480464d 100644 +index b427d3283a6c197203ab0ffed902bca33e0e0017..352421829e24284e4832a168c278233b780a58a2 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -72,8 +72,6 @@ import net.minecraft.tags.FluidTags; +@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4136,7 +4148,7 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.CombatRules; -@@ -448,8 +446,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -420,8 +418,6 @@ public abstract class LivingEntity extends Entity implements Attackable { } super.baseTick(); @@ -4145,45 +4157,46 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 if (this.fireImmune() || this.level().isClientSide) { this.clearFire(); } -@@ -565,7 +561,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.yHeadRotO = this.yHeadRot; +@@ -512,7 +508,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.yBodyRotO = this.yBodyRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); - profilerFiller.pop(); } @Override -@@ -3260,11 +3255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3305,11 +3300,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + f1 = this.getYRot(); } - this.run = this.run + (f3 - this.run) * 0.3F; - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("headTurn"); - f2 = this.tickHeadTurn(f1, f2); + this.tickHeadTurn(f1); - profilerFiller.pop(); - profilerFiller.push("rangeChecks"); // Paper start - stop large pitch and yaw changes from crashing the server this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3275,7 +3266,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - +@@ -3321,7 +3312,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; + // Paper end - stop large pitch and yaw changes from crashing the server - profilerFiller.pop(); - this.animStep += f2; if (this.isFallFlying()) { this.fallFlyTicks++; -@@ -3487,20 +3477,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + } else { +@@ -3497,21 +3487,15 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.setDeltaMovement(d, d1, d2); - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("ai"); + this.applyInput(); if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; this.zza = 0.0F; - } else if (this.isEffectiveAi()) { + } else if (this.isEffectiveAi() && !this.level().isClientSide) { - profilerFiller.push("newAi"); this.serverAiStep(); - profilerFiller.pop(); @@ -4194,29 +4207,33 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 if (this.jumping && this.isAffectedByFluids()) { double fluidHeight; if (this.isInLava()) { -@@ -3529,8 +3513,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3540,8 +3524,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.noJumpDelay = 0; } - profilerFiller.pop(); - profilerFiller.push("travel"); - this.xxa *= 0.98F; - this.zza *= 0.98F; if (this.isFallFlying()) { -@@ -3554,8 +3536,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.updateFallFlying(); } - - this.calculateEntityAnimation(this instanceof FlyingAnimal); -- profilerFiller.pop(); -- profilerFiller.push("freezing"); - if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API - int ticksFrozen = this.getTicksFrozen(); - if (this.isInPowderSnow && this.canFreeze()) { -@@ -3571,15 +3551,12 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); +@@ -3566,9 +3548,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.calculateEntityAnimation(this instanceof FlyingAnimal); } - profilerFiller.pop(); + if (this.level() instanceof ServerLevel serverLevel) { +- profilerFiller.push("freezing"); + if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API + this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2)); + } +@@ -3578,18 +3558,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { + this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); + } +- +- profilerFiller.pop(); + } + - profilerFiller.push("push"); if (this.autoSpinAttackTicks > 0) { this.autoSpinAttackTicks--; @@ -4229,19 +4246,19 @@ index e7f1be39ecc532e83d9099e81a2dfd8ed5f0df7d..04a1c17a34b495b71eb1b0ccd597cef8 // Purpur start - Ridables if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701c0873c73 100644 +index e9344f61a943d610dfabe4918c227ddba166f17f..5bcbebf35eb726a43b957aca5b8b7a1dca7648cd 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -33,8 +33,6 @@ import net.minecraft.sounds.SoundEvent; +@@ -30,8 +30,6 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; -@@ -331,14 +329,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -318,14 +316,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void baseTick() { super.baseTick(); @@ -4256,7 +4273,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan } -@@ -642,8 +637,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -513,8 +508,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void aiStep() { super.aiStep(); @@ -4265,7 +4282,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 if (this.level() instanceof ServerLevel serverLevel && this.canPickUpLoot() && this.isAlive() -@@ -666,8 +659,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -537,8 +530,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } } @@ -4274,7 +4291,7 @@ index bc22d67bba9b1ebb6bef84f5326375100d24461d..66f3565b978f2ed91cb2bc3a816f1701 } protected Vec3i getPickupReach() { -@@ -882,42 +873,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -748,42 +739,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return; } // Paper end - Allow nerfed mobs to jump and float @@ -4372,7 +4389,7 @@ index a927c2790c8ab9ccaa7161b970e10b0b44817dd8..b816b2de8eb327060ca6ea7c4afc1737 public Set getAvailableGoals() { diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index b44f2c49509d847817a78e9c4fb1499fb378054b..6c8fb611943aee8cabc471c63166f9b44ef14826 100644 +index 06389019deba08c7c0966affcdc90512c88db3d5..6bbdfc748f1ce66689c63424fadcf261b1e967b3 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i; @@ -4423,10 +4440,10 @@ index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f this.seen.add(id); } else { diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2cabf22ca12 100644 +index 062f2ca0c8f2443cf890dc917b9de46310eb79bc..29c22b464705f1b50ec0e423c5df40d8f21e57b7 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -30,8 +30,6 @@ import net.minecraft.tags.GameEventTags; +@@ -29,8 +29,6 @@ import net.minecraft.tags.GameEventTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4435,7 +4452,7 @@ index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2ca import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.SimpleContainer; -@@ -288,14 +286,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -284,14 +282,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { @@ -4451,10 +4468,10 @@ index 22e0fad86da2e7b932863ef30182355aa41424a1..b2c9da89ae6044536f4996fdbd37e2ca } diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc666862701516 100644 +index 0b4d1e6633ecc2e11606024d085bb9e6cca5a86b..aea96e036846c66d411fdea55fbbf0efb60d467d 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap; +@@ -24,8 +24,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.util.TimeUtil; @@ -4463,7 +4480,7 @@ index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc6668 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -165,13 +163,8 @@ public class Armadillo extends Animal { +@@ -166,13 +164,8 @@ public class Armadillo extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4478,10 +4495,10 @@ index 90bcd8c79cccbcbe7ff3fd2534e0c3450b970bd4..a24ed1747fb8836927ac41b822dc6668 this.forceDrops = true; // CraftBukkit if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de743558fefd622 100644 +index c5aac98efa518696381b4018b3504ebb323bb6b4..0b787911c929f1564d859dcba1ee04510b4a9b7f 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -26,8 +26,6 @@ import net.minecraft.util.ByIdMap; +@@ -31,8 +31,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; @@ -4490,7 +4507,7 @@ index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de74355 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -348,14 +346,9 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -373,14 +371,9 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { @@ -4506,19 +4523,19 @@ index eb74d8313fd3cc15a33330fe7bafaca4f0a5a368..bbfe48fd278cda9926793d0d2de74355 Optional memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); this.setPlayingDead(memory.isPresent() && memory.get() > 0); diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java -index 1d7ae2a08968860636918e7c66b60139a9d761b4..64ff0d2923f16a567aa753cad028a1b21c20101b 100644 +index 344edef98e13831d1238e5ae155d81b13126a696..101931ff4474ab4445be3fa1a241a731ad3ac1da 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -17,8 +17,6 @@ import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.BlockTags; +@@ -19,8 +19,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; + import net.minecraft.util.RandomSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -159,14 +157,9 @@ public class Camel extends AbstractHorse { +@@ -171,14 +169,9 @@ public class Camel extends AbstractHorse { @Override protected void customServerAiStep(ServerLevel level) { @@ -4534,10 +4551,10 @@ index 1d7ae2a08968860636918e7c66b60139a9d761b4..64ff0d2923f16a567aa753cad028a1b2 } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a818c2859b4 100644 +index 71c09b9b8cc66d1a6f557a685539f9f4c93c0b8b..eb3aa96b2a5cb553b016744863818186d1d831c4 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags; +@@ -29,8 +29,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4546,7 +4563,7 @@ index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a81 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; -@@ -243,14 +241,9 @@ public class Frog extends Animal implements VariantHolder> { +@@ -260,14 +258,9 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4562,7 +4579,7 @@ index 143a740ce2e7f9d384b71b4d64e8b8218f60cba7..4aabb98e0b37b652ad4d334b99c48a81 } diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d2106a928b8f 100644 +index 4db2d63fbc021f28b8ad8d20cc1cc1bb257b057f..63645451495dffd87362fd37cf91a90717ae4470 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4574,7 +4591,7 @@ index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d210 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -134,14 +132,9 @@ public class Tadpole extends AbstractFish { +@@ -135,14 +133,9 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { @@ -4590,7 +4607,7 @@ index e888e606b4b14fa6485de7426bc146b6005962af..78d256f6a95acb367efd690bc368d210 } diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975158cafc3 100644 +index 5eb656a33cb6ca8a93125c27cd7db175d35b80c3..6029051a7bade2eb412d7ec4957a4361e7e575b1 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java @@ -21,8 +21,6 @@ import net.minecraft.tags.ItemTags; @@ -4602,7 +4619,7 @@ index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -224,14 +222,9 @@ public class Goat extends Animal { +@@ -227,14 +225,9 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4618,7 +4635,7 @@ index 6f106f10466440f8e65e04511f67d48f082d703f..9b8f5d9926d68fd8b9f1f976e0be0975 } diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 11a5da22149a61ca48bbb0a8ed10b71e91a5cc98..68751f7ed123c3e99f56259ccc23121661f89bc1 100644 +index a21604d3ff3377946cbcbd57ddfa1cbb7e84dac6..0565b37dd5320b49efb11cf28f064d6a970048aa 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags; @@ -4644,7 +4661,7 @@ index 11a5da22149a61ca48bbb0a8ed10b71e91a5cc98..68751f7ed123c3e99f56259ccc231216 } diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java -index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33dc5142237 100644 +index bdf52bfe661d4c0ad6c5a28254302f8f0021c09b..743946e69af541f6d5fe626108c70f96fe7fce65 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java @@ -15,8 +15,6 @@ import net.minecraft.network.syncher.SynchedEntityData; @@ -4656,7 +4673,7 @@ index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33d import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; -@@ -287,11 +285,8 @@ public class Zoglin extends Monster implements HoglinBase { +@@ -288,11 +286,8 @@ public class Zoglin extends Monster implements HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -4669,7 +4686,7 @@ index d2a67f3e1c971f737e58567dae23fa70e9d942ea..ee59cf42db965296e6e8d4aa4ec7b33d } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java -index 23dff1d01387ce89b020aa93de99e6ef557c04e3..fb643596bd5fb12e4cd323706f51a479d78a5455 100644 +index c12653070d62c44b97a07676f24caf7ab570cd2a..d91ce14cc39b1b6ccd558f53ed605d4c6a5acae5 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java @@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent; @@ -4695,10 +4712,10 @@ index 23dff1d01387ce89b020aa93de99e6ef557c04e3..fb643596bd5fb12e4cd323706f51a479 } diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java -index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebddb84b137d 100644 +index d19f34616942177e736ba507c27ec93ba1e1e903..c9404d72de59e18dc809b8dec107f1f23d50f441 100644 --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -18,8 +18,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -17,8 +17,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -4707,7 +4724,7 @@ index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebdd import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; -@@ -234,10 +232,7 @@ public class Creaking extends Monster { +@@ -235,10 +233,7 @@ public class Creaking extends Monster { @Override protected void customServerAiStep(ServerLevel level) { @@ -4719,7 +4736,7 @@ index 887a81ea82b86edceaa46eb2032f53fccb84e158..2c6833753950f1bb0941b0cbe54bebdd } diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7962e8027 100644 +index 252a6469cab202bcc612b4d52a5027c615029a21..0644f425cddebe8e5a65e69acae57db867380981 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -16,8 +16,6 @@ import net.minecraft.sounds.SoundEvents; @@ -4731,7 +4748,7 @@ index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -204,11 +202,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -207,11 +205,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -4744,7 +4761,7 @@ index 28f3bc31b4c093e426ae141edeee61a12a444ba1..a5ee49e35b0825c03af058347ee189a7 if (this.isConverting()) { this.timeInOverworld++; diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a 100644 +index 54ab9593b39051d47f1dd8bddf210064768382be..73049e486fbf8411819551b43e3ca641ed7a5578 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -17,8 +17,6 @@ import net.minecraft.tags.ItemTags; @@ -4756,7 +4773,7 @@ index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -383,11 +381,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -358,11 +356,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { @@ -4769,7 +4786,7 @@ index f0d78cf5fe2c39add9a673471103c352cce72a45..b2e64c0d4c1943f8a50a03ba59318fc2 super.customServerAiStep(level); } diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index 4984b9864b63f92bc939b530253e871ca94a3277..460dace4818605ecd5409be887013713f06442a5 100644 +index 70ee15527fa6f30783d6a58bb767b18124f25c53..c4eb58d0b0c51e930f9cb72e1de0103902badba7 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java @@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4794,10 +4811,10 @@ index 4984b9864b63f92bc939b530253e871ca94a3277..460dace4818605ecd5409be887013713 PiglinBruteAi.maybePlayActivitySound(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c7984442538 100644 +index 8d61d5347896481f250a18d04d17fd4d2088f633..60a8d79306755e9483ba9e93a07939b73ad717fe 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -32,8 +32,6 @@ import net.minecraft.tags.TagKey; +@@ -31,8 +31,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4806,7 +4823,7 @@ index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c79 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; -@@ -308,10 +306,7 @@ public class Warden extends Monster implements VibrationSystem { +@@ -305,10 +303,7 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { @@ -4818,10 +4835,10 @@ index f968e5c99bdb23b268bc34ea1ba5d54ae9ad0ff9..e4b8a74fae6d058a9a75a12d2ff08c79 if ((this.tickCount + this.getId()) % 120 == 0) { applyDarknessAround(level, this.position(), this, 20); diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86a1586221 100644 +index 5b52bbac242a7fbb8eaea7e41b7265a1a859ff7c..a08818450ed6fd78bb429743ee044726fc7994e7 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -35,8 +35,6 @@ import net.minecraft.stats.Stats; +@@ -36,8 +36,6 @@ import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.SpawnUtil; @@ -4830,7 +4847,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; -@@ -390,8 +388,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -393,8 +391,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } protected void customServerAiStep(ServerLevel level, boolean inactive) { // Purpur - Lobotomize stuck villagers - not final // Paper end - EAR 2 @@ -4839,7 +4856,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 // Purpur start - Lobotomize stuck villagers if (this.level().purpurConfig.villagerLobotomizeEnabled) { // treat as inactive if lobotomized -@@ -406,7 +402,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -409,7 +405,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers // Pufferfish end @@ -4848,7 +4865,7 @@ index 16fbe4e6521cd4f6baa8f5dd590da0fc749f6585..fec90e482c8935dfca609bbf90e67f86 this.assignProfessionWhenSpawned = false; } diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index 70eb3f84da8f0c962eaa52998ded69fcfae2f197..c7d91a38fc3b5cf2487e09719a1f9bc39ca5d20e 100644 +index b857e811b4b7a25eaec6dceaae5528d2ec0a1c45..bf69cef9b8ade11a1c08199cdd6c723e5a78c078 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java @@ -28,7 +28,6 @@ import net.minecraft.server.level.ServerLevel; @@ -4878,7 +4895,7 @@ index 70eb3f84da8f0c962eaa52998ded69fcfae2f197..c7d91a38fc3b5cf2487e09719a1f9bc3 LOGGER.info("Loaded {} recipes", object.values().size()); } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d07006c41deca 100644 +index 38ddadf551c039202c68c44d740f23a08b58d003..2e90bb96ed90f3debbe5803856ed41a5c08003f8 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer; @@ -4890,7 +4907,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; import net.minecraft.world.damagesource.DamageSource; -@@ -267,7 +265,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -254,7 +252,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { @@ -4898,7 +4915,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -277,7 +274,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -264,7 +261,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { @@ -4906,7 +4923,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); -@@ -1513,8 +1509,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1498,8 +1494,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl } protected void tickBlockEntities() { @@ -4915,7 +4932,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 this.tickingBlockEntities = true; if (!this.pendingBlockEntityTickers.isEmpty()) { this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); -@@ -1545,7 +1539,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1529,7 +1523,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 this.tickingBlockEntities = false; @@ -4923,7 +4940,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 this.spigotConfig.currentPrimedTnt = 0; // Spigot } -@@ -1804,7 +1797,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1788,7 +1781,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -4931,7 +4948,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -1833,8 +1825,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1817,8 +1809,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public void getEntities(final EntityTypeTest entityTypeTest, final AABB boundingBox, final Predicate predicate, final List into, final int maxCount) { @@ -4941,7 +4958,7 @@ index b4c2602ecf6b943ab022866231f74b850269af8f..0c58919e8242317ba276e103b81d0700 if (maxCount != Integer.MAX_VALUE) { ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount); diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf55e749e43 100644 +index fa06ecacc27f619853c8db76d909ab4ba75dc529..345d4b80bd4383e0fb66d744d87bc8ef4100fd32 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java @@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags; @@ -4950,10 +4967,10 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 import net.minecraft.util.VisibleForDebug; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.util.random.WeightedRandomList; + import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; -@@ -158,9 +156,6 @@ public final class NaturalSpawner { +@@ -152,9 +150,6 @@ public final class NaturalSpawner { } public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List categories) { @@ -4963,7 +4980,7 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -195,8 +190,6 @@ public final class NaturalSpawner { +@@ -189,8 +184,6 @@ public final class NaturalSpawner { // Paper end - Optional per player mob spawns } } @@ -4973,7 +4990,7 @@ index 8aeeeffae50b3ec68ab972e793bb5edb4530ca78..d3f5242fc66529bf3137da4d505a6cf5 // Paper start - Add mobcaps commands diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e0e3239fe 100644 +index 6cbb5e923d9cc79090ec00bbe173a298ed674dbe..a772f2bd7be00172ad41353c6ad42d9239b9ec88 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java @@ -13,8 +13,6 @@ import net.minecraft.Util; @@ -4985,7 +5002,7 @@ index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -@@ -682,10 +680,7 @@ public class ServerExplosion implements Explosion { +@@ -671,10 +669,7 @@ public class ServerExplosion implements Explosion { List list = this.calculateExplodedPositions(); this.hurtEntities(); if (this.interactsWithBlocks()) { @@ -4997,7 +5014,7 @@ index 278761647a6095581f8d8ff4f94ccc28b6e9c8a7..6bddf42504039f2be5eb9a5a35a0835e if (this.fire) { diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290af1bd1cb0 100644 +index 3829e02fcdd7c6b101157d3bc187cd1d2016b770..04942e23dd2bc82e4c60110756beedb5e0f074d7 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -23,8 +23,6 @@ import net.minecraft.network.FriendlyByteBuf; @@ -5009,7 +5026,7 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -@@ -393,12 +391,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -390,12 +388,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } if (LightEngine.hasDifferentLightProperties(blockState, state)) { @@ -5021,8 +5038,8 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a - profilerFiller.pop(); } - boolean hasBlockEntity = blockState.hasBlockEntity(); -@@ -918,8 +912,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + boolean flag = !blockState.is(block); +@@ -922,8 +916,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p BlockPos blockPos = this.blockEntity.getBlockPos(); if (LevelChunk.this.isTicking(blockPos)) { try { @@ -5031,7 +5048,7 @@ index 048ad8e11c6913ef08c977c7fab3200cc610519c..e3d71604c161373ef44164606602290a BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); -@@ -933,8 +925,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -937,8 +929,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } // Paper end - Remove the Block Entity if it's invalid } diff --git a/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch b/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch index 1001338..fc0d04a 100644 --- a/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch +++ b/divinemc-server/minecraft-patches/features/0004-Implement-Secure-Seed.patch @@ -52,10 +52,10 @@ index 5748658abf0b90812005ae9d426df92daf5532f0..8b4b91be368b4195326eeb1c714d713a this.get("generator-settings", property -> GsonHelper.parse(!property.isEmpty() ? property : "{}"), new JsonObject()), this.get("level-type", property -> property.toLowerCase(Locale.ROOT), WorldPresets.NORMAL.location().toString()) diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 8055b8552b40160732953b15876dda7983890d06..ab30af9cd58ff7310e05be87b08f42bacf69e11e 100644 +index f5d4f439c3346cc158043ada02094257ff05a06e..4d4139b5f42a4db6e22bf1d063a23dc7b9914f85 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -618,6 +618,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -619,6 +619,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -64,10 +64,10 @@ index 8055b8552b40160732953b15876dda7983890d06..ab30af9cd58ff7310e05be87b08f42ba } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3980e0dfb08a357384ea33670fb282a26a598f6e..9afd448ede87c9192dc576f66e08676a68b34d98 100644 +index 2bb5055f2fb1e8b95b2a5d8dba5f1fa0bb5fdec7..c03895b2fc783d748fe52660b9ef30367143d0f5 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -632,6 +632,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -624,6 +624,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe chunkGenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkGenerator, gen); } // CraftBukkit end @@ -76,27 +76,24 @@ index 3980e0dfb08a357384ea33670fb282a26a598f6e..9afd448ede87c9192dc576f66e08676a DataFixer fixerUpper = server.getFixerUpper(); // Paper - rewrite chunk system diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java -index 240a54b210e23d5b79e6bcaf3806aa454668135d..66dffb8a2c6725ea2502b498044b854f043f3c73 100644 +index 7b6db084a483b4a9c2f292c5ed6e4c7550344c50..0a15269413b443f284b4c703b47e5436c22c15a3 100644 --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -423,8 +423,13 @@ public class Slime extends Mob implements Enemy { - return false; +@@ -412,7 +412,11 @@ public class Slime extends Mob implements Enemy { } -- ChunkPos chunkPos = new ChunkPos(pos); -- boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -+ ChunkPos chunkPos = new ChunkPos(pos); -+ // DivineMC start - Implement Secure Seed -+ boolean isSlimeChunk = org.bxteam.divinemc.DivineConfig.enableSecureSeed -+ ? level.getChunk(chunkPos.x, chunkPos.z).isSlimeChunk() -+ : WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper -+ boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk; -+ // DivineMC end - Implement Secure Seed + ChunkPos chunkPos = new ChunkPos(pos); +- boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ // DivineMC start - Implement Secure Seed ++ boolean flag = level.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || org.bxteam.divinemc.DivineConfig.enableSecureSeed ++ ? level.getChunk(chunkPos.x, chunkPos.z).isSlimeChunk() ++ : WorldgenRandom.seedSlimeChunk(chunkPos.x, chunkPos.z, ((WorldGenLevel) level).getSeed(), level.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ // DivineMC end - Implement Secure Seed // Paper start - Replace rules for Height in Slime Chunks final double maxHeightSlimeChunk = level.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 6d565b52552534ce9cacfc35ad1bf4adcb69eac3..80a0f5524e91e55d716e93c29e199d9816b0072a 100644 +index 3b7f0d5fe40bdda65ab859a0c22bf0d369dc0f01..42458418e6217adba28f729f04904814542eaa17 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -82,6 +82,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -126,13 +123,13 @@ index 6d565b52552534ce9cacfc35ad1bf4adcb69eac3..80a0f5524e91e55d716e93c29e199d98 + // DivineMC end - Implement Secure Seed + public abstract BlockState getBlockState(final int x, final int y, final int z); // Paper + @Nullable - public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving); diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java -index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..7e0b602e9fd9e3b3f60014ab179b3a82e3bf5c2a 100644 +index 857aa6e29b57a0a8eea4d7c14971b9dde59bb0d0..fdf9318b96d7ac7f707777bb63a5d36a5230b066 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -343,7 +343,11 @@ public abstract class ChunkGenerator { +@@ -342,7 +342,11 @@ public abstract class ChunkGenerator { Registry registry = level.registryAccess().lookupOrThrow(Registries.STRUCTURE); Map> map = registry.stream().collect(Collectors.groupingBy(structure1 -> structure1.step().ordinal())); List list = this.featuresPerStep.get(); @@ -145,7 +142,7 @@ index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..7e0b602e9fd9e3b3f60014ab179b3a82 long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); ChunkPos.rangeClosed(sectionPos.chunk(), 1).forEach(chunkPos -> { -@@ -556,8 +560,18 @@ public abstract class ChunkGenerator { +@@ -551,8 +555,18 @@ public abstract class ChunkGenerator { } else { ArrayList list1 = new ArrayList<>(list.size()); list1.addAll(list); @@ -331,7 +328,7 @@ index c92508741439a8d0d833ea02d0104416adb83c92..630f6c409db349819fc5fd19a3d78fad public static OptionalLong parseSeed(String seed) { seed = seed.trim(); diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index 38475f6975533909924c8d54f438cf43cdfe31a3..6759df026a29810021ddb37f3ddb62382b83a94e 100644 +index 4e72eb49dbf4c70ae7556ba6eb210fcd5ef36aaa..44cefaac4806008ce59b43f5b95ce17ee3ad39e5 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -41,7 +41,11 @@ public class GeodeFeature extends Feature { @@ -391,10 +388,10 @@ index ee0d9dddb36b6879fa113299e24f1aa3b2b151cc..f01d96895ab348971fb31b614026fb3d int i3 = this.spreadType.evaluate(worldgenRandom, i2); int i4 = this.spreadType.evaluate(worldgenRandom, i2); diff --git a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index 670335a7bbfbc9da64c389977498c22dfcd03251..7174a9767cbc94544be81c74d6468f3f73386edc 100644 +index 1f939b325ec5291b3c4aabc4735c863f9436a6f8..4ed6a3d6103ce48797950c7363ea0854227e62e8 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -118,8 +118,17 @@ public abstract class StructurePlacement { +@@ -119,8 +119,17 @@ public abstract class StructurePlacement { public abstract StructurePlacementType type(); private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here @@ -415,7 +412,7 @@ index 670335a7bbfbc9da64c389977498c22dfcd03251..7174a9767cbc94544be81c74d6468f3f } diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index eb85edaa3b7fab4f11545b0fa8bfea882dedb67d..63143ceec98f7a84ec4064d05e8f88c11200172f 100644 +index 1cfa0fcd28685736fcdce4aef817e4d4cc4061cb..e275dc8395e556e8a9412b121034e91553fbaea4 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java @@ -64,7 +64,11 @@ public class JigsawPlacement { diff --git a/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch b/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch index a99b3e5..afaebb5 100644 --- a/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch +++ b/divinemc-server/minecraft-patches/features/0005-Async-Pathfinding.patch @@ -393,7 +393,7 @@ index 045cfafb3afe8271d60852ae3c7cdcb039b44d4f..f544bf28ac6531061da08c7266846874 } diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 6c8fb611943aee8cabc471c63166f9b44ef14826..02814be0e1ac9b743a4c6b5b75015a5e87fc2aa6 100644 +index 6bbdfc748f1ce66689c63424fadcf261b1e967b3..55d0ed422f25b6469f9d8ee3ecf2ef8eaf77e9cb 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -167,6 +167,10 @@ public abstract class PathNavigation { @@ -557,7 +557,7 @@ index 1f96fd5085bacb4c584576c7cb9f51e7898e9b03..9494dd144ff1115c9f0862614ef61803 + // DivineMC end - async pathfinding } diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java -index d5727999eb67ff30dbf47865d59452483338e170..ddbee0f0f42fae0a26321bb324d22f5e7520ae72 100644 +index e9dfff7e3726cd2229f89bb39fa1ca4815d99a6d..a0294937487bfd13f26a5e7eb2bd21f29aa7c229 100644 --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java @@ -936,7 +936,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -579,10 +579,10 @@ index d5727999eb67ff30dbf47865d59452483338e170..ddbee0f0f42fae0a26321bb324d22f5e } } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c401806757 100644 +index eb3aa96b2a5cb553b016744863818186d1d831c4..3ccc48afb7a9eb2290f16c6a3218515bee59c2bd 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -473,6 +473,17 @@ public class Frog extends Animal implements VariantHolder> { +@@ -482,6 +482,17 @@ public class Frog extends Animal { super(mob, level); } @@ -600,7 +600,7 @@ index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c4 @Override public boolean canCutCorner(PathType pathType) { return pathType != PathType.WATER_BORDER && super.canCutCorner(pathType); -@@ -481,6 +492,11 @@ public class Frog extends Animal implements VariantHolder> { +@@ -490,6 +501,11 @@ public class Frog extends Animal { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new Frog.FrogNodeEvaluator(true); @@ -613,7 +613,7 @@ index 4aabb98e0b37b652ad4d334b99c48a818c2859b4..dfcba5c2c8a489ebe74c2d5c1fa980c4 } } diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 6c73245b8d04f194e72165aa0000ca79a95db59d..2686df57d9d48db1438278d0d053bdbd3c65c0a7 100644 +index b85d1e196d2bf61ac4896205afb08eba89c4397e..ea90e3d7ad84e301f975ff91fade63c5429972cf 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -313,7 +313,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -626,10 +626,10 @@ index 6c73245b8d04f194e72165aa0000ca79a95db59d..2686df57d9d48db1438278d0d053bdbd if (target != null) { double d = this.distanceToSqr(target.getX(), target.getY(), target.getZ()); diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java -index 241526239bdbd5d9276f85e7fca46a7051f46a25..2329973f735e1ae7fbb76798dc113f4261c906b7 100644 +index fe31c4a45afd61be8b74efe9d0858ccd0aced075..5f965f50294d03e7b03c5d7e912b7aec99db635c 100644 --- a/net/minecraft/world/entity/monster/Strider.java +++ b/net/minecraft/world/entity/monster/Strider.java -@@ -579,9 +579,25 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { +@@ -560,9 +560,25 @@ public class Strider extends Animal implements ItemSteerable { super(strider, level); } @@ -656,10 +656,10 @@ index 241526239bdbd5d9276f85e7fca46a7051f46a25..2329973f735e1ae7fbb76798dc113f42 } diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index e4b8a74fae6d058a9a75a12d2ff08c7984442538..59a12809e5c7f5ee85ca1f587f6b77383a1ff062 100644 +index 60a8d79306755e9483ba9e93a07939b73ad717fe..97ee07ebbba5ad29f766dff5eb4e51fc0e12cfcb 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -597,6 +597,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -578,6 +578,16 @@ public class Warden extends Monster implements VibrationSystem { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new WalkNodeEvaluator(); diff --git a/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch index 2f524d7..0521fbd 100644 --- a/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0006-Multithreaded-Tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multithreaded Tracker diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index dd2509996bfd08e8c3f9f2be042229eac6d7692d..8ef5a1aaac9c27873ce746eb281f77bb318a3c69 100644 +index 02a9ef1694c796584c29430d27f0a09047368835..7a52c42845bd74d0bb7649f87764aba12f442f02 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -@@ -342,7 +342,11 @@ public final class RegionizedPlayerChunkLoader { +@@ -340,7 +340,11 @@ public final class RegionizedPlayerChunkLoader { private boolean canGenerateChunks = true; private final ArrayDeque> delayedTicketOps = new ArrayDeque<>(); @@ -22,10 +22,10 @@ index dd2509996bfd08e8c3f9f2be042229eac6d7692d..8ef5a1aaac9c27873ce746eb281f77bb private static final byte CHUNK_TICKET_STAGE_NONE = 0; private static final byte CHUNK_TICKET_STAGE_LOADING = 1; diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cbf15b714d 100644 +index b28d19b2fcdff9250e95db05f6e428db54a771e6..b5028cc64e2a43c841801114908825102df41765 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -951,6 +951,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1013,6 +1013,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - optimise entity tracker protected void tick() { @@ -39,7 +39,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb // Paper start - optimise entity tracker if (true) { this.newTrackerTick(); -@@ -1073,7 +1080,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1135,7 +1142,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; @@ -52,7 +52,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb // Paper start - optimise entity tracker private long lastChunkUpdate = -1L; -@@ -1100,21 +1111,55 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1162,21 +1173,55 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastTrackedChunk = chunk; final ServerPlayer[] playersRaw = players.getRawDataUnchecked(); @@ -118,7 +118,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb } @Override -@@ -1176,7 +1221,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1238,7 +1283,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcast(Packet packet) { @@ -127,7 +127,7 @@ index d3d9926d504fa6b3384be5ae06b2843ebb7f807c..965899a98223b15bd770378c202873cb serverPlayerConnection.send(packet); } } -@@ -1189,21 +1234,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1259,21 +1304,20 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcastRemoved() { @@ -169,29 +169,10 @@ index f106373ef3ac4a8685c2939c9e8361688a285913..3b4dff8867e91884b5720ca8a9cb64af public boolean visible = true; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..b6053158f5d9b6ad325ea075ab7c60f9966ba496 100644 +index 257ecbcf7d463eefb951867a5426eaf24e356305..7748183dd12434693b89d2dbc8325988381857c9 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -110,8 +110,16 @@ public class ServerEntity { - .forEach( - removedPassenger -> { - if (removedPassenger instanceof ServerPlayer serverPlayer1) { -- serverPlayer1.connection -- .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()); -+ // DivineMC start - Multithreaded tracker -+ if (org.bxteam.divinemc.DivineConfig.multithreadedEnabled && Thread.currentThread() instanceof org.bxteam.divinemc.entity.tracking.MultithreadedTracker.MultithreadedTrackerThread) { -+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> serverPlayer1.connection -+ .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()) -+ ); -+ } else { -+ serverPlayer1.connection -+ .teleport(serverPlayer1.getX(), serverPlayer1.getY(), serverPlayer1.getZ(), serverPlayer1.getYRot(), serverPlayer1.getXRot()); -+ } -+ // DivineMC end - Multithreaded tracker - } - } - ); -@@ -410,12 +418,13 @@ public class ServerEntity { +@@ -418,12 +418,13 @@ public class ServerEntity { if (this.entity instanceof LivingEntity) { Set attributesToSync = ((LivingEntity)this.entity).getAttributes().getAttributesToSync(); if (!attributesToSync.isEmpty()) { @@ -208,10 +189,10 @@ index 0fb253aa55a24b56b17f524b3261c5b75c7d7e59..b6053158f5d9b6ad325ea075ab7c60f9 attributesToSync.clear(); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b28fe918a 100644 +index c03895b2fc783d748fe52660b9ef30367143d0f5..8fa3af0ebcb92138d0dae858c131db0a710df693 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2497,7 +2497,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2481,7 +2481,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { @@ -220,7 +201,7 @@ index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system } -@@ -2724,7 +2724,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2717,7 +2717,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } map.carriedByPlayers.remove(player); @@ -230,10 +211,10 @@ index c229d69ce3d007e4cb57e559611b3fca7a03562f..ba5ca5213fafd60b2257409f334a7c6b } } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 56a22d19a82a937c08cb4527b0f67f219a6bb8a0..f8c76bb2c9fa625e191036dc58ef3dfb1d4ee930 100644 +index 374d9e1036a1c4b50f80f3121c7ad0793506a280..b05657f763bbdbc9268c83d78c2da62b97d095e2 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1822,7 +1822,7 @@ public class ServerGamePacketListenerImpl +@@ -1882,7 +1882,7 @@ public class ServerGamePacketListenerImpl } public void internalTeleport(PositionMoveRotation posMoveRotation, Set relatives) { @@ -243,10 +224,10 @@ index 56a22d19a82a937c08cb4527b0f67f219a6bb8a0..f8c76bb2c9fa625e191036dc58ef3dfb if (this.player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -index 8013594bb4844e7a8abf28123958e7f632d39341..72593629324ccd4d70b8ed86a90fb69785d57f5f 100644 +index 3ac9f36eae87369354e992a1d9b5c5b2d87d17cb..3a6c481fae0d3cb5ffdd39caf85252f164774323 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -@@ -24,8 +24,11 @@ public class AttributeInstance { +@@ -26,8 +26,11 @@ public class AttributeInstance { private final Map> modifiersByOperation = Maps.newEnumMap( AttributeModifier.Operation.class ); @@ -261,13 +242,13 @@ index 8013594bb4844e7a8abf28123958e7f632d39341..72593629324ccd4d70b8ed86a90fb697 private boolean dirty = true; private double cachedValue; diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index a25d74592e89e3d6339479c6dc2b6f45d1932cfc..621b183211b8148bb8db256d2119c82f8a2c626b 100644 +index 23576e631ad4a12ec3ff3630be253738534588f3..b37a49c44ecb456c798d153fddf3cb6090a9a296 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -19,9 +19,12 @@ import org.slf4j.Logger; +@@ -14,9 +14,12 @@ import net.minecraft.nbt.ListTag; + import net.minecraft.resources.ResourceLocation; public class AttributeMap { - private static final Logger LOGGER = LogUtils.getLogger(); - private final Map, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>(); - private final Set attributesToSync = new ObjectOpenHashSet<>(); - private final Set attributesToUpdate = new ObjectOpenHashSet<>(); @@ -281,10 +262,10 @@ index a25d74592e89e3d6339479c6dc2b6f45d1932cfc..621b183211b8148bb8db256d2119c82f private final net.minecraft.world.entity.LivingEntity entity; // Purpur - Ridables diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 681dec447486138088fe5f705ef4fadab531139f..3d6aad86519be3e1449d3288369a41aebb924c90 100644 +index 3ae69b17fec1cdb2bee2b5a795026a875f197c30..f8620d34137fe13122deb5b761512e09bb8c4aa7 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -279,6 +279,7 @@ public class MapItemSavedData extends SavedData { +@@ -211,6 +211,7 @@ public class MapItemSavedData extends SavedData { for (int i = 0; i < this.carriedBy.size(); i++) { MapItemSavedData.HoldingPlayer holdingPlayer1 = this.carriedBy.get(i); diff --git a/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch b/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch index d8757d2..4d7c0da 100644 --- a/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch +++ b/divinemc-server/minecraft-patches/features/0007-Async-locate-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async locate command diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java -index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..0bc2d17e9bad62f62ab171feb2a92b87e1c3ba6a 100644 +index 2723d5377567241921fef61952e474c1c0ee9bbf..ee9f84b33a34b5b9d7c3f8928c958c298f780a03 100644 --- a/net/minecraft/server/commands/LocateCommand.java +++ b/net/minecraft/server/commands/LocateCommand.java @@ -103,44 +103,77 @@ public class LocateCommand { @@ -119,7 +119,7 @@ index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..0bc2d17e9bad62f62ab171feb2a92b87 public static int showLocateResult( @@ -195,7 +228,7 @@ public class LocateCommand { - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("chat.coordinates.tooltip"))) + .withHoverEvent(new HoverEvent.ShowText(Component.translatable("chat.coordinates.tooltip"))) ); source.sendSuccess(() -> Component.translatable(translationKey, elementName, component, i), false); - LOGGER.info("Locating element " + elementName + " took " + duration.toMillis() + " ms"); diff --git a/divinemc-server/minecraft-patches/features/0009-Misc-Optimizations.patch b/divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch similarity index 83% rename from divinemc-server/minecraft-patches/features/0009-Misc-Optimizations.patch rename to divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch index 6a665b6..9aa0cfe 100644 --- a/divinemc-server/minecraft-patches/features/0009-Misc-Optimizations.patch +++ b/divinemc-server/minecraft-patches/features/0008-Misc-Optimizations.patch @@ -4,23 +4,11 @@ Date: Fri, 31 Jan 2025 21:50:46 +0300 Subject: [PATCH] Misc Optimizations -diff --git a/com/mojang/math/OctahedralGroup.java b/com/mojang/math/OctahedralGroup.java -index 11902e7427761746ee098fea3276a34fef0096ba..3ba23fa243f7af712a41316066ca554f1c23b495 100644 ---- a/com/mojang/math/OctahedralGroup.java -+++ b/com/mojang/math/OctahedralGroup.java -@@ -112,6 +112,7 @@ public enum OctahedralGroup implements StringRepresentable { - this.transformation = new Matrix3f().scaling(invertX ? -1.0F : 1.0F, invertY ? -1.0F : 1.0F, invertZ ? -1.0F : 1.0F); - this.transformation.mul(permutation.transformation()); - this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields -+ this.rotate(Direction.UP); // DivineMC - Math Optimizations - } - - private BooleanList packInversions() { diff --git a/com/mojang/math/Transformation.java b/com/mojang/math/Transformation.java -index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32cc8347a9 100644 +index 5fb382be4d86328690c49f2a5a0c3ec698a38e21..f333d9028f315e7912dd335c8158abd525c27ecd 100644 --- a/com/mojang/math/Transformation.java +++ b/com/mojang/math/Transformation.java -@@ -51,6 +51,7 @@ public final class Transformation { +@@ -52,6 +52,7 @@ public final class Transformation { } else { this.matrix = matrix; } @@ -28,7 +16,7 @@ index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32 } public Transformation(@Nullable Vector3f translation, @Nullable Quaternionf leftRotation, @Nullable Vector3f scale, @Nullable Quaternionf rightRotation) { -@@ -60,6 +61,7 @@ public final class Transformation { +@@ -61,6 +62,7 @@ public final class Transformation { this.scale = scale != null ? scale : new Vector3f(1.0F, 1.0F, 1.0F); this.rightRotation = rightRotation != null ? rightRotation : new Quaternionf(); this.decomposed = true; @@ -37,10 +25,10 @@ index aa755b8b7f8bc5910322e0c5b520f603da06a85a..e781dea43279aa77cc40a7afd2281c32 public static Transformation identity() { diff --git a/net/minecraft/core/MappedRegistry.java b/net/minecraft/core/MappedRegistry.java -index 5f752603aa5611ce9d3dd44cc5b70c27ac46a86e..332122c0b700fb743f91f3fed16aade41dceec28 100644 +index 761e583a56b1c4a605b0cbb04b61c4df60b8b9bb..c07155589ef44cbbacafe03b36d2cd4cdcba3fd2 100644 --- a/net/minecraft/core/MappedRegistry.java +++ b/net/minecraft/core/MappedRegistry.java -@@ -34,10 +34,12 @@ public class MappedRegistry implements WritableRegistry { +@@ -33,10 +33,12 @@ public class MappedRegistry implements WritableRegistry { private final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(2048), map -> map.defaultReturnValue(-1)); // Paper - Perf: Use bigger expected size to reduce collisions @@ -57,6 +45,63 @@ index 5f752603aa5611ce9d3dd44cc5b70c27ac46a86e..332122c0b700fb743f91f3fed16aade4 private Lifecycle registryLifecycle; private final Map, HolderSet.Named> frozenTags = new IdentityHashMap<>(); MappedRegistry.TagSet allTags = MappedRegistry.TagSet.unbound(); +diff --git a/net/minecraft/network/VarInt.java b/net/minecraft/network/VarInt.java +index 4897ff4648083ebe737ae5b32bae344af27357e4..0d103821d7220daa5cc0d5d3231e794fca0ca055 100644 +--- a/net/minecraft/network/VarInt.java ++++ b/net/minecraft/network/VarInt.java +@@ -52,16 +52,43 @@ public class VarInt { + + public static ByteBuf write(ByteBuf buffer, int value) { + // Paper start - Optimize VarInts +- // Peel the one and two byte count cases explicitly as they are the most common VarInt sizes +- // that the proxy will write, to improve inlining. +- if ((value & (0xFFFFFFFF << 7)) == 0) { +- buffer.writeByte(value); +- } else if ((value & (0xFFFFFFFF << 14)) == 0) { +- int w = (value & 0x7F | 0x80) << 8 | (value >>> 7); +- buffer.writeShort(w); +- } else { +- writeOld(buffer, value); ++ // DivineMC start - Misc optimizations ++ int bytesNeeded = getByteSize(value); ++ ++ switch (bytesNeeded) { ++ case 1: ++ buffer.writeByte(value); ++ break; ++ case 2: ++ int w2 = ((value & 0x7F) << 8) | (value >>> 7) | 0x00008000; ++ buffer.writeShort(w2); ++ break; ++ case 3: ++ int w3 = (value & 0x7F) << 16 ++ | (value & 0x3F80) << 1 ++ | (value >>> 14) ++ | 0x00808000; ++ buffer.writeMedium(w3); ++ break; ++ case 4: ++ int w4 = (value & 0x7F) << 24 ++ | ((value & 0x3F80) << 9) ++ | (value & 0x1FC000) >> 6 ++ | (value >>> 21) ++ | 0x80808000; ++ buffer.writeInt(w4); ++ break; ++ case 5: ++ int w5 = (value & 0x7F) << 24 ++ | (value & 0x3F80) << 9 ++ | (value & 0x1FC000) >> 6 ++ | ((value >>> 21) & 0x7F) ++ | 0x80808080; ++ buffer.writeInt(w5); ++ buffer.writeByte(value >>> 28); ++ break; + } ++ // DivineMC end - Slightly optimized VarInt#write + return buffer; + } + public static ByteBuf writeOld(ByteBuf buffer, int value) { diff --git a/net/minecraft/server/level/ChunkTrackingView.java b/net/minecraft/server/level/ChunkTrackingView.java index bee90335677f7d8b01589ce5cfd81a40fd422886..a5e488d14fd2016ee188b114d0e681562b5b09cc 100644 --- a/net/minecraft/server/level/ChunkTrackingView.java @@ -386,7 +431,7 @@ index ab3a221c115992d0f4ea921aa92cf0976b815ff4..076a931341da486162f289a5f19d3d67 return number % multiple == 0; } diff --git a/net/minecraft/util/RandomSource.java b/net/minecraft/util/RandomSource.java -index 98a54bc4de251014342cda6d0951b7fea79ce553..663edee4dfa660e3d3a04c728fd764258867916d 100644 +index 8516d47b0ba79d91638837199e7ae0fb6cb44a79..71444431b10582f5917c1795275ccdadd2364c3c 100644 --- a/net/minecraft/util/RandomSource.java +++ b/net/minecraft/util/RandomSource.java @@ -12,7 +12,7 @@ public interface RandomSource { @@ -408,23 +453,23 @@ index 98a54bc4de251014342cda6d0951b7fea79ce553..663edee4dfa660e3d3a04c728fd76425 static RandomSource createNewThreadLocalInstance() { diff --git a/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java b/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java -index 15de39fa82c7aea18298509fe9587d027c30cc15..eb534ed5a7478fc632db096328e3582f4ec410b8 100644 +index a18240418a19a95147341a634527d774f3d5bb92..66f74ad2a194a6676574da2932cf4677f9383ecd 100644 --- a/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java +++ b/net/minecraft/util/debugchart/DebugSampleSubscriptionTracker.java -@@ -15,7 +15,7 @@ public class DebugSampleSubscriptionTracker { +@@ -14,7 +14,7 @@ public class DebugSampleSubscriptionTracker { public static final int STOP_SENDING_AFTER_MS = 10000; private final PlayerList playerList; - private final EnumMap> subscriptions; + private final Map> subscriptions; - private final Queue subscriptionRequestQueue = new LinkedList<>(); + private final java.util.List subscriptionRequestQueue = java.util.Collections.synchronizedList(new LinkedList<>()); // DivineMC - Misc Optimizations public DebugSampleSubscriptionTracker(PlayerList playerList) { this.playerList = playerList; diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 7e29f1f1972f2fb4f9a779653467bc85ce37c7bc..3943789e241f6bb6bc165099b1fb585463cf3d86 100644 +index d513b82c0681fdc990af082af69278bd773225a9..b065accf4ca3e87a4c35506f8cbf4d88759e1128 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -143,7 +143,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -149,7 +149,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper start - Share random for entities to make them more random @@ -433,11 +478,35 @@ index 7e29f1f1972f2fb4f9a779653467bc85ce37c7bc..3943789e241f6bb6bc165099b1fb5854 // Paper start - replace random private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom { public RandomRandomSource() { +@@ -4502,10 +4502,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + // Paper start - optimise collisions + public boolean updateFluidHeightAndDoFluidPushing(final TagKey fluid, final double flowScale) { +- if (this.touchingUnloadedChunk()) { +- return false; +- } +- + final AABB boundingBox = this.getBoundingBox().deflate(1.0E-3); + + final Level world = this.level; +@@ -4541,7 +4537,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) { + for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) { +- final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunkSource.getChunk(currChunkX, currChunkZ, net.minecraft.world.level.chunk.status.ChunkStatus.FULL, false).getSections(); ++ // DivineMC start - Misc optimizations ++ final net.minecraft.world.level.chunk.ChunkAccess chunk = chunkSource.getChunk(currChunkX, currChunkZ, net.minecraft.world.level.chunk.status.ChunkStatus.FULL, false); ++ if (chunk == null) continue; ++ final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections(); ++ // DivineMC end - Misc optimizations + + // bound y + for (int currChunkY = minChunkY; currChunkY <= maxChunkY; ++currChunkY) { diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c222725c3 100644 +index 5bcbebf35eb726a43b957aca5b8b7a1dca7648cd..d618752727e2f2f5c0c1afa97f455e349cb7e76c 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -832,7 +832,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -698,7 +698,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { @@ -446,7 +515,7 @@ index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c if (nearestPlayer != null) { // Paper start - Configurable despawn distances final io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DespawnRangePair despawnRangePair = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()); -@@ -861,6 +861,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -727,6 +727,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } @@ -467,10 +536,10 @@ index 66f3565b978f2ed91cb2bc3a816f1701c0873c73..b4e19cc65701d5ef94e1cc0a7473225c protected final void serverAiStep() { this.noActionTime++; diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java -index 5ded2f808a9fcb26856567de6bc56e206f948a84..02d64a5ea756b2c91a71b7a0fc0f21219983616a 100644 +index 02bc5d83b92a594ec519f0a02b0517fdb4b9e954..86c1f5effde3173c8bc458af21b454c81738935e 100644 --- a/net/minecraft/world/level/GameRules.java +++ b/net/minecraft/world/level/GameRules.java -@@ -249,7 +249,7 @@ public class GameRules { +@@ -277,7 +277,7 @@ public class GameRules { } private GameRules(Map, GameRules.Value> rules, FeatureFlagSet enabledFeatures) { @@ -542,36 +611,24 @@ index 01e5b29d6e9a5c53c0e23b61ed0c1d7be1a0fe08..d80df05e40f3941ade5ed320e12f8dcf return 1.0 * (32.0 * (d1 - 128.0) - 3.0 * (d1 - 120.0) * d2 + 3.0 * d2 * d2) / (128.0 * (32.0 - 3.0 * d2)); } -diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 3d6aad86519be3e1449d3288369a41aebb924c90..9294ac7bb91f86b631b1f0b4ad0bc1dbca82b3a1 100644 ---- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -+++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -198,6 +198,7 @@ public class MapItemSavedData extends SavedData { - } - } - -+ mapItemSavedData.setDirty(false); // DivineMC - Misc Optimizations - return mapItemSavedData; - } - diff --git a/net/minecraft/world/level/storage/DimensionDataStorage.java b/net/minecraft/world/level/storage/DimensionDataStorage.java -index d9a3b5a2e6495b7e22c114506c2bd1e406f58f8f..a6e03345afd6d8a38e06a43c59103209618baa14 100644 +index 05361803a929cbcf651a37cf43009e57acb25f3e..5d21d2520dd33889988d8300060e6a41a8334562 100644 --- a/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/net/minecraft/world/level/storage/DimensionDataStorage.java -@@ -34,7 +34,7 @@ import org.slf4j.Logger; - +@@ -39,7 +39,7 @@ import org.slf4j.Logger; public class DimensionDataStorage implements AutoCloseable { private static final Logger LOGGER = LogUtils.getLogger(); -- public final Map> cache = new HashMap<>(); -+ public final Map> cache = new java.util.concurrent.ConcurrentHashMap<>(); // DivineMC - Concurrent HashMap + private final SavedData.Context context; +- public final Map, Optional> cache = new HashMap<>(); ++ public final Map, Optional> cache = new java.util.concurrent.ConcurrentHashMap<>(); // DivineMC - Misc Optimizations private final DataFixer fixerUpper; private final HolderLookup.Provider registries; private final Path dataFolder; diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index c9c6e4e460ad8435f12761704bb9b0284d6aa708..54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1 100644 +index 5767fbfd7f33c5276fb4335ce473b2e1baca411c..1866d857cabde481f23e861e0db7994bfa84ac40 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java -@@ -189,13 +189,15 @@ public class AABB { +@@ -190,13 +190,15 @@ public class AABB { } public AABB intersect(AABB other) { @@ -594,7 +651,7 @@ index c9c6e4e460ad8435f12761704bb9b0284d6aa708..54807bb4b4189ceaded1f78a1a9ab85c } public AABB minmax(AABB other) { -@@ -227,16 +229,37 @@ public class AABB { +@@ -228,16 +230,37 @@ public class AABB { } public boolean intersects(AABB other) { diff --git a/divinemc-server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch b/divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch similarity index 93% rename from divinemc-server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch rename to divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch index a4b1721..706fbb0 100644 --- a/divinemc-server/minecraft-patches/features/0010-Chunk-System-Optimizations.patch +++ b/divinemc-server/minecraft-patches/features/0009-Chunk-System-Optimizations.patch @@ -96,10 +96,10 @@ index 866f38eb0f379ffbe2888023a7d1c290f521a231..08666b4aa1c7663861dc361f60e6f1cc if (indexer == null) { return dfl; diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f2686feb3 100644 +index 7a52c42845bd74d0bb7649f87764aba12f442f02..78f2d7c698a4f2c21a473627c3017a9751f80cf1 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -@@ -189,13 +189,13 @@ public final class RegionizedPlayerChunkLoader { +@@ -187,13 +187,13 @@ public final class RegionizedPlayerChunkLoader { } if (((ChunkSystemServerPlayer)player).moonrise$getChunkLoader() != null) { @@ -115,7 +115,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } public void updatePlayer(final ServerPlayer player) { -@@ -301,7 +301,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -299,7 +299,7 @@ public final class RegionizedPlayerChunkLoader { return false; } @@ -124,7 +124,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f TickThread.ensureTickThread("Cannot tick player chunk loader async"); long currTime = System.nanoTime(); for (final ServerPlayer player : new java.util.ArrayList<>(this.world.players())) { -@@ -312,6 +312,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -310,6 +310,7 @@ public final class RegionizedPlayerChunkLoader { } loader.update(); // can't invoke plugin logic loader.updateQueues(currTime); @@ -132,7 +132,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } } -@@ -362,7 +363,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -360,7 +361,7 @@ public final class RegionizedPlayerChunkLoader { GENERATED_TICKET_LEVEL, TICK_TICKET_LEVEL }; @@ -141,7 +141,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f { this.chunkTicketStage.defaultReturnValue(CHUNK_TICKET_STAGE_NONE); } -@@ -384,10 +385,19 @@ public final class RegionizedPlayerChunkLoader { +@@ -382,10 +383,19 @@ public final class RegionizedPlayerChunkLoader { final int centerX = PlayerChunkLoaderData.this.lastChunkX; final int centerZ = PlayerChunkLoaderData.this.lastChunkZ; @@ -165,7 +165,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f }; private final LongHeapPriorityQueue sendQueue = new LongHeapPriorityQueue(CLOSEST_MANHATTAN_DIST); private final LongHeapPriorityQueue tickingQueue = new LongHeapPriorityQueue(CLOSEST_MANHATTAN_DIST); -@@ -490,7 +500,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -488,7 +498,7 @@ public final class RegionizedPlayerChunkLoader { } @Override @@ -174,7 +174,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f final long chunk = CoordinateUtils.getChunkKey(chunkX, chunkZ); // note: by the time this is called, the tick cleanup should have ran - so, if the chunk is at // the tick stage it was deemed in range for loading. Thus, we need to move it to generated -@@ -624,7 +634,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -622,7 +632,7 @@ public final class RegionizedPlayerChunkLoader { return Math.max(Math.abs(dx), Math.abs(dz)) <= this.lastTickDistance; } @@ -183,7 +183,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f for (int dz = -radius; dz <= radius; ++dz) { for (int dx = -radius; dx <= radius; ++dx) { if ((dx | dz) == 0) { -@@ -643,10 +653,10 @@ public final class RegionizedPlayerChunkLoader { +@@ -641,10 +651,10 @@ public final class RegionizedPlayerChunkLoader { return true; } @@ -196,7 +196,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } // update rate limits final double loadRate = this.getMaxChunkLoadRate(); -@@ -910,10 +920,10 @@ public final class RegionizedPlayerChunkLoader { +@@ -907,10 +917,10 @@ public final class RegionizedPlayerChunkLoader { ); } @@ -209,7 +209,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } final ViewDistances playerDistances = ((ChunkSystemServerPlayer)this.player).moonrise$getViewDistanceHolder().getViewDistances(); final ViewDistances worldDistances = ((ChunkSystemServerLevel)this.world).moonrise$getViewDistanceHolder().getViewDistances(); -@@ -1062,7 +1072,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -1059,7 +1069,7 @@ public final class RegionizedPlayerChunkLoader { this.flushDelayedTicketOps(); } @@ -218,7 +218,7 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f TickThread.ensureTickThread(this.player, "Cannot add player asynchronously"); if (this.removed) { throw new IllegalStateException("Removing removed player chunk loader"); -@@ -1090,7 +1100,7 @@ public final class RegionizedPlayerChunkLoader { +@@ -1087,7 +1097,7 @@ public final class RegionizedPlayerChunkLoader { } public LongOpenHashSet getSentChunksRaw() { @@ -228,17 +228,17 @@ index 8ef5a1aaac9c27873ce746eb281f77bb318a3c69..886825a10bd06b4b656d19a05624c74f } } diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d56318eb22 100644 +index f473999938840562b1007a789600342e5796a123..60705955e231d47c60f5a0a5e869988aed8774fc 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -@@ -71,36 +71,49 @@ public final class ChunkHolderManager { - private static final long PROBE_MARKER = Long.MIN_VALUE + 1; +@@ -72,36 +72,49 @@ public final class ChunkHolderManager { + private static final long NO_TIMEOUT_MARKER = Long.MIN_VALUE; public final ReentrantAreaLock ticketLockArea; -- private final ConcurrentLong2ReferenceChainedHashTable>> tickets = new ConcurrentLong2ReferenceChainedHashTable<>(); +- private final ConcurrentLong2ReferenceChainedHashTable> tickets = new ConcurrentLong2ReferenceChainedHashTable<>(); - private final ConcurrentLong2ReferenceChainedHashTable sectionToChunkToExpireCount = new ConcurrentLong2ReferenceChainedHashTable<>(); + // DivineMC start - Chunk System optimization -+ private final ConcurrentLong2ReferenceChainedHashTable>> tickets = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); ++ private final ConcurrentLong2ReferenceChainedHashTable> tickets = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); + private final ConcurrentLong2ReferenceChainedHashTable sectionToChunkToExpireCount = ConcurrentLong2ReferenceChainedHashTable.createWithCapacity(20, 0.9F); + // DivineMC end - Chunk System optimization final ChunkUnloadQueue unloadQueue; @@ -298,9 +298,9 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 + } + // DivineMC end - Chunk System optimization - public ChunkHolderManager(final ServerLevel world, final ChunkTaskScheduler taskScheduler) { - this.world = world; -@@ -222,26 +235,29 @@ public final class ChunkHolderManager { + private final ConcurrentLong2ReferenceChainedHashTable ticketCounters = new ConcurrentLong2ReferenceChainedHashTable<>(); + +@@ -224,26 +237,29 @@ public final class ChunkHolderManager { this.taskScheduler.setShutdown(true); } @@ -337,7 +337,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 holder.lastAutoSave = currentTick; if (holder.save(false) != null) { -@@ -255,10 +271,11 @@ public final class ChunkHolderManager { +@@ -257,10 +273,11 @@ public final class ChunkHolderManager { for (final NewChunkHolder holder : reschedule) { if (holder.getChunkStatus().isOrAfter(FullChunkStatus.FULL)) { @@ -350,7 +350,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 public void saveAllChunks(final boolean flush, final boolean shutdown, final boolean logProgress) { final List holders = this.getChunkHolders(); -@@ -317,13 +334,9 @@ public final class ChunkHolderManager { +@@ -319,13 +336,9 @@ public final class ChunkHolderManager { } if (logProgress) { final long currTime = System.nanoTime(); @@ -366,8 +366,8 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 } } } -@@ -425,8 +438,8 @@ public final class ChunkHolderManager { - final Long2ObjectOpenHashMap>> ret = new Long2ObjectOpenHashMap<>(); +@@ -459,8 +472,8 @@ public final class ChunkHolderManager { + final Long2ObjectOpenHashMap> ret = new Long2ObjectOpenHashMap<>(); final Long2ObjectOpenHashMap sections = new Long2ObjectOpenHashMap<>(); final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); - for (final PrimitiveIterator.OfLong iterator = this.tickets.keyIterator(); iterator.hasNext();) { @@ -377,7 +377,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 sections.computeIfAbsent( CoordinateUtils.getChunkKey( CoordinateUtils.getChunkX(coord) >> sectionShift, -@@ -523,7 +536,7 @@ public final class ChunkHolderManager { +@@ -557,7 +570,7 @@ public final class ChunkHolderManager { chunkZ >> sectionShift ); @@ -386,16 +386,18 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 return new Long2IntOpenHashMap(); }).addTo(chunkKey, 1); } -@@ -567,7 +580,7 @@ public final class ChunkHolderManager { +@@ -601,8 +614,8 @@ public final class ChunkHolderManager { final ReentrantAreaLock.Node ticketLock = lock ? this.ticketLockArea.lock(chunkX, chunkZ) : null; try { -- final SortedArraySet> ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (final long keyInMap) -> { -+ final SortedArraySet> ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (keyInMap) -> { // DivineMC - Chunk System optimization - return SortedArraySet.create(4); +- final SortedArraySet ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (final long keyInMap) -> { +- return (SortedArraySet)SortedArraySet.create(4); ++ final SortedArraySet ticketsAtChunk = this.tickets.computeIfAbsent(chunk, (keyInMap) -> { // DivineMC - Chunk System optimization ++ return SortedArraySet.create(4); }); -@@ -697,8 +710,8 @@ public final class ChunkHolderManager { + final int levelBefore = getTicketLevelAt(ticketsAtChunk); +@@ -782,8 +795,8 @@ public final class ChunkHolderManager { final Long2ObjectOpenHashMap sections = new Long2ObjectOpenHashMap<>(); final int sectionShift = this.taskScheduler.getChunkSystemLockShift(); @@ -406,7 +408,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 sections.computeIfAbsent( CoordinateUtils.getChunkKey( CoordinateUtils.getChunkX(coord) >> sectionShift, -@@ -746,8 +759,8 @@ public final class ChunkHolderManager { +@@ -831,8 +844,8 @@ public final class ChunkHolderManager { return removeDelay <= 0L; }; @@ -417,16 +419,16 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 if (!this.sectionToChunkToExpireCount.containsKey(sectionKey)) { // removed concurrently -@@ -1033,7 +1046,7 @@ public final class ChunkHolderManager { +@@ -1118,7 +1131,7 @@ public final class ChunkHolderManager { } - if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && !TickThread.isTickThreadFor(world)) { // DivineMC - Parallel world ticking + if (!TickThread.isTickThread()) { this.taskScheduler.scheduleChunkTask(() -> { - final ArrayDeque pendingFullLoadUpdate = ChunkHolderManager.this.pendingFullLoadUpdate; + final java.util.Deque pendingFullLoadUpdate = ChunkHolderManager.this.getData().pendingFullLoadUpdate; // DivineMC - Chunk System optimization for (int i = 0, len = changedFullStatus.size(); i < len; ++i) { pendingFullLoadUpdate.add(changedFullStatus.get(i)); } -@@ -1041,16 +1054,16 @@ public final class ChunkHolderManager { +@@ -1126,16 +1139,16 @@ public final class ChunkHolderManager { ChunkHolderManager.this.processPendingFullUpdate(); }, Priority.HIGHEST); } else { @@ -446,7 +448,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 PlatformHooks.get().onChunkHolderDelete(this.world, holder.vanillaChunkHolder); this.chunkHolders.remove(CoordinateUtils.getChunkKey(holder.chunkX, holder.chunkZ)); } -@@ -1214,6 +1227,27 @@ public final class ChunkHolderManager { +@@ -1293,6 +1306,27 @@ public final class ChunkHolderManager { } } @@ -474,7 +476,7 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 public enum TicketOperationType { ADD, REMOVE, ADD_IF_REMOVED, ADD_AND_REMOVE } -@@ -1387,7 +1421,7 @@ public final class ChunkHolderManager { +@@ -1466,7 +1500,7 @@ public final class ChunkHolderManager { // only call on tick thread private boolean processPendingFullUpdate() { @@ -483,21 +485,21 @@ index 5683395e09a65b1b39748df5152fffef630ac083..6aea99f071bd1a6a1ea9507bb70739d5 boolean ret = false; -@@ -1423,8 +1457,7 @@ public final class ChunkHolderManager { +@@ -1502,8 +1536,7 @@ public final class ChunkHolderManager { final JsonArray allTicketsJson = new JsonArray(); ret.add("tickets", allTicketsJson); -- for (final Iterator>>> iterator = this.tickets.entryIterator(); +- for (final Iterator>> iterator = this.tickets.entryIterator(); - iterator.hasNext();) { -+ for (final Iterator>>> iterator = this.tickets.entryIterator(); iterator.hasNext();) { // DivineMC - Chunk System optimization - final ConcurrentLong2ReferenceChainedHashTable.TableEntry>> coordinateTickets = iterator.next(); ++ for (final Iterator>> iterator = this.tickets.entryIterator(); iterator.hasNext();) { // DivineMC - Chunk System optimization + final ConcurrentLong2ReferenceChainedHashTable.TableEntry> coordinateTickets = iterator.next(); final long coordinate = coordinateTickets.getKey(); - final SortedArraySet> tickets = coordinateTickets.getValue(); + final SortedArraySet tickets = coordinateTickets.getValue(); diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96ff452b2d 100644 +index 8f8268924ac92fca5df8a11e08031fa8416c6e05..f1bc7a5e80de0293e1837b2f7401b347fc59f831 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkTaskScheduler.java -@@ -65,14 +65,6 @@ public final class ChunkTaskScheduler { +@@ -66,14 +66,6 @@ public final class ChunkTaskScheduler { private static final Logger LOGGER = LogUtils.getClassLogger(); @@ -509,10 +511,10 @@ index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96 - LOGGER.info("Chunk system is using population gen parallelism: " + useParallelGen); - } - - public static final TicketType CHUNK_LOAD = TicketType.create("chunk_system:chunk_load", Long::compareTo); + public static final TicketType CHUNK_LOAD = ChunkSystemTicketType.create("chunk_system:chunk_load", Long::compareTo); private static final AtomicLong CHUNK_LOAD_IDS = new AtomicLong(); -@@ -115,12 +107,12 @@ public final class ChunkTaskScheduler { +@@ -116,12 +108,12 @@ public final class ChunkTaskScheduler { public final ServerLevel world; public final RadiusAwarePrioritisedExecutor radiusAwareScheduler; @@ -530,7 +532,7 @@ index 67532b85073b7978254a0b04caadfe822679e61f..4b97b676d4245e7ece956eb4c78bed96 private final PrioritisedTaskQueue mainThreadExecutor = new PrioritisedTaskQueue(); -@@ -291,14 +283,14 @@ public final class ChunkTaskScheduler { +@@ -292,14 +284,14 @@ public final class ChunkTaskScheduler { this.lockShift = Math.max(((ChunkSystemServerLevel)world).moonrise$getRegionChunkShift(), ThreadedTicketLevelPropagator.SECTION_SHIFT); this.schedulingLockArea = new ReentrantAreaLock(this.getChunkSystemLockShift()); @@ -784,7 +786,7 @@ index 28ffa653e87a4e8ef7cf614916ef3fe61681fe16..b35b92b204fbefd139c4544f15e32d46 } finally { this.returnNode(); diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java -index 6ab353b0d2465c3680bb3c8d0852ba0f65c00fd2..70067c12d4d82460d55d8f90d01b0bc1e5368408 100644 +index 96ccb8f657d755b2e58a8dd0cda00ca0df4886b2..89de0fcb3f8142f76399fc00e288e03d7f3742f2 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/task/ChunkFullTask.java @@ -35,7 +35,7 @@ public final class ChunkFullTask extends ChunkProgressionTask implements Runnabl @@ -865,17 +867,18 @@ index 95ed5a0ff3f0588f625ba48a5fee3aafbab9d13f..f2fd6d5eb024f646875868c441eb2da2 protected static final class LoadDataFromDiskTask { diff --git a/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java b/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java -index e97e7d276faf055c89207385d3820debffb06463..4aeb75a2cdcfb4206bab3eee5ad674dd9890e720 100644 +index 6d1fe8028739145b11fce98ad62b2f8044299548..2cd1197fa0d15e19749409cc857a0254de444ba5 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java +++ b/ca/spottedleaf/moonrise/patches/chunk_tick_iteration/ChunkTickConstants.java -@@ -2,6 +2,6 @@ package ca.spottedleaf.moonrise.patches.chunk_tick_iteration; +@@ -2,7 +2,7 @@ package ca.spottedleaf.moonrise.patches.chunk_tick_iteration; public final class ChunkTickConstants { - public static final int PLAYER_SPAWN_TRACK_RANGE = 8; + public static final int PLAYER_SPAWN_TRACK_RANGE = (int) Math.round(org.bxteam.divinemc.DivineConfig.playerNearChunkDetectionRange / 16.0); // DivineMC - Chunk System optimization - - } + // the smallest distance on x/z is at 45 degrees, we need to subtract 0.5 since this is calculated from chunk center and not chunk perimeter + // note: vanilla does not subtract 0.5 but the result is (luckily!) the same + public static final int NARROW_SPAWN_TRACK_RANGE = (int)Math.floor(((double)PLAYER_SPAWN_TRACK_RANGE / Math.sqrt(2.0)) - 0.5); diff --git a/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java b/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java index 4ca68a903e67606fc4ef0bfa9862a73797121c8b..f94f443f862611f039454d1dc8ff2a4ba5f081d3 100644 --- a/ca/spottedleaf/moonrise/patches/starlight/light/SWMRNibbleArray.java @@ -890,10 +893,10 @@ index 4ca68a903e67606fc4ef0bfa9862a73797121c8b..f94f443f862611f039454d1dc8ff2a4b return false; } diff --git a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java -index 571db5f9bf94745a8afe2cd313e593fb15db5e37..c8e59f6abed384f45314fc995d3822724c9b4001 100644 +index 51f4dd4f583dfbd16cb00f1cb4418d1044cecb1c..2f83deafbb5b50e5ce191b5351ec5ed948262008 100644 --- a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java +++ b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java -@@ -888,7 +888,7 @@ public final class StarLightInterface { +@@ -887,7 +887,7 @@ public final class StarLightInterface { super(chunkCoordinate, lightEngine, queue); this.task = ((ChunkSystemServerLevel)(ServerLevel)lightEngine.getWorld()).moonrise$getChunkTaskScheduler().radiusAwareScheduler.createTask( CoordinateUtils.getChunkX(chunkCoordinate), CoordinateUtils.getChunkZ(chunkCoordinate), @@ -903,7 +906,7 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..c8e59f6abed384f45314fc995d382272 } diff --git a/io/papermc/paper/FeatureHooks.java b/io/papermc/paper/FeatureHooks.java -index 460bb584db04b582f3297ae419183f430aff1ec0..72c4e1876115745fbeec12fe8a1ad6f4803e9d7f 100644 +index 52b981a05ad5aabb7c85dc1e0f1d2b835163bb87..f4af8e131c2badbe0e57ccec5be8710e12d7c38d 100644 --- a/io/papermc/paper/FeatureHooks.java +++ b/io/papermc/paper/FeatureHooks.java @@ -32,11 +32,6 @@ import org.bukkit.Chunk; @@ -919,10 +922,10 @@ index 460bb584db04b582f3297ae419183f430aff1ec0..72c4e1876115745fbeec12fe8a1ad6f4 commands.put(Set.of("fixlight"), new FixLightCommand()); // Paper - rewrite chunk system commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand()); // Paper - rewrite chunk system diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae82185929494b62 100644 +index b5028cc64e2a43c841801114908825102df41765..fb6e0beb35d1d6bb9a159debeb06e861051821b9 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -127,8 +127,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -132,8 +132,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public private final String storageName; private final PlayerMap playerMap = new PlayerMap(); @@ -933,7 +936,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 // Paper - rewrite chunk system public int serverViewDistance; public final WorldGenContext worldGenContext; // Paper - public -@@ -249,7 +249,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -256,7 +256,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final ServerPlayer[] backingSet = inRange.getRawDataUnchecked(); for (int i = 0, len = inRange.size(); i < len; i++) { @@ -946,7 +949,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } } -@@ -266,7 +270,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -273,7 +277,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } final ServerPlayer[] backingSet = inRange.getRawDataUnchecked(); for (int i = 0, len = inRange.size(); i < len; i++) { @@ -959,7 +962,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } } // Paper end - per player mob count backoff -@@ -720,27 +728,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -774,27 +782,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return false; } @@ -977,8 +980,8 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 - if (event == null || event.isCancelled()) continue; - blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4)); - } -- // Paper end - PlayerNaturallySpawnCreaturesEvent - if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos, blockRange)) { +- // Paper end - PlayerNaturallySpawnCreaturesEvent - return true; - } - } @@ -988,7 +991,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 // Paper end - chunk tick iteration optimisation } -@@ -758,10 +746,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -812,10 +800,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final ServerPlayer[] raw = players.getRawDataUnchecked(); final int len = players.size(); @@ -1002,7 +1005,7 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 if (ret == null) { ret = new ArrayList<>(len - i); ret.add(player); -@@ -1146,6 +1134,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1208,6 +1196,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } else { for (int i = 0, len = players.size(); i < len; ++i) { final ServerPlayer player = playersRaw[i]; @@ -1011,10 +1014,10 @@ index 965899a98223b15bd770378c202873cbf15b714d..dccf4d4b1067e1b09e38cabeae821859 } diff --git a/net/minecraft/server/level/DistanceManager.java b/net/minecraft/server/level/DistanceManager.java -index 5eab6179ce3913cb4e4d424f910ba423faf21c85..4b1efd53e423bdfe90d5efd472823869fc87e73b 100644 +index fd3d0f6cb53bc8b6186f0d86575f21007b2c20ed..7f3c41b59e288364d67534511fc038e6dbb268fa 100644 --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -178,15 +178,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches +@@ -127,15 +127,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches public boolean inEntityTickingRange(long chunkPos) { // Paper start - rewrite chunk system @@ -1033,10 +1036,10 @@ index 5eab6179ce3913cb4e4d424f910ba423faf21c85..4b1efd53e423bdfe90d5efd472823869 } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index ab30af9cd58ff7310e05be87b08f42bacf69e11e..ae0e36d198ad8243920c8e8a55c0be4945542763 100644 +index 4d4139b5f42a4db6e22bf1d063a23dc7b9914f85..9a65321ce62f21b150d29be30dbae7dba0ff40be 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -439,8 +439,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -444,8 +444,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon public boolean isPositionTicking(long chunkPos) { // Paper start - rewrite chunk system @@ -1047,18 +1050,18 @@ index ab30af9cd58ff7310e05be87b08f42bacf69e11e..ae0e36d198ad8243920c8e8a55c0be49 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6c5e40023 100644 +index 8fa3af0ebcb92138d0dae858c131db0a710df693..e351b75f03b7096dcd0378b49987d27c04474116 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -181,6 +181,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -177,6 +177,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final ServerChunkCache chunkSource; private final MinecraftServer server; public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type + public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.LevelHolderData chunkHolderData; // DivineMC - Chunk System optimization private int lastSpawnChunkRadius; - final EntityTickList entityTickList = new EntityTickList(this); // DivineMC - Parallel world ticking + final EntityTickList entityTickList = new EntityTickList(); // Paper - rewrite chunk system -@@ -291,6 +292,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -287,6 +288,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - optimise getPlayerByUUID // Paper start - rewrite chunk system @@ -1066,7 +1069,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder viewDistanceHolder = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.ViewDistanceHolder(); private final ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader chunkLoader = new ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader((ServerLevel)(Object)this); private final ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController entityDataController; -@@ -689,6 +691,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -678,6 +680,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper start - rewrite chunk system this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); @@ -1074,15 +1077,15 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 this.entityDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController( new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController.EntityRegionFileStorage( new RegionStorageInfo(levelStorageAccess.getLevelId(), dimension, "entities"), -@@ -703,6 +706,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -691,6 +694,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit - this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new org.bxteam.divinemc.server.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // DivineMC - Parallel world ticking this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle + this.chunkSystemPriorities = new org.bxteam.divinemc.server.chunk.PriorityHandler(this); // DivineMC - Chunk System optimizations } // Paper start -@@ -832,8 +836,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -820,8 +824,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public boolean shouldTickBlocksAt(long chunkPos) { // Paper start - rewrite chunk system @@ -1092,7 +1095,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 // Paper end - rewrite chunk system } -@@ -889,7 +892,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -877,7 +880,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private void optimiseRandomTick(final LevelChunk chunk, final int tickSpeed) { final LevelChunkSection[] sections = chunk.getSections(); @@ -1101,7 +1104,7 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294(); -@@ -897,42 +900,41 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -885,42 +888,41 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe final int offsetX = cpos.x << 4; final int offsetZ = cpos.z << 4; @@ -1154,9 +1157,9 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 } // Paper end - optimise random ticking -@@ -2557,30 +2559,25 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2532,16 +2534,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { + public boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { // Paper start - rewrite chunk system - final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(chunkPos); - // isTicking implies the chunk is loaded, and the chunk is loaded now implies the entities are loaded @@ -1173,24 +1176,8 @@ index 52ba052fc1ff2a35786570c282a7de4e9dff99f5..9298bdca9a653622f3625190e875e7b6 // Paper end - rewrite chunk system } - public boolean isNaturalSpawningAllowed(BlockPos pos) { - // Paper start - rewrite chunk system -- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(pos)); -- return chunkHolder != null && chunkHolder.isEntityTickingReady(); -+ return this.moonrise$getChunkTaskScheduler().chunkHolderManager.entityTickingChunkHolders.contains(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(pos)); // DivineMC - Chunk System optimization - // Paper end - rewrite chunk system - } - - public boolean isNaturalSpawningAllowed(ChunkPos chunkPos) { - // Paper start - rewrite chunk system -- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos)); -- return chunkHolder != null && chunkHolder.isEntityTickingReady(); -+ return this.moonrise$getChunkTaskScheduler().chunkHolderManager.entityTickingChunkHolders.contains(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos)); // DivineMC - Chunk System optimization - // Paper end - rewrite chunk system - } - diff --git a/net/minecraft/server/level/ThreadedLevelLightEngine.java b/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 5c9ac44a3b4bc8e047feaf61a94eb163761498a2..66dc6d77263d6f5de7d0a96b8b6575e7a363f5bf 100644 +index 216c2294f59a9d53613ac249ea63adeaa8a8efa4..b83438852a7b01fef9a736a5b0bc46f15ed1d59b 100644 --- a/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -138,7 +138,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @@ -1203,10 +1190,10 @@ index 5c9ac44a3b4bc8e047feaf61a94eb163761498a2..66dc6d77263d6f5de7d0a96b8b6575e7 return chunks.size(); } diff --git a/net/minecraft/world/level/LevelReader.java b/net/minecraft/world/level/LevelReader.java -index 26c8c1e5598daf3550aef05b12218c47bda6618b..94c824ab1457939c425e1f99929d3222ee2c18a0 100644 +index 0842fd6488c8b27d98c4344e1244996b4c0e9912..cba72a86d99fb4b3a3f9f5aefe9993ec8e84abfd 100644 --- a/net/minecraft/world/level/LevelReader.java +++ b/net/minecraft/world/level/LevelReader.java -@@ -70,10 +70,27 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste +@@ -74,10 +74,27 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste @Override default Holder getNoiseBiome(int x, int y, int z) { @@ -1424,7 +1411,7 @@ index cf3172be76fa4c7987ed569138439ff42f92fa7f..ed3c470056855a520a110ac7014f7839 + // DivineMC end - Chunk System Optimizations } diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java -index c83d0667b19830304f22319a46a23422a8766790..aa10c5087a0fc9306b734f20ccbad73045a1b6d0 100644 +index 4db7ec2647b9f08536dc5253dac0fa8d3044e38b..e3abc97a1a66988e44b1ed78b76a198b82051da1 100644 --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java @@ -23,6 +23,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ @@ -1539,7 +1526,7 @@ index a80b2e9dceea423180a9c390d1970317dff4f1b0..6d9dfc1837dccef2073da180aaaf68b0 void read(FriendlyByteBuf buffer); diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index 230cb433c38f9b6ffb1adeaa8b6040490f13e826..712d3d1669aecd38934957c81835e1f38289539a 100644 +index d7f4d54f73adc0d4d71fb9ba425e45a11c456961..a512609aaa823b940ed269c981fc9beec49a126e 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java @@ -393,6 +393,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer @@ -1556,7 +1543,7 @@ index 230cb433c38f9b6ffb1adeaa8b6040490f13e826..712d3d1669aecd38934957c81835e1f3 public PalettedContainer copy() { return new PalettedContainer<>(this, this.presetValues); // Paper - Anti-Xray - Add preset values diff --git a/net/minecraft/world/level/chunk/ProtoChunk.java b/net/minecraft/world/level/chunk/ProtoChunk.java -index e66239e2da91bd3ddf358d239be796719c0da327..35e9d8cfe12252d3419626f1cefb64d30e20069e 100644 +index 13837d5508c34de3ccc49caac0d6c0ba7010d88a..3449d4dbb68353204ec67c46eed1404dd6410e96 100644 --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java @@ -41,7 +41,7 @@ public class ProtoChunk extends ChunkAccess { @@ -1610,7 +1597,7 @@ index 2ffae24b0cb1a20c7d5a8520f1b5197c2cedea11..c3ec5e5645f680a915c95d833b589b68 public T valueFor(int id) { if (this.value != null && id == 0) { diff --git a/net/minecraft/world/level/chunk/storage/IOWorker.java b/net/minecraft/world/level/chunk/storage/IOWorker.java -index 2199a9e2a0141c646d108f2687a27f1d165453c5..c28c2583b257f92207b822a1fdde8f5b7e480992 100644 +index 27e1edbd8d8ffd80c1a3df17bc47f4a6936619f7..fae062a643692369175f58bb1687e766e873d8e3 100644 --- a/net/minecraft/world/level/chunk/storage/IOWorker.java +++ b/net/minecraft/world/level/chunk/storage/IOWorker.java @@ -212,7 +212,38 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { @@ -1653,10 +1640,10 @@ index 2199a9e2a0141c646d108f2687a27f1d165453c5..c28c2583b257f92207b822a1fdde8f5b if (entry != null) { this.runStore(entry.getKey(), entry.getValue()); diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 6ebd1300c2561116b83cb2472ac7939ead36d576..16cd10ab8de69ca3d29c84cf93715645322fd72a 100644 +index 8d1174f25e0e90d0533970f4ddd8448442024936..c98cb390bda4b536f97445f228e06aaebcd84609 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -244,7 +244,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -269,7 +269,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise protected RegionFileStorage(RegionStorageInfo info, Path folder, boolean sync) { // Paper - protected this.folder = folder; @@ -2222,7 +2209,7 @@ index c62a15ea4a1bb22e7bcc2fc544acf8a601892029..bc67039f8374ae4e471ca14e0c623e6b } } diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java -index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d07c259099 100644 +index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..4c11b822fa65388c1d8d9aaa7fd70200d0eaa418 100644 --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java @@ -29,6 +29,17 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { @@ -2243,7 +2230,7 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 public static Beardifier forStructuresInChunk(StructureManager structureManager, ChunkPos chunkPos) { int minBlockX = chunkPos.getMinBlockX(); -@@ -76,50 +87,44 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -75,50 +86,44 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { this.junctionIterator = junctionIterator; } @@ -2318,7 +2305,7 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 @Override public double minValue() { -@@ -132,8 +137,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -131,8 +136,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } private static double getBuryContribution(double x, double y, double z) { @@ -2336,10 +2323,10 @@ index 131923282c9ecbcb1d7f45a826da907c02bd2716..1af75406ba69c5eec4a41fe7a8dce0d0 private static double getBeardContribution(int x, int y, int z, int height) { diff --git a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java -index 4993ace2b3d615570de3d4b6621aeba3a3e7fe99..1be79332446559c95ae3048a71a6634fd01cf2e2 100644 +index 3379c3893227d42bb54f3a94e697a9851d279605..161aed37d14cd283a3b4341ea15d57a4a0f088b3 100644 --- a/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java +++ b/net/minecraft/world/level/levelgen/BelowZeroRetrogen.java -@@ -82,6 +82,7 @@ public final class BelowZeroRetrogen { +@@ -74,6 +74,7 @@ public final class BelowZeroRetrogen { } public void applyBedrockMask(ProtoChunk chunk) { @@ -2623,20 +2610,19 @@ index 9d3a9ca1e13cd80f468f1352bbb74345f03903dd..d97b9b43686bda0a95fc02f6ca31b2d0 public RandomSource at(int x, int y, int z) { long seed = Mth.getSeed(x, y, z); diff --git a/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java b/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java -index f4009671880b00ecec98fe604215e2824e453cdf..7b00301da0b3fb6429d04e4d10cafa30e168aa62 100644 +index 21cbf6c1723feb1813d8cd5106e36594d140d987..29fad81878fe6902328b810e1584650cfb65aba6 100644 --- a/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java +++ b/net/minecraft/world/level/levelgen/feature/stateproviders/RandomizedIntStateProvider.java -@@ -54,18 +54,21 @@ public class RandomizedIntStateProvider extends BlockStateProvider { - } +@@ -55,17 +55,21 @@ public class RandomizedIntStateProvider extends BlockStateProvider { @Override -+ @SuppressWarnings("DataFlowIssue") public BlockState getState(RandomSource random, BlockPos pos) { - BlockState state = this.source.getState(random, pos); - if (this.property == null || !state.hasProperty(this.property)) { - IntegerProperty integerProperty = findProperty(state, this.propertyName); - if (integerProperty == null) { - return state; ++ // DivineMC start - Chunk System optimization + BlockState blockState = this.source.getState(random, pos); + IntegerProperty propertyLocal = this.property; + if (propertyLocal == null || !blockState.hasProperty(propertyLocal)) { @@ -2650,13 +2636,14 @@ index f4009671880b00ecec98fe604215e2824e453cdf..7b00301da0b3fb6429d04e4d10cafa30 + this.property = intProperty; } -- return state.setValue(this.property, Integer.valueOf(this.values.sample(random))); -+ return (BlockState)blockState.setValue(propertyLocal, this.values.sample(random)); +- return state.setValue(this.property, this.values.sample(random)); ++ return (BlockState) blockState.setValue(this.property, this.values.sample(random)); ++ // DivineMC end - Chunk System optimization } @Nullable diff --git a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java -index d122221deefb218db962e97ba2d958c33d903b8a..56311b439ac22700593d2d31da3a4efe3a519d53 100644 +index e2036a80eff3dc1a9ec625880d4aab6ef71d84fa..6c5200a311a6c5a93a49999cc0c3a8b3f3ca8240 100644 --- a/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java +++ b/net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece.java @@ -12,7 +12,7 @@ public abstract class ScatteredFeaturePiece extends StructurePiece { @@ -2669,10 +2656,10 @@ index d122221deefb218db962e97ba2d958c33d903b8a..56311b439ac22700593d2d31da3a4efe protected ScatteredFeaturePiece(StructurePieceType type, int x, int y, int z, int width, int height, int depth, Direction orientation) { super(type, 0, StructurePiece.makeBoundingBox(x, y, z, orientation, width, height, depth)); diff --git a/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb2f808eb7 100644 +index 48fce0845fb023d6286dac144c285b048d778564..3e8e740f08614143f09c62f07bee7b305dd7929c 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -46,6 +46,7 @@ public class StructureCheck { +@@ -47,6 +47,7 @@ public class StructureCheck { private final LevelHeightAccessor heightAccessor; private final BiomeSource biomeSource; private final long seed; @@ -2680,7 +2667,7 @@ index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb private final DataFixer fixerUpper; // Paper start - rewrite chunk system // make sure to purge entries from the maps to prevent memory leaks -@@ -235,15 +236,13 @@ public class StructureCheck { +@@ -229,15 +230,13 @@ public class StructureCheck { } private void storeFullResults(long chunkPos, Object2IntMap structureChunks) { @@ -2702,7 +2689,7 @@ index f7dc4957b38878ddd3bfc7546be8a4e0af65c807..4023115e8120a6ccbc2a5bf7f2d17ffb public void incrementReference(ChunkPos pos, Structure structure) { diff --git a/net/minecraft/world/level/levelgen/structure/StructureStart.java b/net/minecraft/world/level/levelgen/structure/StructureStart.java -index 4dafa79dd4ec55a443ba3731a79e7cd6e8052f48..8aeab4d773473ad20b1c64295c93d6fcb4ea02a1 100644 +index f9a15c3769f29af1952ef880f6fcd2612119ecf0..13f6654e06f87e9a9fbeba2217ee0e0eaa95347d 100644 --- a/net/minecraft/world/level/levelgen/structure/StructureStart.java +++ b/net/minecraft/world/level/levelgen/structure/StructureStart.java @@ -26,7 +26,7 @@ public final class StructureStart { @@ -2768,10 +2755,10 @@ index c84d865837e0f009fcde19e14a44fa43aefe660a..64d7adbd4aa398044a1d68d51e463b67 @Nullable private volatile StructureTemplatePool.Projection projection; diff --git a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java -index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b8eab533c 100644 +index 0d2451a9ade43650dbbcbab69ce0f6e8f69b5aee..21b8e738c8823eac5d8fc8241dd8fb0e5ce82364 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java +++ b/net/minecraft/world/level/levelgen/structure/structures/DesertPyramidPiece.java -@@ -23,29 +23,44 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; +@@ -23,29 +23,45 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; public class DesertPyramidPiece extends ScatteredFeaturePiece { public static final int WIDTH = 21; public static final int DEPTH = 21; @@ -2798,15 +2785,16 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b public DesertPyramidPiece(CompoundTag tag) { super(StructurePieceType.DESERT_PYRAMID_PIECE, tag); -- this.hasPlacedChest[0] = tag.getBoolean("hasPlacedChest0"); -- this.hasPlacedChest[1] = tag.getBoolean("hasPlacedChest1"); -- this.hasPlacedChest[2] = tag.getBoolean("hasPlacedChest2"); -- this.hasPlacedChest[3] = tag.getBoolean("hasPlacedChest3"); +- this.hasPlacedChest[0] = tag.getBooleanOr("hasPlacedChest0", false); +- this.hasPlacedChest[1] = tag.getBooleanOr("hasPlacedChest1", false); +- this.hasPlacedChest[2] = tag.getBooleanOr("hasPlacedChest2", false); +- this.hasPlacedChest[3] = tag.getBooleanOr("hasPlacedChest3", false); + // DivineMC start - Chunk System Optimizations -+ this.hasPlacedChestAtomic.set(0, tag.getBoolean("hasPlacedChest0")); -+ this.hasPlacedChestAtomic.set(1, tag.getBoolean("hasPlacedChest1")); -+ this.hasPlacedChestAtomic.set(2, tag.getBoolean("hasPlacedChest2")); -+ this.hasPlacedChestAtomic.set(3, tag.getBoolean("hasPlacedChest3")); ++ this.hasPlacedChestAtomic.set(0, tag.getBooleanOr("hasPlacedChest0", false)); ++ this.hasPlacedChestAtomic.set(1, tag.getBooleanOr("hasPlacedChest1", false)); ++ this.hasPlacedChestAtomic.set(2, tag.getBooleanOr("hasPlacedChest2", false)); ++ this.hasPlacedChestAtomic.set(3, tag.getBooleanOr("hasPlacedChest3", false)); ++ init(); + // DivineMC end - Chunk System Optimizations } @@ -2826,7 +2814,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } @Override -@@ -287,12 +302,12 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { +@@ -287,12 +303,12 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { this.placeBlock(level, Blocks.CUT_SANDSTONE.defaultBlockState(), 10, -11, 13, box); for (Direction direction : Direction.Plane.HORIZONTAL) { @@ -2842,7 +2830,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } } -@@ -419,7 +434,7 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { +@@ -419,7 +435,7 @@ public class DesertPyramidPiece extends ScatteredFeaturePiece { this.randomCollapsedRoofPos = new BlockPos(this.getWorldX(i1, randomInt), this.getWorldY(y), this.getWorldZ(i1, randomInt)); } @@ -2852,7 +2840,7 @@ index e8c125ddb335bfe81b8f1dbb91f7f7ccec11d980..4b6b18b3d255f6a72e6be3b85260732b } diff --git a/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java b/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java -index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793ad612fbc6 100644 +index d28f1a25e2137955402e41679d1a4220a0136579..d751eac6d7a97b8de44c83c35ff7d3e36ca3b066 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java +++ b/net/minecraft/world/level/levelgen/structure/structures/JungleTemplePiece.java @@ -30,10 +30,12 @@ import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -2876,15 +2864,15 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a public JungleTemplePiece(CompoundTag tag) { super(StructurePieceType.JUNGLE_PYRAMID_PIECE, tag); -- this.placedMainChest = tag.getBoolean("placedMainChest"); -- this.placedHiddenChest = tag.getBoolean("placedHiddenChest"); -- this.placedTrap1 = tag.getBoolean("placedTrap1"); -- this.placedTrap2 = tag.getBoolean("placedTrap2"); +- this.placedMainChest = tag.getBooleanOr("placedMainChest", false); +- this.placedHiddenChest = tag.getBooleanOr("placedHiddenChest", false); +- this.placedTrap1 = tag.getBooleanOr("placedTrap1", false); +- this.placedTrap2 = tag.getBooleanOr("placedTrap2", false); + // DivineMC start - Chunk System Optimizations -+ this.placedMainChest.set(tag.getBoolean("placedMainChest")); -+ this.placedHiddenChest.set(tag.getBoolean("placedHiddenChest")); -+ this.placedTrap1.set(tag.getBoolean("placedTrap1")); -+ this.placedTrap2.set(tag.getBoolean("placedTrap2")); ++ this.placedMainChest.set(tag.getBooleanOr("placedMainChest", false)); ++ this.placedHiddenChest.set(tag.getBooleanOr("placedHiddenChest", false)); ++ this.placedTrap1.set(tag.getBooleanOr("placedTrap1", false)); ++ this.placedTrap2.set(tag.getBooleanOr("placedTrap2", false)); + // DivineMC end - Chunk System Optimizations } @@ -2904,7 +2892,7 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } @Override -@@ -242,8 +248,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { +@@ -236,8 +242,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { box ); this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 3, -3, 1, box); @@ -2914,8 +2902,8 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a + this.placedTrap1.set(this.createDispenser(level, box, random, 3, -2, 1, Direction.NORTH, BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER)); // DivineMC - Chunk System Optimizations } - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.SOUTH, Boolean.valueOf(true)), 3, -2, 2, box); -@@ -340,14 +346,14 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.SOUTH, true), 3, -2, 2, box); +@@ -328,14 +334,14 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { ); this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 9, -3, 4, box); this.placeBlock(level, blockState4, 9, -2, 4, box); @@ -2925,8 +2913,8 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a + this.placedTrap2.set(this.createDispenser(level, box, random, 9, -2, 3, Direction.WEST, BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER)); // DivineMC - Chunk System Optimizations } - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, Boolean.valueOf(true)), 8, -1, 3, box); - this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, Boolean.valueOf(true)), 8, -2, 3, box); + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, true), 8, -1, 3, box); + this.placeBlock(level, Blocks.VINE.defaultBlockState().setValue(VineBlock.EAST, true), 8, -2, 3, box); - if (!this.placedMainChest) { - this.placedMainChest = this.createChest(level, box, random, 8, -3, 3, BuiltInLootTables.JUNGLE_TEMPLE); + if (!this.placedMainChest.get()) { // DivineMC - Chunk System Optimizations @@ -2934,7 +2922,7 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } this.placeBlock(level, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), 9, -3, 2, box); -@@ -390,8 +396,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { +@@ -378,8 +384,8 @@ public class JungleTemplePiece extends ScatteredFeaturePiece { this.placeBlock(level, Blocks.STICKY_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.WEST), 10, -2, 8, box); this.placeBlock(level, Blocks.STICKY_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, Direction.WEST), 10, -1, 8, box); this.placeBlock(level, Blocks.REPEATER.defaultBlockState().setValue(RepeaterBlock.FACING, Direction.NORTH), 10, -2, 10, box); @@ -2946,10 +2934,10 @@ index 82600a247e13b82fc56273e1fd8483c8102a8d3d..cd9b24f017ebea5df55c7d15ee3d793a } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java -index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff2ee99b03 100644 +index 53d3bf1d2a1debe46e276b1db25b420be4ad9958..5212e4a4392efa0171c9d709dc2606a4e14df07f 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/MineshaftPieces.java -@@ -95,7 +95,7 @@ public class MineshaftPieces { +@@ -91,7 +91,7 @@ public class MineshaftPieces { public static class MineShaftCorridor extends MineshaftPieces.MineShaftPiece { private final boolean hasRails; private final boolean spiderCorridor; @@ -2958,7 +2946,7 @@ index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff private final int numSections; public MineShaftCorridor(CompoundTag tag) { -@@ -954,7 +954,7 @@ public class MineshaftPieces { +@@ -950,7 +950,7 @@ public class MineshaftPieces { } public static class MineShaftRoom extends MineshaftPieces.MineShaftPiece { @@ -2968,10 +2956,10 @@ index 1acd506f7c0679fa9f69b6ab221002b28d00c3e5..52237559477e1965cb13a94ee4e6b4ff public MineShaftRoom(int genDepth, RandomSource random, int x, int z, MineshaftStructure.Type type) { super( diff --git a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java -index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa44642f417 100644 +index ae4ffcf1859e8ff7f8fbc91246e66e20f5c33dd7..b9124999f1aede4450f25e25c55bca96077670e8 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/NetherFortressPieces.java -@@ -1301,7 +1301,7 @@ public class NetherFortressPieces { +@@ -1112,7 +1112,7 @@ public class NetherFortressPieces { int i = 0; for (NetherFortressPieces.PieceWeight pieceWeight : weights) { @@ -2980,7 +2968,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 flag = true; } -@@ -1341,7 +1341,7 @@ public class NetherFortressPieces { +@@ -1152,7 +1152,7 @@ public class NetherFortressPieces { pieceWeight, pieces, random, x, y, z, orientation, genDepth ); if (netherBridgePiece != null) { @@ -2989,7 +2977,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 startPiece.previousPiece = pieceWeight; if (!pieceWeight.isValid()) { weights.remove(pieceWeight); -@@ -1576,7 +1576,7 @@ public class NetherFortressPieces { +@@ -1387,7 +1387,7 @@ public class NetherFortressPieces { static class PieceWeight { public final Class pieceClass; public final int weight; @@ -2998,7 +2986,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 public final int maxPlaceCount; public final boolean allowInRow; -@@ -1592,11 +1592,11 @@ public class NetherFortressPieces { +@@ -1403,11 +1403,11 @@ public class NetherFortressPieces { } public boolean doPlace(int genDepth) { @@ -3012,7 +3000,7 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 } } -@@ -1746,24 +1746,24 @@ public class NetherFortressPieces { +@@ -1545,24 +1545,24 @@ public class NetherFortressPieces { } public static class StartPiece extends NetherFortressPieces.BridgeCrossing { @@ -3043,10 +3031,10 @@ index 20ddc6403823f72ef15d10e3d53b5f4d13e82724..081fbe004cac5bca67210a1abcca7fa4 } } diff --git a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java -index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f19819dfd 100644 +index 1f1ee6e2d020cd06184313d19523ea928cf242c8..ab6d51b60cdbaed7ac7395d2a27eadd6d6b4518f 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java -@@ -63,32 +63,36 @@ public class StrongholdPieces { +@@ -65,32 +65,36 @@ public class StrongholdPieces { } } }; @@ -3094,7 +3082,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } return flag; -@@ -138,9 +142,11 @@ public class StrongholdPieces { +@@ -140,9 +144,11 @@ public class StrongholdPieces { if (!updatePieceWeight()) { return null; } else { @@ -3109,7 +3097,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f if (strongholdPiece != null) { return strongholdPiece; } -@@ -150,9 +156,9 @@ public class StrongholdPieces { +@@ -152,9 +158,9 @@ public class StrongholdPieces { while (i < 5) { i++; @@ -3121,7 +3109,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f randomInt -= pieceWeight.weight; if (randomInt < 0) { if (!pieceWeight.doPlace(genDepth) || pieceWeight == piece.previousPiece) { -@@ -163,10 +169,10 @@ public class StrongholdPieces { +@@ -165,10 +171,10 @@ public class StrongholdPieces { pieceWeight.pieceClass, pieces, random, x, y, z, direction, genDepth ); if (strongholdPiece1 != null) { @@ -3134,7 +3122,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } return strongholdPiece1; -@@ -202,7 +208,7 @@ public class StrongholdPieces { +@@ -204,7 +210,7 @@ public class StrongholdPieces { private static final int WIDTH = 5; private static final int HEIGHT = 5; private static final int DEPTH = 7; @@ -3143,7 +3131,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public ChestCorridor(int genDepth, RandomSource random, BoundingBox box, Direction orientation) { super(StructurePieceType.STRONGHOLD_CHEST_CORRIDOR, genDepth, box); -@@ -723,7 +729,7 @@ public class StrongholdPieces { +@@ -690,7 +696,7 @@ public class StrongholdPieces { static class PieceWeight { public final Class pieceClass; public final int weight; @@ -3152,7 +3140,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public final int maxPlaceCount; public PieceWeight(Class pieceClass, int weight, int maxPlaceCount) { -@@ -733,11 +739,11 @@ public class StrongholdPieces { +@@ -700,11 +706,11 @@ public class StrongholdPieces { } public boolean doPlace(int genDepth) { @@ -3166,7 +3154,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } } -@@ -745,7 +751,7 @@ public class StrongholdPieces { +@@ -712,7 +718,7 @@ public class StrongholdPieces { protected static final int WIDTH = 11; protected static final int HEIGHT = 8; protected static final int DEPTH = 16; @@ -3175,7 +3163,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public PortalRoom(int genDepth, BoundingBox box, Direction orientation) { super(StructurePieceType.STRONGHOLD_PORTAL_ROOM, genDepth, box); -@@ -1273,7 +1279,7 @@ public class StrongholdPieces { +@@ -1174,7 +1180,7 @@ public class StrongholdPieces { @Override public void addChildren(StructurePiece piece, StructurePieceAccessor pieces, RandomSource random) { if (this.isSource) { @@ -3184,7 +3172,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f } this.generateSmallDoorChildForward((StrongholdPieces.StartPiece)piece, pieces, random, 1, 1); -@@ -1322,10 +1328,10 @@ public class StrongholdPieces { +@@ -1223,10 +1229,10 @@ public class StrongholdPieces { } public static class StartPiece extends StrongholdPieces.StairsDown { @@ -3199,7 +3187,7 @@ index b28829043c558af04511108691a4e9042a5afc62..b9d9fe3affd1f991ea3a742bc48a518f public StartPiece(RandomSource random, int x, int z) { super(StructurePieceType.STRONGHOLD_START, 0, x, z, getRandomHorizontalDirection(random)); diff --git a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java -index 6c5b6ba8973c88e959d57fec38abcef5f097e9b3..ad44f4915e7a9609445b62664d2a47581de8c169 100644 +index 081fe9509b777bd1f853b662ca8b01c64f27b5e5..9a3d1ed95d201d24374ff15c7a8daa30bc25f777 100644 --- a/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/WoodlandMansionPieces.java @@ -126,7 +126,7 @@ public class WoodlandMansionPieces { @@ -3261,10 +3249,10 @@ index 05027cc20d174d78bef118cd2ba545ac56e1559c..32bbfe48dee44b0b491aa369dec59cbf private boolean finalizeEntities; diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index ab1dcbe416e2c3c94cfddf04b7ed053425a71806..a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897 100644 +index bb8b5ca9044ecb33687e7f20cfb0acbf55f887c7..df3a1b9ed4ad836bd3358b6b440964e497213ea3 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -71,8 +71,8 @@ public class StructureTemplate { +@@ -69,8 +69,8 @@ public class StructureTemplate { public static final String ENTITY_TAG_BLOCKPOS = "blockPos"; public static final String ENTITY_TAG_NBT = "nbt"; public static final String SIZE_TAG = "size"; @@ -3276,11 +3264,11 @@ index ab1dcbe416e2c3c94cfddf04b7ed053425a71806..a37eb2e29b4577ebc711e8ef7b47fbbc private String author = "?"; // CraftBukkit start - data containers diff --git a/net/minecraft/world/ticks/LevelChunkTicks.java b/net/minecraft/world/ticks/LevelChunkTicks.java -index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c28fa2f90 100644 +index 66d0a6390febe929ef774b0a7813329015bc8cc2..d1917dee4ca6bba5f2c92475811c724caf2948cb 100644 --- a/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/net/minecraft/world/ticks/LevelChunkTicks.java -@@ -18,10 +18,10 @@ import net.minecraft.nbt.ListTag; - import net.minecraft.world.level.ChunkPos; +@@ -14,10 +14,10 @@ import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; public class LevelChunkTicks implements SerializableTickContainer, TickContainerAccess, ca.spottedleaf.moonrise.patches.chunk_system.ticks.ChunkSystemLevelChunkTicks { // Paper - rewrite chunk system - private final Queue> tickQueue = new PriorityQueue<>(ScheduledTick.DRAIN_ORDER); @@ -3292,7 +3280,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c @Nullable private BiConsumer, ScheduledTick> onTickAdded; -@@ -71,10 +71,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -67,10 +67,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon @Nullable public ScheduledTick poll() { @@ -3314,7 +3302,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c return scheduledTick; } -@@ -87,6 +95,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -83,6 +91,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } private void scheduleUnchecked(ScheduledTick tick) { @@ -3322,7 +3310,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c this.tickQueue.add(tick); if (this.onTickAdded != null) { this.onTickAdded.accept(this, tick); -@@ -127,6 +136,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -124,6 +133,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } for (ScheduledTick scheduledTick : this.tickQueue) { @@ -3331,7 +3319,7 @@ index faf45ac459f7c25309d6ef6dce371d484a0dae7b..0e862e9c0d9d562e77ce02a35deb761c } diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java -index 0a9805d42142678ca5213c511235daa6505ddbf3..cd73f1a3ccc80e4ab1766147fccc67d81eeb4cc3 100644 +index 0a9805d42142678ca5213c511235daa6505ddbf3..6e3d4e78a7d92a846e68fe60271cfe5a5cd7b569 100644 --- a/net/minecraft/world/ticks/LevelTicks.java +++ b/net/minecraft/world/ticks/LevelTicks.java @@ -30,17 +30,18 @@ public class LevelTicks implements LevelTickAccess { @@ -3398,10 +3386,11 @@ index 0a9805d42142678ca5213c511235daa6505ddbf3..cd73f1a3ccc80e4ab1766147fccc67d8 if (!this.toRunThisTickSet.isEmpty()) { this.toRunThisTickSet.remove(scheduledTick); } -@@ -183,6 +189,7 @@ public class LevelTicks implements LevelTickAccess { +@@ -182,7 +188,7 @@ public class LevelTicks implements LevelTickAccess { + } private void cleanupAfterTick() { - this.toRunThisTick.clear(); +- this.toRunThisTick.clear(); + this.toRunThisTickCount.set(0); // DivineMC - Chunk System Optimizations this.containersToTick.clear(); this.alreadyRunThisTick.clear(); diff --git a/divinemc-server/minecraft-patches/features/0011-Optimize-Fluids.patch b/divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch similarity index 92% rename from divinemc-server/minecraft-patches/features/0011-Optimize-Fluids.patch rename to divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch index 9cb6893..04ece05 100644 --- a/divinemc-server/minecraft-patches/features/0011-Optimize-Fluids.patch +++ b/divinemc-server/minecraft-patches/features/0010-Optimize-Fluids.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Optimize Fluids diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index 47a7ce88bf4d26408545dcc061aa763311af0dc9..13877d2bd4289652a9627780839b8d879a66d753 100644 +index ae609e0603a78423c4c89b7efb9c41ab8fe7aa52..5c143e3227371c701f36362e24bd3c1fc8061ed2 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java @@ -193,6 +193,7 @@ public class LiquidBlock extends Block implements BucketPickup { Block block = level.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState())) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { + level.setBlock(pos, block.defaultBlockState(), 3); // DivineMC - Optimize Fluids this.fizz(level, pos); } // CraftBukkit end diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java -index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9dcd6cd23 100644 +index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..abf1866c26330fc3ec61a4457a7c6966cf0f38a7 100644 --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java @@ -199,6 +199,7 @@ public abstract class FlowingFluid extends Fluid { @@ -41,7 +41,7 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 + BlockPos blockPos = pos.relative(direction.getOpposite()); + if (level.getFluidState(blockPos).is(net.minecraft.tags.FluidTags.WATER)) { + Block block = level.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState())) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { + this.fizz(level, pos); + level.setBlock(pos, block.defaultBlockState(), 3); + } @@ -49,7 +49,7 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 + } + + if (isSoulSoil && level.getBlockState(blockPos).is(Blocks.BLUE_ICE)) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, Blocks.BASALT.defaultBlockState())) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, Blocks.BASALT.defaultBlockState(), 3)) { + this.fizz(level, pos); + } + return false; @@ -68,8 +68,8 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 protected FluidState getNewLiquid(ServerLevel level, BlockPos pos, BlockState state) { int i = 0; int i1 = 0; -@@ -341,33 +375,46 @@ public abstract class FlowingFluid extends Fluid { - protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state, BlockPos source) { beforeDestroyingBlock(level, pos, state); } // Paper - Add BlockBreakBlockEvent +@@ -342,33 +376,46 @@ public abstract class FlowingFluid extends Fluid { + protected abstract void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state); + // DivineMC start - Optimize Fluids @@ -132,10 +132,10 @@ index 44bc0823e163bb7edee27889201ec76e93e095cf..974e1e5dcb2613c5aaedd3f2f66483c9 return canPassThroughWall(Direction.DOWN, level, pos, state, belowPos, belowState) && (belowState.getFluidState().getType().isSame(this) || canHoldFluid(level, belowPos, belowState, this.getFlowing())); diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index 85629a43f5469a89dd6078d879f475e8212438ec..35b5a33c79c883f28c99c992695b188524593b55 100644 +index 43cdc2f8fdfdeb1426e386e0084087779ef62754..e7ae29a4da3bf36b99fdab39af78f03c06696dbc 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -224,6 +224,7 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -236,6 +236,7 @@ public abstract class LavaFluid extends FlowingFluid { // CraftBukkit end } diff --git a/divinemc-server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch b/divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch similarity index 95% rename from divinemc-server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch rename to divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch index 25943dd..f3cddb3 100644 --- a/divinemc-server/minecraft-patches/features/0012-Optimize-entity-stupid-brain.patch +++ b/divinemc-server/minecraft-patches/features/0011-Optimize-entity-stupid-brain.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entity stupid brain diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java -index 179f4e4b9b1eb57f78bbb2f9fa34b11ea79b7a88..143a4ca51a57934bf545e031b10525dedbe9c3bd 100644 +index 201c6d6e2f5799a7678b16f01c85508bc72e8af5..caa829739e002f28e5c9072fa573efa34da80d4c 100644 --- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java -@@ -121,6 +121,16 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -124,6 +124,16 @@ public abstract class AgeableMob extends PathfinderMob { public void onSyncedDataUpdated(EntityDataAccessor key) { if (DATA_BABY_ID.equals(key)) { this.refreshDimensions(); @@ -26,7 +26,7 @@ index 179f4e4b9b1eb57f78bbb2f9fa34b11ea79b7a88..143a4ca51a57934bf545e031b10525de super.onSyncedDataUpdated(key); diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java -index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc25c6f68b6 100644 +index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..572415b91152756a246eca242eeaca387289be7c 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java @@ -45,16 +45,73 @@ public class Brain { @@ -196,7 +196,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 } } -@@ -374,11 +444,13 @@ public class Brain { +@@ -383,11 +453,13 @@ public class Brain { .computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet()) .add((BehaviorControl)pair.getSecond()); } @@ -210,7 +210,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 } public boolean isActive(Activity activity) { -@@ -395,6 +467,7 @@ public class Brain { +@@ -404,6 +476,7 @@ public class Brain { } } @@ -218,7 +218,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2 return brain; } -@@ -429,31 +502,38 @@ public class Brain { +@@ -438,31 +511,38 @@ public class Brain { for (BehaviorControl behaviorControl : this.getRunningBehaviors()) { behaviorControl.doStop(level, owner, gameTime); @@ -327,10 +327,10 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..253b9ad671cf0932bb17d468f8b91a15 public static enum Status { STOPPED, diff --git a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8bebefdf6 100644 +index 977afa268838304abdb34be253ca36ac1c22e99f..55a20253d139bc997d2b5d0c0d928fe67df2da32 100644 --- a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java +++ b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -@@ -120,6 +120,12 @@ public class LongJumpToRandomPos extends Behavior { +@@ -119,6 +119,12 @@ public class LongJumpToRandomPos extends Behavior { int x = blockPos.getX(); int y = blockPos.getY(); int z = blockPos.getZ(); @@ -343,13 +343,15 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 this.jumpCandidates = BlockPos.betweenClosedStream( x - this.maxLongJumpWidth, y - this.maxLongJumpHeight, -@@ -175,11 +181,27 @@ public class LongJumpToRandomPos extends Behavior { +@@ -174,12 +180,25 @@ public class LongJumpToRandomPos extends Behavior { } } + // DivineMC start - Optimize entity stupid brain protected Optional getJumpCandidate(ServerLevel level) { -- Optional randomItem = WeightedRandom.getRandomItem(level.random, this.jumpCandidates); +- Optional randomItem = WeightedRandom.getRandomItem( +- level.random, this.jumpCandidates, LongJumpToRandomPos.PossibleJump::weight +- ); - randomItem.ifPresent(this.jumpCandidates::remove); - return randomItem; + Optional optional = getRandomFast(level.random, this.jumpCandidates); @@ -361,7 +363,7 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 + if (pool instanceof org.bxteam.divinemc.util.collections.LongJumpChoiceList longJumpChoiceList) { + return Optional.ofNullable(longJumpChoiceList.removeRandomWeightedByDistanceSq(random)); + } else { -+ return WeightedRandom.getRandomItem(random, pool); ++ return WeightedRandom.getRandomItem(random, pool, LongJumpToRandomPos.PossibleJump::weight); + } + } + @@ -370,10 +372,8 @@ index ec90ea4e66c6c38d7ad41805a16c63e006e44be4..0204fe68c97d152a7c3201620b6709a8 + result.ifPresent(removeAction); + } } -+ // DivineMC end - Optimize entity stupid brain private boolean isAcceptableLandingPosition(ServerLevel level, E entity, BlockPos pos) { - BlockPos blockPos = entity.blockPosition(); diff --git a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java b/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da7c9837ac 100644 --- a/net/minecraft/world/entity/ai/sensing/VillagerBabiesSensor.java @@ -403,10 +403,10 @@ index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da private boolean isVillagerBaby(LivingEntity livingEntity) { return livingEntity.getType() == EntityType.VILLAGER && livingEntity.isBaby(); diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 9b8f5d9926d68fd8b9f1f976e0be0975158cafc3..e21f024d0ed7f936ff17df16bd9666fffbf44a75 100644 +index 6029051a7bade2eb412d7ec4957a4361e7e575b1..01e1712854aaebc59db844045141b25561df8fc3 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -96,6 +96,13 @@ public class Goat extends Animal { +@@ -99,6 +99,13 @@ public class Goat extends Animal { this.getNavigation().setCanFloat(true); this.setPathfindingMalus(PathType.POWDER_SNOW, -1.0F); this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F); diff --git a/divinemc-server/minecraft-patches/features/0014-Optimize-explosions.patch b/divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch similarity index 95% rename from divinemc-server/minecraft-patches/features/0014-Optimize-explosions.patch rename to divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch index 51ff3d9..4dd2423 100644 --- a/divinemc-server/minecraft-patches/features/0014-Optimize-explosions.patch +++ b/divinemc-server/minecraft-patches/features/0012-Optimize-explosions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize explosions diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445eadfb540c 100644 +index a772f2bd7be00172ad41353c6ad42d9239b9ec88..fb6df8b2d96727b3febfe404be0eb2d77b2edf13 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -375,6 +375,11 @@ public class ServerExplosion implements Explosion { +@@ -372,6 +372,11 @@ public class ServerExplosion implements Explosion { } private List calculateExplodedPositions() { @@ -20,7 +20,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e // Paper start - collision optimisations final ObjectArrayList ret = new ObjectArrayList<>(); -@@ -473,6 +478,157 @@ public class ServerExplosion implements Explosion { +@@ -470,6 +475,157 @@ public class ServerExplosion implements Explosion { // Paper end - collision optimisations } @@ -170,7 +170,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e + } + + private Optional noBlockCalcsWithNoBLockDamage(final ExplosionDamageCalculator instance, final Explosion explosion, final BlockGetter blockGetter, final BlockPos blockPos, final BlockState blockState, final FluidState fluidState) { -+ if (org.bxteam.divinemc.DivineConfig.explosionNoBlockDamage) return Optional.of(Blocks.BEDROCK.getExplosionResistance()); ++ if (org.bxteam.divinemc.DivineConfig.explosionNoBlockDamage) return Optional.of(net.minecraft.world.level.block.Blocks.BEDROCK.getExplosionResistance()); + return instance.getBlockExplosionResistance(explosion, blockGetter, blockPos, blockState, fluidState); + } + // DivineMC end - Optimize explosions @@ -178,7 +178,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e private void hurtEntities() { float f = this.radius * 2.0F; int floor = Mth.floor(this.center.x - f - 1.0); -@@ -565,6 +721,11 @@ public class ServerExplosion implements Explosion { +@@ -559,6 +715,11 @@ public class ServerExplosion implements Explosion { } private void interactWithBlocks(List blocks) { diff --git a/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch new file mode 100644 index 0000000..f0e3afa --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0013-Option-to-allow-weird-movement-and-disable-teleporti.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sat, 1 Feb 2025 18:03:13 +0300 +Subject: [PATCH] Option to allow weird movement and disable teleporting + players when they move too quickly + + +diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index b05657f763bbdbc9268c83d78c2da62b97d095e2..a271b76224246f04ad9396a3b3be40f5f7302965 100644 +--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -566,7 +566,7 @@ public class ServerGamePacketListenerImpl + return; + } + // Paper end - Prevent moving into unloaded chunks +- if (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner()) { ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner())) { // DivineMC - stop weird movement + // CraftBukkit end + LOGGER.warn( + "{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 +@@ -596,7 +596,7 @@ public class ServerGamePacketListenerImpl + d5 = d2 - rootVehicle.getZ(); + d7 = d3 * d3 + d4 * d4 + d5 * d5; + boolean flag2 = false; +- if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold)) { // Spigot // DivineMC - stop weird movement + flag2 = true; // Paper - diff on change, this should be moved wrongly + LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); + } +@@ -1510,20 +1510,24 @@ public class ServerGamePacketListenerImpl + if (this.shouldCheckPlayerMovement(isFallFlying)) { + float f2 = isFallFlying ? 300.0F : 100.0F; + if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { +- // CraftBukkit end +- // Paper start - Add fail move event +- io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, ++ // DivineMC start - Stop teleporting players when they move too quickly ++ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && !(org.bxteam.divinemc.DivineConfig.ignoreMovedTooQuicklyWhenLagging && player.serverLevel().getServer().lagging)) { ++ // CraftBukkit end ++ // Paper start - Add fail move event ++ io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, + toX, toY, toZ, toYaw, toPitch, true); +- if (!event.isAllowed()) { +- if (event.getLogWarning()) { +- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); +- } +- this.teleport( ++ if (!event.isAllowed()) { ++ if (event.getLogWarning()) { ++ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); ++ } ++ this.teleport( + this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot() +- ); +- return; ++ ); ++ return; ++ } ++ // Paper end - Add fail move event + } +- // Paper end - Add fail move event ++ // DivineMC end - Stop teleporting players when they move too quickly + } + } + } +@@ -1584,6 +1588,7 @@ public class ServerGamePacketListenerImpl + d7 = d3 * d3 + d4 * d4 + d5 * d5; + boolean movedWrongly = false; // Paper - Add fail move event; rename + if (!this.player.isChangingDimension() ++ && !org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement // DivineMC - Stop teleporting players when they move too quickly + && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold // Spigot + && !this.player.isSleeping() + && !this.player.isCreative() diff --git a/divinemc-server/minecraft-patches/features/0016-Lag-compensation.patch b/divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch similarity index 83% rename from divinemc-server/minecraft-patches/features/0016-Lag-compensation.patch rename to divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch index b19fcea..e281314 100644 --- a/divinemc-server/minecraft-patches/features/0016-Lag-compensation.patch +++ b/divinemc-server/minecraft-patches/features/0014-Lag-compensation.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Lag compensation diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 5a726da8535aa939f043829a3c60fdd9d4ed154a..0aebdd1cb0e1b63ff9a867bdcda7cbdc3c194b56 100644 +index 9956405d7f9d14af7278837adeede76dea8d4bd9..86754cb52caeef962172bcb79cbc8f16bcdd3b63 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1558,6 +1559,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -1533,6 +1534,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop key) { @@ -216,10 +220,10 @@ index 02d64a5ea756b2c91a71b7a0fc0f21219983616a..d515ba4e775e1199e1cbf4f79978d318 public static class BooleanValue extends GameRules.Value { private boolean value; diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index b631e35e965b1914cdeeddab8bd6bdbfd2465079..bb7dab597850fba8f0dff4461fc518e0a33b00c7 100644 +index 8db95b74f88f8096de93115ae8d3fb2e6184ad3b..8c0abcbf1af03092b54d2e4bdad8ac152c2431e6 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -346,13 +346,21 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -347,13 +347,21 @@ public abstract class BlockBehaviour implements FeatureElement { protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { } @@ -244,10 +248,10 @@ index b631e35e965b1914cdeeddab8bd6bdbfd2465079..bb7dab597850fba8f0dff4461fc518e0 } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49eb3a40c1 100644 +index 04942e23dd2bc82e4c60110756beedb5e0f074d7..7eb6da13dc47eaeac6e70d4e2935c1cc022c6400 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -907,6 +907,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -910,6 +910,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p this.ticker = ticker; } @@ -267,7 +271,7 @@ index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49 @Override public void tick() { if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { -@@ -915,7 +928,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -918,7 +931,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p try { BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { @@ -281,10 +285,10 @@ index b245f594ff91e2d29c83f56b9ed5165f37387e7e..534384727e852dc8ea822f49f182af49 // Paper start - Remove the Block Entity if it's invalid } else { diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index 35b5a33c79c883f28c99c992695b188524593b55..6845a1c3b6038700751312d8beb0f9a2844003a5 100644 +index e7ae29a4da3bf36b99fdab39af78f03c06696dbc..e57c04df4cb5955713d61d8237094041d3f3ca4f 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -175,9 +175,22 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -187,9 +187,22 @@ public abstract class LavaFluid extends FlowingFluid { return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); } @@ -309,10 +313,10 @@ index 35b5a33c79c883f28c99c992695b188524593b55..6845a1c3b6038700751312d8beb0f9a2 @Override diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java -index 2e4fed7c27910b6c886f710f33b0841c2a175837..89f22ebcbaf21df3afb6a00f60d8e00777875aac 100644 +index b248fe1d66940c05d56fc322df61c52ece72e77f..8fa7883a0fe5fc2651d640ecde20198293afa654 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java -@@ -113,8 +113,16 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -124,8 +124,16 @@ public abstract class WaterFluid extends FlowingFluid { return 1; } diff --git a/divinemc-server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch deleted file mode 100644 index e2ea80b..0000000 --- a/divinemc-server/minecraft-patches/features/0015-Option-to-allow-weird-movement-and-disable-teleporti.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 1 Feb 2025 18:03:13 +0300 -Subject: [PATCH] Option to allow weird movement and disable teleporting - players when they move too quickly - - -diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f8c76bb2c9fa625e191036dc58ef3dfb1d4ee930..5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697 100644 ---- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -574,7 +574,7 @@ public class ServerGamePacketListenerImpl - return; - } - // Paper end - Prevent moving into unloaded chunks -- if (d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 - d6 > Math.max(100.0, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner())) { // DivineMC - stop weird movement - // CraftBukkit end - LOGGER.warn( - "{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 -@@ -604,7 +604,7 @@ public class ServerGamePacketListenerImpl - d5 = d2 - rootVehicle.getZ(); - d7 = d3 * d3 + d4 * d4 + d5 * d5; - boolean flag2 = false; -- if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold)) { // Spigot // DivineMC - stop weird movement - flag2 = true; // Paper - diff on change, this should be moved wrongly - LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); - } -@@ -1453,18 +1453,22 @@ public class ServerGamePacketListenerImpl - if (this.shouldCheckPlayerMovement(isFallFlying)) { - float f2 = isFallFlying ? 300.0F : 100.0F; - if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { -- // CraftBukkit end -- // Paper start - Add fail move event -- io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, -- toX, toY, toZ, toYaw, toPitch, true); -- if (!event.isAllowed()) { -- if (event.getLogWarning()) { -- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); -+ // DivineMC start - Stop teleporting players when they move too quickly -+ if (!org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement && !(org.bxteam.divinemc.DivineConfig.ignoreMovedTooQuicklyWhenLagging && player.serverLevel().getServer().lagging)) { -+ // CraftBukkit end -+ // Paper start - Add fail move event -+ io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, -+ toX, toY, toZ, toYaw, toPitch, true); -+ if (!event.isAllowed()) { -+ if (event.getLogWarning()) { -+ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); -+ } -+ this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); -+ return; - } -- this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); -- return; -+ // Paper end - Add fail move event - } -- // Paper end - Add fail move event -+ // DivineMC end - Stop teleporting players when they move too quickly - } - } - } -@@ -1525,6 +1529,7 @@ public class ServerGamePacketListenerImpl - d7 = d3 * d3 + d4 * d4 + d5 * d5; - boolean movedWrongly = false; // Paper - Add fail move event; rename - if (!this.player.isChangingDimension() -+ && !org.bxteam.divinemc.DivineConfig.alwaysAllowWeirdMovement // DivineMC - Stop teleporting players when they move too quickly - && d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold // Spigot - && !this.player.isSleeping() - && !this.player.gameMode.isCreative() diff --git a/divinemc-server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch b/divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch similarity index 85% rename from divinemc-server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch rename to divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch index 553afe2..bfa9166 100644 --- a/divinemc-server/minecraft-patches/features/0018-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch +++ b/divinemc-server/minecraft-patches/features/0015-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch @@ -6,18 +6,18 @@ Subject: [PATCH] Skip EntityScheduler's executeTick checks if there isn't any diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index df07a4a62bd518f3a13995a3ccc7970c714bad7b..851f943cddad03ae12e1ed85f64072682447a367 100644 +index 86754cb52caeef962172bcb79cbc8f16bcdd3b63..1a842ecfb717f7b5ed2fdb2779040ab0e857612d 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -290,6 +290,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1706,17 +1707,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -1661,17 +1662,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop imp diff --git a/divinemc-server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch b/divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch similarity index 90% rename from divinemc-server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch rename to divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch index 22cdda0..0606edb 100644 --- a/divinemc-server/minecraft-patches/features/0020-Snowball-and-Egg-knockback.patch +++ b/divinemc-server/minecraft-patches/features/0017-Snowball-and-Egg-knockback.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Snowball and Egg knockback diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index 1d399532c67c213c95c06837b0c7855384f1a25c..cad1f8cb68ef9615587e651a3120f68a3c32add0 100644 +index d8f9fb603fd2e3e5c1dfc05face7f42b4844daf4..86e75722b37eaa02858fa4313d8bcc2a72c0f7f6 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -54,6 +54,12 @@ public class Snowball extends ThrowableItemProjectile { @@ -22,10 +22,10 @@ index 1d399532c67c213c95c06837b0c7855384f1a25c..cad1f8cb68ef9615587e651a3120f68a // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java -index 76481c0e77fc3a2e4be8eeb9de8d1e6de5507c64..8f0aa83cc81f36d70a39600a82d0212db70e02ec 100644 +index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..fe605f728020b42a61ea6703401e08f0efc3a69c 100644 --- a/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/net/minecraft/world/entity/projectile/ThrownEgg.java -@@ -52,7 +52,14 @@ public class ThrownEgg extends ThrowableItemProjectile { +@@ -54,7 +54,14 @@ public class ThrownEgg extends ThrowableItemProjectile { @Override protected void onHitEntity(EntityHitResult result) { super.onHitEntity(result); diff --git a/divinemc-server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch b/divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch similarity index 88% rename from divinemc-server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch rename to divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch index f848bca..d70cf92 100644 --- a/divinemc-server/minecraft-patches/features/0021-Block-Log4Shell-exploit.patch +++ b/divinemc-server/minecraft-patches/features/0018-Block-Log4Shell-exploit.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block Log4Shell exploit diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697..a3ec8c92dae7735bb0b1ececc9851c829c486a53 100644 +index a271b76224246f04ad9396a3b3be40f5f7302965..c2375c8f7be0b942489193561ceefc48ac8373fa 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2425,6 +2425,7 @@ public class ServerGamePacketListenerImpl +@@ -2487,6 +2487,7 @@ public class ServerGamePacketListenerImpl } private void tryHandleChat(String message, Runnable handler, boolean sync) { // CraftBukkit @@ -16,7 +16,7 @@ index 5b8031a45b1f4f6d0e86c2a839d173a6e3f4f697..a3ec8c92dae7735bb0b1ececc9851c82 if (isChatMessageIllegal(message)) { this.disconnectAsync(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add proper async disconnect } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales -@@ -2453,6 +2454,15 @@ public class ServerGamePacketListenerImpl +@@ -2519,6 +2520,15 @@ public class ServerGamePacketListenerImpl } } diff --git a/divinemc-server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch b/divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch similarity index 73% rename from divinemc-server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch rename to divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch index aee90a0..c1ebb13 100644 --- a/divinemc-server/minecraft-patches/features/0022-Re-Fix-MC-117075.patch +++ b/divinemc-server/minecraft-patches/features/0019-Re-Fix-MC-117075.patch @@ -5,26 +5,25 @@ Subject: [PATCH] Re-Fix MC-117075 diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 9608aa7231e1e19ac34f7fcf6cc4051da01f2f3e..92fc936c6bdbda909b9cdf157ec9d46a4872098c 100644 +index 2e90bb96ed90f3debbe5803856ed41a5c08003f8..4eedfc61c7e682a44858703b462eecad17a48904 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public static final int TICKS_PER_DAY = 24000; public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; -- public final List blockEntityTickers = Lists.newArrayList(); // Paper - public +- public final List blockEntityTickers = Lists.newArrayList(); + public final org.bxteam.divinemc.util.BlockEntityTickersList blockEntityTickers = new org.bxteam.divinemc.util.BlockEntityTickersList(); // Paper - public // DivineMC - optimize block entity removals - Fix MC-117075 protected final NeighborUpdater neighborUpdater; private final List pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; -@@ -1521,14 +1521,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1504,13 +1504,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl boolean runsNormally = this.tickRateManager().runsNormally(); int tickedEntities = 0; // Paper - rewrite chunk system - var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet(); // Paper - Fix MC-117075; use removeAll - toRemove.add(null); // Paper - Fix MC-117075 - for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters - this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; + for (this.tileTickPosition = 0; this.tileTickPosition < this.blockEntityTickers.size(); this.tileTickPosition++) { // Paper - Disable tick limiters TickingBlockEntity tickingBlockEntity = this.blockEntityTickers.get(this.tileTickPosition); // Spigot end if (tickingBlockEntity.isRemoved()) { @@ -32,9 +31,9 @@ index 9608aa7231e1e19ac34f7fcf6cc4051da01f2f3e..92fc936c6bdbda909b9cdf157ec9d46a + this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // DivineMC - optimize block entity removals - Fix MC-117075 } else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) { tickingBlockEntity.tick(); - // DivineMC start - Parallel world ticking -@@ -1539,7 +1537,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - // DivineMC end - Parallel world ticking + // Paper start - rewrite chunk system +@@ -1520,7 +1518,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl + // Paper end - rewrite chunk system } } - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 diff --git a/divinemc-server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch b/divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch similarity index 95% rename from divinemc-server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch rename to divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch index c531a69..3b48a34 100644 --- a/divinemc-server/minecraft-patches/features/0023-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch +++ b/divinemc-server/minecraft-patches/features/0020-Skip-distanceToSqr-call-in-ServerEntity-sendChanges-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Skip distanceToSqr call in ServerEntity#sendChanges if the diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index b6053158f5d9b6ad325ea075ab7c60f9966ba496..c7ad6bf5dd8cb8a27de3e3ed82c6eefaa36c5c08 100644 +index 7748183dd12434693b89d2dbc8325988381857c9..372e33f22d9012348d19cc1a38504d90049a6833 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -203,23 +203,27 @@ public class ServerEntity { +@@ -200,23 +200,27 @@ public class ServerEntity { if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { Vec3 deltaMovement = this.entity.getDeltaMovement(); diff --git a/divinemc-server/minecraft-patches/features/0024-Optimize-canSee-checks.patch b/divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch similarity index 87% rename from divinemc-server/minecraft-patches/features/0024-Optimize-canSee-checks.patch rename to divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch index 395c9e8..84163de 100644 --- a/divinemc-server/minecraft-patches/features/0024-Optimize-canSee-checks.patch +++ b/divinemc-server/minecraft-patches/features/0021-Optimize-canSee-checks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize canSee checks diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index dccf4d4b1067e1b09e38cabeae82185929494b62..55da7420dc3dfff468529a0f101f864dbefe3c7c 100644 +index fb6e0beb35d1d6bb9a159debeb06e861051821b9..71c7d0186288e5b910d3898f10c5bffb6657e760 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -1258,7 +1258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1328,7 +1328,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z); // Paper end - Configurable entity tracking range by Y // CraftBukkit start - respect vanish API diff --git a/divinemc-server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch b/divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch similarity index 95% rename from divinemc-server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch rename to divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch index bd22335..14749ea 100644 --- a/divinemc-server/minecraft-patches/features/0027-Verify-Minecraft-EULA-earlier.patch +++ b/divinemc-server/minecraft-patches/features/0022-Verify-Minecraft-EULA-earlier.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Verify Minecraft EULA earlier diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java -index 1485186d4989874ef89c4e83830f26358a43759c..c4f9b67c92e4c7e8015f637fe633a9e8da276e5c 100644 +index 29dd9a980bb7dc8457dd9ad6eeaa2c5067e3b954..a0553288d99e94d14345f25ec4672e1ca70950b6 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java @@ -123,7 +123,6 @@ public class Main { diff --git a/divinemc-server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch similarity index 87% rename from divinemc-server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch rename to divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch index 79a0955..9ec436c 100644 --- a/divinemc-server/minecraft-patches/features/0029-Option-to-disable-saving-of-snowball-and-firework.patch +++ b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable saving of snowball and firework diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index c7ae41b2cbc1eb85a6eb9c16813bd326fb8f49f0..e6764ee35f9d9d20a7693d50ea61b703867e3c79 100644 +index e0e193078e550225e163149638bf9e053c0531f8..a3c9421506d1b9d79cb9cac46dbb2f86c83e7036 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -364,4 +364,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -354,4 +354,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { double d1 = entity.position().z - this.position().z; return DoubleDoubleImmutablePair.of(d, d1); } @@ -24,7 +24,7 @@ index c7ae41b2cbc1eb85a6eb9c16813bd326fb8f49f0..e6764ee35f9d9d20a7693d50ea61b703 + // DivineMC end - Option to disable saving firework } diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index cad1f8cb68ef9615587e651a3120f68a3c32add0..18298f3ba544e07110ea8d5b15ae753f7e3de65a 100644 +index 86e75722b37eaa02858fa4313d8bcc2a72c0f7f6..0f611169a4ed2a059b9231bedf94a903600b73f0 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -100,4 +100,14 @@ public class Snowball extends ThrowableItemProjectile { diff --git a/divinemc-server/minecraft-patches/features/0031-lithium-fast_util.patch b/divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch similarity index 87% rename from divinemc-server/minecraft-patches/features/0031-lithium-fast_util.patch rename to divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch index f1df73f..61ad0fc 100644 --- a/divinemc-server/minecraft-patches/features/0031-lithium-fast_util.patch +++ b/divinemc-server/minecraft-patches/features/0024-lithium-fast_util.patch @@ -5,10 +5,10 @@ Subject: [PATCH] lithium: fast_util diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java -index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3cfffc675 100644 +index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c468255635f5c7bc1 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java -@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -222,7 +222,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public Direction getOpposite() { @@ -17,7 +17,7 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3 } public Direction getClockWise(Direction.Axis axis) { -@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -355,7 +355,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public static Direction getRandom(RandomSource random) { @@ -27,10 +27,10 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..05c7de5729466786a0196fa5f91eccc3 public static Direction getApproximateNearest(double x, double y, double z) { diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index 54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1..977642da91cf3bace9182e36c10512c8a1830503 100644 +index 1866d857cabde481f23e861e0db7994bfa84ac40..de2a22fde8d91f13ccae347de48f4143d5749a6c 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java -@@ -18,6 +18,15 @@ public class AABB { +@@ -19,6 +19,15 @@ public class AABB { public final double maxY; public final double maxZ; @@ -46,7 +46,7 @@ index 54807bb4b4189ceaded1f78a1a9ab85ce40ab2b1..977642da91cf3bace9182e36c10512c8 public AABB(double x1, double y1, double z1, double x2, double y2, double z2) { this.minX = Math.min(x1, x2); this.minY = Math.min(y1, y2); -@@ -79,11 +88,33 @@ public class AABB { +@@ -80,11 +89,33 @@ public class AABB { } public double min(Direction.Axis axis) { diff --git a/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch b/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch index ff4bfba..8684ee8 100644 --- a/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch +++ b/divinemc-server/minecraft-patches/features/0025-Implement-NoChatReports.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement NoChatReports diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java -index d1daa3443446f47e2215f0c7c5823da58e053bab..61b1440ee7909946cd2d7a4d8622f79c6f6ac76b 100644 +index 7da7d645f83f351e8c964da01734f3074a877ca1..39426086e1c417758d6ff940c3ab716fcba6cd6c 100644 --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java @@ -105,7 +105,28 @@ public class FriendlyByteBuf extends ByteBuf { @@ -123,7 +123,7 @@ index 1df628ac0b414511aaed6e09d78f884c4170f730..d94858facc06d57139e953796ee09dad } } diff --git a/net/minecraft/network/protocol/status/ServerStatus.java b/net/minecraft/network/protocol/status/ServerStatus.java -index 30bd254542d631676494f349ff3f44f52d54ab2f..6c728ae3b58bc1b8449d34c6c74091612b79f39e 100644 +index 094d1821d298fc228270b2d6cf0445949434f3e2..8f7e3e5f1d3a87ba3528c9dd61e063ecfda4e1ec 100644 --- a/net/minecraft/network/protocol/status/ServerStatus.java +++ b/net/minecraft/network/protocol/status/ServerStatus.java @@ -15,13 +15,7 @@ import net.minecraft.network.chat.CommonComponents; @@ -206,10 +206,10 @@ index 30bd254542d631676494f349ff3f44f52d54ab2f..6c728ae3b58bc1b8449d34c6c7409161 private static final String PREFIX = "data:image/png;base64,"; public static final Codec CODEC = Codec.STRING.comapFlatMap(string -> { diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index d3431511fdc6c3e807ea4dfcf877ebe088ff90bd..fb02ec67234e46a55d68d2b4b1c7a6ba56f9995a 100644 +index 116970622a4e7cc9c7c8333cdb18da71381abcff..3f9b26de801b2d8e85c56d219ca7bd61c41b3f9d 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -688,6 +688,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -631,6 +631,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public boolean enforceSecureProfile() { @@ -218,10 +218,10 @@ index d3431511fdc6c3e807ea4dfcf877ebe088ff90bd..fb02ec67234e46a55d68d2b4b1c7a6ba // Paper start - Add setting for proxy online mode status return properties.enforceSecureProfile diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9..4fa55fac5dab26a505cba2c1876e9459a582da12 100644 +index b865c2fd503c3f0368d77d28c2f7a7c7fa7008bb..b3356c65992b1bb165876dfc58a8331d6fda138c 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -312,10 +312,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -311,10 +311,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public void send(Packet packet) { @@ -287,10 +287,10 @@ index 801dd76a2c7f76fc6fdb7167cbf3ab1310be36c9..4fa55fac5dab26a505cba2c1876e9459 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 5ff0ce34cfacb745748d3dc627127842ac1df9fa..0483b754ab9c9da4eaa62101198007d12174cf84 100644 +index 3155f2fb46deebf12bcceb8283c6dc57d96ee365..338df3c49e19b7ff3f54ecf93a980d4573b142d7 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -274,7 +274,7 @@ public abstract class PlayerList { +@@ -275,7 +275,7 @@ public abstract class PlayerList { !_boolean, _boolean2, player.createCommonSpawnInfo(serverLevel), @@ -299,10 +299,10 @@ index 5ff0ce34cfacb745748d3dc627127842ac1df9fa..0483b754ab9c9da4eaa62101198007d1 ) ); player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit -@@ -1333,6 +1333,7 @@ public abstract class PlayerList { +@@ -1327,6 +1327,7 @@ public abstract class PlayerList { } - public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public + public boolean verifyChatTrusted(PlayerChatMessage message) { + if (org.bxteam.divinemc.DivineConfig.noChatReportsEnabled) return true; // DivineMC - Implement NoChatReports return message.hasSignature() && !message.hasExpiredServer(Instant.now()); } diff --git a/divinemc-server/minecraft-patches/features/0032-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch similarity index 91% rename from divinemc-server/minecraft-patches/features/0032-Virtual-Threads.patch rename to divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch index 992e250..4593cde 100644 --- a/divinemc-server/minecraft-patches/features/0032-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0026-Virtual-Threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual Threads diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java -index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..aa2d99de3d23d262542bfb1592fe084f94230f85 100644 +index d1fcc73f579d1c4ac79213ad039c8d803ff51b1a..047ce2391a8ec4bab1b8a2020ab3f20953e5b95f 100644 --- a/net/minecraft/Util.java +++ b/net/minecraft/Util.java -@@ -97,7 +97,12 @@ public class Util { +@@ -98,7 +98,12 @@ public class Util { public static final TracingExecutor DIMENSION_DATA_IO_POOL = makeExtraIoExecutor("Dimension-Data-IO-Worker-"); // Paper - Separate dimension data IO pool private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true); // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread @@ -23,10 +23,10 @@ index 80a7a85e1a03a1ca406259207e1ae3b909b3284f..aa2d99de3d23d262542bfb1592fe084f private final AtomicInteger count = new AtomicInteger(); diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 212d2bcfd34f7cb14e18a8af2cd296fc01d371f6..ec76e4f29ba96b31a24a5d195b852342a57e0bdb 100644 +index 07e228b620962e507b7db70e5a743daf2e5c82ca..cff86f3a50529a9d1a8873aa6f7f77da248c6c67 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -474,7 +474,7 @@ public class Commands { +@@ -473,7 +473,7 @@ public class Commands { } // Fixed pool, but with discard policy @@ -36,10 +36,10 @@ index 212d2bcfd34f7cb14e18a8af2cd296fc01d371f6..ec76e4f29ba96b31a24a5d195b852342 new java.util.concurrent.LinkedBlockingQueue<>(), new com.google.common.util.concurrent.ThreadFactoryBuilder() diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 5a0c8791495aa522e511918ad0a24d9bbe6b5877..9d6fa3bced0ba5ab3443bdf4ce306598a8e4a31f 100644 +index 1a842ecfb717f7b5ed2fdb2779040ab0e857612d..b2e90749bcaf3b9132681713ab0afae95b3197ee 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2710,8 +2710,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop structureBlockInfos) { } -+ // Quiil end - Optimize Structure Generation ++ // DivineMC end - Optimize Structure Generation } diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b9486953ea03 100644 +index df3a1b9ed4ad836bd3358b6b440964e497213ea3..c283d5320c89c0793d59dd107fd9b0ae3b0a9ba6 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -249,6 +249,12 @@ public class StructureTemplate { +@@ -247,6 +247,12 @@ public class StructureTemplate { return transform(pos, decorator.getMirror(), decorator.getRotation(), decorator.getRotationPivot()); } @@ -247,7 +247,7 @@ index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b948 public boolean placeInWorld(ServerLevelAccessor serverLevel, BlockPos offset, BlockPos pos, StructurePlaceSettings settings, RandomSource random, int flags) { if (this.palettes.isEmpty()) { return false; -@@ -266,7 +272,11 @@ public class StructureTemplate { +@@ -264,7 +270,11 @@ public class StructureTemplate { } } // CraftBukkit end @@ -260,7 +260,7 @@ index a37eb2e29b4577ebc711e8ef7b47fbbc3bc66897..45d6fbeeaac577bb35adb69fd344b948 if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()) && this.size.getX() >= 1 && this.size.getY() >= 1 -@@ -890,7 +900,11 @@ public class StructureTemplate { +@@ -871,7 +881,11 @@ public class StructureTemplate { private List cachedJigsaws; Palette(List blocks) { diff --git a/divinemc-server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch b/divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch similarity index 91% rename from divinemc-server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch rename to divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch index f7b2376..712b877 100644 --- a/divinemc-server/minecraft-patches/features/0035-Option-to-disable-disconnect.spam.patch +++ b/divinemc-server/minecraft-patches/features/0029-Option-to-disable-disconnect.spam.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable disconnect.spam diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5dcb2aa8d 100644 +index f2d4a2b8881664a45703e2c56e1f59d8373ab1c4..e713e3667dfd0b93bc6277f68b95d204f47ba4ef 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -819,7 +819,7 @@ public class ServerGamePacketListenerImpl +@@ -812,7 +812,7 @@ public class ServerGamePacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start @@ -17,7 +17,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } -@@ -831,7 +831,7 @@ public class ServerGamePacketListenerImpl +@@ -824,7 +824,7 @@ public class ServerGamePacketListenerImpl // Paper end - Don't suggest if tab-complete is disabled // Paper start final int index; @@ -26,7 +26,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - add proper async disconnect return; } -@@ -891,6 +891,7 @@ public class ServerGamePacketListenerImpl +@@ -884,6 +884,7 @@ public class ServerGamePacketListenerImpl ParseResults parseResults = this.server.getCommands().getDispatcher().parse(stringReader, this.player.createCommandSourceStack()); // Paper start - Handle non-recoverable exceptions if (!parseResults.getExceptions().isEmpty() @@ -34,7 +34,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 && parseResults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) { this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); return; -@@ -2624,6 +2625,7 @@ public class ServerGamePacketListenerImpl +@@ -2614,6 +2615,7 @@ public class ServerGamePacketListenerImpl // this.chatSpamThrottler.increment(); if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() // CraftBukkit end @@ -42,7 +42,7 @@ index 02b4275d170cc854a7482f0e963394aee21171dd..c3e8da14d4faf560d24f877ef9eeb4a5 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause & add proper async disconnect -@@ -3402,7 +3404,7 @@ public class ServerGamePacketListenerImpl +@@ -3393,7 +3395,7 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/divinemc-server/minecraft-patches/features/0028-Configurable-MC-67.patch b/divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch similarity index 85% rename from divinemc-server/minecraft-patches/features/0028-Configurable-MC-67.patch rename to divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch index 0804d57..c4728a6 100644 --- a/divinemc-server/minecraft-patches/features/0028-Configurable-MC-67.patch +++ b/divinemc-server/minecraft-patches/features/0030-Configurable-MC-67.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable MC-67 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 3943789e241f6bb6bc165099b1fb585463cf3d86..07e8bda8eb200d5a7554e0319e1a00dc85454e1a 100644 +index 18718693412f3cc0848c462361c2f06e1ad65a6e..0a23d54a6f03b1d776ab24922f88144762c90875 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -4017,6 +4017,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3961,6 +3961,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean canTeleport(Level fromLevel, Level toLevel) { diff --git a/divinemc-server/minecraft-patches/features/0036-Configurable-MC-59471.patch b/divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch similarity index 82% rename from divinemc-server/minecraft-patches/features/0036-Configurable-MC-59471.patch rename to divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch index fb7d98f..c6d5cfc 100644 --- a/divinemc-server/minecraft-patches/features/0036-Configurable-MC-59471.patch +++ b/divinemc-server/minecraft-patches/features/0031-Configurable-MC-59471.patch @@ -8,10 +8,10 @@ Bring back MC-59471, MC-129055 on 1.21.2+, which fixed in 1.21.2 snapshots 24w33 P.S: This setting is different from skip-tripwire-hook-placement-validation in Paper diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java -index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7ec6838542 100644 +index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..52fa81fdce9d7998f4c2d3b90dfc08391218f7fd 100644 --- a/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/net/minecraft/world/level/block/TripWireHookBlock.java -@@ -201,7 +201,6 @@ public class TripWireHookBlock extends Block { +@@ -187,7 +187,6 @@ public class TripWireHookBlock extends Block { if (!cancelledEmitterHook) { // Paper - Call BlockRedstoneEvent emitState(level, pos, flag2, flag3, flag, flag1); if (!attaching) { @@ -19,13 +19,13 @@ index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7e level.setBlock(pos, blockState1.setValue(FACING, direction), 3); if (shouldNotifyNeighbours) { notifyNeighbors(block, level, pos, direction); -@@ -214,10 +213,17 @@ public class TripWireHookBlock extends Block { +@@ -200,10 +199,18 @@ public class TripWireHookBlock extends Block { BlockPos blockPos1 = pos.relative(direction, i2); BlockState blockState2 = blockStates[i2]; if (blockState2 != null) { - BlockState blockState3 = level.getBlockState(blockPos1); - if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { -- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating +- if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating + // DivineMC start - Configurable MC-59471 + if (level.divineConfig.allowTripwireDupe) { + level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); @@ -33,7 +33,8 @@ index 9aace993c6c18f1a50610e4766225485984b8167..0849e0b116845a16792855afdd16de7e + } else { + BlockState blockState3 = level.getBlockState(blockPos1); + if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { -+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating ++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) ++ level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating + } } + // DivineMC end - Configurable MC-59471 diff --git a/divinemc-server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch b/divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch similarity index 92% rename from divinemc-server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch rename to divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch index e0e5e34..900a716 100644 --- a/divinemc-server/minecraft-patches/features/0037-ModernFix-compact_bit_storage.patch +++ b/divinemc-server/minecraft-patches/features/0032-ModernFix-compact_bit_storage.patch @@ -10,12 +10,12 @@ As part of: ModernFix (https://github.com/embeddedt/ModernFix) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index 712d3d1669aecd38934957c81835e1f38289539a..810e61913aece5a8158f83b6dd56a7b6cb083c19 100644 +index a512609aaa823b940ed269c981fc9beec49a126e..2829ebdda8e9ad8945fe7d3f96c3cdaad798a40a 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java @@ -275,6 +275,28 @@ public class PalettedContainer implements PaletteResize, PalettedContainer data.palette.read(buffer); - buffer.readLongArray(data.storage.getRaw()); + buffer.readFixedSizeLongArray(data.storage.getRaw()); this.data = data; + // DivineMC start - ModernFix: compact_bit_storage + if (org.bxteam.divinemc.DivineConfig.useCompactBitStorage && _byte > 1) { diff --git a/divinemc-server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch b/divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch similarity index 93% rename from divinemc-server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch rename to divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch index 3c5abb6..a764925 100644 --- a/divinemc-server/minecraft-patches/features/0038-Command-block-parse-results-caching.patch +++ b/divinemc-server/minecraft-patches/features/0033-Command-block-parse-results-caching.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Command block parse results caching diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java -index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879692a9631 100644 +index 0eb88c24c66b521fd34d2fda6e6e21e3ecc6ac88..d27eca05abcfd524ff3c22770ce94505ce2ad233 100644 --- a/net/minecraft/world/level/BaseCommandBlock.java +++ b/net/minecraft/world/level/BaseCommandBlock.java -@@ -32,6 +32,10 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -37,6 +37,10 @@ public abstract class BaseCommandBlock implements CommandSource { private String command = ""; @Nullable private Component customName; @@ -19,7 +19,7 @@ index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879 // CraftBukkit start @Override public abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper); -@@ -131,7 +135,35 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -119,7 +123,35 @@ public abstract class BaseCommandBlock implements CommandSource { this.successCount++; } }); @@ -56,7 +56,7 @@ index 8c883ff13866d6416bd70cc61ab1e37dd1a5b33c..7bd3507837862b8afb8227a85a44c879 } catch (Throwable var6) { CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block"); CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed"); -@@ -151,6 +183,13 @@ public abstract class BaseCommandBlock implements CommandSource { +@@ -139,6 +171,13 @@ public abstract class BaseCommandBlock implements CommandSource { } } diff --git a/divinemc-server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch b/divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch similarity index 90% rename from divinemc-server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch rename to divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch index 5f6f427..f7f6c0f 100644 --- a/divinemc-server/minecraft-patches/features/0044-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch +++ b/divinemc-server/minecraft-patches/features/0034-Leaf-Improve-BlockEntity-ticking-isRemoved-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Leaf: Improve BlockEntity ticking isRemoved check diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 0337f4b9ca3c9c9a1e2a7cf19fcbad5e78b949dc..1820069a7c5833b0a13e034c232f06af234788e3 100644 +index 7eb6da13dc47eaeac6e70d4e2935c1cc022c6400..d2eed7a0cf0c2c9dbcfb272cf89194f11d37151c 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -989,13 +989,26 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -992,13 +992,26 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p public static class RebindableTickingBlockEntityWrapper implements TickingBlockEntity { public TickingBlockEntity ticker; @@ -35,7 +35,7 @@ index 0337f4b9ca3c9c9a1e2a7cf19fcbad5e78b949dc..1820069a7c5833b0a13e034c232f06af } @Override -@@ -1005,6 +1018,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -1008,6 +1021,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @Override public boolean isRemoved() { diff --git a/divinemc-server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch b/divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch similarity index 89% rename from divinemc-server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch rename to divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch index d4445d0..c901fc4 100644 --- a/divinemc-server/minecraft-patches/features/0047-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch +++ b/divinemc-server/minecraft-patches/features/0035-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch @@ -7,10 +7,10 @@ Subject: [PATCH] SparklyPaper: Allow throttling hopper checks if the target Original project: https://github.com/SparklyPower/SparklyPaper diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 5cd1326ad5d046c88b2b3449d610a78fa880b4cd..6ad3388ac45a4d2ef85fc0fafece7de6e387f738 100644 +index 15d4f60942c0cc612c1468b4c0fda886867a67cb..d701952d940c0da245aa4f9e3664dd5cfcc8771e 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -419,6 +419,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -423,6 +423,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } else { Direction opposite = blockEntity.facing.getOpposite(); if (isFullContainer(attachedContainer, opposite)) { diff --git a/divinemc-server/minecraft-patches/features/0039-Linear-region-file-format.patch b/divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch similarity index 90% rename from divinemc-server/minecraft-patches/features/0039-Linear-region-file-format.patch rename to divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch index bb7a6fd..815bd63 100644 --- a/divinemc-server/minecraft-patches/features/0039-Linear-region-file-format.patch +++ b/divinemc-server/minecraft-patches/features/0036-Linear-region-file-format.patch @@ -21,7 +21,7 @@ index a814512fcfb85312474ae2c2c21443843bf57831..fdccc27c528b01b16a72e614ffd96523 public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite( final int chunkX, final int chunkZ, final CompoundTag compound diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java -index 98fbc5c8044bd945d64569f13412a6e7e49a4e7f..34682217252cb98a70511a8cb25f077ec9f872b8 100644 +index 709df35246fb328cda21679b53d44d9f96206cb3..72c5463cbdd78bfa215b0c1f9baeb3be089dcde7 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java @@ -1260,7 +1260,7 @@ public final class MoonriseRegionFileIO { @@ -54,10 +54,10 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..8713d00d767c9225a0823d2fdbb0b479 + public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Linear region file format } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 26a4a279122bb03a83dd4a34e780d6a4567ba3a8..51b79f614417f231951e9ba05b29ff0044e081e7 100644 +index b2e90749bcaf3b9132681713ab0afae95b3197ee..7de51e99507dfca76ec5848483fecc9e8df1b86f 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -947,10 +947,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap<>()); volatile Component status = Component.translatable("optimizeWorld.stage.counting"); @@ -83,7 +83,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 final DimensionDataStorage overworldDataStorage; public WorldUpgrader( -@@ -261,7 +261,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -272,7 +272,7 @@ public class WorldUpgrader implements AutoCloseable { } private static List getAllChunkPositions(RegionStorageInfo regionStorageInfo, Path path) { @@ -92,7 +92,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 if (files == null) { return List.of(); } else { -@@ -274,7 +274,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -285,7 +285,7 @@ public class WorldUpgrader implements AutoCloseable { int i1 = Integer.parseInt(matcher.group(2)) << 5; List list1 = Lists.newArrayList(); @@ -101,7 +101,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 for (int i2 = 0; i2 < 32; i2++) { for (int i3 = 0; i3 < 32; i3++) { ChunkPos chunkPos = new ChunkPos(i2 + i, i3 + i1); -@@ -322,7 +322,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -333,7 +333,7 @@ public class WorldUpgrader implements AutoCloseable { protected abstract boolean tryProcessOnePosition(T chunkStorage, ChunkPos chunkPos, ResourceKey dimension); @@ -110,7 +110,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 if (WorldUpgrader.this.recreateRegionFiles) { if (this.previousWriteFuture != null) { this.previousWriteFuture.join(); -@@ -424,7 +424,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -438,7 +438,7 @@ public class WorldUpgrader implements AutoCloseable { } } @@ -120,7 +120,7 @@ index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c7 class PoiUpgrader extends WorldUpgrader.SimpleRegionStorageUpgrader { diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java -index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d09441e79863d 100644 +index ae0a893498d0bfe90c14508f15b431d4885e06ff..6fba4d36377359dbcf8c804b194c4aefdde53b01 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -22,7 +22,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler; @@ -132,7 +132,7 @@ index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d0944 private static final Logger LOGGER = LogUtils.getLogger(); public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails private static final int SECTOR_BYTES = 4096; -@@ -904,7 +904,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche +@@ -912,7 +912,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche } @Override @@ -142,7 +142,7 @@ index c72494e757a9dc50e053dbc873f7b30e83d5cb8c..2988084cf2d72557dd304dcb904d0944 } // Paper end - rewrite chunk system diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb1f14d256 100644 +index c98cb390bda4b536f97445f228e06aaebcd84609..db2a7a2ddb6e3f8e5c0291426407f708585db4ee 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -18,7 +18,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -236,7 +236,16 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ)); -@@ -237,7 +243,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -238,7 +244,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + + final ChunkPos pos = new ChunkPos(chunkX, chunkZ); + final ChunkPos headerChunkPos = SerializableChunkData.getChunkCoordinate(ret); +- final RegionFile regionFile = this.getRegionFile(pos); ++ final org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(pos); // DivineMC - Linear region file format + + if (regionFile.getRecalculateCount() != readData.recalculateCount()) { + return null; +@@ -262,7 +268,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } // Paper end - rewrite chunk system // Paper start - rewrite chunk system @@ -245,7 +254,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb return this.getRegionFile(chunkcoordintpair, false); } // Paper end - rewrite chunk system -@@ -249,7 +255,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -274,7 +280,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers } @@ -254,7 +263,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z); -@@ -257,7 +263,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -282,7 +288,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise synchronized (this) { final long key = ChunkPos.asLong(chunkPos.x >> REGION_SHIFT, chunkPos.z >> REGION_SHIFT); @@ -263,7 +272,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (ret != null) { return ret; } -@@ -272,7 +278,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -297,7 +303,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise FileUtil.createDirectoriesSafe(this.folder); @@ -272,7 +281,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb this.regionCache.putAndMoveToFirst(key, ret); -@@ -286,7 +292,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -311,7 +317,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand } @@ -281,7 +290,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -321,7 +327,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -346,7 +352,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public CompoundTag read(ChunkPos chunkPos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -290,7 +299,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (regionFile == null) { return null; } -@@ -360,7 +366,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -385,7 +391,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -299,7 +308,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb if (regionFile == null) { return; } -@@ -374,7 +380,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -399,7 +405,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public @@ -308,7 +317,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb // Paper start - rewrite chunk system if (regionFile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -404,7 +410,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -429,7 +435,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -317,7 +326,7 @@ index 16cd10ab8de69ca3d29c84cf93715645322fd72a..9fd987078625bee796b381108ae7dbfb try { regionFile.close(); } catch (final IOException ex) { -@@ -420,7 +426,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -445,7 +451,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); diff --git a/divinemc-server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch b/divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch similarity index 87% rename from divinemc-server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch rename to divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch index 3a73717..b803080 100644 --- a/divinemc-server/minecraft-patches/features/0042-Configurable-movement-speed-for-entities.patch +++ b/divinemc-server/minecraft-patches/features/0037-Configurable-movement-speed-for-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable movement speed for entities diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 2686df57d9d48db1438278d0d053bdbd3c65c0a7..44fa660cbe277c2b2dd5cce3e508b61848b2cccc 100644 +index ea90e3d7ad84e301f975ff91fade63c5429972cf..d3d8e140eb597d054bb6ca7a2b6f2fe4903e48ae 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -97,6 +97,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -17,7 +17,7 @@ index 2686df57d9d48db1438278d0d053bdbd3c65c0a7..44fa660cbe277c2b2dd5cce3e508b618 @Override diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java -index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..02ba60f5624c99c6360fa5f08aa2d518e34772ab 100644 +index a4ce65911a5d778f60bcedb3acd9fe59a5094c96..f359bfedd2d6fbd1c2d77d664157c4725fef014b 100644 --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java @@ -43,6 +43,7 @@ public class Husk extends Zombie { @@ -29,10 +29,10 @@ index a5bfc6f5caba1da8cfcb345524e05e8676672cb0..02ba60f5624c99c6360fa5f08aa2d518 @Override diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java -index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721ad1f3f11b 100644 +index 783f8b9a05939b9f42fc77065f6347e3c6ddf8f5..b914cf4f62a1e729e12c2b2c4e5bae8f349e9bd9 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java -@@ -123,6 +123,7 @@ public class Zombie extends Monster { +@@ -127,6 +127,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombieScale); @@ -40,7 +40,7 @@ index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721a } // Purpur end - Configurable entity base attributes -@@ -190,7 +191,6 @@ public class Zombie extends Monster { +@@ -194,7 +195,6 @@ public class Zombie extends Monster { public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) @@ -49,10 +49,10 @@ index 7af71c777dca26cd94b1807a2a77ea0d30e92976..5a86d217f9f8374c4ca8846fa22e721a .add(Attributes.ARMOR, 2.0) .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE); diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java -index 2d5ddf98b79f97bdd15593a5989f978155375e99..a053f42a1ffa7285ddf18f3f92dea803f4fe9461 100644 +index e201b8348d3f816e73b9dc43b2c30681199ec767..b9291d89b06e58c02afa088fd20369ed9901e741 100644 --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -99,6 +99,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { +@@ -98,6 +98,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieVillagerMaxHealth); @@ -61,7 +61,7 @@ index 2d5ddf98b79f97bdd15593a5989f978155375e99..a053f42a1ffa7285ddf18f3f92dea803 @Override diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index fddbbffafea275dad187b7908386cf4c05c86743..05256fefd6b015d84adadd877110440ac31a48b4 100644 +index 39489c8a347031fb4f73faca46039786e35762ac..701311b6988cd7d349d3e0fade665a9d4448c544 100644 --- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -85,6 +85,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { diff --git a/divinemc-server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch b/divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch similarity index 96% rename from divinemc-server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch rename to divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch index ab22096..dec3fd2 100644 --- a/divinemc-server/minecraft-patches/features/0043-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch +++ b/divinemc-server/minecraft-patches/features/0038-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Paper PR: Add FillBottleEvents for player and dispenser diff --git a/net/minecraft/core/cauldron/CauldronInteraction.java b/net/minecraft/core/cauldron/CauldronInteraction.java -index b402f6a6ecb8047bbb791b212fba375f4c9e6af5..f381f3ecd27315e06ca6883006a8a4c3eb443c34 100644 +index a1ce1548bb008f1854baa4c5d6cd963c3a3f7a36..12f3875ed5638ca25787d5307de0b22cf0b63b64 100644 --- a/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/net/minecraft/core/cauldron/CauldronInteraction.java @@ -63,7 +63,12 @@ public interface CauldronInteraction { @@ -23,10 +23,10 @@ index b402f6a6ecb8047bbb791b212fba375f4c9e6af5..f381f3ecd27315e06ca6883006a8a4c3 player.awardStat(Stats.ITEM_USED.get(item)); // level.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index c8c8351f5645cf4041d26b0e02c072546ad329c6..75a695aaf0dd2f58e1fa5e1c532ae298c2a2abdb 100644 +index 582e012222123e5001c34153f2ee1ab1d08935fd..ac27ff24f018d8798921c5152e679ceed1e88d8d 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -727,13 +727,25 @@ public interface DispenseItemBehavior { +@@ -569,13 +569,25 @@ public interface DispenseItemBehavior { blockStateBase -> blockStateBase.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockStateBase.getBlock() instanceof BeehiveBlock ) && blockState.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { @@ -111,10 +111,10 @@ index 105f9166297de2bfa6bdcfa9f6a0ffb00c0242ac..111f43fc5c74577f8f3067a4f84be7a6 } diff --git a/net/minecraft/world/level/block/BeehiveBlock.java b/net/minecraft/world/level/block/BeehiveBlock.java -index fd49500f735e3482a0118316bd7a4340f41fe8be..4160c0649be830476b5bbea97557d9a505672abc 100644 +index 3cec4c5a40c569d848bbf503501d8c8d38ecf3ce..1e92dbb04445596e3adee0ef5f1db47b7cec908e 100644 --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -158,12 +158,26 @@ public class BeehiveBlock extends BaseEntityBlock { +@@ -155,12 +155,26 @@ public class BeehiveBlock extends BaseEntityBlock { flag = true; level.gameEvent(player, GameEvent.SHEAR, pos); } else if (stack.is(Items.GLASS_BOTTLE)) { diff --git a/divinemc-server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 88% rename from divinemc-server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch rename to divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch index 7adef18..586cd6c 100644 --- a/divinemc-server/minecraft-patches/features/0045-Paper-PR-Throttle-failed-spawn-attempts.patch +++ b/divinemc-server/minecraft-patches/features/0039-Paper-PR-Throttle-failed-spawn-attempts.patch @@ -22,13 +22,13 @@ Example config in paper-world-defaults.yml: ``` diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070e1cbaf1f 100644 +index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5d8462080 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -175,29 +175,52 @@ public final class NaturalSpawner { +@@ -158,29 +158,52 @@ public final class NaturalSpawner { // Copied from getFilteredSpawningCategories int limit = mobCategory.getMaxInstancesPerChunk(); - SpawnCategory spawnCategory = CraftSpawnCategory.toBukkit(mobCategory); + org.bukkit.entity.SpawnCategory spawnCategory = org.bukkit.craftbukkit.util.CraftSpawnCategory.toBukkit(mobCategory); + // Paper start - throttle failed spawn attempts + boolean spawnThisTick = true; + long ticksPerSpawn = level.ticksPerSpawnCategory.getLong(spawnCategory); @@ -38,7 +38,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 + ticksPerSpawn = Math.max(ticksPerSpawn, spawningThrottle.throttledTicksPerSpawn.getOrDefault(mobCategory, -1)); + } + // Paper end - throttle failed spawn attempts - if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { + if (org.bukkit.craftbukkit.util.CraftSpawnCategory.isValidForLimits(spawnCategory)) { + spawnThisTick = ticksPerSpawnTmp != 0 && level.getGameTime() % ticksPerSpawn == 0; // Paper - throttle failed spawn attempts limit = level.getWorld().getSpawnLimit(spawnCategory); } @@ -91,7 +91,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 // Paper end - Optional per player mob spawns } } -@@ -221,12 +244,21 @@ public final class NaturalSpawner { +@@ -204,12 +227,21 @@ public final class NaturalSpawner { } public static void spawnCategoryForChunk( MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final Consumer trackEntity @@ -114,7 +114,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 } @VisibleForDebug -@@ -246,16 +278,22 @@ public final class NaturalSpawner { +@@ -229,16 +261,22 @@ public final class NaturalSpawner { } public static void spawnCategoryForPosition( MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity @@ -139,23 +139,24 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 for (int i1 = 0; i1 < 3; i1++) { int x = pos.getX(); int z = pos.getZ(); -@@ -295,13 +333,13 @@ public final class NaturalSpawner { +@@ -278,14 +316,14 @@ public final class NaturalSpawner { } // Paper end - per player mob count backoff if (doSpawning == PreSpawnStatus.ABORT) { - return; + return i; // Paper - throttle failed spawn attempts } - if (doSpawning == PreSpawnStatus.SUCCESS && filter.test(spawnerData.type, mutableBlockPos, chunk)) { - // Paper end - PreCreatureSpawnEvent - Mob mobForSpawn = getMobForSpawn(level, spawnerData.type); + if (doSpawning == PreSpawnStatus.SUCCESS + // Paper end - PreCreatureSpawnEvent + && filter.test(spawnerData.type(), mutableBlockPos, chunk)) { + Mob mobForSpawn = getMobForSpawn(level, spawnerData.type()); if (mobForSpawn == null) { - return; + return i; // Paper - throttle failed spawn attempts } - mobForSpawn.moveTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); -@@ -324,7 +362,7 @@ public final class NaturalSpawner { + mobForSpawn.snapTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); +@@ -308,7 +346,7 @@ public final class NaturalSpawner { } // CraftBukkit end if (i >= mobForSpawn.getMaxSpawnClusterSize() || i >= maxSpawns) { // Paper - Optional per player mob spawns @@ -164,7 +165,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 } if (mobForSpawn.isMaxGroupSizeReached(i3)) { -@@ -337,6 +375,8 @@ public final class NaturalSpawner { +@@ -321,6 +359,8 @@ public final class NaturalSpawner { } } } @@ -174,7 +175,7 @@ index 650dfce05bfc68d4c664471b430bd5c0f9629283..3e9ab446632ffe56de45f7622db44070 private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 80a0f5524e91e55d716e93c29e199d9816b0072a..3ba674ca0656d42b7d9e445cf25166253bf11f2e 100644 +index 42458418e6217adba28f729f04904814542eaa17..d4f95214ffbdedfee9e22f4a76d207ba538c6557 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java @@ -91,6 +91,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -186,7 +187,7 @@ index 80a0f5524e91e55d716e93c29e199d9816b0072a..3ba674ca0656d42b7d9e445cf2516625 // Paper start - rewrite chunk system private volatile ca.spottedleaf.moonrise.patches.starlight.light.SWMRNibbleArray[] blockNibbles; diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69e71f45ff 100644 +index 749096358fccbd5d1d13801092255c51096eb001..23b54c108c99b40f8ac8a695b18525a4f349c4a7 100644 --- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -92,6 +92,7 @@ public record SerializableChunkData( @@ -197,35 +198,35 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 ) { public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW( Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null // Paper - Anti-Xray -@@ -216,6 +217,19 @@ public record SerializableChunkData( - lists[i] = list4; +@@ -188,6 +189,19 @@ public record SerializableChunkData( + lists[i] = list2; } + // Paper start - throttle failed spawn attempts + long[] failedSpawnAttemptsData = null; -+ if (tag.contains("Paper.FailedSpawnAttempts", net.minecraft.nbt.Tag.TAG_COMPOUND)) { ++ if (tag.contains("Paper.FailedSpawnAttempts")) { + failedSpawnAttemptsData = new long[net.minecraft.world.entity.MobCategory.values().length]; -+ CompoundTag failedSpawnAttemptsTag = tag.getCompound("Paper.FailedSpawnAttempts"); ++ CompoundTag failedSpawnAttemptsTag = tag.getCompoundOrEmpty("Paper.FailedSpawnAttempts"); + for (net.minecraft.world.entity.MobCategory mobCategory : net.minecraft.world.level.NaturalSpawner.SPAWNING_CATEGORIES) { -+ if (failedSpawnAttemptsTag.contains(mobCategory.getSerializedName(), net.minecraft.nbt.Tag.TAG_LONG)) { -+ failedSpawnAttemptsData[mobCategory.ordinal()] = failedSpawnAttemptsTag.getLong(mobCategory.getSerializedName()); ++ if (failedSpawnAttemptsTag.contains(mobCategory.getSerializedName())) { ++ failedSpawnAttemptsData[mobCategory.ordinal()] = failedSpawnAttemptsTag.getLongOr(mobCategory.getSerializedName(), 0); + } + } + } + // Paper end - throttle failed spawn attempts + - List list5 = Lists.transform(tag.getList("entities", 10), tag1 -> (CompoundTag)tag1); - List list6 = Lists.transform(tag.getList("block_entities", 10), tag1 -> (CompoundTag)tag1); - CompoundTag compound1 = tag.getCompound("structures"); -@@ -294,6 +308,7 @@ public record SerializableChunkData( - list6, - compound1 + List list3 = tag.getList("entities").stream().flatMap(ListTag::compoundStream).toList(); + List list4 = tag.getList("block_entities").stream().flatMap(ListTag::compoundStream).toList(); + CompoundTag compoundOrEmpty = tag.getCompoundOrEmpty("structures"); +@@ -268,6 +282,7 @@ public record SerializableChunkData( + list4, + compoundOrEmpty , tag.get("ChunkBukkitValues") // CraftBukkit - ChunkBukkitValues + , failedSpawnAttemptsData // Paper - throttle failed spawn attempts ); } } -@@ -450,6 +465,15 @@ public record SerializableChunkData( +@@ -424,6 +439,15 @@ public record SerializableChunkData( chunkAccess.addPackedPostProcess(this.postProcessingSections[i], i); } @@ -241,7 +242,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 if (chunkType == ChunkType.LEVELCHUNK) { return this.loadStarlightLightData(level, new ImposterProtoChunk((LevelChunk)chunkAccess, false)); // Paper - starlight } else { -@@ -587,6 +611,7 @@ public record SerializableChunkData( +@@ -554,6 +578,7 @@ public record SerializableChunkData( persistentDataContainer = chunk.persistentDataContainer.toTagCompound(); } // CraftBukkit end @@ -249,7 +250,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 return new SerializableChunkData( level.registryAccess().lookupOrThrow(Registries.BIOME), pos, -@@ -607,6 +632,7 @@ public record SerializableChunkData( +@@ -574,6 +599,7 @@ public record SerializableChunkData( list1, compoundTag , persistentDataContainer // CraftBukkit - persistentDataContainer @@ -257,7 +258,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 ); } } -@@ -703,6 +729,21 @@ public record SerializableChunkData( +@@ -658,6 +684,21 @@ public record SerializableChunkData( compoundTag.put("ChunkBukkitValues", this.persistentDataContainer); } // CraftBukkit end @@ -279,7 +280,7 @@ index 6b6aaeca14178b5b709e20ae13552d42217f15c0..56ed001b8ce9273bdc7afd8228f69e69 // Paper start - starlight if (this.lightCorrect && !this.chunkStatus.isBefore(net.minecraft.world.level.chunk.status.ChunkStatus.LIGHT)) { // clobber vanilla value to force vanilla to relight -@@ -931,4 +972,49 @@ public record SerializableChunkData( +@@ -865,4 +906,49 @@ public record SerializableChunkData( } // Paper end - starlight - convert from record } diff --git a/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch b/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch index ccd9bae..5d69edc 100644 --- a/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch +++ b/divinemc-server/minecraft-patches/features/0040-Async-mob-spawning.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Async mob spawning diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 51b79f614417f231951e9ba05b29ff0044e081e7..dee93ae262a2a06e68dfe8ae1b7193172c436990 100644 +index 0270e0045a76927e156f7bf54fed7ca406a113f8..d19337ce45a8ab7f6438f9101d61d17b70d68a47 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -291,6 +291,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run + public org.bxteam.divinemc.util.AsyncProcessor mobSpawnExecutor = new org.bxteam.divinemc.util.AsyncProcessor("mob_spawning"); // DivineMC - Async mob spawning public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system + AtomicReference atomicReference = new AtomicReference<>(); diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f7c17a7db 100644 +index 9a65321ce62f21b150d29be30dbae7dba0ff40be..3bbaa9bdc7d49b456b5749e4880354c9f793a8b6 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -183,6 +183,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -182,6 +182,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - chunk tick iteration optimisations @@ -31,7 +31,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f public ServerChunkCache( ServerLevel level, -@@ -581,6 +585,35 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -505,6 +509,35 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.broadcastChangedChunks(); } @@ -57,7 +57,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f + MinecraftServer.getServer().mobSpawnExecutor.submit(() -> { + int mapped = distanceManager.getNaturalSpawnChunkCount(); + try { -+ lastSpawnState = NaturalSpawner.createState(mapped, new ArrayList<>(level.entityTickList.entities), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), true); ++ lastSpawnState = NaturalSpawner.createState(mapped, new java.util.ArrayList<>(level.entityTickList.entities), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap), true); + } finally { } + spawnCountsReady.set(true); + }); @@ -67,7 +67,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f } private void broadcastChangedChunks() { -@@ -621,27 +654,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -522,27 +555,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; @@ -113,7 +113,7 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); List filteredSpawningCategories; -@@ -655,7 +692,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -556,7 +593,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - PlayerNaturallySpawnCreaturesEvent boolean flag = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit @@ -122,24 +122,36 @@ index 7f982949304535376dabf42aab1848cabc8987cf..a2bb32b964d08079456d93d49f12b23f } else { filteredSpawningCategories = List.of(); } -@@ -663,8 +700,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon - for (LevelChunk levelChunk : chunks) { - ChunkPos pos = levelChunk.getPos(); - levelChunk.incrementInhabitedTime(timeInhabited); -- if (!filteredSpawningCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && this.chunkMap.anyPlayerCloseEnoughForSpawning(pos, true)) { // Spigot -- NaturalSpawner.spawnForChunk(this.level, levelChunk, spawnState, filteredSpawningCategories); -+ // DivineMC start - Async mob spawning -+ if (!filteredSpawningCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && (!org.bxteam.divinemc.DivineConfig.enableAsyncSpawning || spawnCountsReady.get()) && this.chunkMap.anyPlayerCloseEnoughForSpawning(pos, true)) { // Spigot -+ NaturalSpawner.spawnForChunk(this.level, levelChunk, lastSpawnState, filteredSpawningCategories); -+ // DivineMC end - Async mob spawning - } +@@ -571,7 +608,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper end - chunk tick iteration optimisation - if (true) { // Paper - rewrite chunk system + for (LevelChunk levelChunk : list) { +- this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); ++ this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, lastSpawnState); // DivineMC - Async mob spawning + } + } finally { + list.clear(); +@@ -590,11 +627,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + this.level.tickThunder(chunk); + } + +- if (!spawnCategories.isEmpty()) { +- if (this.level.getWorldBorder().isWithinBounds(pos)) { // Paper - rewrite chunk system +- NaturalSpawner.spawnForChunk(this.level, chunk, spawnState, spawnCategories); +- } ++ // DivineMC start - Async mob spawning ++ if (!spawnCategories.isEmpty() && this.level.getWorldBorder().isWithinBounds(pos) && (!org.bxteam.divinemc.DivineConfig.enableAsyncSpawning || spawnCountsReady.get())) { // Paper - rewrite chunk system ++ NaturalSpawner.spawnForChunk(this.level, chunk, spawnState, spawnCategories); + } ++ // DivineMC end - Async mob spawning + } + + private void getFullChunk(long chunkPos, Consumer fullChunkGetter) { diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0f9629283 100644 +index 68a074a1eb11b158af773a2c44aa49d5d8462080..a5f6f50ad1e276a908347d9c21527fb583734538 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -155,7 +155,18 @@ public final class NaturalSpawner { +@@ -149,7 +149,18 @@ public final class NaturalSpawner { return list; } @@ -158,7 +170,7 @@ index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -642,6 +653,13 @@ public final class NaturalSpawner { +@@ -680,6 +691,13 @@ public final class NaturalSpawner { } boolean canSpawnForCategoryLocal(MobCategory category, ChunkPos chunkPos) { @@ -173,7 +185,7 @@ index d3f5242fc66529bf3137da4d505a6cf55e749e43..650dfce05bfc68d4c664471b430bd5c0 } } diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java -index 018a04674897cfcec0e8de5cb2ab06243a994ae3..8c1de4654a3a29e75716a03efd476b8a3b7fe9e9 100644 +index c89701d7bdc9b889038d3c52f2232fb17624b113..9e75320e51886e0f93c23683d8614128f44a613e 100644 --- a/net/minecraft/world/level/entity/EntityTickList.java +++ b/net/minecraft/world/level/entity/EntityTickList.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; @@ -182,10 +194,10 @@ index 018a04674897cfcec0e8de5cb2ab06243a994ae3..8c1de4654a3a29e75716a03efd476b8a public class EntityTickList { - public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system + public final java.util.concurrent.ConcurrentLinkedQueue entities = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - rewrite chunk system // DivineMC - Async mob spawning - // DivineMC start - Parallel world ticking - private final net.minecraft.server.level.ServerLevel serverLevel; -@@ -43,13 +43,13 @@ public class EntityTickList { + private void ensureActiveIsNotIterated() { + // Paper - rewrite chunk system +@@ -33,13 +33,13 @@ public class EntityTickList { // Paper start - rewrite chunk system // To ensure nothing weird happens with dimension travelling, do not iterate over new entries... // (by dfl iterator() is configured to not iterate over new entries) diff --git a/divinemc-server/minecraft-patches/features/0046-Optimize-Raids.patch b/divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch similarity index 80% rename from divinemc-server/minecraft-patches/features/0046-Optimize-Raids.patch rename to divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch index c380052..449edc8 100644 --- a/divinemc-server/minecraft-patches/features/0046-Optimize-Raids.patch +++ b/divinemc-server/minecraft-patches/features/0041-Optimize-Raids.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Optimize Raids diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 92e35158b68dcb8d1f34fb1b748c12d1d39468c7..c87d1f81bd1b4b9756bd2f4c1dbc58a2dc85c63b 100644 +index 9c64da096bfd8325e0c8f692b8ae7f420096728a..d7ec2dd011a6728e7a1adb5a84f587904166df79 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -219,6 +219,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -214,6 +214,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) public boolean hasRidableMoveEvent = false; // Purpur - Ridables public org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag Compensation + public net.minecraft.world.item.ItemStack ominousBanner; // DivineMC - Optimize Raids - public LevelChunk getChunkIfLoaded(int x, int z) { - return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -714,6 +715,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new org.bxteam.divinemc.server.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // DivineMC - Parallel world ticking + @Override + public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { +@@ -696,6 +697,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle this.chunkSystemPriorities = new org.bxteam.divinemc.server.chunk.PriorityHandler(this); // DivineMC - Chunk System optimizations + this.ominousBanner = Objects.requireNonNullElse(this.registryAccess(), net.minecraft.core.RegistryAccess.EMPTY).lookup(Registries.BANNER_PATTERN).map(Raid::getOminousBannerInstance).orElse(null); // DivineMC - Optimize Raids @@ -25,21 +25,21 @@ index 92e35158b68dcb8d1f34fb1b748c12d1d39468c7..c87d1f81bd1b4b9756bd2f4c1dbc58a2 // Paper start diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java -index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c988277887c 100644 +index eb7208b03240d647ace22c41ac665d3030407196..f19ae5318b7d8e1225b19228bcdc7a93dd11c747 100644 --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -109,6 +109,7 @@ public class Raid { - private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); - public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY); - // Paper end +@@ -125,6 +125,7 @@ public class Raid { + private Raid.RaidStatus status; + private int celebrationTicks; + private Optional waveSpawnPos = Optional.empty(); + private boolean isBarDirty; // DivineMC - Optimize Raids - public Raid(int id, ServerLevel level, BlockPos center) { - this.id = id; -@@ -263,6 +264,12 @@ public class Raid { + public Raid(BlockPos center, Difficulty difficulty) { + this.active = true; +@@ -277,6 +278,12 @@ public class Raid { } - public void tick() { + public void tick(ServerLevel level) { + // DivineMC start - Optimize Raids + if (this.isBarDirty) { + this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F)); @@ -49,7 +49,7 @@ index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c98 if (!this.isStopped()) { if (this.status == Raid.RaidStatus.ONGOING) { boolean flag = this.active; -@@ -581,7 +588,7 @@ public class Raid { +@@ -587,7 +594,7 @@ public class Raid { } public void updateBossbar() { @@ -59,7 +59,7 @@ index 41b0db439b425b052bd1469daa6620a435ca852b..4e53cb7ad7c787fd7581763ae3e77c98 public float getHealthOfLivingRaiders() { diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java -index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315dacec930 100644 +index 77bb3aa7ff042aab6464aac55c846cb9082e5b97..b822905c38818434f3d406067d71b1db13e7efc8 100644 --- a/net/minecraft/world/entity/raid/Raider.java +++ b/net/minecraft/world/entity/raid/Raider.java @@ -42,9 +42,25 @@ import net.minecraft.world.phys.Vec3; @@ -88,10 +88,10 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 + return ominousBanner; + } + // DivineMC end - Optimize Raids + private static final int DEFAULT_WAVE = 0; + private static final boolean DEFAULT_CAN_JOIN_RAID = false; @Nullable - protected Raid raid; - private int wave; -@@ -147,7 +163,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -149,7 +165,7 @@ public abstract class Raider extends PatrollingMonster { public boolean isCaptain() { ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); boolean flag = !itemBySlot.isEmpty() @@ -100,7 +100,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 boolean isPatrolLeader = this.isPatrolLeader(); return flag && isPatrolLeader; } -@@ -211,7 +227,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -212,7 +228,7 @@ public abstract class Raider extends PatrollingMonster { boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; if (this.hasActiveRaid() && !flag @@ -109,7 +109,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 // Paper start - EntityPickupItemEvent fixes if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entity, 0, false).isCancelled()) { return; -@@ -398,6 +414,16 @@ public abstract class Raider extends PatrollingMonster { +@@ -399,6 +415,16 @@ public abstract class Raider extends PatrollingMonster { && !this.cannotPickUpBanner(); } @@ -126,7 +126,7 @@ index c06b589e669b055a26f662df60070d5908256220..7f954bab6e8a1b25abcb3aa6c2d26315 private boolean cannotPickUpBanner() { if (!this.mob.level().purpurConfig.pillagerBypassMobGriefing == !getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing bypass to everything affected if (!this.mob.hasActiveRaid()) { -@@ -407,7 +433,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -408,7 +434,7 @@ public abstract class Raider extends PatrollingMonster { } else if (!this.mob.canBeLeader()) { return true; } else if (ItemStack.matches( diff --git a/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch similarity index 86% rename from divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch rename to divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch index 48e1f64..d74735b 100644 --- a/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch +++ b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dynamic Activation of Brain diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index ae0a3c3d9d6300293a6d0dff5cae49ebe7c11dab..3b08dad7a9fac7ac9acec0bfb85d4826452bdc99 100644 +index 265f20fd771df850a0bb0029e699d3146d883837..a9326f1acc6ffe7fbacc34bf13f56d87e212027a 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java @@ -161,6 +161,21 @@ public final class ActivationRange { @@ -14,7 +14,7 @@ index ae0a3c3d9d6300293a6d0dff5cae49ebe7c11dab..3b08dad7a9fac7ac9acec0bfb85d4826 ActivationRange.activateEntity(entity); + + // DivineMC start - Dynamic Activation of Brain -+ if (org.bxteam.divinemc.DivineConfig.dabEnabled && entity.getType().dabEnabled && (!org.bxteam.divinemc.DivineConfig.dabDontEnableIfInWater || entity.getType().is(net.minecraft.tags.EntityTypeTags.CAN_BREATHE_UNDER_WATER) || !entity.isInWaterOrBubble())) { ++ if (org.bxteam.divinemc.DivineConfig.dabEnabled && entity.getType().dabEnabled && (!org.bxteam.divinemc.DivineConfig.dabDontEnableIfInWater || entity.getType().is(net.minecraft.tags.EntityTypeTags.CAN_BREATHE_UNDER_WATER) || !entity.isInWaterOrRain())) { + if (!entity.activatedPriorityReset) { + entity.activatedPriorityReset = true; + entity.activatedPriority = org.bxteam.divinemc.DivineConfig.dabMaximumActivationFrequency; @@ -31,10 +31,10 @@ index ae0a3c3d9d6300293a6d0dff5cae49ebe7c11dab..3b08dad7a9fac7ac9acec0bfb85d4826 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 561066a2cf769e13ef3cea0881f7a2010ecbf2ec..5fe908ce51f95e1eab024dcd41ed108373f17fea 100644 +index d7ec2dd011a6728e7a1adb5a84f587904166df79..27ff3ae4400de969c95eb337cfd88f8137c77d3b 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -818,6 +818,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -802,6 +802,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.entityTickList .forEach( entity -> { @@ -43,10 +43,10 @@ index 561066a2cf769e13ef3cea0881f7a2010ecbf2ec..5fe908ce51f95e1eab024dcd41ed1083 if (!tickRateManager.isEntityFrozen(entity)) { entity.checkDespawn(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 04ae7636d14a40a427b5d9b746632b0c489efa21..f1cd66d7d96771bc4967e214f70c756fec30efe5 100644 +index 0a23d54a6f03b1d776ab24922f88144762c90875..b98010d6d3d369c680ccc8f15da9574e4f6a139c 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -336,6 +336,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -344,6 +344,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public boolean fixedPose = false; // Paper - Expand Pose API private final int despawnTime; // Paper - entity despawn time limit public int totalEntityAge; // Paper - age-like counter for all entities @@ -56,10 +56,10 @@ index 04ae7636d14a40a427b5d9b746632b0c489efa21..f1cd66d7d96771bc4967e214f70c756f // Paper start - EAR 2 public final boolean defaultActivationState; diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java -index 4186db5cb8d2cd29ebc230d704dd125ae0dfa358..79593dc0e42e4cf0aee5e7b8cac4aca186887d6f 100644 +index d6a0ad078fd1f0350afaac3f1743896d73b015e1..50bc352f4d918678a479a39b218973f7cd0500c7 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1063,6 +1063,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -1075,6 +1075,7 @@ public class EntityType implements FeatureElement, EntityTypeT private final boolean canSpawnFarFromPlayer; private final int clientTrackingRange; private final int updateInterval; @@ -68,10 +68,10 @@ index 4186db5cb8d2cd29ebc230d704dd125ae0dfa358..79593dc0e42e4cf0aee5e7b8cac4aca1 @Nullable private Component description; diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index b4e19cc65701d5ef94e1cc0a7473225c222725c3..00daf8de01bf23f55ba8af12d3e3e551d981c61c 100644 +index d618752727e2f2f5c0c1afa97f455e349cb7e76c..ed89fe2ccfb5ce3e8384a108243288f6e542bc1d 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -218,10 +218,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -206,10 +206,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void inactiveTick() { super.inactiveTick(); @@ -84,7 +84,7 @@ index b4e19cc65701d5ef94e1cc0a7473225c222725c3..00daf8de01bf23f55ba8af12d3e3e551 this.targetSelector.tick(); } } -@@ -888,13 +888,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -754,13 +754,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab // Paper end - Allow nerfed mobs to jump and float this.sensing.tick(); int i = this.tickCount + this.getId(); @@ -147,10 +147,10 @@ index b816b2de8eb327060ca6ea7c4afc17373fa77ff6..4eed0bd3670fdcb0a156c29e7db63233 public boolean hasTasks() { for (WrappedGoal task : this.availableGoals) { diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae8e98e91e 100644 +index 29c22b464705f1b50ec0e423c5df40d8f21e57b7..76d99e4a89fe7df736b836a165d829def489c07b 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -118,6 +118,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -116,6 +116,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS private float spinningAnimationTicks0; public boolean forceDancing = false; // CraftBukkit private org.purpurmc.purpur.controller.FlyingMoveControllerWASD purpurController; // Purpur - Ridables @@ -158,7 +158,7 @@ index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae public Allay(EntityType entityType, Level level) { super(entityType, level); -@@ -287,9 +288,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -283,9 +284,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -176,10 +176,10 @@ index b2c9da89ae6044536f4996fdbd37e2cabf22ca12..fa9672e890f327dbdec57eadc258bbae @Override diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc08347318fd3 100644 +index 0b787911c929f1564d859dcba1ee04510b4a9b7f..b3c09fe1a86f6a47448d4e71261ff34664758c17 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -105,6 +105,7 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -110,6 +110,7 @@ public class Axolotl extends Animal implements Bucketable { public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, Mth::easeInOutSine); public final BinaryAnimator movingAnimator = new BinaryAnimator(10, Mth::easeInOutSine); private static final int REGEN_BUFF_BASE_DURATION = 100; @@ -187,7 +187,7 @@ index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc083 public Axolotl(EntityType entityType, Level level) { super(entityType, level); -@@ -347,12 +348,16 @@ public class Axolotl extends Animal implements VariantHolder, B +@@ -372,12 +373,16 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -210,10 +210,10 @@ index bbfe48fd278cda9926793d0d2de743558fefd622..3f7c48282577a2de20e78b69ddcbc083 public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbfbefddd48 100644 +index 3ccc48afb7a9eb2290f16c6a3218515bee59c2bd..617d47d61dd97fd1c7b56db71e47f4e334a4f491 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -106,6 +106,7 @@ public class Frog extends Animal implements VariantHolder> { +@@ -105,6 +105,7 @@ public class Frog extends Animal { public final AnimationState swimIdleAnimationState = new AnimationState(); private org.purpurmc.purpur.controller.MoveControllerWASD purpurLandController; // Purpur - Ridables private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurWaterController; // Purpur - Ridables @@ -221,7 +221,7 @@ index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbf public Frog(EntityType entityType, Level level) { super(entityType, level); -@@ -242,9 +243,13 @@ public class Frog extends Animal implements VariantHolder> { +@@ -259,9 +260,13 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -239,10 +239,10 @@ index dfcba5c2c8a489ebe74c2d5c1fa980c401806757..1827dead0a0a1d8e9dfbcc44038c9dbf @Override diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45b9bef0b8 100644 +index 63645451495dffd87362fd37cf91a90717ae4470..615655b41eb51b18b9517110e463ef44837ff8dc 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -62,6 +62,7 @@ public class Tadpole extends AbstractFish { +@@ -63,6 +63,7 @@ public class Tadpole extends AbstractFish { ); public boolean ageLocked; // Paper private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurController; // Purpur - Ridables @@ -250,7 +250,7 @@ index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45 public Tadpole(EntityType entityType, Level level) { super(entityType, level); -@@ -133,9 +134,13 @@ public class Tadpole extends AbstractFish { +@@ -134,9 +135,13 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -268,18 +268,18 @@ index 78d256f6a95acb367efd690bc368d2106a928b8f..b32fabed65f929cb8d2c8c93667f2e45 public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index e21f024d0ed7f936ff17df16bd9666fffbf44a75..1f46d9e9def33458001c4c30bf2e37486646d23f 100644 +index 01e1712854aaebc59db844045141b25561df8fc3..45aac1f956a54368f33e1292ba2dbfdd3e426bd0 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -90,6 +90,7 @@ public class Goat extends Animal { - public static final EntityDataAccessor DATA_HAS_RIGHT_HORN = SynchedEntityData.defineId(Goat.class, EntityDataSerializers.BOOLEAN); +@@ -93,6 +93,7 @@ public class Goat extends Animal { + private static final boolean DEFAULT_HAS_RIGHT_HORN = true; private boolean isLoweringHead; private int lowerHeadTick; + private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain public Goat(EntityType entityType, Level level) { super(entityType, level); -@@ -230,9 +231,13 @@ public class Goat extends Animal { +@@ -233,9 +234,13 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -297,10 +297,10 @@ index e21f024d0ed7f936ff17df16bd9666fffbf44a75..1f46d9e9def33458001c4c30bf2e3748 @Override diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b80fc5145b 100644 +index 0644f425cddebe8e5a65e69acae57db867380981..56fb3c23a265403a20cfab551aa002792cd942ea 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -84,6 +84,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -87,6 +87,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING ); @@ -308,7 +308,7 @@ index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b8 public Hoglin(EntityType entityType, Level level) { super(entityType, level); -@@ -203,17 +204,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -206,17 +207,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -340,18 +340,18 @@ index a5ee49e35b0825c03af058347ee189a7962e8027..4a02ff2dbea64cf6fb867872c08ad1b8 @Override diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a..a7f2c0aec77a8b196c9207b071ac904c30f34ee6 100644 +index 73049e486fbf8411819551b43e3ca641ed7a5578..acbbe69df488b085de44e7825e9713bdeb600308 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -143,6 +143,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento - public Set allowedBarterItems = new HashSet<>(); - public Set interestItems = new HashSet<>(); +@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento + private static final com.mojang.serialization.Codec> ITEM_SET_CODEC = net.minecraft.core.registries.BuiltInRegistries.ITEM + .byNameCodec().listOf().xmap(java.util.HashSet::new, List::copyOf); // CraftBukkit end + private int behaviorTick; // DivineMC - Dynamic Activation of Brain public Piglin(EntityType entityType, Level level) { super(entityType, level); -@@ -382,9 +383,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -357,9 +358,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider @@ -369,10 +369,10 @@ index b2e64c0d4c1943f8a50a03ba59318fc2e6b9e26a..a7f2c0aec77a8b196c9207b071ac904c @Override diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12dedaaba6a0a 100644 +index 97ee07ebbba5ad29f766dff5eb4e51fc0e12cfcb..0898a7ea98b60edb31828d91afb92db44f63f85e 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -113,6 +113,7 @@ public class Warden extends Monster implements VibrationSystem { +@@ -110,6 +110,7 @@ public class Warden extends Monster implements VibrationSystem { private final VibrationSystem.User vibrationUser; private VibrationSystem.Data vibrationData; AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList()); @@ -380,7 +380,7 @@ index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12ded public Warden(EntityType entityType, Level level) { super(entityType, level); -@@ -306,18 +307,22 @@ public class Warden extends Monster implements VibrationSystem { +@@ -303,18 +304,22 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { @@ -414,10 +414,10 @@ index 59a12809e5c7f5ee85ca1f587f6b77383a1ff062..9777f5e99909790b49b05ea64fe12ded @Override diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index fec90e482c8935dfca609bbf90e67f86a1586221..2ac8a11e9afc6f776eba3dbe852d7b680ed21705 100644 +index a08818450ed6fd78bb429743ee044726fc7994e7..abf7308a41e7c28e1d9fd82d5f86022a80159bff 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -179,6 +179,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -178,6 +178,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler ); private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers private int notLobotomizedCount = 0; // Purpur - Lobotomize stuck villagers @@ -426,7 +426,7 @@ index fec90e482c8935dfca609bbf90e67f86a1586221..2ac8a11e9afc6f776eba3dbe852d7b68 public Villager(EntityType entityType, Level level) { this(entityType, level, VillagerType.PLAINS); -@@ -397,7 +399,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -400,7 +402,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } // Purpur end - Lobotomize stuck villagers // Pufferfish start diff --git a/divinemc-server/minecraft-patches/features/0008-Parallel-world-ticking.patch b/divinemc-server/minecraft-patches/features/0043-Parallel-world-ticking.patch similarity index 65% rename from divinemc-server/minecraft-patches/features/0008-Parallel-world-ticking.patch rename to divinemc-server/minecraft-patches/features/0043-Parallel-world-ticking.patch index 7d2a317..9a2ae47 100644 --- a/divinemc-server/minecraft-patches/features/0008-Parallel-world-ticking.patch +++ b/divinemc-server/minecraft-patches/features/0043-Parallel-world-ticking.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Parallel world ticking diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -index b5817aa8f537593f6d9fc6b612c82ccccb250ac7..5683395e09a65b1b39748df5152fffef630ac083 100644 +index 60705955e231d47c60f5a0a5e869988aed8774fc..3106d183cc9fdb08b445838c7724799fbba55f7a 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java -@@ -1031,7 +1031,7 @@ public final class ChunkHolderManager { +@@ -1129,7 +1129,7 @@ public final class ChunkHolderManager { if (changedFullStatus.isEmpty()) { return; } - if (!TickThread.isTickThread()) { + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && !TickThread.isTickThreadFor(world)) { // DivineMC - Parallel world ticking this.taskScheduler.scheduleChunkTask(() -> { - final ArrayDeque pendingFullLoadUpdate = ChunkHolderManager.this.pendingFullLoadUpdate; + final java.util.Deque pendingFullLoadUpdate = ChunkHolderManager.this.getData().pendingFullLoadUpdate; // DivineMC - Chunk System optimization for (int i = 0, len = changedFullStatus.size(); i < len; ++i) { -@@ -1057,7 +1057,13 @@ public final class ChunkHolderManager { +@@ -1155,7 +1155,13 @@ public final class ChunkHolderManager { // note: never call while inside the chunk system, this will absolutely break everything public void processUnloads() { @@ -32,7 +32,7 @@ index b5817aa8f537593f6d9fc6b612c82ccccb250ac7..5683395e09a65b1b39748df5152fffef if (BLOCK_TICKET_UPDATES.get() == Boolean.TRUE) { throw new IllegalStateException("Cannot unload chunks recursively"); -@@ -1339,7 +1345,7 @@ public final class ChunkHolderManager { +@@ -1458,7 +1464,7 @@ public final class ChunkHolderManager { List changedFullStatus = null; @@ -41,112 +41,14 @@ index b5817aa8f537593f6d9fc6b612c82ccccb250ac7..5683395e09a65b1b39748df5152fffef boolean ret = false; final boolean canProcessFullUpdates = processFullUpdates & isTickThread; -diff --git a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -index 4a881636ba21fae9e50950bbba2b4321b71d35ab..ebcd52da2228893f7a2d96f61e71906f8d2783ba 100644 ---- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -+++ b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -@@ -46,7 +46,7 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleItemStack); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d1, d2 + d4, d3)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java -index bd5bbc7e55c6bea77991fe5a3c0c2580313d16c5..b822dd53138c9cde3e7248afb7589ca32a1b178a 100644 ---- a/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java -+++ b/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java -@@ -78,7 +78,7 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(itemEntity.getDeltaMovement())); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index f576449e8bc6fd92963cbe3954b0c853a02def3c..075987ec1eabb7385918049c54d7210ff2b38847 100644 +index ac27ff24f018d8798921c5152e679ceed1e88d8d..ec7d1353b19e55b00c558df8981323efb9b88bdf 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -89,7 +89,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleItemStack); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -147,7 +147,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleItemStack); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -201,7 +201,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleItemStack); - - org.bukkit.event.block.BlockDispenseArmorEvent event = new org.bukkit.event.block.BlockDispenseArmorEvent(block, craftItem.clone(), entitiesOfClass.get(0).getBukkitLivingEntity()); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - world.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -251,7 +251,7 @@ public interface DispenseItemBehavior { - org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockSource.pos()); - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleCopy); - org.bukkit.event.block.BlockDispenseArmorEvent event = new org.bukkit.event.block.BlockDispenseArmorEvent(block, craftItem.clone(), abstractChestedHorse.getBukkitLivingEntity()); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - world.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -329,7 +329,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -389,7 +389,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(blockPos)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - levelAccessor.getMinecraftWorld().getCraftServer().getPluginManager().callEvent(event); - } - -@@ -425,7 +425,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item); // Paper - ignore stack size on damageable items - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -482,7 +482,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -510,8 +510,10 @@ public interface DispenseItemBehavior { +@@ -401,8 +401,10 @@ public interface DispenseItemBehavior { // CraftBukkit start level.captureTreeGeneration = false; - if (level.capturedBlockStates.size() > 0) { + if (!level.capturedBlockStates.isEmpty()) { - org.bukkit.TreeType treeType = net.minecraft.world.level.block.SaplingBlock.treeType; - net.minecraft.world.level.block.SaplingBlock.treeType = null; + // DivineMC start - Parallel world ticking @@ -154,131 +56,21 @@ index f576449e8bc6fd92963cbe3954b0c853a02def3c..075987ec1eabb7385918049c54d7210f + net.minecraft.world.level.block.SaplingBlock.setTreeTypeTL(null); + // DivineMC end - Parallel world ticking org.bukkit.Location location = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(blockPos, level.getWorld()); - List blocks = new java.util.ArrayList<>(level.capturedBlockStates.values()); + List states = new java.util.ArrayList<>(level.capturedBlockStates.values()); level.capturedBlockStates.clear(); -@@ -548,7 +550,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(singleItemStack); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockPos.getX() + 0.5D, (double) blockPos.getY(), (double) blockPos.getZ() + 0.5D)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -591,7 +593,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(blockPos)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -644,7 +646,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(blockPos)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - level.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -702,7 +704,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - only single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(blockPos)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -@@ -783,7 +785,7 @@ public interface DispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item); // Paper - ignore stack size on damageable items - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseArmorEvent(block, craftItem.clone(), entitiesOfClass.get(0).getBukkitLivingEntity()); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java -index b91b2f5ea6a1da0477541dc65fdfbfa57b9af475..136c52cab0097fb68e8d12f653f1dab934de9bde 100644 ---- a/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java -+++ b/net/minecraft/core/dispenser/EquipmentDispenseItemBehavior.java -@@ -39,7 +39,7 @@ public class EquipmentDispenseItemBehavior extends DefaultDispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack); - - org.bukkit.event.block.BlockDispenseArmorEvent event = new org.bukkit.event.block.BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) livingEntity.getBukkitEntity()); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - world.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java b/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java -index 116395b6c00a0814922516707544a9ff26d68835..11d4da87aa80aa338d5f3048285079777bae7d3d 100644 ---- a/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java -+++ b/net/minecraft/core/dispenser/MinecartDispenseItemBehavior.java -@@ -62,7 +62,7 @@ public class MinecartDispenseItemBehavior extends DefaultDispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack1); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(vec31.x, vec31.y, vec31.z)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -index 449d9b72ff4650961daa9d1bd25940f3914a6b12..ce12d4729d100be7dffaf4bdfc1c999d68c07bac 100644 ---- a/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -+++ b/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -@@ -32,7 +32,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack1); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) direction.getStepX(), (double) direction.getStepY(), (double) direction.getStepZ())); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -index 626e9feb6a6e7a2cbc7c63e30ba4fb6b923e85c7..81b37cf681ff0220263628b390910d9597662a3a 100644 ---- a/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -+++ b/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -@@ -25,7 +25,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { - org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(serverLevel, blockSource.pos()); - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item); // Paper - ignore stack size on damageable items - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - serverLevel.getCraftServer().getPluginManager().callEvent(event); - } - -diff --git a/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -index 5ab2c8333178335515e619b87ae420f948c83bd1..e3034132c9119956e15a6a0342173d70e44ad669 100644 ---- a/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -+++ b/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -@@ -27,7 +27,7 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior { - org.bukkit.craftbukkit.inventory.CraftItemStack craftItem = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(item.copyWithCount(1)); // Paper - single item in event - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockPos.getX(), blockPos.getY(), blockPos.getZ())); -- if (!DispenserBlock.eventFired) { -+ if (!DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - blockSource.level().getCraftServer().getPluginManager().callEvent(event); - } - diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 4cb26cb312802ffc00426293014ed3994793a391..5a726da8535aa939f043829a3c60fdd9d4ed154a 100644 +index 172c69d577e53354fd4f37702d395e8f61754336..ef2cf6d9ca57266bb0466ca1aa5d2066349f9954 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run + public org.bxteam.divinemc.util.AsyncProcessor mobSpawnExecutor = new org.bxteam.divinemc.util.AsyncProcessor("mob_spawning"); // DivineMC - Async mob spawning + public java.util.concurrent.Semaphore serverLevelTickingSemaphore = null; // DivineMC - Parallel world ticking public static S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -320,24 +321,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop atomicReference = new AtomicReference<>(); +@@ -321,24 +322,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit -@@ -1714,28 +1739,43 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> oldLevels = this.levels; Map, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); newLevels.remove(level.dimension()); @@ -418,36 +210,37 @@ index 4cb26cb312802ffc00426293014ed3994793a391..5a726da8535aa939f043829a3c60fdd9 } // CraftBukkit end diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 0d889730641fd88d4da0c9116226a4dae385e846..f7a061ad623fa909389c60c1d5b4be840f99e2bf 100644 +index 3f9b26de801b2d8e85c56d219ca7bd61c41b3f9d..8fa8cd1a06c86c8424d43b588ff13a917865e80e 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -243,6 +243,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command - this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark - com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics +@@ -224,6 +224,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + } + // DivineMC end - Pufferfish SIMD + + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) { + serverLevelTickingSemaphore = new java.util.concurrent.Semaphore(org.bxteam.divinemc.DivineConfig.parallelThreadCount); + DedicatedServer.LOGGER.info("Using {} permits for Parallel world ticking", serverLevelTickingSemaphore.availablePermits()); + } + // DivineMC end - Parallel world ticking - /*// Purpur start - Purpur config files // Purpur - Configurable void damage height and damage - try { - org.purpurmc.purpur.PurpurConfig.init((java.io.File) options.valueOf("purpur-settings")); ++ + this.setPvpAllowed(properties.pvp); + this.setFlightAllowed(properties.allowFlight); + this.setMotd(properties.motd); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index ba5ca5213fafd60b2257409f334a7c6b28fe918a..52ba052fc1ff2a35786570c282a7de4e9dff99f5 100644 +index 27ff3ae4400de969c95eb337cfd88f8137c77d3b..857439f7b59549cff75e318fdf9c1effe83c7e17 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -182,7 +182,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe - private final MinecraftServer server; +@@ -179,7 +179,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type + public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.LevelHolderData chunkHolderData; // DivineMC - Chunk System optimization private int lastSpawnChunkRadius; - final EntityTickList entityTickList = new EntityTickList(); + final EntityTickList entityTickList = new EntityTickList(this); // DivineMC - Parallel world ticking // Paper - rewrite chunk system private final GameEventDispatcher gameEventDispatcher; public boolean noSave; -@@ -208,6 +208,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -205,6 +205,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private double preciseTime; // Purpur - Configurable daylight cycle private boolean forceTime; // Purpur - Configurable daylight cycle private final RandomSequences randomSequences; @@ -455,15 +248,15 @@ index ba5ca5213fafd60b2257409f334a7c6b28fe918a..52ba052fc1ff2a35786570c282a7de4e // CraftBukkit start public final LevelStorageSource.LevelStorageAccess levelStorageAccess; -@@ -700,6 +701,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -695,6 +696,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit + this.tickExecutor = java.util.concurrent.Executors.newSingleThreadExecutor(new org.bxteam.divinemc.server.ServerLevelTickExecutorThreadFactory(getWorld().getName())); // DivineMC - Parallel world ticking this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle - } - -@@ -1281,12 +1283,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + this.chunkSystemPriorities = new org.bxteam.divinemc.server.chunk.PriorityHandler(this); // DivineMC - Chunk System optimizations + this.ominousBanner = Objects.requireNonNullElse(this.registryAccess(), net.minecraft.core.RegistryAccess.EMPTY).lookup(Registries.BANNER_PATTERN).map(Raid::getOminousBannerInstance).orElse(null); // DivineMC - Optimize Raids +@@ -1293,12 +1295,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (fluidState.is(fluid)) { fluidState.tick(this, pos, blockState); } @@ -481,7 +274,7 @@ index ba5ca5213fafd60b2257409f334a7c6b28fe918a..52ba052fc1ff2a35786570c282a7de4e } private void tickBlock(BlockPos pos, Block block) { -@@ -1294,12 +1296,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1306,12 +1308,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (blockState.is(block)) { blockState.tick(this, pos, this.random); } @@ -499,18 +292,18 @@ index ba5ca5213fafd60b2257409f334a7c6b28fe918a..52ba052fc1ff2a35786570c282a7de4e } // Paper start - log detailed entity tick information -@@ -1548,6 +1550,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1560,6 +1562,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } private void addPlayer(ServerPlayer player) { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot add player off-main"); // DivineMC - Parallel world ticking (additional concurrency issues logs) - Entity entity = this.getEntities().get(player.getUUID()); ++ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot add player off-main"); // DivineMC - Parallel world ticking + Entity entity = this.getEntity(player.getUUID()); if (entity != null) { LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); -@@ -1560,7 +1563,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1572,7 +1575,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit start - private boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + private boolean addEntity(Entity entity, @Nullable org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { - org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) { @@ -523,10 +316,10 @@ index ba5ca5213fafd60b2257409f334a7c6b28fe918a..52ba052fc1ff2a35786570c282a7de4e // Paper start - extra debug info if (entity.valid) { diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bbacf2919e 100644 +index 30c6bdbcd2e33e384f4d6b67e03e7a0acad2a464..fa95080ef6cca7d0b67f4b885fc62a0c3126a41d 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -432,6 +432,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -460,6 +460,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return this.viewDistanceHolder; } // Paper end - rewrite chunk system @@ -534,7 +327,7 @@ index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bb public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile); -@@ -808,6 +809,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -753,6 +754,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @Override public void tick() { @@ -542,7 +335,7 @@ index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bb // CraftBukkit start if (this.joining) { this.joining = false; -@@ -1453,6 +1455,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1397,6 +1399,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return this; } else { // CraftBukkit start @@ -550,7 +343,7 @@ index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bb /* this.isChangingDimension = true; LevelData levelData = level.getLevelData(); -@@ -1815,6 +1818,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1738,6 +1741,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return OptionalInt.empty(); } else { // CraftBukkit start @@ -563,7 +356,7 @@ index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bb this.containerMenu = abstractContainerMenu; // Moved up if (!this.isImmobile()) this.connection -@@ -1879,6 +1888,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1802,6 +1811,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc } @Override public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { @@ -576,7 +369,7 @@ index 21d41b477cc0e8d2476d1e3141bdf23d0c06f3e0..195d9dc696a9a7da0bb041612b73c0bb // Paper end - Inventory close reason this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 6f66c5a93383b2897425e117c32add9a34054add..5ff0ce34cfacb745748d3dc627127842ac1df9fa 100644 +index 338df3c49e19b7ff3f54ecf93a980d4573b142d7..0b8301ea5e90565e673e38e51f7ed3c8c3552a50 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java @@ -150,6 +150,7 @@ public abstract class PlayerList { @@ -587,22 +380,22 @@ index 6f66c5a93383b2897425e117c32add9a34054add..5ff0ce34cfacb745748d3dc627127842 player.isRealPlayer = true; // Paper player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed GameProfile gameProfile = player.getGameProfile(); -@@ -716,6 +717,14 @@ public abstract class PlayerList { - return this.respawn(player, keepInventory, reason, eventReason, null); +@@ -715,6 +716,14 @@ public abstract class PlayerList { } - public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, org.bukkit.Location location) { -+ // DivineMC start - Parallel world ticking (additional concurrency issues logs) + + public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, @Nullable org.bukkit.Location location) { ++ // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) { + if (location != null) + ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, from world " + player.serverLevel().getWorld().getName() + " to world " + location.getWorld().getName()); + else + ca.spottedleaf.moonrise.common.util.TickThread.ensureOnlyTickThread("Cannot respawn player off-main, respawning in world " + player.serverLevel().getWorld().getName()); + } -+ // DivineMC end - Parallel world ticking (additional concurrency issues logs) ++ // DivineMC end - Parallel world ticking this.players.remove(player); this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot player.serverLevel().removePlayerImmediately(player, reason); -@@ -725,6 +734,7 @@ public abstract class PlayerList { +@@ -724,6 +733,7 @@ public abstract class PlayerList { ServerPlayer serverPlayer = player; Level fromWorld = player.level(); player.wonGame = false; @@ -611,10 +404,10 @@ index 6f66c5a93383b2897425e117c32add9a34054add..5ff0ce34cfacb745748d3dc627127842 serverPlayer.connection = player.connection; serverPlayer.restoreFrom(player, keepInventory); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 4c4bed85db28d92ca55593a19ac23616619e4bd1..7e29f1f1972f2fb4f9a779653467bc85ce37c7bc 100644 +index 255e48ac3c05dec9b861fee0c8ec8f478abfa999..07b8fd62a2a3bbd4195ad6550748802a70f75bcb 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -3314,14 +3314,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3248,14 +3248,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { this.setPortalCooldown(); @@ -655,7 +448,7 @@ index 4c4bed85db28d92ca55593a19ac23616619e4bd1..7e29f1f1972f2fb4f9a779653467bc85 } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -3851,6 +3871,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3820,6 +3840,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } private Entity teleportCrossDimension(ServerLevel level, TeleportTransition teleportTransition) { @@ -664,7 +457,7 @@ index 4c4bed85db28d92ca55593a19ac23616619e4bd1..7e29f1f1972f2fb4f9a779653467bc85 List list = new ArrayList<>(passengers.size()); this.ejectPassengers(); diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java -index 88b07fbb96b20124777889830afa480673629d43..be357d9e3c5327ceec12c31830551a564c8cea1b 100644 +index d2661ea79536010414f77256332f214d19106dd9..f77da420bc88df6ec304086fc1eba0690fe278b1 100644 --- a/net/minecraft/world/entity/PortalProcessor.java +++ b/net/minecraft/world/entity/PortalProcessor.java @@ -11,6 +11,7 @@ public class PortalProcessor { @@ -683,7 +476,7 @@ index 88b07fbb96b20124777889830afa480673629d43..be357d9e3c5327ceec12c31830551a56 if (!this.insidePortalThisTick) { this.decayTick(); return false; -@@ -42,7 +44,7 @@ public class PortalProcessor { +@@ -52,7 +54,7 @@ public class PortalProcessor { } public boolean hasExpired() { @@ -692,7 +485,7 @@ index 88b07fbb96b20124777889830afa480673629d43..be357d9e3c5327ceec12c31830551a56 } public BlockPos getEntryPosition() { -@@ -68,4 +70,30 @@ public class PortalProcessor { +@@ -78,4 +80,30 @@ public class PortalProcessor { public boolean isSamePortal(Portal portal) { return this.portal == portal; } @@ -756,27 +549,27 @@ index 3614551856c594f3c0cfee984fcf03fad672b007..6add256046e392d8eb797e3fa9d1cbe7 }); entity.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE); diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index fec90e482c8935dfca609bbf90e67f86a1586221..4ee1791f293ba3abdbfe69824b85566fd9a36586 100644 +index abf7308a41e7c28e1d9fd82d5f86022a80159bff..b68dfb81974e8cc8537c1f42add6a9c6e57fe40d 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java -@@ -803,13 +803,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - this.brain.getMemory(moduleType).ifPresent(globalPos -> { - ServerLevel level = server.getLevel(globalPos.dimension()); +@@ -795,13 +795,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + this.brain.getMemory(moduleType).ifPresent(pos -> { + ServerLevel level = server.getLevel(pos.dimension()); if (level != null) { - PoiManager poiManager = level.getPoiManager(); -- Optional> type = poiManager.getType(globalPos.pos()); +- Optional> type = poiManager.getType(pos.pos()); - BiPredicate> biPredicate = POI_MEMORIES.get(moduleType); - if (type.isPresent() && biPredicate.test(this, type.get())) { -- poiManager.release(globalPos.pos()); -- DebugPackets.sendPoiTicketCountPacket(level, globalPos.pos()); +- poiManager.release(pos.pos()); +- DebugPackets.sendPoiTicketCountPacket(level, pos.pos()); + // DivineMC start - Parallel world ticking + Runnable releasePoiTask = () -> { + PoiManager poiManager = level.getPoiManager(); -+ Optional> type = poiManager.getType(globalPos.pos()); ++ Optional> type = poiManager.getType(pos.pos()); + BiPredicate> biPredicate = POI_MEMORIES.get(moduleType); + if (type.isPresent() && biPredicate.test(this, type.get())) { -+ poiManager.release(globalPos.pos()); -+ DebugPackets.sendPoiTicketCountPacket(level, globalPos.pos()); ++ poiManager.release(pos.pos()); ++ DebugPackets.sendPoiTicketCountPacket(level, pos.pos()); + } + }; + @@ -791,10 +584,10 @@ index fec90e482c8935dfca609bbf90e67f86a1586221..4ee1791f293ba3abdbfe69824b85566f }); } diff --git a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index d212f57c8c0b2086f567fd30237b110203d9e8cb..d59bdab65c034bab443ea9448930fdff85a85392 100644 +index 6575e8ef16f6011f7a799ba31531a2ebefee0c4d..407f00af5aac495eb116e4cf8a05fcc66c7331b1 100644 --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -126,40 +126,50 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +@@ -122,40 +122,50 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { Vec3 vec3 = this.oldPosition(); if (owner instanceof ServerPlayer serverPlayer) { if (serverPlayer.connection.isAcceptingMessages()) { @@ -809,7 +602,7 @@ index d212f57c8c0b2086f567fd30237b110203d9e8cb..d59bdab65c034bab443ea9448930fdff - Endermite endermite = EntityType.ENDERMITE.create(serverLevel, EntitySpawnReason.TRIGGERED); - if (endermite != null) { - endermite.setPlayerSpawned(true); // Purpur - Add back player spawned endermite API -- endermite.moveTo(owner.getX(), owner.getY(), owner.getZ(), owner.getYRot(), owner.getXRot()); +- endermite.snapTo(owner.getX(), owner.getY(), owner.getZ(), owner.getYRot(), owner.getXRot()); - serverLevel.addFreshEntity(endermite, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENDER_PEARL); + // DivineMC start - Parallel world ticking + java.util.function.Consumer teleportPlayerCrossDimensionTask = taskServerPlayer -> { @@ -824,7 +617,7 @@ index d212f57c8c0b2086f567fd30237b110203d9e8cb..d59bdab65c034bab443ea9448930fdff + Endermite endermite = EntityType.ENDERMITE.create(serverLevel, EntitySpawnReason.TRIGGERED); + if (endermite != null) { + endermite.setPlayerSpawned(true); // Purpur - Add back player spawned endermite API -+ endermite.moveTo(owner.getX(), owner.getY(), owner.getZ(), owner.getYRot(), owner.getXRot()); ++ endermite.snapTo(owner.getX(), owner.getY(), owner.getZ(), owner.getYRot(), owner.getXRot()); + serverLevel.addFreshEntity(endermite, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.ENDER_PEARL); + } } @@ -876,11 +669,11 @@ index d212f57c8c0b2086f567fd30237b110203d9e8cb..d59bdab65c034bab443ea9448930fdff } else { Entity entity = owner.teleport( diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index e6419715fab462b12790ecb175ce1e1a1fceed8f..b03068bb94c785db51da660361ce28b9f4b45898 100644 +index 8e97a20306652cdfc757b7102a07c58ce0e339e3..8b691f9b0283cf1847c40a57892395763751aad3 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -92,8 +92,14 @@ public abstract class AbstractContainerMenu { - } +@@ -96,8 +96,14 @@ public abstract class AbstractContainerMenu { + public void startOpen() {} // CraftBukkit end + public Throwable containerCreationStacktrace; // DivineMC - Parallel world ticking @@ -895,10 +688,10 @@ index e6419715fab462b12790ecb175ce1e1a1fceed8f..b03068bb94c785db51da660361ce28b9 this.containerId = containerId; } diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index 264b713e8b7c3d5f7d8e1facc90a60349f2cf414..596abdcda01e412d995d150ca9d056a5278ea691 100644 +index f1b61e98e07d1d89f9af225f99085d8a3fee878c..ac2c8d38fc6d75d23d0f3c5c49ec141b30403e4e 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -407,8 +407,10 @@ public final class ItemStack implements DataComponentHolder { +@@ -406,8 +406,10 @@ public final class ItemStack implements DataComponentHolder { if (interactionResult.consumesAction() && serverLevel.captureTreeGeneration && !serverLevel.capturedBlockStates.isEmpty()) { serverLevel.captureTreeGeneration = false; org.bukkit.Location location = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(clickedPos, serverLevel.getWorld()); @@ -912,18 +705,18 @@ index 264b713e8b7c3d5f7d8e1facc90a60349f2cf414..596abdcda01e412d995d150ca9d056a5 serverLevel.capturedBlockStates.clear(); org.bukkit.event.world.StructureGrowEvent structureEvent = null; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7ef46543b 100644 +index 4eedfc61c7e682a44858703b462eecad17a48904..c01463194470624ecd84209100fdbdc851028fb7 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -170,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - public final io.papermc.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray +@@ -160,6 +160,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl + public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur - Purpur config files public final org.bxteam.divinemc.DivineWorldConfig divineConfig; // DivineMC - Configuration + public io.papermc.paper.redstone.RedstoneWireTurbo turbo = new io.papermc.paper.redstone.RedstoneWireTurbo((net.minecraft.world.level.block.RedStoneWireBlock) net.minecraft.world.level.block.Blocks.REDSTONE_WIRE); // DivineMC - Parallel world ticking (moved to world) - public static BlockPos lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -1149,6 +1150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + public static @Nullable BlockPos lastPhysicsProblem; // Spigot + private int tileTickPosition; + public final Map explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions +@@ -1134,6 +1135,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public boolean setBlock(BlockPos pos, BlockState state, int flags, int recursionLeft) { @@ -931,8 +724,8 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 // CraftBukkit start - tree generation if (this.captureTreeGeneration) { // Paper start - Protect Bedrock and End Portal/Frames from being destroyed -@@ -1529,11 +1531,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll +@@ -1511,11 +1513,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl + this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // DivineMC - optimize block entity removals - Fix MC-117075 } else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) { tickingBlockEntity.tick(); - // Paper start - rewrite chunk system @@ -947,8 +740,8 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 + // DivineMC end - Parallel world ticking } } - this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075 -@@ -1553,7 +1556,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + this.blockEntityTickers.removeMarkedEntries(); // DivineMC - optimize block entity removals - Fix MC-117075 +@@ -1535,7 +1538,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Paper end - Prevent block entity and entity crashes } @@ -961,7 +754,7 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 } // Paper start - Option to prevent armor stands from doing entity lookups -@@ -1696,6 +1703,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1678,6 +1685,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Nullable public BlockEntity getBlockEntity(BlockPos pos, boolean validate) { @@ -969,7 +762,7 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 // Paper start - Perf: Optimize capturedTileEntities lookup net.minecraft.world.level.block.entity.BlockEntity blockEntity; if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(pos)) != null) { -@@ -1713,6 +1721,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1695,6 +1703,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl } public void setBlockEntity(BlockEntity blockEntity) { @@ -977,7 +770,7 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 BlockPos blockPos = blockEntity.getBlockPos(); if (!this.isOutsideBuildHeight(blockPos)) { // CraftBukkit start -@@ -1797,6 +1806,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1779,6 +1788,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -985,7 +778,7 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -2106,8 +2116,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -2097,8 +2107,15 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl public abstract RecipeAccess recipeAccess(); public BlockPos getBlockRandomPos(int x, int y, int z, int yMask) { @@ -1003,50 +796,11 @@ index 0c58919e8242317ba276e103b81d07006c41deca..788e83078e9e430b84bf5dc9df877eb7 return new BlockPos(x + (i & 15), y + (i >> 16 & yMask), z + (i >> 8 & 15)); } -diff --git a/net/minecraft/world/level/block/DispenserBlock.java b/net/minecraft/world/level/block/DispenserBlock.java -index e0a4d41e5bcf144ea4c10d6f633c3a95ed2c5aec..12ead3dc17828558b2e6b67a5f306a5948f7b2cf 100644 ---- a/net/minecraft/world/level/block/DispenserBlock.java -+++ b/net/minecraft/world/level/block/DispenserBlock.java -@@ -51,6 +51,25 @@ public class DispenserBlock extends BaseEntityBlock { - public static final Map DISPENSER_REGISTRY = new IdentityHashMap<>(); - private static final int TRIGGER_DURATION = 4; - public static boolean eventFired = false; // CraftBukkit -+ // DivineMC start - Parallel world ticking -+ public static ThreadLocal eventFiredTL = ThreadLocal.withInitial(() -> Boolean.FALSE); -+ -+ public static boolean getEventFiredTL() { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && eventFiredTL.get()) return true; -+ -+ synchronized (DispenserBlock.class) { -+ return eventFired; -+ } -+ } -+ -+ public static void setEventFiredTL(boolean value) { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) eventFiredTL.set(value); -+ -+ synchronized (DispenserBlock.class) { -+ eventFired = value; -+ } -+ } -+ // DivineMC end - Parallel world ticking - - @Override - public MapCodec codec() { -@@ -96,7 +115,7 @@ public class DispenserBlock extends BaseEntityBlock { - DispenseItemBehavior dispenseMethod = this.getDispenseMethod(level, item); - if (dispenseMethod != DispenseItemBehavior.NOOP) { - if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(level, pos, item, randomSlot)) return; // Paper - Add BlockPreDispenseEvent -- DispenserBlock.eventFired = false; // CraftBukkit - reset event status -+ DispenserBlock.setEventFiredTL(Boolean.FALSE); // CraftBukkit - reset event status // DivineMC - Parallel world ticking - dispenserBlockEntity.setItem(randomSlot, dispenseMethod.dispense(blockSource, item)); - } - } diff --git a/net/minecraft/world/level/block/FungusBlock.java b/net/minecraft/world/level/block/FungusBlock.java -index 85f0eac75784565c658c5178c544f969db3d6f54..fc900a7c382f825110c561070155c1f6451557ed 100644 +index 9711efb088bd0da9168e9bcd0496bd7caddd2974..ea310d53f728aaf5de3284b372ed393e4225a52f 100644 --- a/net/minecraft/world/level/block/FungusBlock.java +++ b/net/minecraft/world/level/block/FungusBlock.java -@@ -76,9 +76,9 @@ public class FungusBlock extends BushBlock implements BonemealableBlock { +@@ -76,9 +76,9 @@ public class FungusBlock extends VegetationBlock implements BonemealableBlock { // CraftBukkit start .map((value) -> { if (this == Blocks.WARPED_FUNGUS) { @@ -1059,10 +813,10 @@ index 85f0eac75784565c658c5178c544f969db3d6f54..fc900a7c382f825110c561070155c1f6 return value; }) diff --git a/net/minecraft/world/level/block/MushroomBlock.java b/net/minecraft/world/level/block/MushroomBlock.java -index 904369f4d7db41026183f2de7c96c2f0f4dc204d..371334bc3a1ea505b3293f13542aef4cf8f2a2d2 100644 +index d306f5f524dc64618df94c9783c2168dc561a5e3..6a0c4dc2ff5e3d82e811db63dc9da7b93e6f2cc9 100644 --- a/net/minecraft/world/level/block/MushroomBlock.java +++ b/net/minecraft/world/level/block/MushroomBlock.java -@@ -94,7 +94,7 @@ public class MushroomBlock extends BushBlock implements BonemealableBlock { +@@ -93,7 +93,7 @@ public class MushroomBlock extends VegetationBlock implements BonemealableBlock return false; } else { level.removeBlock(pos, false); @@ -1072,10 +826,10 @@ index 904369f4d7db41026183f2de7c96c2f0f4dc204d..371334bc3a1ea505b3293f13542aef4c return true; } else { diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index 12c9d60314c99fb65e640d255a2d0c6b7790ad4d..4293c5f11a17500353b63cad399727ece1461c5e 100644 +index 1943a6aad888647953e2d9dbbeedb0bd81c6f9df..9b564348b24444c4cf717907bc92b8ea7cf40ffe 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -308,7 +308,13 @@ public class RedStoneWireBlock extends Block { +@@ -283,7 +283,13 @@ public class RedStoneWireBlock extends Block { if (orientation != null) { source = pos.relative(orientation.getFront().getOpposite()); } @@ -1090,7 +844,7 @@ index 12c9d60314c99fb65e640d255a2d0c6b7790ad4d..4293c5f11a17500353b63cad399727ec return; } updatePowerStrength(worldIn, pos, state, orientation, blockAdded); -@@ -336,7 +342,13 @@ public class RedStoneWireBlock extends Block { +@@ -311,7 +317,13 @@ public class RedStoneWireBlock extends Block { // [Space Walker] suppress shape updates and emit those manually to // bypass the new neighbor update stack. if (level.setBlock(pos, state, Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS)) { @@ -1106,13 +860,13 @@ index 12c9d60314c99fb65e640d255a2d0c6b7790ad4d..4293c5f11a17500353b63cad399727ec } } diff --git a/net/minecraft/world/level/block/SaplingBlock.java b/net/minecraft/world/level/block/SaplingBlock.java -index e014f052e9b0f5ca6b28044e2389782b7d0e0cb8..4ad0e278a348407beed1ec4381bfeacf4de32a0d 100644 +index a22cb810622e0ae97bc2a0d6390d026d9482b783..8ccc1dafdd035477ecbfcbed4cf9a9c503820ce3 100644 --- a/net/minecraft/world/level/block/SaplingBlock.java +++ b/net/minecraft/world/level/block/SaplingBlock.java -@@ -27,6 +27,26 @@ public class SaplingBlock extends BushBlock implements BonemealableBlock { - protected static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 12.0, 14.0); +@@ -26,6 +26,26 @@ public class SaplingBlock extends VegetationBlock implements BonemealableBlock { + private static final VoxelShape SHAPE = Block.column(12.0, 0.0, 12.0); protected final TreeGrower treeGrower; - public static org.bukkit.TreeType treeType; // CraftBukkit + public static @javax.annotation.Nullable org.bukkit.TreeType treeType; // CraftBukkit + // DivineMC start - Parallel world ticking + public static final ThreadLocal treeTypeTL = new ThreadLocal<>(); + @@ -1136,7 +890,7 @@ index e014f052e9b0f5ca6b28044e2389782b7d0e0cb8..4ad0e278a348407beed1ec4381bfeacf @Override public MapCodec codec() { -@@ -63,14 +83,16 @@ public class SaplingBlock extends BushBlock implements BonemealableBlock { +@@ -62,14 +82,16 @@ public class SaplingBlock extends VegetationBlock implements BonemealableBlock { this.treeGrower.growTree(level, level.getChunkSource().getGenerator(), pos, state, random); level.captureTreeGeneration = false; if (!level.capturedBlockStates.isEmpty()) { @@ -1158,12 +912,12 @@ index e014f052e9b0f5ca6b28044e2389782b7d0e0cb8..4ad0e278a348407beed1ec4381bfeacf } if (event == null || !event.isCancelled()) { diff --git a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index 26db603ed681a6c302596627d4dd5bf8a9bafc4e..20e8155c0c5f4bd60344c1bbd15f7555ad9ef554 100644 +index c63370fd458fb4f7190b79b1a8174fcc92d88f9c..6af22d8c1a244b7540cad18c6c9da8f939d8d81a 100644 --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -@@ -77,6 +77,12 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co - return canUnlock(player, code, displayName, null); +@@ -79,6 +79,12 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co } + public static boolean canUnlock(Player player, LockCode code, Component displayName, @Nullable BlockEntity blockEntity) { + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != serverPlayer.serverLevel()) { @@ -1175,102 +929,100 @@ index 26db603ed681a6c302596627d4dd5bf8a9bafc4e..20e8155c0c5f4bd60344c1bbd15f7555 final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(displayName)); diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -index 1638eccef431fb68775af624110f1968f0c6dabd..491ac8be8fdaa573fe1b3a234a14110d89b43345 100644 +index 2627583ab12d886b1fba0b1d1e599f942926b499..2caa770411c542a70fe50267ce4cffb22fc94b97 100644 --- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -@@ -43,9 +43,9 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi +@@ -43,9 +43,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi // Paper end - Fix NPE in SculkBloomEvent world access public static void serverTick(Level level, BlockPos pos, BlockState state, SculkCatalystBlockEntity sculkCatalyst) { - org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = sculkCatalyst.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. -+ org.bukkit.craftbukkit.event.CraftEventFactory.setSourceBlockOverrideTL(pos); // DivineMC - Parallel world ticking // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. sculkCatalyst.catalystListener.getSculkSpreader().updateCursors(level, pos, level.getRandom(), true); - org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = null; // CraftBukkit -+ org.bukkit.craftbukkit.event.CraftEventFactory.setSourceBlockOverrideTL(null); // DivineMC - Parallel world ticking // CraftBukkit } @Override diff --git a/net/minecraft/world/level/block/grower/TreeGrower.java b/net/minecraft/world/level/block/grower/TreeGrower.java -index cf7311c507de09a8f89934e430b2201e8bdffe51..e76cb020471f28c29f1b24addb5cd101ddc9630f 100644 +index d23f255de9208f42125fa358a9e8194c984fe4d3..92e9bc9ba577474ca1108b8d0615739502ca5e57 100644 --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java -@@ -204,55 +204,59 @@ public final class TreeGrower { +@@ -203,55 +203,59 @@ public final class TreeGrower { + // CraftBukkit start - private void setTreeType(Holder> holder) { - ResourceKey> treeFeature = holder.unwrapKey().get(); + private void setTreeType(Holder> feature) { + // DivineMC start - Parallel world ticking + org.bukkit.TreeType treeType; - if (treeFeature == TreeFeatures.OAK || treeFeature == TreeFeatures.OAK_BEES_005) { + if (feature.is(TreeFeatures.OAK) || feature.is(TreeFeatures.OAK_BEES_005)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.TREE; + treeType = org.bukkit.TreeType.TREE; - } else if (treeFeature == TreeFeatures.HUGE_RED_MUSHROOM) { + } else if (feature.is(TreeFeatures.HUGE_RED_MUSHROOM)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.RED_MUSHROOM; + treeType = org.bukkit.TreeType.RED_MUSHROOM; - } else if (treeFeature == TreeFeatures.HUGE_BROWN_MUSHROOM) { + } else if (feature.is(TreeFeatures.HUGE_BROWN_MUSHROOM)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.BROWN_MUSHROOM; + treeType = org.bukkit.TreeType.BROWN_MUSHROOM; - } else if (treeFeature == TreeFeatures.JUNGLE_TREE) { + } else if (feature.is(TreeFeatures.JUNGLE_TREE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.COCOA_TREE; + treeType = org.bukkit.TreeType.COCOA_TREE; - } else if (treeFeature == TreeFeatures.JUNGLE_TREE_NO_VINE) { + } else if (feature.is(TreeFeatures.JUNGLE_TREE_NO_VINE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.SMALL_JUNGLE; + treeType = org.bukkit.TreeType.SMALL_JUNGLE; - } else if (treeFeature == TreeFeatures.PINE) { + } else if (feature.is(TreeFeatures.PINE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.TALL_REDWOOD; + treeType = org.bukkit.TreeType.TALL_REDWOOD; - } else if (treeFeature == TreeFeatures.SPRUCE) { + } else if (feature.is(TreeFeatures.SPRUCE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.REDWOOD; + treeType = org.bukkit.TreeType.REDWOOD; - } else if (treeFeature == TreeFeatures.ACACIA) { + } else if (feature.is(TreeFeatures.ACACIA)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.ACACIA; + treeType = org.bukkit.TreeType.ACACIA; - } else if (treeFeature == TreeFeatures.BIRCH || treeFeature == TreeFeatures.BIRCH_BEES_005) { + } else if (feature.is(TreeFeatures.BIRCH) || feature.is(TreeFeatures.BIRCH_BEES_005)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.BIRCH; + treeType = org.bukkit.TreeType.BIRCH; - } else if (treeFeature == TreeFeatures.SUPER_BIRCH_BEES_0002) { + } else if (feature.is(TreeFeatures.SUPER_BIRCH_BEES_0002)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.TALL_BIRCH; + treeType = org.bukkit.TreeType.TALL_BIRCH; - } else if (treeFeature == TreeFeatures.SWAMP_OAK) { + } else if (feature.is(TreeFeatures.SWAMP_OAK)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.SWAMP; + treeType = org.bukkit.TreeType.SWAMP; - } else if (treeFeature == TreeFeatures.FANCY_OAK || treeFeature == TreeFeatures.FANCY_OAK_BEES_005) { + } else if (feature.is(TreeFeatures.FANCY_OAK) || feature.is(TreeFeatures.FANCY_OAK_BEES_005)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.BIG_TREE; + treeType = org.bukkit.TreeType.BIG_TREE; - } else if (treeFeature == TreeFeatures.JUNGLE_BUSH) { + } else if (feature.is(TreeFeatures.JUNGLE_BUSH)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.JUNGLE_BUSH; + treeType = org.bukkit.TreeType.JUNGLE_BUSH; - } else if (treeFeature == TreeFeatures.DARK_OAK) { + } else if (feature.is(TreeFeatures.DARK_OAK)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.DARK_OAK; + treeType = org.bukkit.TreeType.DARK_OAK; - } else if (treeFeature == TreeFeatures.MEGA_SPRUCE) { + } else if (feature.is(TreeFeatures.MEGA_SPRUCE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.MEGA_REDWOOD; + treeType = org.bukkit.TreeType.MEGA_REDWOOD; - } else if (treeFeature == TreeFeatures.MEGA_PINE) { + } else if (feature.is(TreeFeatures.MEGA_PINE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.MEGA_PINE; + treeType = org.bukkit.TreeType.MEGA_PINE; - } else if (treeFeature == TreeFeatures.MEGA_JUNGLE_TREE) { + } else if (feature.is(TreeFeatures.MEGA_JUNGLE_TREE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.JUNGLE; + treeType = org.bukkit.TreeType.JUNGLE; - } else if (treeFeature == TreeFeatures.AZALEA_TREE) { + } else if (feature.is(TreeFeatures.AZALEA_TREE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.AZALEA; + treeType = org.bukkit.TreeType.AZALEA; - } else if (treeFeature == TreeFeatures.MANGROVE) { + } else if (feature.is(TreeFeatures.MANGROVE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.MANGROVE; + treeType = org.bukkit.TreeType.MANGROVE; - } else if (treeFeature == TreeFeatures.TALL_MANGROVE) { + } else if (feature.is(TreeFeatures.TALL_MANGROVE)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.TALL_MANGROVE; + treeType = org.bukkit.TreeType.TALL_MANGROVE; - } else if (treeFeature == TreeFeatures.CHERRY || treeFeature == TreeFeatures.CHERRY_BEES_005) { + } else if (feature.is(TreeFeatures.CHERRY) || feature.is(TreeFeatures.CHERRY_BEES_005)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.CHERRY; + treeType = org.bukkit.TreeType.CHERRY; - } else if (treeFeature == TreeFeatures.PALE_OAK || treeFeature == TreeFeatures.PALE_OAK_BONEMEAL) { + } else if (feature.is(TreeFeatures.PALE_OAK) || feature.is(TreeFeatures.PALE_OAK_BONEMEAL)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.PALE_OAK; + treeType = org.bukkit.TreeType.PALE_OAK; - } else if (treeFeature == TreeFeatures.PALE_OAK_CREAKING) { + } else if (feature.is(TreeFeatures.PALE_OAK_CREAKING)) { - net.minecraft.world.level.block.SaplingBlock.treeType = org.bukkit.TreeType.PALE_OAK_CREAKING; + treeType = org.bukkit.TreeType.PALE_OAK_CREAKING; } else { - throw new IllegalArgumentException("Unknown tree generator " + treeFeature); + throw new IllegalArgumentException("Unknown tree generator " + feature); } + net.minecraft.world.level.block.SaplingBlock.setTreeTypeTL(treeType); + // DivineMC end - Parallel world ticking @@ -1278,25 +1030,25 @@ index cf7311c507de09a8f89934e430b2201e8bdffe51..e76cb020471f28c29f1b24addb5cd101 // CraftBukkit end } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index e3d71604c161373ef44164606602290af1bd1cb0..b245f594ff91e2d29c83f56b9ed5165f37387e7e 100644 +index d2eed7a0cf0c2c9dbcfb272cf89194f11d37151c..b5d74a13e6311732b9cb67f23844e64de31d9cac 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -365,6 +365,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - +@@ -363,6 +363,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @Nullable - public BlockState setBlockState(BlockPos pos, BlockState state, boolean isMoving, boolean doPlace) { + @Override + public BlockState setBlockState(BlockPos pos, BlockState state, int flags) { + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.level, pos, "Updating block asynchronously"); // DivineMC - Parallel world ticking - // CraftBukkit end int y = pos.getY(); LevelChunkSection section = this.getSection(this.getSectionIndex(y)); + boolean hasOnlyAir = section.hasOnlyAir(); diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java -index c89701d7bdc9b889038d3c52f2232fb17624b113..018a04674897cfcec0e8de5cb2ab06243a994ae3 100644 +index 9e75320e51886e0f93c23683d8614128f44a613e..86c7e5a469fbd276ebbf5aee1b72531d444d6359 100644 --- a/net/minecraft/world/level/entity/EntityTickList.java +++ b/net/minecraft/world/level/entity/EntityTickList.java @@ -10,17 +10,26 @@ import net.minecraft.world.entity.Entity; public class EntityTickList { - public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system + public final java.util.concurrent.ConcurrentLinkedQueue entities = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - rewrite chunk system // DivineMC - Async mob spawning + // DivineMC start - Parallel world ticking + private final net.minecraft.server.level.ServerLevel serverLevel; + @@ -1310,13 +1062,13 @@ index c89701d7bdc9b889038d3c52f2232fb17624b113..018a04674897cfcec0e8de5cb2ab0624 } public void add(Entity entity) { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist addition"); // Paper // DivineMC - Parallel world ticking ++ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist addition"); // DivineMC - Parallel world ticking this.ensureActiveIsNotIterated(); this.entities.add(entity); // Paper - rewrite chunk system } public void remove(Entity entity) { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist removal"); // Paper // DivineMC - Parallel world ticking ++ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(entity, "Asynchronous entity ticklist removal"); // DivineMC - Parallel world ticking this.ensureActiveIsNotIterated(); this.entities.remove(entity); // Paper - rewrite chunk system } @@ -1328,39 +1080,3 @@ index c89701d7bdc9b889038d3c52f2232fb17624b113..018a04674897cfcec0e8de5cb2ab0624 // Paper start - rewrite chunk system // To ensure nothing weird happens with dimension travelling, do not iterate over new entries... // (by dfl iterator() is configured to not iterate over new entries) -diff --git a/net/minecraft/world/level/saveddata/maps/MapIndex.java b/net/minecraft/world/level/saveddata/maps/MapIndex.java -index ffe604f8397a002800e6ecc2f878d0f6f1c98703..8f6436d2e87e7e11d98dcf20f4a62a4b3c7f6d92 100644 ---- a/net/minecraft/world/level/saveddata/maps/MapIndex.java -+++ b/net/minecraft/world/level/saveddata/maps/MapIndex.java -@@ -34,17 +34,24 @@ public class MapIndex extends SavedData { - - @Override - public CompoundTag save(CompoundTag tag, HolderLookup.Provider registries) { -- for (Entry entry : this.usedAuxIds.object2IntEntrySet()) { -- tag.putInt(entry.getKey(), entry.getIntValue()); -+ // DivineMC start - make map data thread-safe -+ synchronized (this.usedAuxIds) { -+ for (Entry entry : this.usedAuxIds.object2IntEntrySet()) { -+ tag.putInt(entry.getKey(), entry.getIntValue()); -+ } - } -- -+ // DivineMC end - make map data thread-safe - return tag; - } - - public MapId getFreeAuxValueForMap() { -- int i = this.usedAuxIds.getInt("map") + 1; -- this.usedAuxIds.put("map", i); -- this.setDirty(); -- return new MapId(i); -+ // DivineMC start - make map data thread-safe -+ synchronized (this.usedAuxIds) { -+ int i = this.usedAuxIds.getInt("map") + 1; -+ this.usedAuxIds.put("map", i); -+ this.setDirty(); -+ return new MapId(i); -+ } -+ // DivineMC end - make map data thread-safe - } - } diff --git a/divinemc-server/minecraft-patches/features/0017-MSPT-Tracking-for-each-world.patch b/divinemc-server/minecraft-patches/features/0044-MSPT-Tracking-for-each-world.patch similarity index 86% rename from divinemc-server/minecraft-patches/features/0017-MSPT-Tracking-for-each-world.patch rename to divinemc-server/minecraft-patches/features/0044-MSPT-Tracking-for-each-world.patch index a9a4bf9..9347b1d 100644 --- a/divinemc-server/minecraft-patches/features/0017-MSPT-Tracking-for-each-world.patch +++ b/divinemc-server/minecraft-patches/features/0044-MSPT-Tracking-for-each-world.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MSPT Tracking for each world diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 11b89a625b942f5f2f882c54dbfc08c16e983425..fc9de137ed1681afd1ef51391cf8f30fd4c61c4b 100644 +index ef2cf6d9ca57266bb0466ca1aa5d2066349f9954..c4ae883af4337e04d0944c603f298ee1576cb3d2 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1684,7 +1684,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Sat, 26 Apr 2025 22:30:35 +0300 +Subject: [PATCH] Player ProfileResult caching + + +diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +index 738c8749593cf3c30a1c321664abf12ba8dac635..7dbd73d8b5f5d2888cede36f9ea0d0cf71b4a49d 100644 +--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java ++++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -74,6 +74,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + private net.minecraft.server.level.ServerPlayer player; // CraftBukkit + public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding + private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support ++ // DivineMC start - Player ProfileResult caching ++ private static final com.google.common.cache.Cache playerProfileResultCache = com.google.common.cache.CacheBuilder.newBuilder() ++ .expireAfterWrite(1, java.util.concurrent.TimeUnit.MINUTES) ++ .build(); ++ // DivineMC end - Player ProfileResult caching + + public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) { + this.server = server; +@@ -293,9 +298,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + String string1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); + + try { +- ProfileResult profileResult = ServerLoginPacketListenerImpl.this.server +- .getSessionService() +- .hasJoinedServer(string1, string, this.getAddress()); ++ // DivineMC start - Player ProfileResult caching ++ ProfileResult profileResult; ++ if (org.bxteam.divinemc.DivineConfig.playerProfileResultCachingEnabled) { ++ profileResult = playerProfileResultCache.getIfPresent(string1); ++ ++ if (profileResult == null) { ++ profileResult = ServerLoginPacketListenerImpl.this.server ++ .getSessionService() ++ .hasJoinedServer(string1, string, this.getAddress()); ++ playerProfileResultCache.put(string1, profileResult); ++ } ++ } else { ++ profileResult = ServerLoginPacketListenerImpl.this.server ++ .getSessionService() ++ .hasJoinedServer(string1, string, this.getAddress()); ++ } ++ // DivineMC end - Player ProfileResult caching + if (profileResult != null) { + GameProfile gameProfile = profileResult.profile(); + // CraftBukkit start - fire PlayerPreLoginEvent diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index 05a9f23..5281b0f 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -994,6 +_,13 @@ +@@ -986,6 +_,13 @@ if (this.hasStopped) return; this.hasStopped = true; } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch index e990ac9..93ab0b0 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -245,6 +_,26 @@ - */// Purpur end - Purpur config files // Purpur - Configurable void damage height and damage +@@ -195,6 +_,26 @@ + // Purpur end - Purpur config files com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now + // DivineMC start - Pufferfish SIMD diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch index f79e55a..0e54f81 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/level/ServerPlayer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -2266,6 +_,7 @@ +@@ -2190,6 +_,7 @@ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, gameMode.getId())); if (gameMode == GameType.SPECTATOR) { this.removeEntitiesOnShoulder(); diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch index 91384eb..dd4fe4b 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -733,8 +_,14 @@ +@@ -725,8 +_,14 @@ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (packet.getId() == this.awaitingTeleport) { if (this.awaitingPositionFromClient == null) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/server/players/PlayerList.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/server/players/PlayerList.java.patch index f7172a5..1c94562 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/server/players/PlayerList.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/server/players/PlayerList.java.patch @@ -1,9 +1,9 @@ --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -716,7 +_,6 @@ - return this.respawn(player, keepInventory, reason, eventReason, null); +@@ -715,7 +_,6 @@ } - public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, org.bukkit.Location location) { + + public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, @Nullable org.bukkit.event.player.PlayerRespawnEvent.RespawnReason eventReason, @Nullable org.bukkit.Location location) { - player.stopRiding(); // CraftBukkit this.players.remove(player); this.playersByName.remove(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch index deb2c27..0762114 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/stats/ServerStatsCounter.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/stats/ServerStatsCounter.java +++ b/net/minecraft/stats/ServerStatsCounter.java -@@ -81,12 +_,6 @@ +@@ -100,12 +_,6 @@ this.dirty.add(stat); } @@ -13,7 +13,7 @@ public void parseLocal(DataFixer fixerUpper, String json) { try { try (JsonReader jsonReader = new JsonReader(new StringReader(json))) { -@@ -190,9 +_,11 @@ +@@ -144,9 +_,11 @@ public void sendStats(ServerPlayer player) { Object2IntMap> map = new Object2IntOpenHashMap<>(); 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 c1c1c83..e6bea2a 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 @@ -1,6 +1,6 @@ --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -1385,7 +_,7 @@ +@@ -1393,7 +_,7 @@ player.setRealHealth(health); } @@ -9,7 +9,7 @@ return; } // CraftBukkit end -@@ -2673,6 +_,7 @@ +@@ -2730,6 +_,7 @@ } protected void updateSwingTime() { @@ -17,7 +17,7 @@ int currentSwingDuration = this.getCurrentSwingDuration(); if (this.swinging) { this.swingTime++; -@@ -3157,7 +_,13 @@ +@@ -3212,7 +_,13 @@ } protected float getFlyingSpeed() { @@ -32,7 +32,7 @@ } public float getSpeed() { -@@ -3642,6 +_,7 @@ +@@ -3657,6 +_,7 @@ protected void updateFallFlying() { this.checkSlowFallDistance(); if (!this.level().isClientSide) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch index 494bacd..e825eb7 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/target/HurtByTargetGoal.java.patch @@ -5,6 +5,6 @@ protected void alertOther(Mob mob, LivingEntity target) { + if (mob == target) return; // DivineMC - Fix MC-110386 - mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit - reason + mob.setTarget(target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY); // CraftBukkit - reason } } diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java.patch index f300a3f..91d2928 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java.patch @@ -5,11 +5,11 @@ @Override protected void doTick(ServerLevel level, Villager entity) { + // DivineMC start - skip useless secondary poi sensor -+ if (org.bxteam.divinemc.DivineConfig.skipUselessSecondaryPoiSensor && entity.getVillagerData().getProfession().secondaryPoi().isEmpty()) { ++ if (org.bxteam.divinemc.DivineConfig.skipUselessSecondaryPoiSensor && entity.getVillagerData().profession().value().secondaryPoi().isEmpty()) { + entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE); + return; + } + // DivineMC end - skip useless secondary poi sensor // Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off Brain brain = entity.getBrain(); - if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == net.minecraft.world.entity.npc.VillagerProfession.CLERIC) { + if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().profession().is(net.minecraft.world.entity.npc.VillagerProfession.CLERIC)) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch index 8cc12f5..1b00990 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/monster/ZombieVillager.java.patch @@ -1,8 +1,8 @@ --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -319,6 +_,12 @@ +@@ -293,6 +_,12 @@ if (!this.isSilent()) { - serverLevel.levelEvent(null, 1027, this.blockPosition(), 0); + level.levelEvent(null, 1027, this.blockPosition(), 0); } + + // DivineMC start - Fix MC-200418 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 b431131..7968f8e 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 -@@ -1879,6 +_,11 @@ +@@ -1806,6 +_,11 @@ } public void causeFoodExhaustion(float exhaustion, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason reason) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch index 7058426..c653df7 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/BaseCommandBlock.java.patch @@ -1,15 +1,15 @@ --- a/net/minecraft/world/level/BaseCommandBlock.java +++ b/net/minecraft/world/level/BaseCommandBlock.java -@@ -21,7 +_,7 @@ +@@ -25,7 +_,7 @@ import net.minecraft.world.phys.Vec3; public abstract class BaseCommandBlock implements CommandSource { - private static final SimpleDateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm:ss"); + private static final ThreadLocal TIME_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("HH:mm:ss")); // DivineMC - Make it thread safe private static final Component DEFAULT_NAME = Component.literal("@"); + private static final int NO_LAST_EXECUTION = -1; private long lastExecution = -1L; - private boolean updateLastExecution = true; -@@ -168,7 +_,7 @@ +@@ -156,7 +_,7 @@ public void sendSystemMessage(Component component) { if (this.trackOutput) { org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/Blocks.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/Blocks.java.patch index 4cd6154..765d174 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/Blocks.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/Blocks.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/Blocks.java +++ b/net/minecraft/world/level/block/Blocks.java -@@ -6632,6 +_,7 @@ +@@ -6744,6 +_,7 @@ .mapColor(MapColor.COLOR_ORANGE) .instrument(NoteBlockInstrument.BASEDRUM) .requiresCorrectToolForDrops() diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch index f9306ac..6bfd496 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -77,12 +_,29 @@ +@@ -70,12 +_,29 @@ } protected boolean decaying(BlockState state) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch index 42d13f8..2d97cab 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -267,11 +_,18 @@ +@@ -270,11 +_,18 @@ public BlockState getBlockStateFinal(final int x, final int y, final int z) { // Copied and modified from below final int sectionIndex = this.getSectionIndex(y); @@ -22,5 +22,5 @@ + return section.states.get((y & 15) << 8 | (z & 15) << 4 | (x & 15)); + // DivineMC end - optimize block state lookup } + @Override - public BlockState getBlockState(BlockPos pos) { diff --git a/divinemc-server/paper-patches/features/0001-Rebrand.patch b/divinemc-server/paper-patches/features/0001-Rebrand.patch index cf01468..4b2f8d1 100644 --- a/divinemc-server/paper-patches/features/0001-Rebrand.patch +++ b/divinemc-server/paper-patches/features/0001-Rebrand.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Rebrand diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java -index be1bb14dca9367b9685841985b6198376986c496..a3f08edec9d5bc60839688df8579fde3f5c927d8 100644 +index 212e0df38ae3ed0b06d147fb5e7e93ef556a0bdd..5736b550ad3f1e7dd9fd1a1f985be2974278e7a9 100644 --- a/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java -@@ -592,7 +592,7 @@ public class Metrics { +@@ -593,7 +593,7 @@ public class Metrics { boolean logFailedRequests = config.getBoolean("logFailedRequests", false); // Only start Metrics, if it's enabled in the config if (config.getBoolean("enabled", true)) { @@ -17,7 +17,7 @@ index be1bb14dca9367b9685841985b6198376986c496..a3f08edec9d5bc60839688df8579fde3 metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> { String minecraftVersion = Bukkit.getVersion(); -@@ -602,7 +602,7 @@ public class Metrics { +@@ -603,7 +603,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 - Purpur config files @@ -27,7 +27,7 @@ index be1bb14dca9367b9685841985b6198376986c496..a3f08edec9d5bc60839688df8579fde3 metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> { Map> map = new HashMap<>(); diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java -index fe66e43c27e0798770e102d1385bacbaa90bda07..5aef1f7aa8c614e50b34747456e7d5a3f0045aff 100644 +index 6ac291288f1e71f56a45e50b650dea4b4adeb763..785c6f744d67592e7b22d9fff7655ee43dd99696 100644 --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java @@ -36,7 +36,7 @@ public class PaperVersionFetcher implements VersionFetcher { @@ -81,7 +81,7 @@ index fe66e43c27e0798770e102d1385bacbaa90bda07..5aef1f7aa8c614e50b34747456e7d5a3 - try { - try (final BufferedReader reader = Resources.asCharSource( - URI.create("https://api.purpurmc.org/v2/purpur/" + build.minecraftVersionId()).toURL(), // Purpur - Rebrand -- Charsets.UTF_8 +- StandardCharsets.UTF_8 - ).openBufferedStream()) { - final JsonObject json = new Gson().fromJson(reader, JsonObject.class); - //final JsonArray builds = json.getAsJsonArray("builds"); // Purpur - Rebrand @@ -231,13 +231,13 @@ index 62e2d5704c348955bc8284dc2d54c933b7bcdd06..341f13e57896f03058ea3ec68e69b7cb public void executeAsync(final Runnable runnable) { MCUtil.scheduleAsyncTask(this.catching(runnable, "asynchronous")); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 2e1b7f613de8876095ef39bb0341a3f9520c8d5d..bab0d25e82f85c7b9524ae42e0bb41e6233d71cf 100644 +index 7091dcb86cad81ed4429f11bf5876b4e192a93f5..81a8076b9bbe94788a682d9ec52dc1a8b779fb83 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -285,7 +285,7 @@ public class Main { +@@ -248,7 +248,7 @@ public class Main { + System.setProperty("library.jansi.version", "Paper"); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows System.setProperty("jdk.console", "java.base"); // Paper - revert default console provider back to java.base so we can have our own jline - //System.out.println("Loading libraries, please wait..."); - //net.minecraft.server.Main.main(options); + - io.papermc.paper.PaperBootstrap.boot(options); + org.bxteam.divinemc.DivineBootstrap.boot(options); // DivineMC - Replace with DivineBootstrap } catch (Throwable t) { @@ -270,12 +270,12 @@ index 99eb04643fce44c37fd96c99756837ccafe7b559..4aef151bd162c4c99a3eaec1854b5463 if (stream != null) { diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 776bc01784b53e3f1d9a35046109c3b9ee4f0882..3731ca80ed58cd385cd66ffbe67f2eeaae642d0f 100644 +index b8b5c2da54a4875d0d23ae6f3efb6052ef25463a..0df159b65ade979c15992aaec51ea1dbc988085b 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java -@@ -77,14 +77,14 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre +@@ -75,14 +75,14 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre + this.lastEarlyWarning = currentTime; if (isLongTimeout) { - // Paper end logger.log(Level.SEVERE, "------------------------------"); - logger.log(Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug."); // Paper // Purpur - Rebrand + logger.log(Level.SEVERE, "The server has stopped responding! This is (probably) not a DivineMC bug."); // DivineMC - Rebrand @@ -291,7 +291,7 @@ index 776bc01784b53e3f1d9a35046109c3b9ee4f0882..3731ca80ed58cd385cd66ffbe67f2eea if (net.minecraft.world.level.Level.lastPhysicsProblem != null) { logger.log(Level.SEVERE, "------------------------------"); -@@ -104,12 +104,12 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre +@@ -102,12 +102,12 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre } // Paper end } else { @@ -306,7 +306,7 @@ index 776bc01784b53e3f1d9a35046109c3b9ee4f0882..3731ca80ed58cd385cd66ffbe67f2eea FeatureHooks.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - log detailed tick information WatchdogThread.dumpThread(ManagementFactory.getThreadMXBean().getThreadInfo(MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE), logger); logger.log(Level.SEVERE, "------------------------------"); -@@ -122,7 +122,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre +@@ -120,7 +120,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre WatchdogThread.dumpThread(thread, logger); } } else { diff --git a/divinemc-server/paper-patches/features/0002-Configuration.patch b/divinemc-server/paper-patches/features/0002-Configuration.patch index e5221ba..a950e2e 100644 --- a/divinemc-server/paper-patches/features/0002-Configuration.patch +++ b/divinemc-server/paper-patches/features/0002-Configuration.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configuration diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 362ab47d0cdba42d7174e9558dd9b926538136d1..d0adbe6fc8ed89ece59226905608cdceb04a6752 100644 +index ae131ec269a4c5c551e4fdcbaefde278e57d69f1..17fb0b603fb79f2368129f284d1211e8a0ce3dc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1103,6 +1103,13 @@ public final class CraftServer implements Server { +@@ -1079,6 +1079,13 @@ public final class CraftServer implements Server { org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur - Purpur config files @@ -22,7 +22,7 @@ index 362ab47d0cdba42d7174e9558dd9b926538136d1..d0adbe6fc8ed89ece59226905608cdce for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1119,6 +1126,13 @@ public final class CraftServer implements Server { +@@ -1095,6 +1102,13 @@ public final class CraftServer implements Server { } world.spigotConfig.init(); // Spigot world.purpurConfig.init(); // Purpur - Purpur config files @@ -37,22 +37,21 @@ index 362ab47d0cdba42d7174e9558dd9b926538136d1..d0adbe6fc8ed89ece59226905608cdce Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bab0d25e82f85c7b9524ae42e0bb41e6233d71cf..f367efa0afae9792f87a842dfe7ba098a3ce7f2d 100644 +index 81a8076b9bbe94788a682d9ec52dc1a8b779fb83..d7f9da2e624d3e27aff36d8818adaf735d78a2d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -183,6 +183,15 @@ public class Main { - .defaultsTo(new File("purpur.yml")) +@@ -173,6 +173,14 @@ public class Main { .describedAs("Yml file"); // Purpur end - Purpur config files -+ + + // DivineMC start - Configuration + acceptsAll(asList("divinemc", "divinemc-settings"), "File for DivineMC settings") -+ .withRequiredArg() -+ .ofType(File.class) -+ .defaultsTo(new File("divinemc.yml")) -+ .describedAs("Yml file"); ++ .withRequiredArg() ++ .ofType(File.class) ++ .defaultsTo(new File("divinemc.yml")) ++ .describedAs("Yml file"); + // DivineMC end - Configuration + - // Paper start acceptsAll(asList("server-name"), "Name of the server") .withRequiredArg() + .ofType(String.class) diff --git a/divinemc-server/paper-patches/features/0003-Delete-timings.patch b/divinemc-server/paper-patches/features/0003-Delete-timings.patch index a9d16f9..95875e7 100644 --- a/divinemc-server/paper-patches/features/0003-Delete-timings.patch +++ b/divinemc-server/paper-patches/features/0003-Delete-timings.patch @@ -45,18 +45,3 @@ index 097500a59336db1bbfffcd1aa4cff7a8586e46ec..69341cb3b11409e41b9ff756b11d9bd1 } @Override -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 037ca6ea2edb3c4ff9bf9f7856360cd2c19b7628..d38061eb738a17368e08750c9297894778b27c84 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1048,10 +1048,8 @@ public final class CraftServer implements Server { - commands.performCommand(results, commandLine, commandLine, true); - } catch (CommandException ex) { - this.pluginManager.callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper -- //target.timings.stopTiming(); // Spigot // Paper - throw ex; - } catch (Throwable ex) { -- //target.timings.stopTiming(); // Spigot // Paper - String msg = "Unhandled exception executing '" + commandLine + "' in " + target; - this.pluginManager.callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper - throw new CommandException(msg, ex); diff --git a/divinemc-server/paper-patches/features/0004-Implement-Secure-Seed.patch b/divinemc-server/paper-patches/features/0004-Implement-Secure-Seed.patch index cc5e8f6..c94c3a5 100644 --- a/divinemc-server/paper-patches/features/0004-Implement-Secure-Seed.patch +++ b/divinemc-server/paper-patches/features/0004-Implement-Secure-Seed.patch @@ -7,32 +7,32 @@ Original license: GPLv3 Original project: https://github.com/plasmoapp/matter diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index de8b9048c8395c05b8688bc9d984b8ad680f15b3..98bd60111797225f3be5e2a19e25d654379ca30d 100644 +index 400e632208d133a3f49fc7f14bceb48a1026769b..4954625e4f1af358ca7c70a57be30dee92ace0e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -206,7 +206,12 @@ public class CraftChunk implements Chunk { +@@ -196,7 +196,12 @@ public class CraftChunk implements Chunk { @Override public boolean isSlimeChunk() { - // 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk -- return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper + // 987234911L is taken from Slime when seeing if a slime can spawn in a chunk +- return this.level.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), level.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper + // DivineMC start - Implement Secure Seed + boolean isSlimeChunk = org.bxteam.divinemc.DivineConfig.enableSecureSeed -+ ? worldServer.getChunk(this.getX(), this.getZ()).isSlimeChunk() -+ : WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper -+ return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk; ++ ? this.level.getChunk(this.getX(), this.getZ()).isSlimeChunk() ++ : WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), this.level.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper ++ return this.level.paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk; + // DivineMC end - Implement Secure Seed } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 384ffd0d306cf01ce58864e9d2fcf7def6afca0f..12cfe2abd84f7ba63d935f91ce907bf3f52832da 100644 +index 17fb0b603fb79f2368129f284d1211e8a0ce3dc0..f92eb3e390b49007c056797f74130cb4c2f9e216 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1414,7 +1414,11 @@ public final class CraftServer implements Server { +@@ -1376,7 +1376,11 @@ public final class CraftServer implements Server { registryAccess = levelDataAndDimensions.dimensions().dimensionsRegistryAccess(); } else { LevelSettings levelSettings; -- WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), false); +- WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), creator.bonusChest()); + // DivineMC start - Implement Secure Seed + WorldOptions worldOptions = org.bxteam.divinemc.DivineConfig.enableSecureSeed + ? new WorldOptions(creator.seed(), su.plo.matter.Globals.createRandomWorldSeed(), creator.generateStructures(), false) diff --git a/divinemc-server/paper-patches/features/0006-Chunk-System-Optimizations.patch b/divinemc-server/paper-patches/features/0005-Chunk-System-Optimizations.patch similarity index 99% rename from divinemc-server/paper-patches/features/0006-Chunk-System-Optimizations.patch rename to divinemc-server/paper-patches/features/0005-Chunk-System-Optimizations.patch index e044381..887c95b 100644 --- a/divinemc-server/paper-patches/features/0006-Chunk-System-Optimizations.patch +++ b/divinemc-server/paper-patches/features/0005-Chunk-System-Optimizations.patch @@ -664,7 +664,7 @@ index 559c959aff3c9deef867b9e425fba3e2e669cac6..a5b0585b56d71d21c9da3b129d213def private MoonriseConstants() {} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 8b70a8e9b0aacbe7964b0441b5bbbaab228962d8..f0c420f4a1b282fb976825c33cb7a118e45de36d 100644 +index 6e9bfd986674c26240700c788987028be4ec32e7..4fd8c2f6fdefe518b5cea0ae81901c44be0ff021 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -229,7 +229,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/divinemc-server/paper-patches/features/0007-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch b/divinemc-server/paper-patches/features/0006-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch similarity index 96% rename from divinemc-server/paper-patches/features/0007-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch rename to divinemc-server/paper-patches/features/0006-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch index 346e7cf..282e420 100644 --- a/divinemc-server/paper-patches/features/0007-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch +++ b/divinemc-server/paper-patches/features/0006-Skip-EntityScheduler-s-executeTick-checks-if-there-i.patch @@ -68,10 +68,10 @@ index c03608fec96b51e1867f43d8f42e5aefb1520e46..eda35b81c36ca8ebe4f9487cb41e2b0c throw new IllegalStateException("Ticking retired scheduler"); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 8635cd772c5c2ae0ba326812ff2a1a179285a86f..614e407814fe47dab58fbcbc49d8e9dd54b4245e 100644 +index 8feb78c4d7fa793f01991756b618fc49de023db6..a138a364c73bc0b325391c9f30943769e54e4cda 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -75,7 +75,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -83,7 +83,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY); protected net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers // Paper start - Folia shedulers @@ -80,7 +80,7 @@ index 8635cd772c5c2ae0ba326812ff2a1a179285a86f..614e407814fe47dab58fbcbc49d8e9dd private final io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler apiScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler(this); @Override -@@ -88,6 +88,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -96,6 +96,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { this.server = server; this.entity = entity; this.entityType = CraftEntityType.minecraftToBukkit(entity.getType()); diff --git a/divinemc-server/paper-patches/features/0008-Optimize-canSee-checks.patch b/divinemc-server/paper-patches/features/0007-Optimize-canSee-checks.patch similarity index 91% rename from divinemc-server/paper-patches/features/0008-Optimize-canSee-checks.patch rename to divinemc-server/paper-patches/features/0007-Optimize-canSee-checks.patch index b311a4b..18bc110 100644 --- a/divinemc-server/paper-patches/features/0008-Optimize-canSee-checks.patch +++ b/divinemc-server/paper-patches/features/0007-Optimize-canSee-checks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize canSee checks diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d2010fc46215c37c3ef1d8a75cc39bce655d2c3f..3cb2cd294874ece5fbefd0618b4db27701ef118a 100644 +index a5cf4e4b9cc35bd81b530bc3eac31b0af3d72b7c..24d72cc726ed238101ccc4f097be784ad9470247 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -210,7 +210,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -212,7 +212,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private boolean hasPlayedBefore = false; private final ConversationTracker conversationTracker = new ConversationTracker(); private final Set channels = new HashSet(); @@ -17,7 +17,7 @@ index d2010fc46215c37c3ef1d8a75cc39bce655d2c3f..3cb2cd294874ece5fbefd0618b4db277 private final Set unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player private static final WeakHashMap> pluginWeakReferences = new WeakHashMap<>(); private int hash = 0; -@@ -2267,9 +2267,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2254,9 +2254,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public boolean canSee(org.bukkit.entity.Entity entity) { diff --git a/divinemc-server/paper-patches/features/0009-Configurable-thread-pool-priority.patch b/divinemc-server/paper-patches/features/0008-Configurable-thread-pool-priority.patch similarity index 100% rename from divinemc-server/paper-patches/features/0009-Configurable-thread-pool-priority.patch rename to divinemc-server/paper-patches/features/0008-Configurable-thread-pool-priority.patch diff --git a/divinemc-server/paper-patches/features/0010-Virtual-Threads.patch b/divinemc-server/paper-patches/features/0009-Virtual-Threads.patch similarity index 97% rename from divinemc-server/paper-patches/features/0010-Virtual-Threads.patch rename to divinemc-server/paper-patches/features/0009-Virtual-Threads.patch index 2ed537c..48ca51d 100644 --- a/divinemc-server/paper-patches/features/0010-Virtual-Threads.patch +++ b/divinemc-server/paper-patches/features/0009-Virtual-Threads.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Virtual Threads diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index a4ac34ebb58a404f4fca7e763e61d4ab05ee3af4..3c7f66571ca346e9776ba6044bbb0f0263f34157 100644 +index 8756aedc6943f80a64e89be36f4cce0fd0348a0f..2ebaed19ced1901d2d849cbd2351a75ca854e1c8 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java @@ -37,7 +37,7 @@ public final class MCUtil { diff --git a/divinemc-server/paper-patches/features/0011-Multithreaded-Tracker.patch b/divinemc-server/paper-patches/features/0010-Multithreaded-Tracker.patch similarity index 66% rename from divinemc-server/paper-patches/features/0011-Multithreaded-Tracker.patch rename to divinemc-server/paper-patches/features/0010-Multithreaded-Tracker.patch index 075937c..a94aa86 100644 --- a/divinemc-server/paper-patches/features/0011-Multithreaded-Tracker.patch +++ b/divinemc-server/paper-patches/features/0010-Multithreaded-Tracker.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Multithreaded Tracker diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -index 124715b53090085fc0a9f50bb2df196d31d89bed..adf526bcb5b4df3b798a8b80ad11b7b2c30775d7 100644 +index d7398b1ecf2660c29fb7d106b48fe02d3736603e..a9ec83b5bcb329bf3d2f3fb0e502685a37f9dcbc 100644 --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -@@ -49,6 +49,12 @@ class PaperEventManager { - // DivineMC end - Parallel world ticking +@@ -42,6 +42,12 @@ class PaperEventManager { + if (event.isAsynchronous() && this.server.isPrimaryThread()) { throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) { + // DivineMC start - Multithreaded Tracker @@ -22,33 +22,33 @@ index 124715b53090085fc0a9f50bb2df196d31d89bed..adf526bcb5b4df3b798a8b80ad11b7b2 } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 59ee059f8d2d96b5e5ae507f209d267da24c9fa1..68c529473e9ce24cb6c6108cb65100757d1d8759 100644 +index f32316b0357f1cb0501a052361a0221f8e9d1438..2e28891cb4c058c022b06040c0283aacf4c2445e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1996,6 +1996,26 @@ public class CraftEventFactory { +@@ -1751,6 +1751,26 @@ public class CraftEventFactory { } - public static boolean handleBlockFormEvent(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState block, int flag, @Nullable Entity entity) { + public static boolean handleBlockFormEvent(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState state, int flags, @Nullable Entity entity, boolean checkSetResult) { + // DivineMC start - Multithreaded Tracker + if (org.bxteam.divinemc.DivineConfig.multithreadedEnabled && Thread.currentThread() instanceof org.bxteam.divinemc.entity.tracking.MultithreadedTracker.MultithreadedTrackerThread) { + java.util.concurrent.CompletableFuture future = new java.util.concurrent.CompletableFuture<>(); + net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { -+ CraftBlockState blockState = CraftBlockStates.getBlockState(world, pos, flag); -+ blockState.setData(block); ++ boolean resultFlag = false; ++ CraftBlockState snapshot = CraftBlockStates.getBlockState(world, pos); ++ snapshot.setData(state); + -+ BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState); -+ world.getCraftServer().getPluginManager().callEvent(event); -+ -+ if (!event.isCancelled()) { -+ blockState.update(true); ++ BlockFormEvent event = (entity == null) ? new BlockFormEvent(snapshot.getBlock(), snapshot) : new EntityBlockFormEvent(entity.getBukkitEntity(), snapshot.getBlock(), snapshot); ++ if (event.callEvent()) { ++ boolean result = snapshot.place(flags); ++ resultFlag = !checkSetResult || result; + } + -+ future.complete(!event.isCancelled()); ++ future.complete(resultFlag); + }); + + return future.join(); + } + // DivineMC end - Multithreaded Tracker - CraftBlockState blockState = CraftBlockStates.getBlockState(world, pos, flag); - blockState.setData(block); + CraftBlockState snapshot = CraftBlockStates.getBlockState(world, pos); + snapshot.setData(state); diff --git a/divinemc-server/paper-patches/features/0012-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch b/divinemc-server/paper-patches/features/0011-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch similarity index 90% rename from divinemc-server/paper-patches/features/0012-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch rename to divinemc-server/paper-patches/features/0011-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch index 59136d6..b8fcd74 100644 --- a/divinemc-server/paper-patches/features/0012-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch +++ b/divinemc-server/paper-patches/features/0011-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Paper PR: Add FillBottleEvents for player and dispenser diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 68c529473e9ce24cb6c6108cb65100757d1d8759..ba5adea7a791a9539ae485ef1c1641a56ca19236 100644 +index 2e28891cb4c058c022b06040c0283aacf4c2445e..e3ba9a423ca15d611196400e394a637c85669087 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2330,4 +2330,18 @@ public class CraftEventFactory { +@@ -2065,4 +2065,18 @@ public class CraftEventFactory { + return event; } - // Paper end - add EntityFertilizeEggEvent + + // DivineMC start - Paper PR: Add FillBottleEvents for player and dispenser + public static io.papermc.paper.event.player.PlayerFillBottleEvent callPlayerFillBottleEvent(net.minecraft.world.entity.player.Player player, InteractionHand hand, ItemStack glassBottle, ItemStack resultItem) { diff --git a/divinemc-server/paper-patches/features/0013-Paper-PR-Player-standing-on-position-API.patch b/divinemc-server/paper-patches/features/0012-Paper-PR-Player-standing-on-position-API.patch similarity index 81% rename from divinemc-server/paper-patches/features/0013-Paper-PR-Player-standing-on-position-API.patch rename to divinemc-server/paper-patches/features/0012-Paper-PR-Player-standing-on-position-API.patch index 574cf0c..a047a7a 100644 --- a/divinemc-server/paper-patches/features/0013-Paper-PR-Player-standing-on-position-API.patch +++ b/divinemc-server/paper-patches/features/0012-Paper-PR-Player-standing-on-position-API.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Paper PR: Player standing on position API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 614e407814fe47dab58fbcbc49d8e9dd54b4245e..c0f25f97519d59919d965f53ea87dada537f3f00 100644 +index a138a364c73bc0b325391c9f30943769e54e4cda..e84408d1a64dbaba1500ee4d31df964d258f058f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1355,6 +1355,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1314,6 +1314,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + return this.entity.get(io.papermc.paper.datacomponent.PaperDataComponentType.bukkitToMinecraft(type)) != null; } - // Paper end - broadcast hurt animation + // Paper start - Player standing on position API + @Override diff --git a/divinemc-server/paper-patches/features/0014-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/paper-patches/features/0013-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 93% rename from divinemc-server/paper-patches/features/0014-Paper-PR-Throttle-failed-spawn-attempts.patch rename to divinemc-server/paper-patches/features/0013-Paper-PR-Throttle-failed-spawn-attempts.patch index 3c66bce..3d489d3 100644 --- a/divinemc-server/paper-patches/features/0014-Paper-PR-Throttle-failed-spawn-attempts.patch +++ b/divinemc-server/paper-patches/features/0013-Paper-PR-Throttle-failed-spawn-attempts.patch @@ -22,10 +22,10 @@ Example config in paper-world-defaults.yml: ``` diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index 7bfa7aa30c1181587c7632f920f48348d2493ea4..d838c90f98c6593404c77d0aab8655c0d15905c4 100644 +index 65f6839fe75340a4b58894ad50c6eda7b59128c0..f7610c709bd6f9e30ec7b1295d58dfbe98fc8661 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -181,6 +181,17 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -182,6 +182,17 @@ public class WorldConfiguration extends ConfigurationPart { @MergeMap public Reference2IntMap ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); diff --git a/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch b/divinemc-server/paper-patches/features/0014-Parallel-world-ticking.patch similarity index 83% rename from divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch rename to divinemc-server/paper-patches/features/0014-Parallel-world-ticking.patch index c282fb3..0973f1b 100644 --- a/divinemc-server/paper-patches/features/0005-Parallel-world-ticking.patch +++ b/divinemc-server/paper-patches/features/0014-Parallel-world-ticking.patch @@ -222,7 +222,7 @@ index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..c153e79ebe1f2338f0d0ca6b45b39279 + // DivineMC end - Parallel world ticking } diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java -index d7398b1ecf2660c29fb7d106b48fe02d3736603e..124715b53090085fc0a9f50bb2df196d31d89bed 100644 +index a9ec83b5bcb329bf3d2f3fb0e502685a37f9dcbc..adf526bcb5b4df3b798a8b80ad11b7b2c30775d7 100644 --- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java +++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java @@ -28,6 +28,7 @@ import java.util.logging.Level; @@ -245,12 +245,12 @@ index d7398b1ecf2660c29fb7d106b48fe02d3736603e..124715b53090085fc0a9f50bb2df196d + // DivineMC end - Parallel world ticking throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) { - throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously."); + // DivineMC start - Multithreaded Tracker diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0bc888372 100644 +index 7ce39901cb1bd41a214ed4444d2072656943fa0f..c3ea717868c2064ea5ff23a79cbbe4cc81557c86 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -446,7 +446,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -447,7 +447,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean unloadChunkRequest(int x, int z) { @@ -263,9 +263,9 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 + } + // DivineMC end - Parallel world ticking if (this.isChunkLoaded(x, z)) { - this.world.getChunkSource().removeRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 1, Unit.INSTANCE); + this.world.getChunkSource().removeTicketWithRadius(TicketType.PLUGIN, new ChunkPos(x, z), 1); } -@@ -471,6 +477,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -472,6 +478,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean refreshChunk(int x, int z) { @@ -273,7 +273,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); if (playerChunk == null) return false; -@@ -521,7 +528,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -522,7 +529,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { @@ -288,7 +288,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 warnUnsafeChunk("loading a faraway chunk", x, z); // Paper ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper -@@ -749,6 +762,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -750,6 +763,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { @@ -296,7 +296,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 this.world.captureTreeGeneration = true; this.world.captureBlockStates = true; boolean grownTree = this.generateTree(loc, type); -@@ -864,6 +878,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -865,6 +879,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { } public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source, Consumer configurator) { // Paper end - expand explosion API @@ -304,7 +304,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 net.minecraft.world.level.Level.ExplosionInteraction explosionType; if (!breakBlocks) { explosionType = net.minecraft.world.level.Level.ExplosionInteraction.NONE; // Don't break blocks -@@ -955,6 +970,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -956,6 +971,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getHighestBlockYAt(int x, int z, org.bukkit.HeightMap heightMap) { @@ -312,7 +312,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 warnUnsafeChunk("getting a faraway chunk", x >> 4, z >> 4); // Paper // Transient load for this tick return this.world.getChunk(x >> 4, z >> 4).getHeight(CraftHeightMap.toNMS(heightMap), x, z); -@@ -985,6 +1001,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -986,6 +1002,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setBiome(int x, int y, int z, Holder bb) { BlockPos pos = new BlockPos(x, 0, z); @@ -320,7 +320,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 if (this.world.hasChunkAt(pos)) { net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkAt(pos); -@@ -2288,6 +2305,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2294,6 +2311,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) { @@ -329,7 +329,7 @@ index bc2522968205d0c701a2fa23f29565a500881492..312018206729b623a7c854af1c11a2d0 } // Paper end diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16aa27d6c6 100644 +index e9ca19c8668d3028f9453f478b1853baa24b47b4..01dd87b5bb0695ea6a1ba386a759e281488d7bdd 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -75,6 +75,11 @@ public class CraftBlock implements Block { @@ -344,31 +344,31 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 return this.world.getBlockState(this.position); } -@@ -157,6 +162,11 @@ public class CraftBlock implements Block { +@@ -155,6 +160,11 @@ public class CraftBlock implements Block { } - private void setData(final byte data, int flag) { + private void setData(final byte data, int flags) { + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && world instanceof ServerLevel serverWorld) { + ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); + } + // DivineMC end - Parallel world ticking - this.world.setBlock(this.position, CraftMagicNumbers.getBlock(this.getType(), data), flag); + this.world.setBlock(this.position, CraftMagicNumbers.getBlock(this.getType(), data), flags); } -@@ -198,6 +208,11 @@ public class CraftBlock implements Block { +@@ -196,6 +206,11 @@ public class CraftBlock implements Block { } - public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics) { + public static boolean setBlockState(LevelAccessor world, BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, boolean applyPhysics) { + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && world instanceof ServerLevel serverWorld) { -+ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously"); ++ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, pos, "Cannot modify world asynchronously"); + } + // DivineMC end - Parallel world ticking - // SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup - if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes + // SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in block entity cleanup + if (oldState.hasBlockEntity() && newState.getBlock() != oldState.getBlock()) { // SPIGOT-3725 remove old block entity if block changes // SPIGOT-4612: faster - just clear tile -@@ -343,18 +358,33 @@ public class CraftBlock implements Block { +@@ -344,18 +359,33 @@ public class CraftBlock implements Block { @Override public Biome getBiome() { @@ -402,7 +402,7 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 this.getWorld().setBiome(this.getX(), this.getY(), this.getZ(), bio); } -@@ -402,6 +432,11 @@ public class CraftBlock implements Block { +@@ -403,6 +433,11 @@ public class CraftBlock implements Block { @Override public boolean isBlockFaceIndirectlyPowered(BlockFace face) { @@ -414,7 +414,7 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 int power = this.world.getMinecraftWorld().getSignal(this.position, CraftBlock.blockFaceToNotch(face)); Block relative = this.getRelative(face); -@@ -414,6 +449,11 @@ public class CraftBlock implements Block { +@@ -415,6 +450,11 @@ public class CraftBlock implements Block { @Override public int getBlockPower(BlockFace face) { @@ -426,7 +426,7 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 int power = 0; net.minecraft.world.level.Level world = this.world.getMinecraftWorld(); int x = this.getX(); -@@ -484,6 +524,11 @@ public class CraftBlock implements Block { +@@ -483,6 +523,11 @@ public class CraftBlock implements Block { @Override public boolean breakNaturally() { @@ -438,7 +438,7 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 return this.breakNaturally(null); } -@@ -543,6 +588,11 @@ public class CraftBlock implements Block { +@@ -542,6 +587,11 @@ public class CraftBlock implements Block { @Override public boolean applyBoneMeal(BlockFace face) { @@ -450,17 +450,17 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 Direction direction = CraftBlock.blockFaceToNotch(face); BlockFertilizeEvent event = null; ServerLevel world = this.getCraftWorld().getHandle(); -@@ -554,8 +604,10 @@ public class CraftBlock implements Block { +@@ -553,8 +603,10 @@ public class CraftBlock implements Block { world.captureTreeGeneration = false; - if (world.capturedBlockStates.size() > 0) { + if (!world.capturedBlockStates.isEmpty()) { - TreeType treeType = SaplingBlock.treeType; - SaplingBlock.treeType = null; + // DivineMC start - Parallel world ticking + TreeType treeType = SaplingBlock.getTreeTypeTL(); + SaplingBlock.setTreeTypeTL(null); + // DivineMC end - Parallel world ticking - List blocks = new ArrayList<>(world.capturedBlockStates.values()); + List states = new ArrayList<>(world.capturedBlockStates.values()); world.capturedBlockStates.clear(); StructureGrowEvent structureEvent = null; @@ -644,6 +696,11 @@ public class CraftBlock implements Block { @@ -500,7 +500,7 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..0e47184336f63123211e24a966908a16 this.getNMS().tick(level, this.position, level.random); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 768d3f93da2522d467183654260a8bd8653588b1..dd3c9e214a59d20c2b5e8556951687e2aba2d116 100644 +index 3422970353dcd886934b9ee906467769d39abbde..cb60c1b09f06872c07d05b04b7bacc5921fea78d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -26,6 +26,25 @@ public abstract class CraftBlockEntityState extends Craft @@ -527,8 +527,8 @@ index 768d3f93da2522d467183654260a8bd8653588b1..dd3c9e214a59d20c2b5e8556951687e2 + } + // DivineMC end - Parallel world ticking - public CraftBlockEntityState(World world, T tileEntity) { - super(world, tileEntity.getBlockPos(), tileEntity.getBlockState()); + public CraftBlockEntityState(World world, T blockEntity) { + super(world, blockEntity.getBlockPos(), blockEntity.getBlockState()); @@ -34,8 +53,10 @@ public abstract class CraftBlockEntityState extends Craft try { // Paper - Show blockstate location if we failed to read it @@ -539,14 +539,14 @@ index 768d3f93da2522d467183654260a8bd8653588b1..dd3c9e214a59d20c2b5e8556951687e2 + this.snapshotDisabled = getDisableSnapshotTL(); + if (snapshotDisabled) { + // DivineMC end - Parallel world ticking - this.snapshot = this.tileEntity; + this.snapshot = this.blockEntity; } else { - this.snapshot = this.createSnapshot(tileEntity); + this.snapshot = this.createSnapshot(blockEntity); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -index fa63a6cfcfcc4eee4503a82d85333c139c8c8b2b..cddb460892f1756faa4b58ae53406058acd9803d 100644 +index c0a7659776a9f0fb82bb8563acbf3286b318fe03..d4ffcf6a96a66f4482af440d1b89aa8ccdd0fd9b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -@@ -215,6 +215,12 @@ public class CraftBlockState implements BlockState { +@@ -217,6 +217,12 @@ public class CraftBlockState implements BlockState { LevelAccessor access = this.getWorldHandle(); CraftBlock block = this.getBlock(); @@ -559,7 +559,7 @@ index fa63a6cfcfcc4eee4503a82d85333c139c8c8b2b..cddb460892f1756faa4b58ae53406058 if (block.getType() != this.getType()) { if (!force) { return false; -@@ -350,6 +356,7 @@ public class CraftBlockState implements BlockState { +@@ -365,6 +371,7 @@ public class CraftBlockState implements BlockState { @Override public java.util.Collection getDrops(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Entity entity) { @@ -568,13 +568,13 @@ index fa63a6cfcfcc4eee4503a82d85333c139c8c8b2b..cddb460892f1756faa4b58ae53406058 net.minecraft.world.item.ItemStack nms = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..c3cc5012cf460f57495d8867f198007676bae5bf 100644 +index 2338e7c115037430cefae26a571ded71f77983c4..6d5af7f72158e9e4abbfb6ae650833a66ea7a934 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -@@ -249,8 +249,10 @@ public final class CraftBlockStates { - net.minecraft.world.level.block.state.BlockState blockData = craftBlock.getNMS(); - BlockEntity tileEntity = craftBlock.getHandle().getBlockEntity(blockPosition); - // Paper start - block state snapshots +@@ -195,14 +195,16 @@ public final class CraftBlockStates { + BlockPos pos = craftBlock.getPosition(); + net.minecraft.world.level.block.state.BlockState state = craftBlock.getNMS(); + BlockEntity blockEntity = craftBlock.getHandle().getBlockEntity(pos); - boolean prev = CraftBlockEntityState.DISABLE_SNAPSHOT; - CraftBlockEntityState.DISABLE_SNAPSHOT = !useSnapshot; + // DivineMC start - Parallel world ticking @@ -582,69 +582,15 @@ index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..c3cc5012cf460f57495d8867f1980076 + CraftBlockEntityState.setDisableSnapshotTL(!useSnapshot); + // DivineMC end - Parallel world ticking try { - // Paper end - CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockPosition, blockData, tileEntity); -@@ -258,7 +260,7 @@ public final class CraftBlockStates { - return blockState; - // Paper start + CraftBlockState blockState = CraftBlockStates.getBlockState(world, pos, state, blockEntity); + blockState.setWorldHandle(craftBlock.getHandle()); // Inject the block's generator access + return blockState; } finally { - CraftBlockEntityState.DISABLE_SNAPSHOT = prev; + CraftBlockEntityState.setDisableSnapshotTL(prev); // DivineMC - Parallel world ticking } - // Paper end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 4df143dfa4c01dc70e496ec8dc44fdde00ab40c6..59ee059f8d2d96b5e5ae507f209d267da24c9fa1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -961,6 +961,26 @@ public class CraftEventFactory { } - public static BlockPos sourceBlockOverride = null; // SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep. -+ // DivineMC start - Parallel world ticking -+ public static final ThreadLocal sourceBlockOverrideTL = new ThreadLocal<>(); -+ -+ public static BlockPos getSourceBlockOverrideTL() { -+ BlockPos sourceBlockOverrideRTCopy; -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking && (sourceBlockOverrideRTCopy = sourceBlockOverrideTL.get()) != null) return sourceBlockOverrideRTCopy; -+ -+ synchronized (CraftEventFactory.class) { -+ return sourceBlockOverride; -+ } -+ } -+ -+ public static void setSourceBlockOverrideTL(BlockPos value) { -+ if (org.bxteam.divinemc.DivineConfig.enableParallelWorldTicking) sourceBlockOverrideTL.set(value); -+ -+ synchronized (CraftEventFactory.class) { -+ sourceBlockOverride = value; -+ } -+ } -+ // DivineMC end - Parallel world ticking - - public static boolean handleBlockSpreadEvent(LevelAccessor world, BlockPos source, BlockPos target, net.minecraft.world.level.block.state.BlockState block, int flag) { - // Suppress during worldgen -@@ -972,7 +992,10 @@ public class CraftEventFactory { - CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag); - state.setData(block); - -- BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, CraftEventFactory.sourceBlockOverride != null ? CraftEventFactory.sourceBlockOverride : source), state); -+ // DivineMC start - Parallel world ticking -+ final BlockPos sourceBlockOverrideRTSnap = getSourceBlockOverrideTL(); -+ BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, sourceBlockOverrideRTSnap != null ? sourceBlockOverrideRTSnap : source), state); -+ // DivineMC end - Parallel world ticking - Bukkit.getPluginManager().callEvent(event); - - if (!event.isCancelled()) { -@@ -2245,7 +2268,7 @@ public class CraftEventFactory { - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1)); - - org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to)); -- if (!net.minecraft.world.level.block.DispenserBlock.eventFired) { -+ if (!net.minecraft.world.level.block.DispenserBlock.getEventFiredTL()) { // DivineMC - Parallel world ticking - if (!event.callEvent()) { - return itemStack; - } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java index e4e2e42d0ca25df7fe9f2dd4275610e45fcb2c84..8d0816dcc4159b62e5bbb03e3897b255feb961e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncTask.java diff --git a/divinemc-server/paper-patches/features/0015-Optimize-default-values-for-configs.patch b/divinemc-server/paper-patches/features/0015-Optimize-default-values-for-configs.patch index a1b10bc..287118f 100644 --- a/divinemc-server/paper-patches/features/0015-Optimize-default-values-for-configs.patch +++ b/divinemc-server/paper-patches/features/0015-Optimize-default-values-for-configs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize default values for configs diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index f0c420f4a1b282fb976825c33cb7a118e45de36d..af728eec05f67d9c3185bd2ccf7a9088a33be401 100644 +index 4fd8c2f6fdefe518b5cea0ae81901c44be0ff021..ae70fb008ff35b83c82dabec9a62c20ab94ea722 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -349,8 +349,8 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -20,10 +20,10 @@ index f0c420f4a1b282fb976825c33cb7a118e45de36d..af728eec05f67d9c3185bd2ccf7a9088 public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT; @Comment("Defines the leniency distance added on the server to the interaction range of a player when validating interact packets.") diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397fa02e0d4 100644 +index 6c298304f842612d0e063b578f274eed04b32960..18c501a2fe2213e3282bf83f5e07fe3772eef05f 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -146,8 +146,10 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -147,8 +147,10 @@ public class WorldConfiguration extends ConfigurationPart { public ArmorStands armorStands; public class ArmorStands extends ConfigurationPart { @@ -36,7 +36,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 } public Markers markers; -@@ -273,8 +275,38 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -274,8 +276,38 @@ public class WorldConfiguration extends ConfigurationPart { public AltItemDespawnRate altItemDespawnRate; public class AltItemDespawnRate extends ConfigurationPart { @@ -86,7 +86,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 public boolean disableExplosionKnockback = false; public boolean generateFlatBedrock = false; public FrostedIce frostedIce; -@@ -473,7 +505,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -471,7 +503,7 @@ public class WorldConfiguration extends ConfigurationPart { public Fixes fixes; public class Fixes extends ConfigurationPart { @@ -95,7 +95,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 public boolean disableUnloadedChunkEnderpearlExploit = false; public boolean preventTntFromMovingInWater = false; public boolean splitOverstackedLoot = true; -@@ -501,9 +533,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -499,9 +531,9 @@ public class WorldConfiguration extends ConfigurationPart { public class Collisions extends ConfigurationPart { public boolean onlyPlayersCollide = false; public boolean allowVehicleCollisions = true; @@ -107,7 +107,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 public boolean allowPlayerCrammingDamage = false; } -@@ -513,16 +545,32 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -511,16 +543,33 @@ public class WorldConfiguration extends ConfigurationPart { public AutosavePeriod autoSaveInterval = AutosavePeriod.def(); public int maxAutoSaveChunksPerTick = 24; public int fixedChunkInhabitedTime = -1; @@ -135,7 +135,8 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 + map.put(EntityType.FIREBALL, 8); + map.put(EntityType.FIREWORK_ROCKET, 8); + map.put(EntityType.LLAMA_SPIT, 3); -+ map.put(EntityType.POTION, 8); ++ map.put(EntityType.SPLASH_POTION, 8); ++ map.put(EntityType.LINGERING_POTION, 8); + map.put(EntityType.SHULKER_BULLET, 8); + map.put(EntityType.SMALL_FIREBALL, 8); + map.put(EntityType.SNOWBALL, 8); @@ -147,7 +148,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 }); public boolean flushRegionsOnSave = false; } -@@ -537,9 +585,9 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -535,9 +584,9 @@ public class WorldConfiguration extends ConfigurationPart { public TickRates tickRates; public class TickRates extends ConfigurationPart { @@ -159,7 +160,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 public int wetFarmland = 1; public int dryFarmland = 1; public Table, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); -@@ -574,7 +622,7 @@ public class WorldConfiguration extends ConfigurationPart { +@@ -572,7 +621,7 @@ public class WorldConfiguration extends ConfigurationPart { public class Misc extends ConfigurationPart { public boolean updatePathfindingOnBlockUpdate = true; public boolean showSignClickCommandFailureMsgsToPlayer = false; @@ -169,7 +170,7 @@ index d838c90f98c6593404c77d0aab8655c0d15905c4..a2240ee8e3fcbd30cbe724c5db819397 public boolean disableEndCredits = false; public DoubleOr.Default maxLeashDistance = DoubleOr.Default.USE_DEFAULT; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16cee992e200 100644 +index 43c6240ec2855c0f668ce04de29d22a223d2612f..74cae42b0c8971e0ad724ef28a7ddb42906e574d 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -135,13 +135,13 @@ public class SpigotWorldConfig { @@ -197,7 +198,7 @@ index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16ce this.log("Mob Spawn Range: " + this.mobSpawnRange); } -@@ -184,14 +184,16 @@ public class SpigotWorldConfig { +@@ -184,13 +184,15 @@ public class SpigotWorldConfig { this.log("Item Despawn Rate: " + this.itemDespawnRate); } @@ -205,22 +206,22 @@ index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16ce - public int monsterActivationRange = 32; - public int raiderActivationRange = 64; - public int miscActivationRange = 16; +- public int flyingMonsterActivationRange = 32; +- public int waterActivationRange = 16; +- public int villagerActivationRange = 32; + // DivineMC start - Optimize default values for configs + public int animalActivationRange = 16; + public int monsterActivationRange = 24; + public int raiderActivationRange = 48; + public int miscActivationRange = 8; - // Paper start - public int flyingMonsterActivationRange = 32; -- public int waterActivationRange = 16; -- public int villagerActivationRange = 32; ++ public int flyingMonsterActivationRange = 48; + public int waterActivationRange = 8; + public int villagerActivationRange = 16; + // DivineMC end - Optimize default values for configs public int wakeUpInactiveAnimals = 4; public int wakeUpInactiveAnimalsEvery = 60 * 20; public int wakeUpInactiveAnimalsFor = 5 * 20; -@@ -247,10 +249,10 @@ public class SpigotWorldConfig { +@@ -243,10 +245,10 @@ public class SpigotWorldConfig { this.log("Entity Activation Range: An " + this.animalActivationRange + " / Mo " + this.monsterActivationRange + " / Ra " + this.raiderActivationRange + " / Mi " + this.miscActivationRange + " / Tiv " + this.tickInactiveVillagers + " / Isa " + this.ignoreSpectatorActivation); } @@ -235,7 +236,7 @@ index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16ce public int displayTrackingRange = 128; public int otherTrackingRange = 64; private void trackingRange() { -@@ -273,7 +275,7 @@ public class SpigotWorldConfig { +@@ -269,7 +271,7 @@ public class SpigotWorldConfig { if (SpigotConfig.version < 11) { this.set("ticks-per.hopper-check", 1); } @@ -245,10 +246,10 @@ index 89e2adbc1e1a0709d03e151e3ffcdbff10a44098..ad57e4a05dd1347c971424297f3b16ce this.hopperCanLoadChunks = this.getBoolean("hopper-can-load-chunks", false); this.log("Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks); diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml -index eef7c125b2689f29cae5464659eacdf33f5695b2..ff8086f55106f72aa2e2d64b459e6ce0d3d1efb3 100644 +index 00a5b4dc0d7bc57ae3f9231f84a081617ec4b15b..874f862a67e6c2109bce03d21fb4441a53e71633 100644 --- a/src/main/resources/configurations/bukkit.yml +++ b/src/main/resources/configurations/bukkit.yml -@@ -18,28 +18,28 @@ settings: +@@ -16,28 +16,28 @@ settings: update-folder: update plugin-profiling: false connection-throttle: 4000 @@ -293,10 +294,10 @@ index eef7c125b2689f29cae5464659eacdf33f5695b2..ff8086f55106f72aa2e2d64b459e6ce0 autosave: 6000 aliases: now-in-commands.yml diff --git a/src/main/resources/configurations/commands.yml b/src/main/resources/configurations/commands.yml -index 18f54571200e2eca09a39b88f170fe7b99d8618f..12312a1c393f1008dab5b6c82b8c65b3848efed1 100644 +index ddf2cd4b802cf7d22342eed7f09c989761aed7a9..59f2bed6512f23ca7e28aebe0cef7d50bcfb8f8c 100644 --- a/src/main/resources/configurations/commands.yml +++ b/src/main/resources/configurations/commands.yml -@@ -11,6 +11,4 @@ +@@ -10,6 +10,4 @@ command-block-overrides: [] ignore-vanilla-permissions: false 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 6a7636e..410887f 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,25 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -989,7 +_,7 @@ +@@ -446,9 +_,7 @@ + + this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); + this.configuration.options().copyDefaults(true); +- YamlConfiguration configurationDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), StandardCharsets.UTF_8)); +- this.configuration.setDefaults(configurationDefaults); +- this.configuration.options().setHeader(configurationDefaults.options().getHeader()); ++ this.configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), StandardCharsets.UTF_8))); + ConfigurationSection legacyAlias = null; + if (!this.configuration.isString("aliases")) { + legacyAlias = this.configuration.getConfigurationSection("aliases"); +@@ -465,7 +_,6 @@ + if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null); + this.commandsConfiguration.setDefaults(commandsDefaults); + // Paper end - don't enforce icanhasbukkit default if alias block exists +- this.commandsConfiguration.options().setHeader(commandsDefaults.options().getHeader()); + this.saveCommandsConfig(); + + // Migrate aliases from old file and add previously implicit $1- to pass all arguments +@@ -970,7 +_,7 @@ @Override public List getWorlds() { diff --git a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch b/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch index 8a2d54d..e3d8893 100644 --- a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch +++ b/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftWorld.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -466,7 +_,6 @@ +@@ -467,7 +_,6 @@ } this.unloadChunkRequest(x, z); diff --git a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java.patch b/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java.patch deleted file mode 100644 index 9b7c787..0000000 --- a/divinemc-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1979,7 +_,7 @@ - BlockFormEvent event = (entity == null) ? new BlockFormEvent(blockState.getBlock(), blockState) : new EntityBlockFormEvent(entity.getBukkitEntity(), blockState.getBlock(), blockState); - world.getCraftServer().getPluginManager().callEvent(event); - -- if (!event.isCancelled()) { -+ if (!event.isCancelled() && (BlockFormEvent.getHandlerList().getRegisteredListeners().length != 0)) { // DivineMC - skip block update if no listeners - blockState.update(true); - } - diff --git a/divinemc-server/purpur-patches/features/0001-Optimize-default-values-for-configs.patch b/divinemc-server/purpur-patches/features/0001-Optimize-default-values-for-configs.patch index c5166b7..1519f60 100644 --- a/divinemc-server/purpur-patches/features/0001-Optimize-default-values-for-configs.patch +++ b/divinemc-server/purpur-patches/features/0001-Optimize-default-values-for-configs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize default values for configs diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 338154a8098b577acc54f5543f9c20ee91bbc40a..554ae05a1a7f7dbe91455cb14b1d9a02f3b7d288 100644 +index 282057126dff849027717ede935a60aab0d68de5..df77474e4b29069d14683a2d395f0d573199ab74 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -240,7 +240,7 @@ public class PurpurConfig { @@ -18,7 +18,7 @@ index 338154a8098b577acc54f5543f9c20ee91bbc40a..554ae05a1a7f7dbe91455cb14b1d9a02 useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive); } diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 1dd74216ec8bfaca080bd6ae67169815e9a9b855..26ea01d16cfda9ee06eee9fc40461393dad422e0 100644 +index e140497bf271746ef6cd327e9572754c209dcb06..cb851b70af58288535ec9be5006bf8d5ef4c4f93 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -3043,8 +3043,8 @@ public class PurpurWorldConfig { diff --git a/divinemc-server/purpur-patches/features/0004-Configurable-movement-speed-for-entities.patch b/divinemc-server/purpur-patches/features/0004-Configurable-movement-speed-for-entities.patch index c912b67..62917cb 100644 --- a/divinemc-server/purpur-patches/features/0004-Configurable-movement-speed-for-entities.patch +++ b/divinemc-server/purpur-patches/features/0004-Configurable-movement-speed-for-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable movement speed for entities diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 286844cfad8b993f1fbc26a13e1a67381b24ff49..9714deeebe6aa4d37b6fdd5f3a71e1127a61f9f3 100644 +index 1adc4b9426e89924566e132b10d8ab2f07573b6c..99d40020f811588da0dce5ddcc81882eefb2eaaa 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1593,6 +1593,7 @@ public class PurpurWorldConfig { @@ -73,14 +73,14 @@ index 286844cfad8b993f1fbc26a13e1a67381b24ff49..9714deeebe6aa4d37b6fdd5f3a71e112 public boolean zombifiedPiglinRidable = false; @@ -3461,6 +3469,7 @@ public class PurpurWorldConfig { - public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = true; + public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = false; public boolean zombifiedPiglinTakeDamageFromWater = false; public boolean zombifiedPiglinAlwaysDropExp = false; + public double zombifiedPiglinMovementSpeed = 0.23F; // DivineMC - Configurable movement speed for entities private void zombifiedPiglinSettings() { zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable); zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater); -@@ -3479,6 +3488,7 @@ public class PurpurWorldConfig { +@@ -3482,6 +3491,7 @@ public class PurpurWorldConfig { zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry); zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater); zombifiedPiglinAlwaysDropExp = getBoolean("mobs.zombified_piglin.always-drop-exp", zombifiedPiglinAlwaysDropExp); diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java index 2cbe505..c7bd453 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/DivineConfig.java @@ -1,6 +1,7 @@ package org.bxteam.divinemc; import com.google.common.base.Throwables; +import gg.pufferfish.pufferfish.simd.SIMDDetection; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/entity/pathfinding/NodeEvaluatorCache.java b/divinemc-server/src/main/java/org/bxteam/divinemc/entity/pathfinding/NodeEvaluatorCache.java index 5700f5c..cdd7344 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/entity/pathfinding/NodeEvaluatorCache.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/entity/pathfinding/NodeEvaluatorCache.java @@ -1,7 +1,7 @@ package org.bxteam.divinemc.entity.pathfinding; import net.minecraft.world.level.pathfinder.NodeEvaluator; -import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.NotNull; import java.util.Map; diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/region/IRegionFile.java b/divinemc-server/src/main/java/org/bxteam/divinemc/region/IRegionFile.java index 94ecd4e..cf4104a 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/region/IRegionFile.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/region/IRegionFile.java @@ -17,6 +17,7 @@ public interface IRegionFile extends AutoCloseable, ChunkSystemRegionFile { void clear(ChunkPos pos) throws IOException; + @Override void close() throws IOException; void setOversized(int x, int z, boolean b) throws IOException; @@ -31,6 +32,8 @@ public interface IRegionFile extends AutoCloseable, ChunkSystemRegionFile { boolean recalculateHeader() throws IOException; + int getRecalculateCount(); + DataOutputStream getChunkDataOutputStream(ChunkPos pos) throws IOException; DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException; diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/region/LinearRegionFile.java b/divinemc-server/src/main/java/org/bxteam/divinemc/region/LinearRegionFile.java index 706f80f..282cb4c 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/region/LinearRegionFile.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/region/LinearRegionFile.java @@ -592,6 +592,11 @@ public class LinearRegionFile implements IRegionFile { return false; } + @Override + public int getRecalculateCount() { + return 0; + } + @Override public void setOversized(int x, int z, boolean something) { // stub diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java b/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java index 3298792..f88d834 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java @@ -45,7 +45,7 @@ public final class GeneralUtils { for (StructureTemplate.JigsawBlockInfo structureBlockInfo : list) { int key = 0; if (structureBlockInfo.info().nbt() != null) { - key = getIntMicroOptimised(structureBlockInfo.info().nbt(), "selection_priority"); + key = structureBlockInfo.info().nbt().getIntOr("selection_priority", 0); } buckets.computeIfAbsent(key, k -> new ArrayList<>()).add(structureBlockInfo); @@ -73,12 +73,8 @@ public final class GeneralUtils { } } - public static int getIntMicroOptimised(@NotNull CompoundTag tag, String key) { - return tag.get(key) instanceof NumericTag numericTag ? numericTag.getAsInt() : 0; - } - public static @NotNull String getStringMicroOptimised(@NotNull CompoundTag tag, String key) { - return tag.get(key) instanceof StringTag stringTag ? stringTag.getAsString() : ""; + return tag.get(key) instanceof StringTag stringTag ? stringTag.value() : ""; } public static void copyAll(@NotNull List src, List dest) { diff --git a/gradle.properties b/gradle.properties index b530e9a..15f0d0d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ group = org.bxteam.divinemc -version=1.21.4-R0.1-SNAPSHOT +version=1.21.5-R0.1-SNAPSHOT -mcVersion=1.21.4 -purpurRef=51aafbc731b33dfebc4b6180970570cfbbd14d3c -experimental=false +mcVersion=1.21.5 +purpurRef=6cc78b6308cabed2ebea27087b821c2421f6e1ff +experimental=true org.gradle.configuration-cache=true org.gradle.caching = true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..9bbc975 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..37f853b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f3b75f3..faf9300 100755 --- a/gradlew +++ b/gradlew @@ -205,7 +205,7 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. diff --git a/divinemc-server/minecraft-patches/features/0013-Clump-experience-orbs.patch b/patches/unapplied/server/0013-Clump-experience-orbs.patch similarity index 98% rename from divinemc-server/minecraft-patches/features/0013-Clump-experience-orbs.patch rename to patches/unapplied/server/0013-Clump-experience-orbs.patch index 63ef6ba..260b449 100644 --- a/divinemc-server/minecraft-patches/features/0013-Clump-experience-orbs.patch +++ b/patches/unapplied/server/0013-Clump-experience-orbs.patch @@ -53,7 +53,7 @@ index a43e5190c0f9ae14ccecccd5b58dc0e17f18b0a1..06ffba13f211851e8f6d630a72b41474 private boolean canMerge(ExperienceOrb orb) { - return orb != this && canMerge(orb, this.getId(), this.value); -+ return org.bxteam.divinemc.DivineConfig.clumpOrbs ? orb.isAlive() && !this.is(orb) : orb != this && ExperienceOrb.canMerge(orb, this.getId(), this.value); // DivineMC - Clump experience orbs ++ return org.bxteam.divinemc.DivineConfig.clumpOrbs ? orb.isAlive() && !this.is(orb) : orb != this && canMerge(orb, this.getId(), this.value); // DivineMC - Clump experience orbs } private static boolean canMerge(ExperienceOrb orb, int amount, int other) { diff --git a/divinemc-server/minecraft-patches/features/0033-Regionized-Chunk-Ticking.patch b/patches/unapplied/server/0033-Regionized-Chunk-Ticking.patch similarity index 100% rename from divinemc-server/minecraft-patches/features/0033-Regionized-Chunk-Ticking.patch rename to patches/unapplied/server/0033-Regionized-Chunk-Ticking.patch