9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

Update 1.21.5 #24

This commit is contained in:
Artem Ostrasev
2025-04-27 02:13:46 +03:00
committed by GitHub
104 changed files with 2358 additions and 1796 deletions

View File

@@ -1,4 +1,4 @@
name: DivineMC CI
name: Build DivineMC 1.21.5
on:
push:

View File

@@ -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

View File

@@ -57,7 +57,7 @@ For anything else you can refer to our [contribution guide](https://bxteam.org/d
<dependency>
<groupId>org.bxteam.divinemc</groupId>
<artifactId>divinemc-api</artifactId>
<version>1.21.4-R0.1-SNAPSHOT</version>
<version>1.21.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
@@ -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).

View File

@@ -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 {

View File

@@ -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()),

View File

@@ -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 <T> extends ForwardingMap<T, Long> {
- private final Map<T, Long> 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<T, Long> 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<String, Object> 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<String, Object> 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 <E> Element Type
- * @return List
- */
- @NotNull
- public static <E> List toArrayMapper(@NotNull E[] collection, @NotNull Function<E, Object> mapper) {
- return toArrayMapper(Lists.newArrayList(collection), mapper);
- }
-
- @NotNull
- public static <E> List toArrayMapper(@NotNull Iterable<E> collection, @NotNull Function<E, Object> 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 <E> Element Type
- * @return Map
- */
- @NotNull
- public static <E> Map toObjectMapper(@NotNull E[] collection, @NotNull Function<E, JSONPair> mapper) {
- return toObjectMapper(Lists.newArrayList(collection), mapper);
- }
-
- @NotNull
- public static <E> Map toObjectMapper(@NotNull Iterable<E> collection, @NotNull Function<E, JSONPair> 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 <V> Value
- */
-@Deprecated(forRemoval = true)
-public class LoadingIntMap<V> extends Int2ObjectOpenHashMap<V> {
- private final Function<Integer, V> loader;
-
- public LoadingIntMap(@NotNull Function<Integer, V> loader) {
- super();
- this.loader = loader;
- }
-
- public LoadingIntMap(int expectedSize, @NotNull Function<Integer, V> loader) {
- super(expectedSize);
- this.loader = loader;
- }
-
- public LoadingIntMap(int expectedSize, float loadFactor, @NotNull Function<Integer, V> 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 <T> Type
- */
- public abstract static class Feeder <T> implements Function<T, T> {
- @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 <http://aikar.co>
- *
- * 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 <K> Key
- * @param <V> Value
- */
-@Deprecated(forRemoval = true)
-public class LoadingMap <K, V> extends AbstractMap<K, V> {
- private final Map<K, V> backingMap;
- private final java.util.function.Function<K, V> loader;
-
- /**
- * Initializes an auto loading map using specified loader and backing map
- * @param backingMap Map to wrap
- * @param loader Loader
- */
- public LoadingMap(@NotNull Map<K, V> backingMap, @NotNull java.util.function.Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> of(@NotNull Map<K, V> backingMap, @NotNull Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newAutoMap(@NotNull Map<K, V> backingMap, @Nullable final Class<? extends K> keyClass,
- @NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newAutoMap(@NotNull Map<K, V> backingMap,
- @NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newHashAutoMap(@Nullable final Class<? extends K> keyClass, @NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newHashAutoMap(@NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newHashAutoMap(@Nullable final Class<? extends K> keyClass, @NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map that auto instantiates on .get()
- */
- @NotNull
- public static <K, V> Map<K, V> newHashAutoMap(@NotNull final Class<? extends V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> newHashMap(@NotNull Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> newHashMap(@NotNull Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> newHashMap(@NotNull Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> newIdentityHashMap(@NotNull Function<K, V> 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> newIdentityHashMap(@NotNull Function<K, V> 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<? extends K, ? extends V> m) {backingMap.putAll(m);}
-
- @Override
- public void clear() {backingMap.clear();}
-
- @NotNull
- @Override
- public Set<K> keySet() {return backingMap.keySet();}
-
- @NotNull
- @Override
- public Collection<V> 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<Entry<K, V>> entrySet() {
- return backingMap.entrySet();
- }
-
- @NotNull
- public LoadingMap<K, V> clone() {
- return new LoadingMap<>(backingMap, loader);
- }
-
- private static class AutoInstantiatingLoader<K, V> implements Function<K, V> {
- final Constructor<? extends V> constructor;
- private final Class<? extends V> valueClass;
-
- AutoInstantiatingLoader(@Nullable Class<? extends K> keyClass, @NotNull Class<? extends V> 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 <T> Type
- */
- public abstract static class Feeder <T> implements Function<T, T> {
- @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 <http://aikar.co>
- *
- * 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 <K> Key Type of the Map
- * @param <V> Value Type of the Map
- */
-@Deprecated(forRemoval = true)
-public class MRUMapCache<K, V> extends AbstractMap<K, V> {
- final Map<K, V> backingMap;
- Object cacheKey;
- V cacheValue;
- public MRUMapCache(@NotNull final Map<K, V> 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<? extends K, ? extends V> m) {backingMap.putAll(m);}
-
- public void clear() {
- cacheKey = null;
- cacheValue = null;
- backingMap.clear();
- }
-
- @NotNull
- public Set<K> keySet() {return backingMap.keySet();}
-
- @NotNull
- public Collection<V> values() {return backingMap.values();}
-
- @NotNull
- public Set<Map.Entry<K, V>> entrySet() {return backingMap.entrySet();}
-
- /**
- * Wraps the specified map with a most recently used cache
- *
- * @param map Map to be wrapped
- * @param <K> Key Type of the Map
- * @param <V> Value Type of the Map
- * @return Map
- */
- @NotNull
- public static <K, V> Map<K, V> of(@NotNull Map<K, V> map) {
- return new MRUMapCache<K, V>(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

View File

@@ -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

View File

@@ -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) {

View File

@@ -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<Player> players);
// Paper end - broadcast hurt animation

View File

@@ -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()];

View File

@@ -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<JavaCompile> {
+ 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,

View File

@@ -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<TickTa
@@ -1180,6 +1180,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
@@ -61,10 +61,10 @@ index 614c7d9f673c926562acc8fa3b3788623900db41..33456c7c106abbddf743e1203a6e8122
minecraftServerGui.runFinalizers();
}
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 80ed0e4b8c867d031413b4140e52af1342fdcb54..6ebd1300c2561116b83cb2472ac7939ead36d576 100644
index 77db68349aa73d33b86a867099c9395c96d5a02d..8d1174f25e0e90d0533970f4ddd8448442024936 100644
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -283,7 +283,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
@@ -308,7 +308,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {

View File

@@ -5,38 +5,38 @@ Subject: [PATCH] Configuration
diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java
index 1d9bf122c4c32c486a33d846c95afcab12560fd7..61eeec6a0d789e5e44abdeb5826d7ee2307301ba 100644
index debea77d5777b90c6b17b225e27e6b3c72370175..1a8c125a58f7363dbff4f11f5e34537ca1fbd605 100644
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -218,6 +218,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -193,6 +193,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
org.purpurmc.purpur.PurpurConfig.registerCommands();
// Purpur end - Configurable void damage height and damage
// Purpur end - Purpur config files
+ // DivineMC start - Configuration
+ try {
+ org.bxteam.divinemc.DivineConfig.init((java.io.File) options.valueOf("divinemc-settings"));
+ } catch (Exception e) {
+ DedicatedServer.LOGGER.error("Unable to load server configuration", e);
+ DedicatedServer.LOGGER.error("Unable to load DivineMC configuration", e);
+ return false;
+ }
+ org.bxteam.divinemc.command.DivineCommands.registerCommands(this);
+ // DivineMC end - Configuration
// Paper start - initialize global and world-defaults configuration
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
// DivineMC start - Pufferfish SIMD
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 0fe8f4601eedfa68c38ebadc7847ba7a07ff6fb6..b4c2602ecf6b943ab022866231f74b850269af8f 100644
index bbadbdfd643e61a6a3e55df7dd7a646ea1a9744b..38ddadf551c039202c68c44d740f23a08b58d003 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@@ -161,6 +161,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, 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<ServerExplosion.CacheKey, Float> explosionDensityCache = new java.util.HashMap<>(); // Paper - Optimize explosions
@@ -885,6 +886,14 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, 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

View File

@@ -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<Structure> registry = level.registryAccess().lookupOrThrow(Registries.STRUCTURE);
Map<Integer, List<Structure>> map = registry.stream().collect(Collectors.groupingBy(structure1 -> structure1.step().ordinal()));
List<FeatureSorter.StepFeatureData> list = this.featuresPerStep.get();
@@ -145,7 +142,7 @@ index 6ed51cf42b5864194d671b5b56f5b9bdf0291dc0..7e0b602e9fd9e3b3f60014ab179b3a82
long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ());
Set<Holder<Biome>> 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<StructureSet.StructureSelectionEntry> 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<GeodeConfiguration> {
@@ -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 {

View File

@@ -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<Holder<FrogVariant>> {
@@ -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<Holder<FrogVariant>> {
@@ -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();

View File

@@ -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<ChunkHolderManager.TicketOperation<?, ?>> 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<AttributeInstance> 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<Entity> 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<Relative> 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<AttributeModifier.Operation, Map<ResourceLocation, AttributeModifier>> 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<Holder<Attribute>, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>();
- private final Set<AttributeInstance> attributesToSync = new ObjectOpenHashSet<>();
- private final Set<AttributeInstance> 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);

View File

@@ -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");

View File

@@ -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<T> implements WritableRegistry<T> {
@@ -33,10 +33,12 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
private final ResourceKey<? extends Registry<T>> key;
private final ObjectList<Holder.Reference<T>> byId = new ObjectArrayList<>(256);
private final Reference2IntMap<T> 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<TagKey<T>, HolderSet.Named<T>> frozenTags = new IdentityHashMap<>();
MappedRegistry.TagSet<T> 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<RemoteDebugSampleType, Map<ServerPlayer, DebugSampleSubscriptionTracker.SubscriptionStartedAt>> subscriptions;
private final Map<RemoteDebugSampleType, Map<ServerPlayer, DebugSampleSubscriptionTracker.SubscriptionStartedAt>> subscriptions;
- private final Queue<DebugSampleSubscriptionTracker.SubscriptionRequest> subscriptionRequestQueue = new LinkedList<>();
+ private final java.util.List<SubscriptionRequest> 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> 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.Key<?>, 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<String, Optional<SavedData>> cache = new HashMap<>();
+ public final Map<String, Optional<SavedData>> cache = new java.util.concurrent.ConcurrentHashMap<>(); // DivineMC - Concurrent HashMap
private final SavedData.Context context;
- public final Map<SavedDataType<?>, Optional<SavedData>> cache = new HashMap<>();
+ public final Map<SavedDataType<?>, Optional<SavedData>> 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) {

View File

@@ -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
}

View File

@@ -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<E extends LivingEntity> {
@@ -196,7 +196,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2
}
}
@@ -374,11 +444,13 @@ public class Brain<E extends LivingEntity> {
@@ -383,11 +453,13 @@ public class Brain<E extends LivingEntity> {
.computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet())
.add((BehaviorControl<? super E>)pair.getSecond());
}
@@ -210,7 +210,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2
}
public boolean isActive(Activity activity) {
@@ -395,6 +467,7 @@ public class Brain<E extends LivingEntity> {
@@ -404,6 +476,7 @@ public class Brain<E extends LivingEntity> {
}
}
@@ -218,7 +218,7 @@ index 8f7efe6b2c191f615dfc8394baec44dc0761ff51..406eb049cb22d0736d8b003a2f547cc2
return brain;
}
@@ -429,31 +502,38 @@ public class Brain<E extends LivingEntity> {
@@ -438,31 +511,38 @@ public class Brain<E extends LivingEntity> {
for (BehaviorControl<? super E> 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<E extends Mob> extends Behavior<E> {
@@ -119,6 +119,12 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
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<E extends Mob> extends Behavior<E> {
@@ -174,12 +180,25 @@ public class LongJumpToRandomPos<E extends Mob> extends Behavior<E> {
}
}
+ // DivineMC start - Optimize entity stupid brain
protected Optional<LongJumpToRandomPos.PossibleJump> getJumpCandidate(ServerLevel level) {
- Optional<LongJumpToRandomPos.PossibleJump> randomItem = WeightedRandom.getRandomItem(level.random, this.jumpCandidates);
- Optional<LongJumpToRandomPos.PossibleJump> randomItem = WeightedRandom.getRandomItem(
- level.random, this.jumpCandidates, LongJumpToRandomPos.PossibleJump::weight
- );
- randomItem.ifPresent(this.jumpCandidates::remove);
- return randomItem;
+ Optional<LongJumpToRandomPos.PossibleJump> 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);

View File

@@ -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<BlockPos> calculateExplodedPositions() {
@@ -20,7 +20,7 @@ index 6bddf42504039f2be5eb9a5a35a0835e0e3239fe..ea6da35e6c38a0b8b67d0b7a1426445e
// Paper start - collision optimisations
final ObjectArrayList<BlockPos> 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<Float> 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<BlockPos> blocks) {

View File

@@ -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()

View File

@@ -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<TickTa
@@ -287,6 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
public boolean lagging = false; // Purpur - Lagging threshold
protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public java.util.concurrent.Semaphore serverLevelTickingSemaphore = null; // DivineMC - Parallel world ticking
+ public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
@@ -1558,6 +1559,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
AtomicReference<S> atomicReference = new AtomicReference<>();
@@ -1533,6 +1534,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.server.spark.tickStart(); // Paper - spark
@@ -25,18 +25,18 @@ index 5a726da8535aa939f043829a3c60fdd9d4ed154a..0aebdd1cb0e1b63ff9a867bdcda7cbdc
this.tickCount++;
this.tickRateManager.tick();
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index a70007d324e2169d1b2a1a11046500196b8b5660..53b606c34f65b80a676ddd26d64028dbdebecb43 100644
index e351b75f03b7096dcd0378b49987d27c04474116..9c64da096bfd8325e0c8f692b8ae7f420096728a 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -218,6 +218,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -213,6 +213,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
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 LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -774,6 +775,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public @Nullable LevelChunk getChunkIfLoaded(int x, int z) {
@@ -762,6 +763,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
}
@@ -45,7 +45,7 @@ index a70007d324e2169d1b2a1a11046500196b8b5660..53b606c34f65b80a676ddd26d64028db
this.updateSkyBrightness();
if (runsNormally) {
this.tickTime();
@@ -853,11 +856,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -841,11 +844,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.setDayTime(this.preciseTime);
} else
// Purpur end - Configurable daylight cycle
@@ -66,18 +66,18 @@ index a70007d324e2169d1b2a1a11046500196b8b5660..53b606c34f65b80a676ddd26d64028db
this.serverLevelData.setDayTime(time);
// Purpur start - Configurable daylight cycle
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 04a1c17a34b495b71eb1b0ccd597cef83480464d..edb128a3f454e7b3009ca360509decd7a618de5d 100644
index 352421829e24284e4832a168c278233b780a58a2..7d089f51cd07b0ce26765535fcd0a7716bc1a2f4 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -555,6 +555,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -503,6 +503,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+ lagCompensation(); // DivineMC - Lag Compensation
this.tickEffects();
this.animStepO = this.animStep;
this.yHeadRotO = this.yHeadRot;
this.yBodyRotO = this.yBodyRot;
@@ -563,6 +564,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -510,6 +511,17 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.xRotO = this.getXRot();
}
@@ -96,10 +96,10 @@ index 04a1c17a34b495b71eb1b0ccd597cef83480464d..edb128a3f454e7b3009ca360509decd7
protected float getBlockSpeedFactor() {
return Mth.lerp((float)this.getAttributeValue(Attributes.MOVEMENT_EFFICIENCY), super.getBlockSpeedFactor(), 1.0F);
diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java
index be357d9e3c5327ceec12c31830551a564c8cea1b..f77da420bc88df6ec304086fc1eba0690fe278b1 100644
index 88b07fbb96b20124777889830afa480673629d43..d2661ea79536010414f77256332f214d19106dd9 100644
--- a/net/minecraft/world/entity/PortalProcessor.java
+++ b/net/minecraft/world/entity/PortalProcessor.java
@@ -26,10 +26,20 @@ public class PortalProcessor {
@@ -24,10 +24,20 @@ public class PortalProcessor {
return false;
} else {
this.insidePortalThisTick = false;
@@ -122,10 +122,10 @@ index be357d9e3c5327ceec12c31830551a564c8cea1b..f77da420bc88df6ec304086fc1eba069
public TeleportTransition getPortalDestination(ServerLevel level, Entity entity) {
return this.portal.getPortalDestination(level, entity, this.entryPosition);
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
index 771b169fa360411bb313ae04c7dd55836875c611..e64ed6a23efbe89b8d3dd1e5a2a69ba4b7743369 100644
index 4ddf1cdf7a47bf06f95c5bfce8f3c4d035e87cfc..60f5232b24ace1854a3cea7aa790385ae4e90ea9 100644
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -153,8 +153,25 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -160,8 +160,25 @@ public class ItemEntity extends Entity implements TraceableEntity {
}
// Paper end - EAR 2
@@ -152,11 +152,11 @@ index 771b169fa360411bb313ae04c7dd55836875c611..e64ed6a23efbe89b8d3dd1e5a2a69ba4
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else {
diff --git a/net/minecraft/world/item/Item.java b/net/minecraft/world/item/Item.java
index 6821d39a24ef610ea8b04f6dbeca2cdc0b8e7787..a4d76e4aafb98b1bbc0e5a80d65cf0f9a3a53fd5 100644
index c52fb17d1e496a91223b7387cacb128c1865caee..30ab94fa0a6710cc5a39bd1c74c99aac08037167 100644
--- a/net/minecraft/world/item/Item.java
+++ b/net/minecraft/world/item/Item.java
@@ -258,9 +258,21 @@ public class Item implements FeatureElement, ItemLike {
return consumable != null ? consumable.animation() : ItemUseAnimation.NONE;
@@ -286,10 +286,25 @@ public class Item implements FeatureElement, ItemLike {
}
}
+ // DivineMC start - Lag compensation
@@ -168,21 +168,25 @@ index 6821d39a24ef610ea8b04f6dbeca2cdc0b8e7787..a4d76e4aafb98b1bbc0e5a80d65cf0f9
+
public int getUseDuration(ItemStack stack, LivingEntity entity) {
Consumable consumable = stack.get(DataComponents.CONSUMABLE);
- return consumable != null ? consumable.consumeTicks() : 0;
+ int original = consumable != null ? consumable.consumeTicks() : 0;
+ if (entity.level() instanceof net.minecraft.server.level.ServerLevel serverLevel) {
+ return lagCompensation(original, serverLevel);
+ }
if (consumable != null) {
- return consumable.consumeTicks();
+ // DivineMC start - Lag compensation
+ int original = consumable.consumeTicks();
+
+ return original;
}
public boolean releaseUsing(ItemStack stack, Level level, LivingEntity entity, int timeLeft) {
+ if (entity.level() instanceof net.minecraft.server.level.ServerLevel serverLevel) {
+ return lagCompensation(original, serverLevel);
+ }
+
+ return original;
+ // DivineMC end - Lag compensation
} else {
BlocksAttacks blocksAttacks = stack.get(DataComponents.BLOCKS_ATTACKS);
return blocksAttacks != null ? 72000 : 0;
diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java
index 02d64a5ea756b2c91a71b7a0fc0f21219983616a..d515ba4e775e1199e1cbf4f79978d318eaa6b336 100644
index 86c1f5effde3173c8bc458af21b454c81738935e..2a21bb2826e4a174169089e7813796f8d35234d3 100644
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -320,8 +320,31 @@ public class GameRules {
@@ -348,8 +348,31 @@ public class GameRules {
}
public int getInt(GameRules.Key<GameRules.IntegerValue> key) {
@@ -216,10 +220,10 @@ index 02d64a5ea756b2c91a71b7a0fc0f21219983616a..d515ba4e775e1199e1cbf4f79978d318
public static class BooleanValue extends GameRules.Value<GameRules.BooleanValue> {
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;
}

View File

@@ -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()

View File

@@ -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<TickTa
@@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public boolean lagging = false; // Purpur - Lagging threshold
protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public java.util.concurrent.Semaphore serverLevelTickingSemaphore = null; // DivineMC - Parallel world ticking
public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation
+ public final Set<net.minecraft.world.entity.Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // DivineMC - Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
@@ -1706,17 +1707,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
AtomicReference<S> atomicReference = new AtomicReference<>();
@@ -1661,17 +1662,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) org.bukkit.Bukkit.getGlobalRegionScheduler()).tick();

View File

@@ -9,7 +9,7 @@ This is a fully vanilla optimization. Improves: [Blast]Furnace/Campfire/Smoker/S
This was mostly made for the auto crafting table, since the performance boost is much more visible while using that mod
diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java
index c7d91a38fc3b5cf2487e09719a1f9bc39ca5d20e..875e9711c9dacaf73636c7c7ce1cf740a23f006f 100644
index bf69cef9b8ade11a1c08199cdd6c723e5a78c078..ca6751ca70bdb3349c717a3923e9d1c1a19a012f 100644
--- a/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/net/minecraft/world/item/crafting/RecipeManager.java
@@ -166,7 +166,7 @@ public class RecipeManager extends SimplePreparableReloadListener<RecipeMap> imp

View File

@@ -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);

View File

@@ -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
}
}

View File

@@ -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<Entity>, 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<TickingBlockEntity> blockEntityTickers = Lists.newArrayList(); // Paper - public
- public final List<TickingBlockEntity> 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<TickingBlockEntity> 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<Entity>, AutoCl
boolean runsNormally = this.tickRateManager().runsNormally();
int tickedEntities = 0; // Paper - rewrite chunk system
- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // 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<Entity>, AutoCl
// Paper end - rewrite chunk system
}
}
- this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075

View File

@@ -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();

View File

@@ -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

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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<ServerStatus.Favicon> 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());
}

View File

@@ -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<TickTa
@@ -2641,8 +2641,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@@ -54,10 +54,10 @@ index 5a0c8791495aa522e511918ad0a24d9bbe6b5877..9d6fa3bced0ba5ab3443bdf4ce306598
public ChatDecorator getChatDecorator() {
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a3ec8c92dae7735bb0b1ececc9851c829c486a53..02b4275d170cc854a7482f0e963394aee21171dd 100644
index 17a81ea60488fee233a3284fc7c93ec896ed1497..18c96d6cfb6b3b208fd48aaabf8edba26d233aef 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -808,8 +808,11 @@ public class ServerGamePacketListenerImpl
@@ -801,8 +801,11 @@ public class ServerGamePacketListenerImpl
}
// Paper start - AsyncTabCompleteEvent
@@ -72,10 +72,10 @@ index a3ec8c92dae7735bb0b1ececc9851c829c486a53..02b4275d170cc854a7482f0e963394ae
@Override
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 45ea5fa0ef57724acce46008c53f7fa216cf78ee..f4a9d49247d2124b03273c38b14ddf9661184749 100644
index 637b2eb7104cb0bc7f314ad6eea11a432e899861..738c8749593cf3c30a1c321664abf12ba8dac635 100644
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -55,7 +55,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -54,7 +54,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
// CraftBukkit end
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
static final Logger LOGGER = LogUtils.getLogger();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Async Chunk Sending
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
index 76b8d42ae530b59cdaba0583365a557da6b90ede..235772cc9a7c878235b97c8d84cacda3016f91ca 100644
index 78f2d7c698a4f2c21a473627c3017a9751f80cf1..aabfaa370e4bcb8db61e831072b28684482ed938 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
@@ -55,6 +55,8 @@ public final class RegionizedPlayerChunkLoader {
@@ -53,6 +53,8 @@ public final class RegionizedPlayerChunkLoader {
public static final int LOADED_TICKET_LEVEL = ChunkTaskScheduler.getTicketLevel(ChunkStatus.EMPTY);
public static final int TICK_TICKET_LEVEL = ChunkHolderManager.ENTITY_TICKING_TICKET_LEVEL;
@@ -17,7 +17,7 @@ index 76b8d42ae530b59cdaba0583365a557da6b90ede..235772cc9a7c878235b97c8d84cacda3
public static final class ViewDistanceHolder {
private volatile ViewDistances viewDistances;
@@ -426,17 +428,61 @@ public final class RegionizedPlayerChunkLoader {
@@ -424,17 +426,61 @@ public final class RegionizedPlayerChunkLoader {
}
private void sendChunk(final int chunkX, final int chunkZ) {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Optimize Structure Generation
diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java
index 63143ceec98f7a84ec4064d05e8f88c11200172f..02f67af9c312f3d9213af1e410986165dcf618a4 100644
index e275dc8395e556e8a9412b121034e91553fbaea4..61386f6534faff3710c5ff309977aaf37b273145 100644
--- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java
+++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java
@@ -4,6 +4,8 @@ import com.google.common.collect.Lists;
@@ -195,7 +195,7 @@ index 63143ceec98f7a84ec4064d05e8f88c11200172f..02f67af9c312f3d9213af1e410986165
Shapes.joinUnoptimized(
mutableObject1.getValue(), Shapes.create(AABB.of(boundingBox3)), BooleanOp.ONLY_FIRST
diff --git a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java
index 4a6da3648c513a6cce16cf71246937d2d0ad014d..6af4c9026e814dee1ed4c7593ad00b5f8af9b979 100644
index 5c081a5b3d10f713e4e82fe1a43758f553fe50e0..b039e451a95ba67140524132285ccf4b3354ad00 100644
--- a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java
+++ b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java
@@ -119,8 +119,16 @@ public class SinglePoolElement extends StructurePoolElement {
@@ -217,9 +217,9 @@ index 4a6da3648c513a6cce16cf71246937d2d0ad014d..6af4c9026e814dee1ed4c7593ad00b5f
return jigsaws;
}
@@ -191,4 +199,12 @@ public class SinglePoolElement extends StructurePoolElement {
public String toString() {
return "Single[" + this.template + "]";
@@ -196,4 +204,12 @@ public class SinglePoolElement extends StructurePoolElement {
public ResourceLocation getTemplateLocation() {
return this.template.orThrow();
}
+
+ // DivineMC start - Optimize Structure Generation
@@ -228,13 +228,13 @@ index 4a6da3648c513a6cce16cf71246937d2d0ad014d..6af4c9026e814dee1ed4c7593ad00b5f
+ }
+
+ private void structureLayoutOptimizer$fasterJigsawListShuffling2(List<StructureTemplate.JigsawBlockInfo> 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<StructureTemplate.JigsawBlockInfo> cachedJigsaws;
Palette(List<StructureTemplate.StructureBlockInfo> blocks) {

View File

@@ -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<CommandSourceStack> 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()) {

View File

@@ -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) {

View File

@@ -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

View File

@@ -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<T> implements PaletteResize<T>, 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) {

View File

@@ -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 {
}
}

View File

@@ -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() {

View File

@@ -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)) {

View File

@@ -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<TickTa
@@ -926,10 +926,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end
if (flush) {
for (ServerLevel serverLevel2 : this.getAllLevels()) {
@@ -71,10 +71,10 @@ index 26a4a279122bb03a83dd4a34e780d6a4567ba3a8..51b79f614417f231951e9ba05b29ff00
return flag;
diff --git a/net/minecraft/util/worldupdate/WorldUpgrader.java b/net/minecraft/util/worldupdate/WorldUpgrader.java
index e0bcda2ddea0d6633445a7440fbf0d18e50a7653..e99f3c3567f9e6fb5a328bf9b59d40c72522f922 100644
index 559bd4eef7174b04f5aa71b982ba34cbace8da8a..6f4a2eae572d0268600d815aa0fe13577c1e14b6 100644
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -72,7 +72,7 @@ public class WorldUpgrader implements AutoCloseable {
@@ -75,7 +75,7 @@ public class WorldUpgrader implements AutoCloseable {
volatile int skipped;
final Reference2FloatMap<ResourceKey<Level>> 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<WorldUpgrader.FileToUpgrade> 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<ChunkPos> 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<Level> 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<IOException> 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<IOException> exceptionCollector = new ExceptionCollector<>();

View File

@@ -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 {

View File

@@ -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)) {

View File

@@ -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<Entity> 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<Entity> 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<PalettedContainer<BlockState>> 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<CompoundTag> list5 = Lists.transform(tag.getList("entities", 10), tag1 -> (CompoundTag)tag1);
List<CompoundTag> 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<CompoundTag> list3 = tag.getList("entities").stream().flatMap(ListTag::compoundStream).toList();
List<CompoundTag> 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
}

View File

@@ -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<TickTa
public java.util.concurrent.Semaphore serverLevelTickingSemaphore = null; // DivineMC - Parallel world ticking
@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected boolean upnp = false; // Purpur - UPnP Port Forwarding
public final org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag compensation
public final Set<net.minecraft.world.entity.Entity> 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 extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
AtomicReference<S> 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<MobCategory> 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<LevelChunk> 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<net.minecraft.world.entity.Entity> entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system
+ public final java.util.concurrent.ConcurrentLinkedQueue<Entity> 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)

View File

@@ -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<BlockPos> 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(

View File

@@ -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<T extends Entity> implements FeatureElement, EntityTypeT
@@ -1075,6 +1075,7 @@ public class EntityType<T extends Entity> 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<? extends Allay> 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<Axolotl.Variant>, 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<? extends Axolotl> entityType, Level level) {
super(entityType, level);
@@ -347,12 +348,16 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, 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<Holder<FrogVariant>> {
@@ -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<? extends Animal> entityType, Level level) {
super(entityType, level);
@@ -242,9 +243,13 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
@@ -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<? extends AbstractFish> 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<Boolean> 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<? extends Goat> 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<? extends Hoglin> 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<Item> allowedBarterItems = new HashSet<>();
public Set<Item> interestItems = new HashSet<>();
@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
private static final com.mojang.serialization.Codec<java.util.Set<net.minecraft.world.item.Item>> 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<? extends AbstractPiglin> 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<? extends Monster> 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<? extends Villager> 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

View File

@@ -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<TickTa
@@ -1674,7 +1674,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// DivineMC start - Parallel world ticking
private void tickLevel(ServerLevel serverLevel, BooleanSupplier hasTimeLeft) {
try {
@@ -25,10 +25,10 @@ index 11b89a625b942f5f2f882c54dbfc08c16e983425..fc9de137ed1681afd1ef51391cf8f30f
CrashReport crashReport = CrashReport.forThrowable(levelTickingException, "Exception ticking world");
serverLevel.fillReportDetails(crashReport);
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index e034d9f903728cdf7356629694c9f528ba5ebae3..561066a2cf769e13ef3cea0881f7a2010ecbf2ec 100644
index 857439f7b59549cff75e318fdf9c1effe83c7e17..d93014a396c13fed0e86dfadcb5436773efaa2a0 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -575,6 +575,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -568,6 +568,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
// Paper end - chunk tick iteration

View File

@@ -20,10 +20,10 @@ index 4535858701b2bb232b9d2feb2af6551526232ddc..aa4dd7517e8be167aef1eaf7aa907e3c
if (var4 instanceof ReportedException reportedException && reportedException.getCause() instanceof OutOfMemoryError) {
throw makeReportedException(var4, packet, processor);
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 804de864da13ae0be6a1caee88e95a19e35d08c0..5a0c8791495aa522e511918ad0a24d9bbe6b5877 100644
index c4ae883af4337e04d0944c603f298ee1576cb3d2..3a82ce898c38c5d3d971178e2614aed638e03132 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1694,6 +1694,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1683,6 +1683,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.tickTimes10s.add(this.tickCount, j);
serverLevel.tickTimes60s.add(this.tickCount, j);
// DivineMC end - MSPT Tracking for each world
@@ -35,10 +35,10 @@ index 804de864da13ae0be6a1caee88e95a19e35d08c0..5a0c8791495aa522e511918ad0a24d9b
CrashReport crashReport = CrashReport.forThrowable(levelTickingException, "Exception ticking world");
serverLevel.fillReportDetails(crashReport);
diff --git a/net/minecraft/world/level/block/ShulkerBoxBlock.java b/net/minecraft/world/level/block/ShulkerBoxBlock.java
index cdf835ff107bc1eadde706d69384e687626fce70..c04c66668395fa9167e027131daf75c0e9ee6eff 100644
index 49bac7af90b0a7c490141be6357563447783c6ca..941e2f04a7fd5472ad38ede08d81657604d9f2b3 100644
--- a/net/minecraft/world/level/block/ShulkerBoxBlock.java
+++ b/net/minecraft/world/level/block/ShulkerBoxBlock.java
@@ -234,7 +234,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@@ -183,7 +183,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
@Override
protected int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos pos) {
@@ -58,10 +58,10 @@ index cdf835ff107bc1eadde706d69384e687626fce70..c04c66668395fa9167e027131daf75c0
public static Block getBlockByColor(@Nullable DyeColor color) {
diff --git a/net/minecraft/world/level/redstone/NeighborUpdater.java b/net/minecraft/world/level/redstone/NeighborUpdater.java
index 26c15c60d358273a3b369c286771c81d6f0979dd..94fde31891e9f549ca356955913385cbaad02dca 100644
index 332b33a004ab11150cca0cc2cefc26d0286648f5..e6dce5f8bc87a2d0c7985959e3c0408f77b36f5b 100644
--- a/net/minecraft/world/level/redstone/NeighborUpdater.java
+++ b/net/minecraft/world/level/redstone/NeighborUpdater.java
@@ -63,9 +63,19 @@ public interface NeighborUpdater {
@@ -60,9 +60,19 @@ public interface NeighborUpdater {
state.handleNeighborChanged(level, pos, neighborBlock, orientation, movedByPiston);
// Spigot start
} catch (StackOverflowError ex) {
@@ -70,7 +70,7 @@ index 26c15c60d358273a3b369c286771c81d6f0979dd..94fde31891e9f549ca356955913385cb
+ throw new org.bxteam.divinemc.util.exception.UpdateSuppressorException(pos, neighborBlock);
+ }
+ // DivineMC end - Catch update suppressors
level.lastPhysicsProblem = new BlockPos(pos);
level.lastPhysicsProblem = pos.immutable();
// Spigot end
} catch (Throwable var9) {
+ // DivineMC start - Catch update suppressors

View File

@@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
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<String, ProfileResult> 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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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

View File

@@ -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<Stat<?>> map = new Object2IntOpenHashMap<>();

View File

@@ -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) {

View File

@@ -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
}
}

View File

@@ -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)) {

View File

@@ -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

View File

@@ -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) {

View File

@@ -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<SimpleDateFormat> 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

View File

@@ -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()

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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<String, Map<String, Integer>> 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 {

View File

@@ -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)

View File

@@ -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);

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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());

View File

@@ -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<String> channels = new HashSet<String>();
@@ -17,7 +17,7 @@ index d2010fc46215c37c3ef1d8a75cc39bce655d2c3f..3cb2cd294874ece5fbefd0618b4db277
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
private static final WeakHashMap<Plugin, WeakReference<Plugin>> 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) {

View File

@@ -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 {

View File

@@ -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<Boolean> 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);

View File

@@ -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) {

View File

@@ -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

View File

@@ -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<MobCategory> ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));

View File

@@ -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<net.minecraft.world.level.ServerExplosion> 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<net.minecraft.world.level.biome.Biome> 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<BlockState> blocks = new ArrayList<>(world.capturedBlockStates.values());
List<BlockState> 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<T extends BlockEntity> 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<T extends BlockEntity> 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<org.bukkit.inventory.ItemStack> 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<BlockPos> 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

View File

@@ -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<EntityType<?>, 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

View File

@@ -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<World> getWorlds() {

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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 <T> void copyAll(@NotNull List<T> src, List<T> dest) {

View File

@@ -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

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More