Compare commits
16 Commits
build/ver/
...
old/1.21.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a313424212 | ||
|
|
fa3c15b4f3 | ||
|
|
393e079743 | ||
|
|
90d412bbf3 | ||
|
|
98cf5b2d13 | ||
|
|
32243963f5 | ||
|
|
72183c64b9 | ||
|
|
f7998d1955 | ||
|
|
58ddbf4dd6 | ||
|
|
3484117415 | ||
|
|
bff96101bb | ||
|
|
6b54d11f9c | ||
|
|
08a067e974 | ||
|
|
46433f7303 | ||
|
|
72415ee5f2 | ||
|
|
6d7683503c |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Release Plazma (1.20.6)
|
||||
name: Release Plazma (1.21.3)
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
@@ -20,5 +20,5 @@
|
||||
[main]: https://github.com/PlazmaMC/Plazma
|
||||
|
||||
> [!IMPORTANT]
|
||||
This is the branch for Plazma 1.20.6. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
|
||||
이곳은 플라즈마의 1.20.6용 분기입니다. 플라즈마에 대해 자세히 알고 싶다면 **[main 분기][main]** 를 확인해주세요.
|
||||
This is the branch for Plazma 1.21.2/3. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
|
||||
이곳은 플라즈마의 1.21.2/3용 분기입니다. 플라즈마에 대해 자세히 알고 싶다면 **[main 분기][main]** 를 확인해주세요.
|
||||
|
||||
@@ -105,19 +105,27 @@ paperweight {
|
||||
}
|
||||
}
|
||||
|
||||
val paperRepoVal = property("paperRepo").toString()
|
||||
val paperBranch = property("paperBranch").toString()
|
||||
val purpurRepoVal = property("purpurRepo").toString()
|
||||
val purpurBranch = property("purpurBranch").toString()
|
||||
val pufferfishRepoVal = property("pufferfishRepo").toString()
|
||||
val pufferfishBranch = property("pufferfishBranch").toString()
|
||||
val isUsePufferfish = property("usePufferfish").toString().toBoolean()
|
||||
|
||||
alwaysUpToDate {
|
||||
|
||||
paperRepo.set("https://github.com/PaperMC/Paper")
|
||||
paperRef.set("master")
|
||||
paperRepo.set(paperRepoVal)
|
||||
paperRef.set(paperBranch)
|
||||
paperCommitName.set("paperCommit")
|
||||
|
||||
purpurRepo.set("https://github.com/PlazmaMC/Purpur")
|
||||
purpurRef.set("ver/1.20.6")
|
||||
purpurRepo.set(purpurRepoVal)
|
||||
purpurRef.set(purpurBranch)
|
||||
purpurCommitName.set("purpurCommit")
|
||||
|
||||
pufferfishRepo.set("https://github.com/PlazmaMC/Pufferfish")
|
||||
pufferfishRef.set("ver/1.20")
|
||||
usePufferfish.set(true)
|
||||
pufferfishRepo.set(pufferfishRepoVal)
|
||||
pufferfishRef.set(pufferfishBranch)
|
||||
usePufferfish.set(isUsePufferfish)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,17 @@ brandName = Plazma
|
||||
providerName = PlazmaMC
|
||||
providerRepo = PlazmaMC/PlazmaBukkit
|
||||
|
||||
version = 1.20.6-R0.1-SNAPSHOT
|
||||
mcVersion = 1.20.6
|
||||
version = 1.21.1-R0.1-SNAPSHOT
|
||||
mcVersion = 1.21.1
|
||||
jdkVersion = 21
|
||||
|
||||
paperRepo = https://github.com/PaperMC/Paper
|
||||
paperBranch = master
|
||||
purpurRepo = https://github.com/PlazmaMC/Purpur
|
||||
purpurBranch = ver/1.20.6
|
||||
pufferfishRepo = https://github.com/PlazmaMC/Pufferfish
|
||||
pufferfishBranch = ver/1.20
|
||||
purpurRepo = https://github.com/PurpurMC/Purpur
|
||||
purpurBranch = ver/1.21.1
|
||||
pufferfishRepo = https://github.com/pufferfish-gg/Pufferfish
|
||||
pufferfishBranch = ver/1.21
|
||||
usePufferfish = true
|
||||
|
||||
paperCommit = bd5867a96f792f0eb32c1d249bb4bbc1d8338d14
|
||||
purpurCommit = 0cbff64ea99f0878244431477d21d9faa14b768f
|
||||
paperCommit = d348cb88a9fe8d19e46102c8b9febe18f746d46b
|
||||
purpurCommit = 4b57bed513aaadb0a1ecebae3796a5e93b7561ea
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[versions]
|
||||
shadow = "8.1.1"
|
||||
paperweight = "1.7.1"
|
||||
paperweight = "1.7.4"
|
||||
paperclip = "3.0.3"
|
||||
decompiler = "1.10.1"
|
||||
remapper = "0.10.1"
|
||||
remapper = "0.10.3"
|
||||
|
||||
[libraries]
|
||||
remapper = { group = "net.fabricmc", name = "tiny-remapper", version.ref="remapper" }
|
||||
|
||||
10
initDev
Normal file → Executable file
10
initDev
Normal file → Executable file
@@ -8,6 +8,7 @@ export PROJECT_DIR=$(pwd)
|
||||
alias api="cd $PROJECT_DIR/*-API"
|
||||
alias srv="cd $PROJECT_DIR/*-Server"
|
||||
|
||||
alias c="clear;"
|
||||
alias ap="./gradlew --no-rebuild applyPatches"
|
||||
alias aap="./gradlew --no-rebuild applyAPIPatches"
|
||||
alias agp="./gradlew --no-rebuild applyGeneratedAPIPatches"
|
||||
@@ -25,9 +26,11 @@ alias rcc="git rebase --continue"
|
||||
# generate Fixup patches for Server
|
||||
function fs() {
|
||||
cd ./*-Server || exit 1
|
||||
garg="."
|
||||
[[ "$1" == "-x" ]] && garg="--amend"
|
||||
|
||||
git add .
|
||||
git commit -m "fixup"
|
||||
git commit "$garg" -m "fixup"
|
||||
git format-patch -1
|
||||
mv 0001-fixup.patch ../
|
||||
|
||||
@@ -37,9 +40,11 @@ function fs() {
|
||||
# generate Fixup patches for API
|
||||
function fa() {
|
||||
cd ./*-API || exit 1
|
||||
garg="."
|
||||
[[ "$1" == "-x" ]] && garg="--amend"
|
||||
|
||||
git add .
|
||||
git commit -m "fixup"
|
||||
git commit "$garg" -m "fixup"
|
||||
git format-patch -1
|
||||
mv 0001-fixup.patch ../
|
||||
|
||||
@@ -57,3 +62,4 @@ function cuu() {
|
||||
# shellcheck disable=SC2059
|
||||
printf "Updated Upstream ($1)$(/bin/cat compare.txt)" | git commit -F -
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ gson = "2.10.1"
|
||||
joml = "1.10.5"
|
||||
guava = "32.1.2-jre"
|
||||
sentry = "5.4.0"
|
||||
jspecify = "1.0.0"
|
||||
fastutil = "8.5.6"
|
||||
findbugs = "1.3.9"
|
||||
slf4j-api = "2.0.9"
|
||||
@@ -17,6 +18,7 @@ joml = { group = "org.joml", name = "joml", version.ref = "joml" }
|
||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
|
||||
jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" }
|
||||
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
|
||||
findbugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "findbugs" }
|
||||
brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" }
|
||||
@@ -27,5 +29,5 @@ annotations = { group = "org.jetbrains", name = "annotations", version.ref = "an
|
||||
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" }
|
||||
|
||||
[bundles]
|
||||
api = [ "guava", "gson", "joml", "fastutil", "slf4j-api", "sentry", "brigadier" ]
|
||||
api = [ "jspecify", "guava", "gson", "joml", "fastutil", "slf4j-api", "sentry", "brigadier" ]
|
||||
annotations = [ "annotations", "checkerqual" ]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
[versions]
|
||||
asm = "9.6"
|
||||
asm = "9.7.1"
|
||||
log4j = "2.19.0"
|
||||
mockito = "5.5.0"
|
||||
junit = "1.10.0"
|
||||
mockito = "5.14.1"
|
||||
jupiter = "5.10.0"
|
||||
hamcrest = "2.2"
|
||||
snakeyaml = "2.2"
|
||||
@@ -12,6 +13,7 @@ maven-provider = "3.9.6"
|
||||
maven-resolver = "1.9.18"
|
||||
|
||||
[libraries]
|
||||
junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" }
|
||||
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "jupiter" }
|
||||
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
|
||||
@@ -40,6 +42,6 @@ adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-seri
|
||||
|
||||
[bundles]
|
||||
asm = [ "asm-head", "asm-commons" ]
|
||||
test = [ "jupiter", "hamcrest", "mockito", "asm-tree" ]
|
||||
test = [ "jupiter", "hamcrest", "mockito", "asm-tree", "junit" ]
|
||||
maven = [ "maven-connector", "maven-transport" ]
|
||||
adventure = [ "adventure-api", "adventure-slf4j", "adventure-minimessage", "adventure-serializer-gson", "adventure-serializer-plain", "adventure-serializer-legacy" ]
|
||||
|
||||
@@ -5,14 +5,16 @@ upnp = "1.0"
|
||||
ansi = "1.0.3"
|
||||
jansi = "3.21.0"
|
||||
rhino = "1.7.14"
|
||||
mysql = "8.2.0"
|
||||
mysql = "8.4.0"
|
||||
flare = "34637f3f87"
|
||||
sqlite = "3.42.0.1"
|
||||
sqlite = "3.46.0.0"
|
||||
pioneer = "2.2.0"
|
||||
haproxy = "4.1.97.Final"
|
||||
rewriter = "0.0.1"
|
||||
rewriter = "0.0.3"
|
||||
srgutils = "1.0.9"
|
||||
velocity = "3.1.2-SNAPSHOT"
|
||||
sparkapi = "0.1-20240720.200737-2"
|
||||
sparknt = "1.10.105-SNAPSHOT"
|
||||
velocity = "3.3.0-SNAPSHOT"
|
||||
disruptor = "3.4.4"
|
||||
simpleyaml = "1.8.4"
|
||||
classgraph = "4.8.47"
|
||||
@@ -38,6 +40,9 @@ classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref
|
||||
simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" }
|
||||
configurate = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
|
||||
|
||||
spark-api = { group = "me.lucko", name = "spark-api", version.ref = "sparkapi" }
|
||||
spark-paper = { group = "me.lucko", name = "spark-paper", version.ref = "sparknt" }
|
||||
|
||||
rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" }
|
||||
rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" }
|
||||
|
||||
@@ -47,5 +52,5 @@ rewriter-generator = { group = "io.papermc", name = "reflection-rewriter-proxy-g
|
||||
|
||||
[bundles]
|
||||
runtime = [ "sqlite", "mysql", "disruptor" ]
|
||||
implementation = [ "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator", "flare" ]
|
||||
implementation = [ "spark-api", "spark-paper", "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator", "flare" ]
|
||||
test = [ "classgraph", "pioneer" ]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Raneri <kevin.raneri@gmail.com>
|
||||
Date: Sun, 2 Jun 2024 23:04:51 +0000
|
||||
Date: Tue, 22 Oct 2024 07:31:43 +0900
|
||||
Subject: [PATCH] Pufferfish API Changes
|
||||
|
||||
Pufferfish
|
||||
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index fd39ed209b20c927054b8482c400beeeeab460a3..1336685fde70c4a88a1fb591cdfcd781a8f06d0b 100644
|
||||
index e7c96be769fde8375b9a1b128cc7ce474144d16d..f9b44a03fe8d9a2fea2d968f4e944a6663c6f9c9 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -52,6 +52,7 @@ dependencies {
|
||||
@@ -29,9 +29,9 @@ index fd39ed209b20c927054b8482c400beeeeab460a3..1336685fde70c4a88a1fb591cdfcd781
|
||||
api("org.slf4j:slf4j-api:$slf4jVersion")
|
||||
+ api("io.sentry:sentry:5.4.0") // Pufferfish
|
||||
|
||||
implementation("org.ow2.asm:asm:9.7")
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
@@ -130,6 +131,13 @@ val generateApiVersioningFile by tasks.registering {
|
||||
implementation("org.ow2.asm:asm:9.7.1")
|
||||
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||
@@ -131,6 +132,13 @@ val generateApiVersioningFile by tasks.registering {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8e
|
||||
+}
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704ff713345
|
||||
index 0000000000000000000000000000000000000000..3441cdad70da1bd523c5933b1a914688718c2657
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704
|
||||
+ @Deprecated
|
||||
+ public static boolean canEnable(Logger logger) {
|
||||
+ try {
|
||||
+ if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) {
|
||||
+ if (SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21) {
|
||||
+ return false;
|
||||
+ } else {
|
||||
+ SIMDDetection.testRun = true;
|
||||
@@ -388,24 +388,6 @@ index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
index 9df9d09aa477d4cd3c496ba0933c816df1ef0964..ad81341bdd1eb73554cd24f27ac5d655d89db791 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -17,6 +17,13 @@ public interface ServerBuildInfo {
|
||||
* The brand id for Paper.
|
||||
*/
|
||||
Key BRAND_PAPER_ID = Key.key("papermc", "paper");
|
||||
+
|
||||
+ // Pufferfish start
|
||||
+ /**
|
||||
+ * The brand id for Paper.
|
||||
+ */
|
||||
+ Key BRAND_PUFFERFISH_ID = Key.key("pufferfishgg", "pufferfish");
|
||||
+ // Pufferfish end
|
||||
|
||||
/**
|
||||
* Gets the {@code ServerBuildInfo}.
|
||||
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
|
||||
index c80faa079eca1564847070f0338fc98024639829..e632d51d3487eb4807243b6705999ad124466bf5 100644
|
||||
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
||||
@@ -444,10 +426,10 @@ index c80faa079eca1564847070f0338fc98024639829..e632d51d3487eb4807243b6705999ad1
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 07a9c9e254188c251165ca84c8e961fccda01175..5dc64d8c9aeae612fd31af0673f3530a9e777dfc 100644
|
||||
index 003bece642b682985625db93cad93026352bfc66..e8ba4f1108f2548a487877027e37d81fc150e042 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -596,7 +596,9 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -597,7 +597,9 @@ public final class SimplePluginManager implements PluginManager {
|
||||
|
||||
// Paper start
|
||||
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||
@@ -457,7 +439,7 @@ index 07a9c9e254188c251165ca84c8e961fccda01175..5dc64d8c9aeae612fd31af0673f3530a
|
||||
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
}
|
||||
// Paper end
|
||||
@@ -666,9 +668,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -667,9 +669,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,24 +5,24 @@ Subject: [PATCH] Use Gradle Version Catalogs
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b50073488c235c51 100644
|
||||
index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bcbd4ad049 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -9,11 +9,13 @@ java {
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
+/* // Plazma - Use Gradle Version Catalogs
|
||||
+/* // Plazma - Use Gradle Versuib Catalogs
|
||||
val annotationsVersion = "24.1.0"
|
||||
val bungeeCordChatVersion = "1.20-R0.2"
|
||||
val adventureVersion = "4.17.0"
|
||||
val slf4jVersion = "2.0.9"
|
||||
val log4jVersion = "2.17.1"
|
||||
+ */ // Plazma - Use Gradle Version Catalogs
|
||||
+ */
|
||||
val apiAndDocs: Configuration by configurations.creating {
|
||||
attributes {
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||
@@ -27,56 +29,31 @@ configurations.api {
|
||||
@@ -27,57 +29,29 @@ configurations.api {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -53,8 +53,8 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
|
||||
- api("org.slf4j:slf4j-api:$slf4jVersion")
|
||||
- api("io.sentry:sentry:5.4.0") // Pufferfish
|
||||
-
|
||||
- implementation("org.ow2.asm:asm:9.7")
|
||||
- implementation("org.ow2.asm:asm-commons:9.7")
|
||||
- implementation("org.ow2.asm:asm:9.7.1")
|
||||
- implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||
- // Paper end
|
||||
-
|
||||
- api("org.apache.maven:maven-resolver-provider:3.9.6") // Paper - make API dependency for Paper Plugins
|
||||
@@ -70,13 +70,13 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
|
||||
- compileOnlyApi(checkerQual)
|
||||
- testCompileOnly(checkerQual)
|
||||
- // Paper end
|
||||
- api("org.jspecify:jspecify:1.0.0") // Paper - add jspecify
|
||||
-
|
||||
- testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
- testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
- testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
- testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
+
|
||||
- testImplementation("org.mockito:mockito-core:5.14.1")
|
||||
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||
+ // Plazma start - Use Gradle Version Catalogs
|
||||
+ implementation(common.bundles.asm)
|
||||
+
|
||||
@@ -100,11 +100,10 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
|
||||
+ testCompileOnly(api.annotations)
|
||||
+ testCompileOnly(api.checkerqual)
|
||||
+ // Plazma end
|
||||
+
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -157,25 +134,16 @@ tasks.withType<Javadoc> {
|
||||
@@ -158,27 +132,24 @@ tasks.withType<Javadoc> {
|
||||
options.use()
|
||||
options.isDocFilesSubDirs = true
|
||||
options.links(
|
||||
@@ -115,9 +114,11 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
|
||||
- // Paper start - add missing javadoc links
|
||||
- "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
||||
- "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
||||
"https://jspecify.dev/docs/api/",
|
||||
- // Paper end
|
||||
- // Paper start
|
||||
- "https://jd.advntr.dev/api/$adventureVersion/",
|
||||
- "https://jd.advntr.dev/key/$adventureVersion/",
|
||||
- "https://jd.advntr.dev/text-minimessage/$adventureVersion/",
|
||||
- "https://jd.advntr.dev/text-serializer-gson/$adventureVersion/",
|
||||
- "https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
|
||||
@@ -128,6 +129,13 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
|
||||
- // Paper end
|
||||
- "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper
|
||||
+ // Plazma start - Use Gradle Version Catalogs
|
||||
+ "https://jd.advntr.dev/api/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/key/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/text-minimessage/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/text-serializer-gson/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/text-serializer-legacy/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/text-serializer-plain/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://jd.advntr.dev/text-logger-slf4j/${common.adventure.api.orNull?.version}/",
|
||||
+ "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/",
|
||||
+ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/",
|
||||
+ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/",
|
||||
|
||||
@@ -1,38 +1,11 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Tue, 14 May 2024 18:36:30 +0900
|
||||
Subject: [PATCH] Rebrand
|
||||
Subject: [PATCH] Fork-friendly Rebranding
|
||||
|
||||
|
||||
diff --git a/MIT.txt b/MIT.txt
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..67d405764ed68083d0164b1af0eabc0af7f6efea
|
||||
--- /dev/null
|
||||
+++ b/MIT.txt
|
||||
@@ -0,0 +1,21 @@
|
||||
+The MIT License (MIT)
|
||||
+
|
||||
+Copyright (c) 2024 Paper Contributors
|
||||
+
|
||||
+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.
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..3b3bcfa6fa2dbcc7fef899cc7570da097437ab3a 100644
|
||||
index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..41d10421e1e79711e2e90ff2dc225bfd9cac9284 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
|
||||
@@ -127,7 +127,7 @@ class TimingHandler implements Timing {
|
||||
@@ -40,19 +13,19 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..3b3bcfa6fa2dbcc7fef899cc7570da09
|
||||
last.timingDepth = 0;
|
||||
if ("Minecraft".equalsIgnoreCase(last.identifier.group)) {
|
||||
- Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to Paper unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)");
|
||||
+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)");
|
||||
+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)"); // Plazma - Fork-friendly Rebranding
|
||||
} else {
|
||||
Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to the plugin " + last.identifier.group + " (Look for errors above this in the logs) (" + last.identifier + " did not stopTiming)", new Throwable());
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
index fe23268c418cccbd45caf2870f7931cfed978d28..bcf09f735e98f8bbce7c7dfab802ad20e2f17548 100644
|
||||
index 7196594e07af19a14c320d77df893978525fe386..6ac3376f12df2ee3e0519ab8b5a0c8211350e550 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -32,6 +32,29 @@ public interface ServerBuildInfo {
|
||||
@@ -33,6 +33,29 @@ public interface ServerBuildInfo {
|
||||
Key BRAND_PURPUR_ID = Key.key("purpurmc", "purpur");
|
||||
// Purpur end
|
||||
|
||||
+ // Plazma start - Rebranding
|
||||
+ // Plazma start - Fork-friendly Rebranding
|
||||
+ /**
|
||||
+ * The brand id for Plazma.
|
||||
+ */
|
||||
@@ -73,25 +46,25 @@ index fe23268c418cccbd45caf2870f7931cfed978d28..bcf09f735e98f8bbce7c7dfab802ad20
|
||||
+ BRAND_PURPUR_ID,
|
||||
+ BRAND_PLAZMA_ID
|
||||
+ );
|
||||
+ // Plazma end - Rebranding
|
||||
+ // Plazma end - Fork-friendly Rebranding
|
||||
+
|
||||
/**
|
||||
* 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 3d29c47ac0620af82d990faf5dfc266c6f0235f1..0dd22efb7f318867d0f099e336505d2830883745 100644
|
||||
index c880d0010849ab733ad13bbd18fab3c864d0cf61..316317222a137c2781b9b0c38948912e9dd08c76 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -258,7 +258,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -259,7 +259,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()),
|
||||
- ChatColor.parseMM("<grey>Current Purpur Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
|
||||
+ ChatColor.parseMM("<grey>Current " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
|
||||
+ ChatColor.parseMM("<grey>Current " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()), // Plazma - Fork-friendly Rebranding
|
||||
// Purpur end
|
||||
msg
|
||||
);
|
||||
@@ -281,6 +281,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -282,6 +282,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +72,7 @@ index 3d29c47ac0620af82d990faf5dfc266c6f0235f1..0dd22efb7f318867d0f099e336505d28
|
||||
private static int getDistance(@NotNull String repo, @NotNull String hash) {
|
||||
try {
|
||||
BufferedReader reader = Resources.asCharSource(
|
||||
@@ -301,4 +302,5 @@ public class VersionCommand extends BukkitCommand {
|
||||
@@ -302,4 +303,5 @@ public class VersionCommand extends BukkitCommand {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ec8b9b2cbe65838a194281f7d76d0e17defc5211..0062b2d4dc7a64d1e4da240bf8dc5b428eb242ee 100644
|
||||
index eb29794f6ca2efc9cde4dd1685822f9a3a73f3b9..d84c788fe1183833c86cde0ba8e174418cede950 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2269,6 +2269,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2277,6 +2277,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
index 069f2668f5229b0368b796e65eef1648fba0a097..9b991201a2f6cc9feccccf7f4e7bcded64117764 100644
|
||||
index 02411466bdcf4ff731f01ccebb2c99942e0db878..2718c0e5061838b01881bb231c53f4da348adce3 100644
|
||||
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||
@@ -442,6 +442,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
@@ -436,6 +436,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
||||
|
||||
@@ -44,6 +44,6 @@ index 069f2668f5229b0368b796e65eef1648fba0a097..9b991201a2f6cc9feccccf7f4e7bcded
|
||||
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
|
||||
+ // Purpur end
|
||||
+
|
||||
/**
|
||||
* Removed in 1.20.2
|
||||
*/
|
||||
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
|
||||
final @NonNull Class<T> type) {
|
||||
return GoalKey.of(type, NamespacedKey.minecraft(key));
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sun, 14 Jan 2024 19:51:19 +0900
|
||||
Subject: [PATCH] Use Gradle Version Catalogs
|
||||
Subject: [PATCH] Build System Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b10615375d7c2b4 100644
|
||||
index 535b0c6a750cc77fb9340d6e080932f3eb3bde17..3bb91f4d0447fc283c56ffab24cb8e203925ebad 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,65 +14,29 @@ val alsoShade: Configuration by configurations.creating
|
||||
@@ -13,70 +13,29 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
implementation(project(":purpur-api")) // Pufferfish // Purpur
|
||||
- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
|
||||
- // Paper start
|
||||
- implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
- implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -29,14 +30,14 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
|
||||
- implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
|
||||
- // Paper end
|
||||
- implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
|
||||
- implementation("org.ow2.asm:asm-commons:9.7")
|
||||
- implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||
- implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||
- implementation("commons-lang:commons-lang:2.6")
|
||||
- runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0")
|
||||
- runtimeOnly("com.mysql:mysql-connector-j:8.3.0")
|
||||
- runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||
- runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
|
||||
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
|
||||
- // Paper start - Use Velocity cipher
|
||||
- implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
|
||||
- implementation("com.velocitypowered:velocity-native:3.3.0-SNAPSHOT") {
|
||||
- isTransitive = false
|
||||
- }
|
||||
- // Paper end - Use Velocity cipher
|
||||
@@ -44,14 +45,13 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
|
||||
- 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")
|
||||
|
||||
-
|
||||
- // Pufferfish start
|
||||
- implementation("org.yaml:snakeyaml:1.32")
|
||||
- implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.4") {
|
||||
- implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { // Purpur
|
||||
- exclude(group="org.yaml", module="snakeyaml")
|
||||
- }
|
||||
- // Pufferfish end
|
||||
- implementation("com.github.technove:Flare:34637f3f87") // Pufferfish - flare
|
||||
-
|
||||
- implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur
|
||||
- implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
|
||||
@@ -59,19 +59,25 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
|
||||
-
|
||||
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
||||
- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
- testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
|
||||
- testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
- testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
- testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
- testImplementation("org.mockito:mockito-core:5.14.1")
|
||||
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||
- implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
||||
- implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
|
||||
- // Paper start - Remap reflection
|
||||
- val reflectionRewriterVersion = "0.0.1"
|
||||
- val reflectionRewriterVersion = "0.0.3"
|
||||
- implementation("io.papermc:reflection-rewriter:$reflectionRewriterVersion")
|
||||
- implementation("io.papermc:reflection-rewriter-runtime:$reflectionRewriterVersion")
|
||||
- implementation("io.papermc:reflection-rewriter-proxy-generator:$reflectionRewriterVersion")
|
||||
- // Paper end - Remap reflection
|
||||
+ // Plazma start - Use Gradle Version Catalogs
|
||||
- // Paper start - spark
|
||||
- implementation("me.lucko:spark-api:0.1-20240720.200737-2")
|
||||
- implementation("me.lucko:spark-paper:1.10.105-SNAPSHOT")
|
||||
- // Paper end - spark
|
||||
+ // Plazma start - Build System Changes
|
||||
+ implementation(project(":${rootProject.providers.gradleProperty("brandName").get().lowercase()}-api"))
|
||||
+ implementation(common.snakeyaml)
|
||||
+ implementation(common.asm.commons)
|
||||
+ implementation(common.log4j.core)
|
||||
@@ -92,7 +98,27 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
|
||||
+
|
||||
+ testImplementation(common.bundles.test)
|
||||
+ testImplementation(server.bundles.test)
|
||||
+ // Plazma end - Use Gradle Version Catalogs
|
||||
+ // Plazma end - Build System Changes
|
||||
}
|
||||
|
||||
paperweight {
|
||||
@@ -104,14 +63,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
- "Implementation-Title" to "Purpur", // Pufferfish // Purpur
|
||||
+ "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
"Implementation-Version" to implementationVersion,
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
- "Specification-Title" to "Purpur", // Pufferfish // Purpur
|
||||
+ "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
"Specification-Version" to project.version,
|
||||
- "Specification-Vendor" to "Purpur Team", // Pufferfish // Purpur
|
||||
- "Brand-Id" to "purpurmc:purpur", // Pufferfish // Purpur
|
||||
- "Brand-Name" to "Purpur", // Pufferfish // Purpur
|
||||
+ "Specification-Vendor" to rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
@@ -4,41 +4,8 @@ Date: Wed, 21 Dec 2022 19:31:24 +0900
|
||||
Subject: [PATCH] Fork-friendly Rebranding
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 732670587ecf0877be2493f67baade9c27b88f2b..54a30184392815a01f20b8fc841690e4ae5b3cc6 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":purpur-api")) // Pufferfish // Purpur
|
||||
+ implementation(project(":${rootProject.providers.gradleProperty("brandName").get().lowercase()}-api")) // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
|
||||
// Plazma start - Use Gradle Version Catalogs
|
||||
implementation(common.snakeyaml)
|
||||
@@ -63,14 +63,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
- "Implementation-Title" to "Purpur", // Purpur
|
||||
+ "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Rebrand // Plazma - Fork-friendly Rebranding
|
||||
"Implementation-Version" to implementationVersion,
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
- "Specification-Title" to "Purpur", // Purpur
|
||||
+ "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
"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 rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..81b204c03b3c9a997f00fd423daa963757cb0daf 100644
|
||||
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -593,7 +593,7 @@ public class Metrics {
|
||||
@@ -46,7 +13,7 @@ index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..81b204c03b3c9a997f00fd423daa9637
|
||||
// Only start Metrics, if it's enabled in the config
|
||||
if (config.getBoolean("enabled", true)) {
|
||||
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur
|
||||
+ Metrics metrics = new Metrics(io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ Metrics metrics = new Metrics(io.papermc.paper.ServerBrandConstants.BRAND_NAME, serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
|
||||
|
||||
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
|
||||
String minecraftVersion = Bukkit.getVersion();
|
||||
@@ -112,36 +79,36 @@ index 6d36fc6d8e22d9b68dea3830f6ecc8763184c343..6995627310de4911d87a2f93a723d6b9
|
||||
// Contributed by Techcable <Techcable@outlook.com> in GH-65
|
||||
private static int fetchDistanceFromGitHub(final String repo, final String branch, final String hash) {
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
index 3cb56595822799926a8141e60a42f5d1edfc6de5..70d6e514870b5cdf529eb067137a5c1579d3de1e 100644
|
||||
index 90b3526479320064378f2cde6c2f2b8e48a59ba6..21658c61ad091647d5421d1dbf892d03ca175c74 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
|
||||
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@@ -20,7 +20,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
|
||||
@Override
|
||||
protected LineReader buildReader(LineReaderBuilder builder) {
|
||||
builder
|
||||
- .appName("Purpur") // Purpur
|
||||
+ .appName(io.papermc.paper.ServerBuildInfo.buildInfo().brandName()) // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ .appName(io.papermc.paper.ServerBrandConstants.BRAND_NAME) // Purpur // Plazma - Fork-friendly Rebranding
|
||||
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
|
||||
.completer(new ConsoleCommandCompleter(this.server))
|
||||
.option(LineReader.Option.COMPLETE_IN_WORD, true);
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBrandConstants.java b/src/main/java/io/papermc/paper/ServerBrandConstants.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..af534fb15be2be3e5b4258c522e0e6c967c2bb1c
|
||||
index 0000000000000000000000000000000000000000..3af005ce2bbd30601917987d8c831db23c733ab8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBrandConstants.java
|
||||
@@ -0,0 +1,33 @@
|
||||
@@ -0,0 +1,29 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public enum ServerBrandConstants {;
|
||||
+public interface ServerBrandConstants {
|
||||
+
|
||||
+ // Basic brand informations
|
||||
+ public static final String BRAND_NAME = "Plazma";
|
||||
+ public static final String RESOURCE_PATH = "META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties";
|
||||
+ String BRAND_NAME = "Plazma";
|
||||
+ String RESOURCE_PATH = "META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties";
|
||||
+
|
||||
+ @Nullable
|
||||
+ public static final String ASCII_LOGO = """
|
||||
+ String ASCII_LOGO = """
|
||||
+
|
||||
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m█\033[38;2;205;27;135m█\033[38;2;202;28;136m█\033[38;2;199;30;136m█\033[38;2;196;31;137m╗\033[38;2;193;33;138m \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m╗\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m \033[38;2;161;46;144m█\033[38;2;158;47;145m█\033[38;2;155;49;146m█\033[38;2;151;50;146m█\033[38;2;148;52;147m█\033[38;2;145;53;148m╗\033[38;2;142;54;148m \033[38;2;139;56;149m█\033[38;2;135;57;149m█\033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m█\033[38;2;116;65;153m╗ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m╗\033[38;2;101;72;157m \033[38;2;97;73;157m \033[38;2;94;75;158m \033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m╗ \033[38;2;78;81;161m \033[38;2;75;83;162m█\033[38;2;72;84;163m█\033[38;2;69;86;163m█\033[38;2;66;87;164m█\033[38;2;62;88;165m█\033[38;2;59;90;165m╗\033[38;2;56;91;166m\s
|
||||
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m╔\033[38;2;205;27;135m═\033[38;2;202;28;136m═\033[38;2;199;30;136m█\033[38;2;196;31;137m█\033[38;2;193;33;138m╗ \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m║\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m╔\033[38;2;155;49;146m═\033[38;2;151;50;146m═\033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m╗ \033[38;2;139;56;149m╚\033[38;2;135;57;149m═\033[38;2;132;58;150m═\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m╔\033[38;2;116;65;153m╝ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m█\033[38;2;101;72;157m╗\033[38;2;97;73;157m \033[38;2;94;75;158m█\033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m╔\033[38;2;69;86;163m═\033[38;2;66;87;164m═\033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m╗
|
||||
@@ -152,19 +119,15 @@ index 0000000000000000000000000000000000000000..af534fb15be2be3e5b4258c522e0e6c9
|
||||
+ """;
|
||||
+
|
||||
+ // Support URLs
|
||||
+ public static final String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
|
||||
+ public static final String CONFIG_REFERENCE = "https://docs.plazmamc.org/plazma/administration/reference/configurations";
|
||||
+ public static final String START_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started";
|
||||
+ public static final String USAGE_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started/next-step";
|
||||
+ public static final String SUPPORT_PAGE = "https://github.com/PlazmaMC/Plazma/issues";
|
||||
+
|
||||
+ // DO NOT MODIFY BELOW
|
||||
+ public static final String BRAND_LCASE = BRAND_NAME.toLowerCase();
|
||||
+ public static final String BRAND_UCASE = BRAND_NAME.toUpperCase();
|
||||
+ String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
|
||||
+ String CONFIG_REFERENCE = "https://docs.plazmamc.org/plazma/administration/reference/configurations";
|
||||
+ String START_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started";
|
||||
+ String USAGE_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started/next-step";
|
||||
+ String SUPPORT_PAGE = "https://github.com/PlazmaMC/Plazma/issues";
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644
|
||||
index 3099c21ee589acf6edff5903a23673adf489024f..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
@@ -30,10 +30,6 @@ public record ServerBuildInfoImpl(
|
||||
@@ -172,7 +135,7 @@ index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c
|
||||
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
|
||||
|
||||
- private static final String BRAND_PAPER_NAME = "Paper";
|
||||
- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Pufferfish
|
||||
- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Purpur
|
||||
- private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur
|
||||
-
|
||||
private static final String BUILD_DEV = "DEV";
|
||||
@@ -194,56 +157,51 @@ index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c
|
||||
|
||||
@Override
|
||||
public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur
|
||||
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_PUFFERFISH_ID); // Purpur
|
||||
+ return brandId.equals(this.brandId) || SUPPORTED_BRANDS.contains(brandId); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
index 96142deb42700f888ea08689ab62c27ef2b881fd..62b602450a53cfebf08f839b505d0e965aff6e20 100644
|
||||
index 87e5f614ba988547a827486740db217e28585773..f5aac6cde46ca08a4d4792e38f514bb3d8188ae8 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -114,7 +114,12 @@ public abstract class Configurations<G, W> {
|
||||
@@ -113,9 +113,7 @@ public abstract class Configurations<G, W> {
|
||||
try {
|
||||
loader.save(node);
|
||||
} catch (ConfigurateException ex) {
|
||||
if (ex.getCause() instanceof AccessDeniedException) {
|
||||
- if (ex.getCause() instanceof AccessDeniedException) {
|
||||
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
|
||||
+ // Plazma start - Fork-friendly Rebranding
|
||||
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file."
|
||||
+ + "Any setting missing from the configuration file will be set with its default value in memory."
|
||||
+ + "Admins should make sure to review the configuration documentation at {} for more details.",
|
||||
+ filename, io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex);
|
||||
+ // Plazma end - Fork-friendly Rebranding
|
||||
} else throw ex;
|
||||
- } else throw ex;
|
||||
+ if (ex.getCause() instanceof AccessDeniedException) LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); else throw ex; // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
||||
index c366d84518979e842a6f10f969a5951539ecac93..4a885298859a0dff663d12075c82b42b48cce2ef 100644
|
||||
index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644
|
||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||
+++ b/src/main/java/net/minecraft/CrashReport.java
|
||||
@@ -37,7 +37,7 @@ public class CrashReport {
|
||||
@@ -32,13 +32,13 @@ public class CrashReport {
|
||||
private boolean trackingStackTrace = true;
|
||||
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
|
||||
private final SystemReport systemReport = new SystemReport();
|
||||
- private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
|
||||
+ private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " INSTEAD!", ""); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
|
||||
|
||||
public CrashReport(String message, Throwable cause) {
|
||||
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper
|
||||
this.title = message;
|
||||
this.exception = cause;
|
||||
- this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
||||
+ this.systemReport.setDetail(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit // Plazma - Fork-friendly Rebranding
|
||||
+ this.systemReport.setDetail(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
@@ -127,7 +127,7 @@ public class CrashReport {
|
||||
stringbuilder.append("---- Minecraft Crash Report ----\n");
|
||||
// Purpur start
|
||||
stringbuilder.append("// ");
|
||||
- stringbuilder.append("// DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!");
|
||||
+ stringbuilder.append("// DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO %s INSTEAD!".formatted(io.papermc.paper.ServerBrandConstants.BRAND_UCASE)); // Plazma - Fork-friendly Rebranding
|
||||
// Purpur end
|
||||
stringbuilder.append("// ");
|
||||
stringbuilder.append(CrashReport.getErrorComment());
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 0f7d6da8685716604f0749d4f5b60730a44cde73..4911a6d25d12eb9d2b263aeb9b7f521ff828397a 100644
|
||||
index aad2cdf4c2237caf2c99695d0cbb01f56c0074e2..e9842bf7e43a4fdfc4a23d6ee13d56a8cf4fb77a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -107,6 +107,11 @@ public class Main {
|
||||
@@ -108,6 +108,11 @@ public class Main {
|
||||
*/ // CraftBukkit end
|
||||
|
||||
try {
|
||||
@@ -255,29 +213,11 @@ index 0f7d6da8685716604f0749d4f5b60730a44cde73..4911a6d25d12eb9d2b263aeb9b7f521f
|
||||
|
||||
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||
|
||||
@@ -178,7 +183,7 @@ public class Main {
|
||||
if (awtException != null) {
|
||||
Main.LOGGER.error("You are using a headless JRE distribution.");
|
||||
Main.LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
|
||||
- Main.LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
|
||||
+ Main.LOGGER.error("For instructions on how to install the non-headless JRE, see {}", io.papermc.paper.ServerBrandConstants.START_GUIDE); // Plazma - Fork-friendly Rebranding
|
||||
Main.LOGGER.error("");
|
||||
Main.LOGGER.error(awtException);
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4c192b138810650ca0ab5e5d4f2407c0dc3d9fd0..468cb5034f7648e6ef39b1961298f592535aad88 100644
|
||||
index d78cb68c3a53b277aa26186062efc716c8f80f36..e36b9964569c8476ca25386c783fb8323f637476 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -960,7 +960,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
shutdownThread = Thread.currentThread();
|
||||
org.spigotmc.WatchdogThread.doStop(); // Paper
|
||||
if (!isSameThread()) {
|
||||
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PURPUR)"); // Purpur
|
||||
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO {})", io.papermc.paper.ServerBrandConstants.BRAND_UCASE); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
while (this.getRunningThread().isAlive()) {
|
||||
this.getRunningThread().stop();
|
||||
try {
|
||||
@@ -1181,7 +1181,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1259,7 +1259,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("*************************************************************************************");
|
||||
LOGGER.info("This is the first time you're starting this server.");
|
||||
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
|
||||
@@ -287,20 +227,20 @@ index 4c192b138810650ca0ab5e5d4f2407c0dc3d9fd0..468cb5034f7648e6ef39b1961298f592
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index fd88dfafcec517a29e3320ce147516ce2ccb2dc9..6d3f61a05c4d4ad20e62175eb0331bc31b5d6807 100644
|
||||
index 6e6f4dffceb0032153c5be119303c5809629cfcc..dae03900ee8b73448e216891fa8e9a7b5c41ddc2 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -796,7 +796,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -801,7 +801,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
|
||||
|
||||
result.append(this.server.getName());
|
||||
- result.append(" on Bukkit ");
|
||||
+ result.append(" on ").append(io.papermc.paper.ServerBuildInfo.buildInfo().brandName()).append(" "); // Plazma - Fork-friendly Rebranding
|
||||
+ result.append(" on ").append(io.papermc.paper.ServerBrandConstants.BRAND_NAME).append(" "); // Plazma - Fork-friendly Rebranding
|
||||
result.append(this.server.getBukkitVersion());
|
||||
|
||||
if (plugins.length > 0 && this.server.getQueryPlugins()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index 842f382de43df5d5c321422372ec30ccdd7859d7..09aa0c9ec7d66ff82167c035481e5fcccf8618de 100644
|
||||
index 9ebe1f1797b5be562bc4f6d92b9a4d6022ca2151..e0a09827db002b87e738091d820f05a9a97f3edb 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -56,12 +56,12 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
@@ -308,18 +248,18 @@ index 842f382de43df5d5c321422372ec30ccdd7859d7..09aa0c9ec7d66ff82167c035481e5fcc
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur
|
||||
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
public final boolean spawnAnimals = this.get("spawn-animals", true);
|
||||
public final boolean spawnNpcs = this.get("spawn-npcs", true);
|
||||
public final boolean pvp = this.get("pvp", true);
|
||||
public final boolean allowFlight = this.get("allow-flight", false);
|
||||
- public final String motd = this.get("motd", "A Minecraft Server");
|
||||
+ public final String motd = this.get("motd", "A " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Server"); // Plazma - Fork-friendly Rebranding
|
||||
+ public final String motd = this.get("motd", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Plazma - Fork-friendly Rebranding
|
||||
public final String bugReportLink = this.get("bug-report-link", "");
|
||||
public final boolean forceGameMode = this.get("force-gamemode", false);
|
||||
public final boolean enforceWhitelist = this.get("enforce-whitelist", false);
|
||||
public final Difficulty difficulty;
|
||||
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e689c41f1d 100644
|
||||
index 8f74c2ec5252b6265549589310d742337c91cb2c..ecb5a046514e3cd448cbf633c728831b1eb5d30b 100644
|
||||
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
|
||||
@@ -56,7 +56,7 @@ public class MinecraftServerGui extends JComponent {
|
||||
@@ -327,7 +267,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
|
||||
}
|
||||
|
||||
- final JFrame jframe = new JFrame("Purpur Minecraft server"); // Purpur
|
||||
+ final JFrame jframe = new JFrame(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ final JFrame jframe = new JFrame(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
final MinecraftServerGui servergui = new MinecraftServerGui(server);
|
||||
|
||||
jframe.setDefaultCloseOperation(2);
|
||||
@@ -336,7 +276,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
|
||||
jframe.setLocationRelativeTo((Component) null);
|
||||
jframe.setVisible(true);
|
||||
- jframe.setName("Purpur Minecraft server"); // Paper - Improve ServerGUI // Purpur
|
||||
+ jframe.setName(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server"); // Paper - Improve ServerGUI // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ jframe.setName(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Paper - Improve ServerGUI // Purpur // Plazma - Fork-friendly Rebranding
|
||||
|
||||
// Paper start - Improve ServerGUI
|
||||
try {
|
||||
@@ -345,7 +285,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
|
||||
public void windowClosing(WindowEvent windowevent) {
|
||||
if (!servergui.isClosing.getAndSet(true)) {
|
||||
- jframe.setTitle("Purpur Minecraft server - shutting down!"); // Purpur
|
||||
+ jframe.setTitle(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server - shutting down!"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ jframe.setTitle(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server - shutting down!"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
server.halt(true);
|
||||
servergui.runFinalizers();
|
||||
}
|
||||
@@ -359,7 +299,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
|
||||
|
||||
javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
index 1ce1235cbbf23fe975c85a0f713280b433459951..24934c84a6ca3a74784b63ebeadb9457aebd39c0 100644
|
||||
index 4a96d914f8aa6f0c5f13fc85369a311f25835ac2..5b4285d6b37346bcea3bf072c6f00bd50c62e703 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -89,7 +89,7 @@ public class DamageSource {
|
||||
@@ -367,25 +307,25 @@ index 1ce1235cbbf23fe975c85a0f713280b433459951..24934c84a6ca3a74784b63ebeadb9457
|
||||
public DamageSource customEventDamager(Entity entity) {
|
||||
if (this.directEntity != null) {
|
||||
- throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to Paper)");
|
||||
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + ")"); // Plazma - Fork-friendly Rebranding
|
||||
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + ")"); // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
DamageSource damageSource = this.cloneInstance();
|
||||
damageSource.customEventDamager = entity;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
index 1090b7e36e3c1c105bc36135b82751c651f237d4..a5b3f9309393fd54c0aec2918410b331b306684d 100644
|
||||
index 4c178b234bc1118a577d0e016f4b986e9197e99d..f1dab663eebbbdf67c5b8e8f05bf60ce7d6f1650 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||
@@ -157,7 +157,7 @@ public class RegionFileStorage implements AutoCloseable {
|
||||
@@ -177,7 +177,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||
|
||||
// Paper start
|
||||
private static void printOversizedLog(String msg, Path file, int x, int z) {
|
||||
- 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 PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
|
||||
+ 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 {} - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", io.papermc.paper.ServerBuildInfo.buildInfo().brandName()); // Plazma - Fork-friendly Rebranding
|
||||
- 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 PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur
|
||||
+ 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 " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
|
||||
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 549d01337e9a89b356287567db101de383d45c9c..90d6650aa37247f3907f6bcf2fe5201cac4e05ea 100644
|
||||
index 068aa459b4d1dfbbbd80dc0ae5c43b8202474477..8d67bf7aaed07a3438f29347bd3b1fd6c9efac2e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -143,7 +143,7 @@ public class Main {
|
||||
@@ -406,30 +346,21 @@ index 549d01337e9a89b356287567db101de383d45c9c..90d6650aa37247f3907f6bcf2fe5201c
|
||||
.describedAs("Name");
|
||||
// Paper end
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class Main {
|
||||
float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
|
||||
boolean isOldVersion = javaVersion < 61.0;
|
||||
if (!skip && isOldVersion) {
|
||||
- System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
|
||||
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see " + io.papermc.paper.ServerBrandConstants.START_GUIDE); // Plazma - Fork-friendly Rebranding
|
||||
return;
|
||||
}
|
||||
String javaVersionName = System.getProperty("java.version");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index ca8ae8e1c51b937dac916e0b0dc94b5e2e61efeb..e3af3ba8f34626e54cdd931601fd3ec40618a061 100644
|
||||
index 48999a860a3b9ed691691c355beaf3e0674acb95..8a34f8481031db9cd5f05944f37ee5284c99c6fe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
@@ -503,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
@@ -492,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||
this.parsePending();
|
||||
} else {
|
||||
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
|
||||
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur
|
||||
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to {}" + io.papermc.paper.ServerBuildInfo.buildInfo().brandName()); // Paper // Purpur
|
||||
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||
// We don't need to parse pending
|
||||
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e8f7250f366bf9407ffd6d2ce53fd68a3753f97c 100644
|
||||
index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e0414f59b7c5ef149d8e52ebf76dc3e46d9de4d3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
@@ -446,53 +377,53 @@ index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e8f7250f366bf9407ffd6d2ce53fd68a
|
||||
result = properties.getProperty("version");
|
||||
} catch (IOException ex) {
|
||||
- Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Bukkit version!", ex);
|
||||
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " version!", ex); // Plazma - Fork-friendly Rebranding
|
||||
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version!", ex); // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index a353eb9f45af7b7f9bfd92a4a89403335b841840..e221edfd8837f82642de584ecadf47bafc598b38 100644
|
||||
index f51cc3de3ca935ef90f7f0e9dd0506b856fc55f3..d889d964067058762fcffab9945fe586ce8d2a07 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
@@ -155,14 +155,14 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
|
||||
if (isLongTimeout) {
|
||||
// Paper end
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug." ); // Paper // Purpur
|
||||
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " bug." ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug." ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
|
||||
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
|
||||
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
|
||||
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
|
||||
- log.log( Level.SEVERE, "If you are unsure or still think this is a Purpur bug, please report this to https://github.com/PurpurMC/Purpur/issues" ); // Purpur
|
||||
+ log.log( Level.SEVERE, "If you are unsure or still think this is a " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " bug, please report this to " + io.papermc.paper.ServerBrandConstants.SUPPORT_PAGE ); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ log.log( Level.SEVERE, "If you are unsure or still think this is a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug, please report this to " + io.papermc.paper.ServerBrandConstants.SUPPORT_PAGE ); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
|
||||
- log.log( Level.SEVERE, "Purpur version: " + Bukkit.getServer().getVersion() ); // Purpur
|
||||
+ log.log( Level.SEVERE, io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " version: " + Bukkit.getServer().getVersion() ); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ log.log( Level.SEVERE, io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version: " + Bukkit.getServer().getVersion() ); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
//
|
||||
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
|
||||
{
|
||||
@@ -184,12 +184,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
@@ -184,12 +184,12 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
|
||||
// Paper end
|
||||
} else
|
||||
{
|
||||
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur
|
||||
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_UCASE + " - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
|
||||
}
|
||||
// Paper end - Different message for short timeout
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur
|
||||
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + "!):" ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper - rewrite chunk system
|
||||
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + "!):" ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||
ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - rewrite chunk system
|
||||
this.dumpTickingInfo(); // Paper - log detailed tick information
|
||||
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
|
||||
@@ -205,7 +205,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
|
||||
@@ -205,7 +205,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
|
||||
WatchdogThread.dumpThread( thread, log );
|
||||
}
|
||||
} else {
|
||||
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur
|
||||
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||
}
|
||||
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,12 +5,12 @@ Subject: [PATCH] Plazma Configurations
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4dd27a2c5 100644
|
||||
index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06beff65045 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -39,28 +39,95 @@ public abstract class Configurations<G, W> {
|
||||
@@ -39,27 +39,94 @@ public abstract class Configurations<G, W> {
|
||||
public static final String WORLD_DEFAULTS = "__world_defaults__";
|
||||
public static final ResourceLocation WORLD_DEFAULTS_KEY = new ResourceLocation("configurations", WORLD_DEFAULTS);
|
||||
public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS);
|
||||
protected final Path globalFolder;
|
||||
- protected final Class<G> globalConfigClass;
|
||||
- protected final Class<W> worldConfigClass;
|
||||
@@ -26,6 +26,12 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
- final String defaultWorldConfigFileName,
|
||||
- final String worldConfigFileName
|
||||
- ) {
|
||||
- this.globalFolder = globalFolder;
|
||||
- this.globalConfigClass = globalConfigType;
|
||||
- this.worldConfigClass = worldConfigClass;
|
||||
- this.globalConfigFileName = globalConfigFileName;
|
||||
- this.defaultWorldConfigFileName = defaultWorldConfigFileName;
|
||||
- this.worldConfigFileName = worldConfigFileName;
|
||||
+
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ @org.jetbrains.annotations.VisibleForTesting
|
||||
@@ -43,14 +49,9 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
+ } catch (IOException e) {
|
||||
+ throw new RuntimeException("Could not setup configurations", e);
|
||||
+ }
|
||||
this.globalFolder = globalFolder;
|
||||
- this.globalConfigClass = globalConfigType;
|
||||
- this.worldConfigClass = worldConfigClass;
|
||||
- this.globalConfigFileName = globalConfigFileName;
|
||||
- this.defaultWorldConfigFileName = defaultWorldConfigFileName;
|
||||
- this.worldConfigFileName = worldConfigFileName;
|
||||
}
|
||||
|
||||
+ this.globalFolder = globalFolder; // Plazma - diff on changes
|
||||
+ } // Plazma - diff on changes
|
||||
+
|
||||
+ protected abstract Class<G> globalConfigClass();
|
||||
+ protected abstract String globalConfigFileName();
|
||||
+ protected abstract org.spongepowered.configurate.NodePath[] removedGlobalPaths();
|
||||
@@ -117,12 +118,11 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
+ } catch (Exception e) {
|
||||
+ throw new RuntimeException("Could not reload configuration files", e);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // Plazma end - Configurable Plazma
|
||||
+
|
||||
|
||||
protected ObjectMapper.Factory.Builder createObjectMapper() {
|
||||
return ObjectMapper.factoryBuilder()
|
||||
.addConstraint(Constraint.class, new Constraint.Factory())
|
||||
@@ -68,17 +135,21 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
}
|
||||
|
||||
- static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) {
|
||||
+ protected static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) { // Plazma - AT (package -> public)
|
||||
+ protected static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) { // Plazma - package -> protected
|
||||
return node -> {
|
||||
ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
|
||||
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
|
||||
@@ -166,7 +166,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
}
|
||||
|
||||
private void trySaveFileNode(YamlConfigurationLoader loader, ConfigurationNode node, String filename) throws ConfigurateException {
|
||||
@@ -125,7 +196,7 @@ public abstract class Configurations<G, W> {
|
||||
@@ -118,7 +189,7 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
protected G initializeGlobalConfiguration(final CheckedFunction<ConfigurationNode, G, SerializationException> creator) throws ConfigurateException {
|
||||
@@ -175,7 +175,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
final YamlConfigurationLoader loader = this.createGlobalLoaderBuilder()
|
||||
.defaultOptions(this.applyObjectMapperFactory(this.createGlobalObjectMapperFactoryBuilder().build()))
|
||||
.path(configFile)
|
||||
@@ -156,6 +227,13 @@ public abstract class Configurations<G, W> {
|
||||
@@ -149,6 +220,13 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
protected void applyGlobalConfigTransformations(final ConfigurationNode node) throws ConfigurateException {
|
||||
@@ -189,7 +189,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
@@ -163,6 +241,7 @@ public abstract class Configurations<G, W> {
|
||||
@@ -156,6 +234,7 @@ public abstract class Configurations<G, W> {
|
||||
return ContextMap.builder()
|
||||
.put(WORLD_NAME, WORLD_DEFAULTS)
|
||||
.put(WORLD_KEY, WORLD_DEFAULTS_KEY)
|
||||
@@ -197,7 +197,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
.put(REGISTRY_ACCESS, registryAccess);
|
||||
}
|
||||
|
||||
@@ -170,7 +249,7 @@ public abstract class Configurations<G, W> {
|
||||
@@ -163,7 +242,7 @@ public abstract class Configurations<G, W> {
|
||||
final ContextMap contextMap = this.createDefaultContextMap(registryAccess)
|
||||
.put(FIRST_DEFAULT)
|
||||
.build();
|
||||
@@ -206,7 +206,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
final DefaultWorldLoader result = this.createDefaultWorldLoader(false, contextMap, configFile);
|
||||
final YamlConfigurationLoader loader = result.loader();
|
||||
final ConfigurationNode node = loader.load();
|
||||
@@ -180,8 +259,8 @@ public abstract class Configurations<G, W> {
|
||||
@@ -173,8 +252,8 @@ public abstract class Configurations<G, W> {
|
||||
this.verifyWorldConfigVersion(contextMap, node);
|
||||
}
|
||||
this.applyWorldConfigTransformations(contextMap, node, null);
|
||||
@@ -217,29 +217,33 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
this.trySaveFileNode(loader, node, configFile.toString());
|
||||
}
|
||||
|
||||
@@ -202,31 +281,42 @@ public abstract class Configurations<G, W> {
|
||||
private record DefaultWorldLoader(YamlConfigurationLoader loader, boolean isNewFile) {
|
||||
@@ -196,30 +275,45 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
+ // Plazma start - Configurable Plazma
|
||||
protected ObjectMapper.Factory.Builder createWorldObjectMapperFactoryBuilder(final ContextMap contextMap) {
|
||||
- return this.createObjectMapper();
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ return this.createObjectMapper()
|
||||
+ .addNodeResolver(new io.papermc.paper.configuration.legacy.RequiresSpigotInitialization.Factory(contextMap.require(SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get()))
|
||||
+ .addNodeResolver(new NestedSetting.Factory())
|
||||
+ .addDiscoverer(new io.papermc.paper.configuration.mapping.InnerClassFieldDiscoverer(Map.of(this.worldConfigClass(), createWorldConfigInstance(contextMap))));
|
||||
+ // Plazma end - Configurable Plazma
|
||||
}
|
||||
|
||||
@MustBeInvokedByOverriders
|
||||
protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final ContextMap contextMap) {
|
||||
- return this.createLoaderBuilder();
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ return this.createLoaderBuilder().defaultOptions(options -> options
|
||||
+ .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? this.worldDefaultHeader() : this.buildWorldHeader(contextMap)));
|
||||
+ // Plazma end - Configurable Plazma
|
||||
}
|
||||
|
||||
+ // Plazma start - Configurable Plazma
|
||||
// Make sure to run version transforms on the default world config first via #setupWorldDefaultsConfig
|
||||
- public W createWorldConfig(final ContextMap contextMap) throws IOException {
|
||||
- return this.createWorldConfig(contextMap, creator(this.worldConfigClass, false));
|
||||
- }
|
||||
+ public W createWorldConfig(final ContextMap contextMap) {
|
||||
+ final String levelName = contextMap.require(WORLD_NAME);
|
||||
+ try {
|
||||
@@ -247,7 +251,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
+ } catch (IOException exception) {
|
||||
+ throw new RuntimeException("Could not create world config for " + levelName, exception);
|
||||
+ }
|
||||
}
|
||||
+ } // diff on change
|
||||
+ // Plazma end - Configurable Plazma
|
||||
|
||||
protected W createWorldConfig(final ContextMap contextMap, final CheckedFunction<ConfigurationNode, W, SerializationException> creator) throws IOException {
|
||||
@@ -267,7 +271,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
Files.createFile(worldConfigFile); // create empty file as template
|
||||
newFile = true;
|
||||
}
|
||||
@@ -270,6 +360,13 @@ public abstract class Configurations<G, W> {
|
||||
@@ -263,6 +357,13 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
@@ -281,7 +285,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
}
|
||||
|
||||
protected void applyDefaultsAwareWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode worldNode, final ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
@@ -282,7 +379,7 @@ public abstract class Configurations<G, W> {
|
||||
@@ -275,7 +376,7 @@ public abstract class Configurations<G, W> {
|
||||
}
|
||||
|
||||
public Path getWorldConfigFile(ServerLevel level) {
|
||||
@@ -291,10 +295,10 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
|
||||
|
||||
public static class ContextMap {
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15ea16ea262 100644
|
||||
index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d1f26aa4a 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -134,6 +134,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -135,6 +135,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
See https://docs.papermc.io/paper/configuration for more information.
|
||||
""";
|
||||
|
||||
@@ -302,16 +306,14 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
@VisibleForTesting
|
||||
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
|
||||
@Override // override to ensure "verbose" is false
|
||||
@@ -142,12 +143,69 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -143,11 +144,68 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
}
|
||||
});
|
||||
public static final ContextKey<Supplier<SpigotWorldConfig>> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken<Supplier<SpigotWorldConfig>>() {}, "spigot world config");
|
||||
-
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ */
|
||||
+ */ // Plazma - Configurable Plazma
|
||||
|
||||
public PaperConfigurations(final Path globalFolder) {
|
||||
- super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME);
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ public PaperConfigurations(final Path globalFolder) { // diff on change
|
||||
+ super(globalFolder);
|
||||
+ }
|
||||
+
|
||||
@@ -359,30 +361,48 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
+ protected String worldDefaultHeader() {
|
||||
+ return WORLD_DEFAULTS_HEADER;
|
||||
+ }
|
||||
+
|
||||
|
||||
- public PaperConfigurations(final Path globalFolder) {
|
||||
- super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME);
|
||||
+ @Override
|
||||
+ protected String buildWorldHeader(final ContextMap contextMap) {
|
||||
+ return WORLD_HEADER.apply(contextMap);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected WorldConfiguration getWorldConfiguration(final ServerLevel level) {
|
||||
+ return level.paperConfig();
|
||||
+ }
|
||||
}
|
||||
+ // Plazma end - Configurable Plazma
|
||||
+
|
||||
|
||||
@Override
|
||||
protected int globalConfigVersion() {
|
||||
return GlobalConfiguration.CURRENT_VERSION;
|
||||
@@ -158,6 +216,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
return WorldConfiguration.CURRENT_VERSION;
|
||||
@@ -162,14 +220,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@Override
|
||||
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
||||
return super.createLoaderBuilder()
|
||||
- .defaultOptions(PaperConfigurations::defaultOptions);
|
||||
+ .defaultOptions(PaperConfigurations::defaultOptions0); // Plazma - Configurable Plazma
|
||||
}
|
||||
|
||||
- private static ConfigurationOptions defaultOptions(ConfigurationOptions options) {
|
||||
+ private static ConfigurationOptions defaultOptions0(ConfigurationOptions options) { // Plazma - Configurable Plazma
|
||||
return options.serializers(builder -> builder
|
||||
- .register(MapSerializer.TYPE, new MapSerializer(false))
|
||||
- .register(new EnumValueSerializer())
|
||||
- .register(new ComponentSerializer())
|
||||
.register(IntOr.Default.SERIALIZER)
|
||||
.register(IntOr.Disabled.SERIALIZER)
|
||||
.register(DoubleOr.Default.SERIALIZER)
|
||||
@@ -181,6 +236,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
);
|
||||
}
|
||||
|
||||
+ /* // Plazma - Configurable Plazma
|
||||
@Override
|
||||
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
||||
return super.createLoaderBuilder()
|
||||
@@ -180,6 +239,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() {
|
||||
return defaultGlobalFactoryBuilder(super.createGlobalObjectMapperFactoryBuilder());
|
||||
@@ -189,6 +245,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
private static ObjectMapper.Factory.Builder defaultGlobalFactoryBuilder(ObjectMapper.Factory.Builder builder) {
|
||||
return builder.addDiscoverer(InnerClassFieldDiscoverer.globalConfig());
|
||||
}
|
||||
@@ -390,7 +410,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
|
||||
@Override
|
||||
protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() {
|
||||
@@ -203,6 +263,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -211,6 +268,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@@ -398,7 +418,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
@Override
|
||||
protected ContextMap.Builder createDefaultContextMap(final RegistryAccess registryAccess) {
|
||||
return super.createDefaultContextMap(registryAccess)
|
||||
@@ -216,8 +277,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -224,8 +282,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
.addNodeResolver(new NestedSetting.Factory())
|
||||
.addDiscoverer(InnerClassFieldDiscoverer.worldConfig(createWorldConfigInstance(contextMap)));
|
||||
}
|
||||
@@ -409,7 +429,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
return new WorldConfiguration(
|
||||
contextMap.require(PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(),
|
||||
contextMap.require(Configurations.WORLD_KEY)
|
||||
@@ -229,7 +291,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -237,7 +296,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
final RegistryAccess access = contextMap.require(REGISTRY_ACCESS);
|
||||
return super.createWorldConfigLoaderBuilder(contextMap)
|
||||
.defaultOptions(options -> options
|
||||
@@ -418,7 +438,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
.serializers(serializers -> serializers
|
||||
.register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
||||
.register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
||||
@@ -254,11 +316,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -256,12 +315,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
|
||||
@Override
|
||||
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||
@@ -426,12 +446,13 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
- for (final NodePath path : RemovedConfigurations.REMOVED_WORLD_PATHS) {
|
||||
- builder.addAction(path, TransformAction.remove());
|
||||
- }
|
||||
- org.purpurmc.purpur.configuration.transformation.VoidDamageHeightMigration.apply(builder, contextMap); // Purpur
|
||||
- builder.build().apply(node);
|
||||
+ super.applyWorldConfigTransformations(contextMap, node, defaultsNode); // Plazma - Configurable Plazma // Plazma - Configurable Plazma
|
||||
+ super.applyWorldConfigTransformations(contextMap, node, defaultsNode); // Plazma - Configurable Plazma
|
||||
|
||||
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||
V29_ZeroWorldHeight.apply(versionedBuilder);
|
||||
@@ -270,11 +328,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -273,11 +327,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
|
||||
@Override
|
||||
protected void applyGlobalConfigTransformations(ConfigurationNode node) throws ConfigurateException {
|
||||
@@ -444,7 +465,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
|
||||
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||
V29_LogIPs.apply(versionedBuilder);
|
||||
@@ -294,6 +348,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -297,6 +347,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
builder.build().apply(worldNode);
|
||||
}
|
||||
|
||||
@@ -452,7 +473,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
@Override
|
||||
public WorldConfiguration createWorldConfig(final ContextMap contextMap) {
|
||||
final String levelName = contextMap.require(WORLD_NAME);
|
||||
@@ -335,6 +390,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -338,6 +389,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
.put(GAME_RULES, gameRules)
|
||||
.build();
|
||||
}
|
||||
@@ -460,7 +481,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
|
||||
public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
||||
final Path legacy = Files.isSymbolicLink(legacyConfig) ? Files.readSymbolicLink(legacyConfig) : legacyConfig;
|
||||
@@ -368,12 +424,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -371,12 +423,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
throw new RuntimeException("Could not convert '" + legacyFileName + "' to the new configuration format", ex);
|
||||
}
|
||||
}
|
||||
@@ -474,7 +495,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
}
|
||||
|
||||
private static void convert(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
||||
@@ -424,6 +475,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -427,6 +474,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
return Files.exists(legacyConfig) && Files.isRegularFile(legacyConfig);
|
||||
}
|
||||
|
||||
@@ -482,7 +503,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
@Deprecated
|
||||
public YamlConfiguration createLegacyObject(final MinecraftServer server) {
|
||||
YamlConfiguration global = YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile());
|
||||
@@ -434,6 +486,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -437,6 +485,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
}
|
||||
return global;
|
||||
}
|
||||
@@ -490,7 +511,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
|
||||
@Deprecated
|
||||
public static YamlConfiguration loadLegacyConfigFile(File configFile) throws Exception {
|
||||
@@ -456,10 +509,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -459,10 +508,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
return BasicConfigurationNode.root(options);
|
||||
}
|
||||
|
||||
@@ -505,18 +526,18 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 468cb5034f7648e6ef39b1961298f592535aad88..79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6 100644
|
||||
index e36b9964569c8476ca25386c783fb8323f637476..ccfeda1ba3f89112eccf29f382b5526934db1d91 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -318,6 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public final double[] recentTps = new double[ 4 ]; // Purpur
|
||||
// Spigot end
|
||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
||||
+ public final org.plazmamc.plazma.configurations.PlazmaConfigurations plazmaConfigurations; // Plazma - Configurable Plazma
|
||||
public static long currentTickLong = 0L; // Paper - track current tick as a long
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
public boolean lagging = false; // Purpur
|
||||
@@ -422,6 +423,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
protected boolean upnp = false; // Purpur
|
||||
@@ -500,6 +501,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
||||
// CraftBukkit end
|
||||
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
||||
@@ -584,31 +605,31 @@ index 33e3815a0c979609d4c7ab83ad91e87ac07a556d..4f1071c48fec78036d6759cdff179df3
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 6d3f61a05c4d4ad20e62175eb0331bc31b5d6807..6cbbe9c692068edee7e66f85081ec95b8dd12101 100644
|
||||
index dae03900ee8b73448e216891fa8e9a7b5c41ddc2..65594336920c8999c2e2847ebcc80577381de6f3 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -222,6 +222,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -235,6 +235,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// Paper start - initialize global and world-defaults configuration
|
||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
+ this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
+ this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
@@ -232,6 +234,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -246,6 +248,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
|
||||
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||
+ org.plazmamc.plazma.commands.Commands.register(this); // Plazma - Configurable Plazma
|
||||
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||
// Purpur start
|
||||
try {
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index b3d47d16fb9733ca5cc4f90051ee8694ff3545c5..5456d2ded6f6e75c48868147e5a2dde5eb23bec8 100644
|
||||
index 067b10134b087626e05596225744b905211e8b63..dfcd3989ffbd4aa5dc9368a34b95c1c2748c23a2 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -700,15 +700,33 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -506,7 +506,25 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||
|
||||
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
@@ -635,21 +656,11 @@ index b3d47d16fb9733ca5cc4f90051ee8694ff3545c5..5456d2ded6f6e75c48868147e5a2dde5
|
||||
this.pvpMode = minecraftserver.isPvpAllowed();
|
||||
this.convertable = convertable_conversionsession;
|
||||
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
||||
// CraftBukkit end
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
- this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
- this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
+ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang's Profiler
|
||||
+ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang's Profiler
|
||||
this.pathTypesByPosCache = new PathTypeCache();
|
||||
this.navigatingMobs = new ObjectOpenHashSet();
|
||||
this.blockEvents = new ObjectLinkedOpenHashSet();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a6928d8dab3 100644
|
||||
index 5057d9d433ba002a22d22adfaf7323b2cfaee9af..253d47418b4e9cbce74584c2461d12e17effd7bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -169,6 +169,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -171,6 +171,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
return this.paperConfig;
|
||||
}
|
||||
// Paper end - add paper world config
|
||||
@@ -662,11 +673,11 @@ index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a69
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
||||
@@ -251,9 +257,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -728,9 +734,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
}
|
||||
// Paper end - optimise random ticking
|
||||
|
||||
//protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI
|
||||
|
||||
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
|
||||
+ // Plazma start - Configurable Plazma
|
||||
+ protected Level(
|
||||
+ WritableLevelData worlddatamutable,
|
||||
@@ -693,10 +704,10 @@ index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a69
|
||||
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
||||
this.generator = gen;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd15761b77 100644
|
||||
index 8854e3adca98214697fdfa7f1296e2d66b5afa48..0bd9f4dc28bb67def4af402f88b05a257262c0a4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1047,6 +1047,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1086,6 +1086,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -704,7 +715,7 @@ index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd
|
||||
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
@@ -3113,6 +3114,13 @@ public final class CraftServer implements Server {
|
||||
@@ -3068,6 +3069,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
@@ -719,7 +730,7 @@ index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd
|
||||
public void restart() {
|
||||
org.spigotmc.RestartCommand.restart();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 90d6650aa37247f3907f6bcf2fe5201cac4e05ea..24c3914ba4f144a2e43c17e98373b7a4ce1f6217 100644
|
||||
index 8d67bf7aaed07a3438f29347bd3b1fd6c9efac2e..f12a0a44c31de3983f207678bbd7fe232e13e14c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -197,6 +197,14 @@ public class Main {
|
||||
@@ -739,13 +750,14 @@ index 90d6650aa37247f3907f6bcf2fe5201cac4e05ea..24c3914ba4f144a2e43c17e98373b7a4
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5942d0997f07bd51d934dac32cd349792a10643e
|
||||
index 0000000000000000000000000000000000000000..ca11bd22a65c8b9f4fffb1832ada8c519ab75b98
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -0,0 +1,9 @@
|
||||
@@ -0,0 +1,10 @@
|
||||
+package org.plazmamc.plazma;
|
||||
+
|
||||
+import static java.lang.Boolean.getBoolean;
|
||||
+import static java.lang.System.getProperty;
|
||||
+
|
||||
+public interface Options {
|
||||
+
|
||||
@@ -1303,18 +1315,18 @@ index 0000000000000000000000000000000000000000..f2d3d51cb4b8fc7a5fd6db1a63289fff
|
||||
+ int version = VERSION;
|
||||
+
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||
index 1b1d51a68c0abe7d8f0aa1172064192c71ae645e..74af3501397bfd89d637ad5ce72bb8f2c2bbdc8a 100644
|
||||
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
|
||||
@@ -64,6 +64,7 @@ public abstract class AbstractTestingBase {
|
||||
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||
index cb2b39c562f609375b9e5b20cb5899780995373d..272ccfb9bbbf526b596dcc367397e52e84223daf 100644
|
||||
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||
@@ -92,6 +92,7 @@ public final class DummyServerHelper {
|
||||
// Paper end - testing additions
|
||||
|
||||
DummyServer.setup();
|
||||
io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper
|
||||
io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper - configuration files - setup global configuration test base
|
||||
+ org.plazmamc.plazma.configurations.GlobalConfigurationTestingBase.setupGlobalConfigForTest(); // Plazma - Configurable Plazma
|
||||
|
||||
CraftRegistry.setMinecraftRegistry(REGISTRY_CUSTOM);
|
||||
|
||||
// Paper start - add test for recipe conversion
|
||||
when(instance.recipeIterator()).thenAnswer(ignored ->
|
||||
diff --git a/src/test/java/org/plazmamc/plazma/configurations/GlobalConfigurationTestingBase.java b/src/test/java/org/plazmamc/plazma/configurations/GlobalConfigurationTestingBase.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c63942e2dc00ed6d6b4119f418bdaa5a64b4c0fe
|
||||
|
||||
@@ -5,19 +5,19 @@ Subject: [PATCH] Warn on startup
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..57deffa2f3d2f0074512440e668c71afb38510d4 100644
|
||||
index e9842bf7e43a4fdfc4a23d6ee13d56a8cf4fb77a..5aea9b3cc84bcfba940e13e8f680899f5df67856 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -112,6 +112,18 @@ public class Main {
|
||||
@@ -113,6 +113,18 @@ public class Main {
|
||||
if (io.papermc.paper.ServerBrandConstants.ASCII_LOGO != null)
|
||||
System.out.println(io.papermc.paper.ServerBrandConstants.ASCII_LOGO);
|
||||
// Plazma end - Fork-friendly Rebranding
|
||||
+ // Plazma start - Warn on startup
|
||||
+ if (!org.plazmamc.plazma.Options.NO_WARN) {
|
||||
+ LOGGER.warn("Warning! " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
|
||||
+ LOGGER.warn("Warning! " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
|
||||
+ if (io.papermc.paper.ServerBuildInfo.buildInfo().asString(io.papermc.paper.ServerBuildInfo.StringRepresentation.VERSION_FULL).contains("DEV")) {
|
||||
+ LOGGER.error("*********************** CAUTION ***********************");
|
||||
+ LOGGER.error("This version is a development version of {}.", io.papermc.paper.ServerBuildInfo.buildInfo().brandName());
|
||||
+ LOGGER.error("This version is a development version of {}.", io.papermc.paper.ServerBrandConstants.BRAND_NAME);
|
||||
+ LOGGER.error("Nobody knows what kind of problem you're going to have, and there's always the possibility of unexpected problems.");
|
||||
+ LOGGER.error("Never use this version on a public server, and after you've tested it enough before using it!");
|
||||
+ LOGGER.error("*******************************************************");
|
||||
@@ -28,10 +28,10 @@ index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..57deffa2f3d2f0074512440e668c71af
|
||||
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 5942d0997f07bd51d934dac32cd349792a10643e..b02a0dddd99df1691c125660828a61cc4a5a4d02 100644
|
||||
index ca11bd22a65c8b9f4fffb1832ada8c519ab75b98..5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -5,5 +5,6 @@ import static java.lang.Boolean.getBoolean;
|
||||
@@ -6,5 +6,6 @@ import static java.lang.System.getProperty;
|
||||
public interface Options {
|
||||
|
||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||
@@ -4,15 +4,39 @@ Date: Sun, 5 Nov 2023 10:13:14 +0900
|
||||
Subject: [PATCH] Always agree EULA on development mode
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 3bb91f4d0447fc283c56ffab24cb8e203925ebad..95df5b7c437f95849b193345640e6001aed71a3d 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -141,7 +141,7 @@ fun TaskContainer.registerRunTask(
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||
})
|
||||
- jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods")
|
||||
+ jvmArgs("-DPlazma.DevelopmentEnvironment", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") // Plazma - Always agree EULA on development mode
|
||||
|
||||
if (rootProject.childProjects["test-plugin"] != null) {
|
||||
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..29eef278940cab33a1f5f168f66ab2b80f0d60ce 100644
|
||||
index 5aea9b3cc84bcfba940e13e8f680899f5df67856..2807a67ad42b35045ef9f607062403c376e0c4ef 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -166,6 +166,7 @@ public class Main {
|
||||
@@ -179,6 +179,7 @@ public class Main {
|
||||
|
||||
// Spigot Start
|
||||
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
|
||||
+ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.pushPaperAssetsRoot"); // Plazma - Always agree EULA on development mode
|
||||
+ eulaAgreed = eulaAgreed || org.plazmamc.plazma.Options.DEVELOPMENT; // Plazma - Always agree EULA on development mode
|
||||
if ( eulaAgreed )
|
||||
{
|
||||
System.err.println( "You have used the Spigot command line EULA agreement flag." );
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b..b891735728e14c40c67e21897b5043efc7077b7f 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -7,5 +7,6 @@ public interface Options {
|
||||
|
||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||
+ boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH] Optimize default configurations
|
||||
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them
|
||||
|
||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e4e3b92cb 100644
|
||||
index 8f1645573780d12bf29d441d31eab1b76cd9e70f..8e35f7fbe3629ab05c16f52d72a3cd7343cf835f 100644
|
||||
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||
@@ -72,7 +72,7 @@ public class PufferfishConfig {
|
||||
@@ -64,7 +64,7 @@ public class PufferfishConfig {
|
||||
getString("info.version", "1.0");
|
||||
setComment("info",
|
||||
"Pufferfish Configuration",
|
||||
@@ -21,31 +21,31 @@ index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e
|
||||
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
|
||||
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
|
||||
|
||||
@@ -227,7 +227,7 @@ public class PufferfishConfig {
|
||||
@@ -219,7 +219,7 @@ public class PufferfishConfig {
|
||||
public static int maxProjectileLoadsPerTick;
|
||||
public static int maxProjectileLoadsPerProjectile;
|
||||
private static void projectileLoading() {
|
||||
- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
|
||||
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
|
||||
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations
|
||||
maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
|
||||
|
||||
setComment("projectile", "Optimizes projectile settings");
|
||||
@@ -241,12 +241,12 @@ public class PufferfishConfig {
|
||||
@@ -233,12 +233,12 @@ public class PufferfishConfig {
|
||||
public static int activationDistanceMod;
|
||||
|
||||
private static void dynamicActivationOfBrains() throws IOException {
|
||||
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
|
||||
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur
|
||||
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur // Plazma - Optimize default configurations
|
||||
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
|
||||
"This value determines how far away an entity has to be",
|
||||
"from the player to start being effected by DEAR.");
|
||||
startDistanceSquared = startDistance * startDistance;
|
||||
- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
|
||||
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8,
|
||||
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8, // Plazma - Optimize default configurations
|
||||
"This value defines how often in ticks, the furthest entity",
|
||||
"will get their pathfinders and behaviors ticked. 20 = 1s");
|
||||
activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
|
||||
@@ -269,8 +269,18 @@ public class PufferfishConfig {
|
||||
@@ -261,8 +261,18 @@ public class PufferfishConfig {
|
||||
public static Map<String, Integer> projectileTimeouts;
|
||||
private static void projectileTimeouts() {
|
||||
// Set some defaults
|
||||
@@ -67,10 +67,10 @@ index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e
|
||||
"These values define a entity's maximum lifespan. If an",
|
||||
"entity is in this list and it has survived for longer than",
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cdec0842e18 100644
|
||||
index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d8e4b9f6c 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -167,7 +167,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -172,7 +172,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Watchdog extends ConfigurationPart {
|
||||
public int earlyWarningEvery = 5000;
|
||||
@@ -79,7 +79,7 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
|
||||
}
|
||||
|
||||
public SpamLimiter spamLimiter;
|
||||
@@ -207,7 +207,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -214,7 +214,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Commands commands;
|
||||
|
||||
public class Commands extends ConfigurationPart {
|
||||
@@ -88,16 +88,16 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
|
||||
public boolean fixTargetSelectorTagCompletion = true;
|
||||
public boolean timeCommandAffectsAllWorlds = false;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -263,7 +263,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public BookSize bookSize;
|
||||
|
||||
public class BookSize extends ConfigurationPart {
|
||||
- public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above
|
||||
+ public int pageMax = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1024 : 2560; // TODO this appears to be a duplicate setting with one above // Plazma - Optimize default configurations
|
||||
- public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(2560)); // TODO this appears to be a duplicate setting with one above
|
||||
+ public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1024 : 2560)); // TODO this appears to be a duplicate setting with one above // Plazma - Optimize default configurations
|
||||
public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class
|
||||
}
|
||||
public boolean resolveSelectorsInBooks = false;
|
||||
@@ -267,7 +267,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -274,7 +274,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public class PacketLimiter extends ConfigurationPart {
|
||||
public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED);
|
||||
public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK);
|
||||
@@ -114,7 +114,7 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
|
||||
|
||||
@ConfigSerializable
|
||||
public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
|
||||
@@ -335,7 +343,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -342,7 +350,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
executor.setMaximumPoolSize(_chatExecutorMaxSize);
|
||||
}
|
||||
}
|
||||
@@ -124,10 +124,10 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
|
||||
public boolean loadPermissionsYmlBeforePlugins = true;
|
||||
@Constraints.Min(4)
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3e27d5ab5 100644
|
||||
index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae8368bec410b 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -96,12 +96,32 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -100,12 +100,32 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class AntiXray extends ConfigurationPart {
|
||||
public boolean enabled = false;
|
||||
@@ -163,7 +163,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
//<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
|
||||
Blocks.COPPER_ORE,
|
||||
Blocks.DEEPSLATE_COPPER_ORE,
|
||||
@@ -128,7 +148,28 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -132,7 +152,28 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
Blocks.ENDER_CHEST
|
||||
//</editor-fold>
|
||||
);
|
||||
@@ -193,7 +193,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,14 +192,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -155,14 +196,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public ArmorStands armorStands;
|
||||
|
||||
public class ArmorStands extends ConfigurationPart {
|
||||
@@ -211,16 +211,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
}
|
||||
|
||||
public Sniffer sniffer;
|
||||
@@ -181,7 +222,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@MergeMap
|
||||
public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
|
||||
@MergeMap
|
||||
- public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance())));
|
||||
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations
|
||||
@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)));
|
||||
|
||||
@@ -382,7 +423,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -407,7 +448,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Environment extends ConfigurationPart {
|
||||
public boolean disableThunder = false;
|
||||
public boolean disableIceAndSnow = false;
|
||||
@@ -229,7 +220,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
public boolean disableExplosionKnockback = false;
|
||||
public boolean generateFlatBedrock = false;
|
||||
public FrostedIce frostedIce;
|
||||
@@ -434,7 +475,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -463,7 +504,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public Fixes fixes;
|
||||
|
||||
public class Fixes extends ConfigurationPart {
|
||||
@@ -238,7 +229,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
public boolean disableUnloadedChunkEnderpearlExploit = true;
|
||||
public boolean preventTntFromMovingInWater = false;
|
||||
public boolean splitOverstackedLoot = true;
|
||||
@@ -462,9 +503,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -491,9 +532,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public class Collisions extends ConfigurationPart {
|
||||
public boolean onlyPlayersCollide = false;
|
||||
public boolean allowVehicleCollisions = true;
|
||||
@@ -250,7 +241,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
public boolean allowPlayerCrammingDamage = false;
|
||||
}
|
||||
|
||||
@@ -472,18 +513,41 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -501,18 +542,41 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Chunks extends ConfigurationPart {
|
||||
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
|
||||
@@ -300,7 +291,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
});
|
||||
public boolean flushRegionsOnSave = false;
|
||||
}
|
||||
@@ -498,9 +562,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -527,9 +591,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
public TickRates tickRates;
|
||||
|
||||
public class TickRates extends ConfigurationPart {
|
||||
@@ -312,7 +303,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
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));
|
||||
@@ -534,9 +598,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@@ -563,9 +627,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
|
||||
public class Misc extends ConfigurationPart {
|
||||
public int lightQueueSize = 20;
|
||||
@@ -321,9 +312,9 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
|
||||
public boolean showSignClickCommandFailureMsgsToPlayer = false;
|
||||
- public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
|
||||
+ public RedstoneImplementation redstoneImplementation = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? RedstoneImplementation.ALTERNATE_CURRENT : RedstoneImplementation.VANILLA; // Plazma - Optimize default configurations
|
||||
public AlternateCurrentUpdateOrder alternateCurrentUpdateOrder = AlternateCurrentUpdateOrder.HORIZONTAL_FIRST_OUTWARD;
|
||||
public boolean disableEndCredits = false;
|
||||
public float maxLeashDistance = 10f;
|
||||
public boolean disableSprintInterruptionOnAttack = false;
|
||||
public DoubleOr.Default maxLeashDistance = DoubleOr.Default.USE_DEFAULT;
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
|
||||
index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357d9c7d62a 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
|
||||
@@ -337,10 +328,10 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 29eef278940cab33a1f5f168f66ab2b80f0d60ce..b4d47c53bb2a5c75e9f69506dbd69a8817f368dc 100644
|
||||
index 2807a67ad42b35045ef9f607062403c376e0c4ef..7306b1fff556859ccb0a705621a1c7031ed52e29 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -151,7 +151,7 @@ public class Main {
|
||||
@@ -164,7 +164,7 @@ public class Main {
|
||||
File configFile = (File) optionset.valueOf("bukkit-settings");
|
||||
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile);
|
||||
configuration.options().copyDefaults(true);
|
||||
@@ -350,10 +341,10 @@ index 29eef278940cab33a1f5f168f66ab2b80f0d60ce..b4d47c53bb2a5c75e9f69506dbd69a88
|
||||
|
||||
File commandFile = (File) optionset.valueOf("commands-settings");
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939ac2966db 100644
|
||||
index e0a09827db002b87e738091d820f05a9a97f3edb..135476d68e4d9cb2d6a4cbe30e578e9e5fde90e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -131,14 +131,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
@@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
this.spawnMonsters = this.get("spawn-monsters", true);
|
||||
this.useNativeTransport = this.get("use-native-transport", true);
|
||||
this.enableCommandBlock = this.get("enable-command-block", false);
|
||||
@@ -372,7 +363,7 @@ index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939
|
||||
this.maxPlayers = this.get("max-players", 20);
|
||||
this.networkCompressionThreshold = this.get("network-compression-threshold", 256);
|
||||
this.broadcastRconToOps = this.get("broadcast-rcon-to-ops", true);
|
||||
@@ -146,7 +146,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
@@ -147,7 +147,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
this.maxWorldSize = this.get("max-world-size", (integer) -> {
|
||||
return Mth.clamp(integer, 1, 29999984);
|
||||
}, 29999984);
|
||||
@@ -382,10 +373,10 @@ index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939
|
||||
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
||||
this.enableStatus = this.get("enable-status", true);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 02037da80f2f3cada359bbe0f58160fd15761b77..8de087636686b78c12bc1c293258713ff7dddff0 100644
|
||||
index 0bd9f4dc28bb67def4af402f88b05a257262c0a4..52d9b6253e05cae57d44f340b33316eff113db2e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -428,7 +428,7 @@ public final class CraftServer implements Server {
|
||||
@@ -434,7 +434,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
this.configuration.options().copyDefaults(true);
|
||||
@@ -395,14 +386,14 @@ index 02037da80f2f3cada359bbe0f58160fd15761b77..8de087636686b78c12bc1c293258713f
|
||||
if (!this.configuration.isString("aliases")) {
|
||||
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 5942d0997f07bd51d934dac32cd349792a10643e..40a6ef72b4d495140c486c0880fdc5fc1a32931c 100644
|
||||
index b891735728e14c40c67e21897b5043efc7077b7f..1bb779d7c87dcd1a9c819b08e509f62df0559559 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -5,5 +5,6 @@ import static java.lang.Boolean.getBoolean;
|
||||
public interface Options {
|
||||
|
||||
@@ -8,5 +8,6 @@ public interface Options {
|
||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||
+ boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||
boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
||||
+ boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java
|
||||
@@ -426,18 +417,10 @@ index 09053b4ccf268fd204c81dbb8d4f10fa9edcad5f..93f67f125b3674e645cfdae27e579e12
|
||||
#### ENGLISH ####
|
||||
This is the %s configuration file for Plazma.
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f89ee46e24 100644
|
||||
index 546d920198acc2a7aea6e251a34d92d33cbaaee7..97fc4fb795fa2dc859b0ea02dc132b41300d56ed 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -49,6 +49,7 @@ public class PurpurConfig {
|
||||
+ "join us in our Discord guild.\n"
|
||||
+ "\n"
|
||||
+ "Website: https://purpurmc.org \n"
|
||||
+ + "Vanilla Food Properties: https://gist.github.com/BillyGalbreath/4fdfba991bd020e814eabf5143e3b225 \n" // Plazma
|
||||
+ "Docs: https://purpurmc.org/docs \n";
|
||||
private static File CONFIG_FILE;
|
||||
public static YamlConfiguration config;
|
||||
@@ -241,7 +242,7 @@ public class PurpurConfig {
|
||||
@@ -243,7 +243,7 @@ public class PurpurConfig {
|
||||
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
||||
}
|
||||
|
||||
@@ -446,7 +429,7 @@ index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f8
|
||||
private static void useAlternateKeepAlive() {
|
||||
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
||||
}
|
||||
@@ -481,7 +482,7 @@ public class PurpurConfig {
|
||||
@@ -492,7 +492,7 @@ public class PurpurConfig {
|
||||
}
|
||||
|
||||
public static boolean useUPnP = false;
|
||||
@@ -456,10 +439,10 @@ index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f8
|
||||
private static void networkSettings() {
|
||||
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1ac4df435 100644
|
||||
index 3bcbf5e2dbb991a8416d827ddfe59e04f701ebf7..1ff95cced54e8230eb5b4b4314f8f3716e264264 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -433,7 +433,7 @@ public class PurpurWorldConfig {
|
||||
@@ -424,7 +424,7 @@ public class PurpurWorldConfig {
|
||||
public boolean idleTimeoutTargetPlayer = true;
|
||||
public String playerDeathExpDropEquation = "expLevel * 7";
|
||||
public int playerDeathExpDropMax = 100;
|
||||
@@ -468,7 +451,7 @@ index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1
|
||||
public boolean teleportOnNetherCeilingDamage = false;
|
||||
public boolean totemOfUndyingWorksInInventory = false;
|
||||
public boolean playerFixStuckPortal = false;
|
||||
@@ -3135,7 +3135,7 @@ public class PurpurWorldConfig {
|
||||
@@ -3247,7 +3247,7 @@ public class PurpurWorldConfig {
|
||||
public boolean zombieJockeyOnlyBaby = true;
|
||||
public double zombieJockeyChance = 0.05D;
|
||||
public boolean zombieJockeyTryExistingChickens = true;
|
||||
@@ -478,23 +461,23 @@ index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1
|
||||
public boolean zombieTakeDamageFromWater = false;
|
||||
public boolean zombieAlwaysDropExp = false;
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5f39faabc 100644
|
||||
index 2c408fa4abcbe1171c58aee8799c8cf7867d0f0a..aadad0a1e3c7e20b0ab97095ee6e6fb7dbfbd234 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -150,14 +150,14 @@ public class SpigotWorldConfig
|
||||
public double itemMerge;
|
||||
private void itemMerge()
|
||||
{
|
||||
- this.itemMerge = this.getDouble("merge-radius.item", 2.5 );
|
||||
+ this.itemMerge = this.getDouble("merge-radius.item", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3.5 : 2.5 ); // Plazma - Optimize default configurations
|
||||
- this.itemMerge = this.getDouble("merge-radius.item", 0.5 );
|
||||
+ this.itemMerge = this.getDouble("merge-radius.item", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3.5 : 0.5); // Plazma - Optimize default configurations
|
||||
this.log( "Item Merge Radius: " + this.itemMerge );
|
||||
}
|
||||
|
||||
public double expMerge;
|
||||
private void expMerge()
|
||||
{
|
||||
- this.expMerge = this.getDouble("merge-radius.exp", 3.0 );
|
||||
+ this.expMerge = this.getDouble("merge-radius.exp", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4.0 : 3.0 ); // Plazma - Optimize default configurations
|
||||
- this.expMerge = this.getDouble("merge-radius.exp", -1 );
|
||||
+ this.expMerge = this.getDouble("merge-radius.exp", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4.0 : -1); // Plazma - Optimize default configurations
|
||||
this.log( "Experience Merge Radius: " + this.expMerge );
|
||||
}
|
||||
|
||||
@@ -507,47 +490,58 @@ index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5
|
||||
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
|
||||
}
|
||||
|
||||
@@ -207,26 +207,26 @@ public class SpigotWorldConfig
|
||||
@@ -207,27 +207,29 @@ public class SpigotWorldConfig
|
||||
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
|
||||
}
|
||||
|
||||
- public int animalActivationRange = 32;
|
||||
- public int monsterActivationRange = 32;
|
||||
+ public int animalActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations
|
||||
+ public int monsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 24 : 32; // Plazma - Optimize default configurations
|
||||
public int raiderActivationRange = 48;
|
||||
- public int raiderActivationRange = 64;
|
||||
- public int miscActivationRange = 16;
|
||||
+ public int miscActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations
|
||||
// Paper start
|
||||
- // Paper start
|
||||
- public int flyingMonsterActivationRange = 32;
|
||||
- public int waterActivationRange = 16;
|
||||
- public int villagerActivationRange = 32;
|
||||
+ public int flyingMonsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 48 : 32; // Plazma - Optimize default configurations
|
||||
+ public int waterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations
|
||||
+ public int villagerActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations
|
||||
public int wakeUpInactiveAnimals = 4;
|
||||
public int wakeUpInactiveAnimalsEvery = 60*20;
|
||||
- public int wakeUpInactiveAnimals = 4;
|
||||
- public int wakeUpInactiveAnimalsEvery = 60*20;
|
||||
- public int wakeUpInactiveAnimalsFor = 5*20;
|
||||
- public int wakeUpInactiveMonsters = 8;
|
||||
+ public int wakeUpInactiveAnimalsFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 40 : 100; // Plazma - Optimize default configurations
|
||||
+ public int wakeUpInactiveMonsters = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 8; // Plazma - Optimize default configurations
|
||||
public int wakeUpInactiveMonstersEvery = 20*20;
|
||||
- public int wakeUpInactiveMonstersEvery = 20*20;
|
||||
- public int wakeUpInactiveMonstersFor = 5*20;
|
||||
- public int wakeUpInactiveVillagers = 4;
|
||||
+ public int wakeUpInactiveMonstersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations
|
||||
+ public int wakeUpInactiveVillagers = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 4; // Plazma - Optimize default configurations
|
||||
public int wakeUpInactiveVillagersEvery = 30*20;
|
||||
- public int wakeUpInactiveVillagersEvery = 30*20;
|
||||
- public int wakeUpInactiveVillagersFor = 5*20;
|
||||
- public int wakeUpInactiveFlying = 8;
|
||||
+ public int wakeUpInactiveVillagersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 20 : 100; // Plazma - Optimize default configurations
|
||||
+ public int wakeUpInactiveFlying = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 8; // Plazma - Optimize default configurations
|
||||
public int wakeUpInactiveFlyingEvery = 10*20;
|
||||
- public int wakeUpInactiveFlyingEvery = 10*20;
|
||||
- public int wakeUpInactiveFlyingFor = 5*20;
|
||||
+ public int wakeUpInactiveFlyingFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations
|
||||
public int villagersWorkImmunityAfter = 5*20;
|
||||
- public int villagersWorkImmunityAfter = 5*20;
|
||||
+ // Plazma start - Optimize default configurations
|
||||
+ public int animalActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32;
|
||||
+ public int monsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 24 : 32;
|
||||
+ public int raiderActivationRange = 64; // diff on changes
|
||||
+ public int miscActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16;
|
||||
+ // Paper start // diff on changes
|
||||
+ public int flyingMonsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 48 : 32;
|
||||
+ public int waterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16;
|
||||
+ public int villagerActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32;
|
||||
+ public int wakeUpInactiveAnimals = 4; // diff on changes
|
||||
+ public int wakeUpInactiveAnimalsEvery = 1200;
|
||||
+ public int wakeUpInactiveAnimalsFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 40 : 100;
|
||||
+ public int wakeUpInactiveMonsters = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 8;
|
||||
+ public int wakeUpInactiveMonstersEvery = 400;
|
||||
+ public int wakeUpInactiveMonstersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100;
|
||||
+ public int wakeUpInactiveVillagers = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 4;
|
||||
+ public int wakeUpInactiveVillagersEvery = 600;
|
||||
+ public int wakeUpInactiveVillagersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 20 : 100;
|
||||
+ public int wakeUpInactiveFlying = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 8;
|
||||
+ public int wakeUpInactiveFlyingEvery = 200;
|
||||
+ public int wakeUpInactiveFlyingFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100;
|
||||
+ public int villagersWorkImmunityAfter = 100;
|
||||
+ // Plazma end - Optimize default configurations
|
||||
public int villagersWorkImmunityFor = 20;
|
||||
public boolean villagersActiveForPanic = true;
|
||||
@@ -299,7 +299,7 @@ public class SpigotWorldConfig
|
||||
// Paper end
|
||||
@@ -299,7 +301,7 @@ public class SpigotWorldConfig
|
||||
{
|
||||
this.set( "ticks-per.hopper-check", 1 );
|
||||
}
|
||||
@@ -556,7 +550,7 @@ index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5
|
||||
this.hopperAmount = this.getInt( "hopper-amount", 1 );
|
||||
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 );
|
||||
@@ -309,7 +309,7 @@ public class SpigotWorldConfig
|
||||
@@ -309,7 +311,7 @@ public class SpigotWorldConfig
|
||||
public int tridentDespawnRate;
|
||||
private void arrowDespawnRate()
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Add an option to apply the configuration to the vanilla
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 8445a0b25d647b2c1f9a44f849084cdec0842e18..86822868e47b269891a71fdc04371b1e28a2752e 100644
|
||||
index d417b773dec5f2c4a8e115864338612d8e4b9f6c..f89ae1a542120eb01c028a1a1f0771ac211bcd49 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -89,7 +89,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -19,10 +19,10 @@ index 8445a0b25d647b2c1f9a44f849084cdec0842e18..86822868e47b269891a71fdc04371b1e
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 8de087636686b78c12bc1c293258713ff7dddff0..60da66fea37f8b9f68a543ff6cdb844a32d654ad 100644
|
||||
index 52d9b6253e05cae57d44f340b33316eff113db2e..47cbac24d704a047f56a98c9eb0f8a8b2001ae48 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -428,7 +428,19 @@ public final class CraftServer implements Server {
|
||||
@@ -434,7 +434,19 @@ public final class CraftServer implements Server {
|
||||
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
this.configuration.options().copyDefaults(true);
|
||||
@@ -44,22 +44,22 @@ index 8de087636686b78c12bc1c293258713ff7dddff0..60da66fea37f8b9f68a543ff6cdb844a
|
||||
if (!this.configuration.isString("aliases")) {
|
||||
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 40a6ef72b4d495140c486c0880fdc5fc1a32931c..3e0e67c089e269d0bccd4a0d2de5ac1ac515997e 100644
|
||||
index 1bb779d7c87dcd1a9c819b08e509f62df0559559..a8711b8a66b443d40cad8dfec31cca357e0877b4 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -6,5 +6,7 @@ public interface Options {
|
||||
|
||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
+ boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||
+ boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||
@@ -9,5 +9,7 @@ public interface Options {
|
||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||
boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
||||
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
+ boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||
+ boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb134553f651d1 100644
|
||||
index 4dbb109d0526afee99b9190fc256585121aac9b5..3835a7aa3e3c60a6f50f1d6e781f280ea8a83fb3 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -197,8 +197,8 @@ public class SpigotConfig
|
||||
@@ -193,8 +193,8 @@ public class SpigotConfig
|
||||
public static String whitelistMessage;
|
||||
public static String unknownCommandMessage;
|
||||
public static String serverFullMessage;
|
||||
@@ -70,7 +70,7 @@ index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb1345
|
||||
private static String transform(String s)
|
||||
{
|
||||
return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\\\n", "\n" );
|
||||
@@ -211,9 +211,9 @@ public class SpigotConfig
|
||||
@@ -207,9 +207,9 @@ public class SpigotConfig
|
||||
SpigotConfig.set( "messages.outdated-server", SpigotConfig.outdatedServerMessage );
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb1345
|
||||
SpigotConfig.outdatedClientMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-client", SpigotConfig.outdatedClientMessage ) );
|
||||
SpigotConfig.outdatedServerMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-server", SpigotConfig.outdatedServerMessage ) );
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public class SpigotConfig
|
||||
@@ -223,7 +223,7 @@ public class SpigotConfig
|
||||
SpigotConfig.timeoutTime = SpigotConfig.getInt( "settings.timeout-time", SpigotConfig.timeoutTime );
|
||||
SpigotConfig.restartOnCrash = SpigotConfig.getBoolean( "settings.restart-on-crash", SpigotConfig.restartOnCrash );
|
||||
SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript );
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Tweak console logging
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5c3498632 100644
|
||||
index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99cdc27da6 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -193,16 +193,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -197,16 +197,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||
}
|
||||
|
||||
@@ -25,13 +25,12 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
|
||||
DedicatedServer.LOGGER.info("Loading properties");
|
||||
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
|
||||
|
||||
@@ -226,6 +216,17 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -238,6 +228,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
net.sparklypower.sparklypaper.HalloweenManager.startSyncEpochTask(); // Plazma - Port SparklyPaper patches; Optimize Spooky Season
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
+ // Plazma - Tweak console logging; Moved down
|
||||
+ // Paper start - detect running as root
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.rootUserWarnings && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
+ // Paper start - detect running as root // Plazma - Tweak console logging (moved down)
|
||||
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
|
||||
+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
|
||||
@@ -39,11 +38,10 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
|
||||
+ DedicatedServer.LOGGER.warn("****************************");
|
||||
+ }
|
||||
+ // Paper end - detect running as root
|
||||
+ // Plazma end - Tweak console logging
|
||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
this.getProfileCache().save(false); // Paper
|
||||
@@ -333,6 +334,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -338,6 +337,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||
// Paper end - Add Velocity IP Forwarding Support
|
||||
@@ -51,7 +49,7 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
|
||||
if (!this.usesAuthentication()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -346,7 +348,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -351,7 +351,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||
}
|
||||
// Spigot end
|
||||
@@ -61,10 +59,10 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index b863f6fe65c796a1d3102cc3eddb5d6c5becd3ac..c36ebab552c480d34e7fd48a45f0a320a97b9677 100644
|
||||
index 0ea07da1b4bd420cd6765577b4719a2368b5740c..f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1497,6 +1497,7 @@ public abstract class PlayerList {
|
||||
@@ -1462,6 +1462,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
@@ -73,10 +71,10 @@ index b863f6fe65c796a1d3102cc3eddb5d6c5becd3ac..c36ebab552c480d34e7fd48a45f0a320
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 73dd69941a004b4a2ec244f28d8683e9bdb0a445..e725f6e8205976a7b137aefb98b874cf4ae14893 100644
|
||||
index 57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb..3ec9c947ac19412ad81d0cc85e0eff289a285d1e 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -68,4 +68,13 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -63,4 +63,13 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Add missing purpur configuration options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
index 569f42645a7730451944fbbd6b96910493feeca5..a14d2ec3b8c89045916b95da5ce2a18d1e866bcf 100644
|
||||
index 62c62fd26660d8405378340315042d7b95ac7046..771fe01b262e951f1350e4997f4cba1b35c79945 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -150,6 +150,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
@@ -158,6 +158,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.allayMaxHealth);
|
||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.allayScale);
|
||||
}
|
||||
+
|
||||
+ // Plazma start - Add missing purpur configuration options
|
||||
@@ -23,20 +23,15 @@ index 569f42645a7730451944fbbd6b96910493feeca5..a14d2ec3b8c89045916b95da5ce2a18d
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.allayAlwaysDropExp;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void initAttributes() {
|
||||
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.allayMaxHealth);
|
||||
+ }
|
||||
+ // Plazma end - Add missing purpur configuration options
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index 24a1663cf1cd3f888981a13907811b55bdbf6133..fdc3aa9672077787e841d240fe1e690dcd9ca321 100644
|
||||
index e88d6d691bb176e33afeb294d735dfb2cbac12ff..00803dcc2d990046013b8a175af20359883a15fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -93,6 +93,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
@@ -96,6 +96,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
public int getPurpurBreedTime() {
|
||||
return this.level().purpurConfig.camelBreedingTicks;
|
||||
}
|
||||
@@ -51,7 +46,7 @@ index 24a1663cf1cd3f888981a13907811b55bdbf6133..fdc3aa9672077787e841d240fe1e690d
|
||||
+ public boolean isAlwaysExperienceDropper() {
|
||||
+ return level().purpurConfig.camelAlwaysDropExp;
|
||||
+ }
|
||||
+ // Plazma end - Add missing purpur configuration optionsurpur end
|
||||
+ // Plazma end - Add missing purpur configuration options
|
||||
// Purpur end
|
||||
|
||||
@Override
|
||||
@@ -84,7 +79,7 @@ index 4c861b18fbfbae3cb2f1e3563393cfcf4005591c..651f30b4fb02dc03fabad34b62d7d86f
|
||||
|
||||
public int getPurpurBreedTime() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
index 64d0e2edf0e47bfe3bc5fbdbabac26c494110467..e077a0bffedd0bb11c9ab5eb507451a0cf6317ea 100644
|
||||
index 5cd69dd546f42e80a3d3e3a674f65c2ac39f3af9..1abf23fb16391087d41d8a180a17e394dd1a7dd0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish {
|
||||
@@ -112,10 +107,10 @@ index 64d0e2edf0e47bfe3bc5fbdbabac26c494110467..e077a0bffedd0bb11c9ab5eb507451a0
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
index 21bdcbd51d9f440e0734750b40cefa4c08cdaf5f..a2cc1efaa621861828b007759536ac49d7e3646e 100644
|
||||
index b6f5281705ce4c7a755e3818cf6c4a2235a024f9..bc931f54d1087f2515b8185368ade3e8dd55a00d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -119,6 +119,18 @@ public class Sniffer extends Animal {
|
||||
@@ -120,6 +120,18 @@ public class Sniffer extends Animal {
|
||||
public int getPurpurBreedTime() {
|
||||
return this.level().purpurConfig.snifferBreedingTicks;
|
||||
}
|
||||
@@ -135,10 +130,10 @@ index 21bdcbd51d9f440e0734750b40cefa4c08cdaf5f..a2cc1efaa621861828b007759536ac49
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index 722e1fed4b333958e95a847b27cfc67d04f13263..16891921341f8967c9115f415f91ec379fcd5b0c 100644
|
||||
index 8e24cd9ed03e2f11da6f4fb2dd58dd9b9e5d7a06..c0398f21cb2ecc9e07f01163a4432a603ff26f03 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -147,6 +147,23 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
@@ -148,6 +148,23 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||
}
|
||||
@@ -163,7 +158,7 @@ index 722e1fed4b333958e95a847b27cfc67d04f13263..16891921341f8967c9115f415f91ec37
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
index e0aec3b3e04d603dc208029554f981c6b9e6b43e..337702c8042d44d4be6be1341023d0779cfaa580 100644
|
||||
index c14019a131c90c699b8a76bada82592b66f0fa89..8b9f78b3b0e00a859f3106fe383352863027f51e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
@@ -45,12 +45,12 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
@@ -181,7 +176,7 @@ index e0aec3b3e04d603dc208029554f981c6b9e6b43e..337702c8042d44d4be6be1341023d077
|
||||
this.setPos(d0, d1, d2);
|
||||
this.xo = d0;
|
||||
this.yo = d1;
|
||||
@@ -170,7 +170,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
@@ -177,7 +177,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
@@ -191,10 +186,10 @@ index e0aec3b3e04d603dc208029554f981c6b9e6b43e..337702c8042d44d4be6be1341023d077
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883bab64971 100644
|
||||
index 97fc4fb795fa2dc859b0ea02dc132b41300d56ed..cd8194b08457d38b942631e0e6450264615f9427 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -329,6 +329,7 @@ public class PurpurConfig {
|
||||
@@ -330,6 +330,7 @@ public class PurpurConfig {
|
||||
}
|
||||
|
||||
public static int barrelRows = 3;
|
||||
@@ -202,7 +197,7 @@ index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883
|
||||
public static boolean enderChestSixRows = false;
|
||||
public static boolean enderChestPermissionRows = false;
|
||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||
@@ -369,6 +370,7 @@ public class PurpurConfig {
|
||||
@@ -372,6 +373,7 @@ public class PurpurConfig {
|
||||
case 1 -> 9;
|
||||
default -> 27;
|
||||
});
|
||||
@@ -211,26 +206,24 @@ index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883
|
||||
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
||||
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57f9f5f25f 100644
|
||||
index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424568366d9 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1178,7 +1178,15 @@ public class PurpurWorldConfig {
|
||||
public boolean allayRidable = false;
|
||||
public boolean allayRidableInWater = true;
|
||||
@@ -1135,7 +1135,13 @@ public class PurpurWorldConfig {
|
||||
public boolean allayControllable = true;
|
||||
public double allayMaxHealth = 20.0D;
|
||||
public double allayScale = 1.0D;
|
||||
+ // Plazma start - Add missing purpur config options
|
||||
+ public double allayMaxHealth = 20.0D;
|
||||
+ public boolean allayTakeDamageFromWater = false;
|
||||
+ public boolean allayAlwaysDropExp = false;
|
||||
private void allaySettings() {
|
||||
+ allayMaxHealth = getDouble("mobs.allay.max-health", allayMaxHealth);
|
||||
+ allayTakeDamageFromWater = getBoolean("mobs.allay.take-damage-from-water", allayTakeDamageFromWater);
|
||||
+ allayAlwaysDropExp = getBoolean("mobs.allay.always-drop-exp", allayAlwaysDropExp);
|
||||
+ // Plazma end - Add missing purpur configuration options
|
||||
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
|
||||
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
|
||||
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
|
||||
@@ -1295,7 +1303,13 @@ public class PurpurWorldConfig {
|
||||
@@ -1290,7 +1296,13 @@ public class PurpurWorldConfig {
|
||||
public double camelMovementSpeedMin = 0.09D;
|
||||
public double camelMovementSpeedMax = 0.09D;
|
||||
public int camelBreedingTicks = 6000;
|
||||
@@ -244,7 +237,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
|
||||
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
|
||||
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
|
||||
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
|
||||
@@ -1723,7 +1737,15 @@ public class PurpurWorldConfig {
|
||||
@@ -1744,7 +1756,15 @@ public class PurpurWorldConfig {
|
||||
public boolean frogControllable = true;
|
||||
public float frogRidableJumpHeight = 0.65F;
|
||||
public int frogBreedingTicks = 6000;
|
||||
@@ -260,9 +253,9 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
|
||||
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
|
||||
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
|
||||
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
|
||||
@@ -2676,7 +2698,13 @@ public class PurpurWorldConfig {
|
||||
public boolean snifferControllable = true;
|
||||
@@ -2756,7 +2776,13 @@ public class PurpurWorldConfig {
|
||||
public double snifferMaxHealth = 14.0D;
|
||||
public double snifferScale = 1.0D;
|
||||
public int snifferBreedingTicks = 6000;
|
||||
+ // Plazma start - Add missing purpur config options
|
||||
+ public boolean snifferTakeDamageFromWater = false;
|
||||
@@ -274,7 +267,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
|
||||
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
|
||||
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
|
||||
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
|
||||
@@ -2775,7 +2803,15 @@ public class PurpurWorldConfig {
|
||||
@@ -2864,7 +2890,15 @@ public class PurpurWorldConfig {
|
||||
public boolean tadpoleRidable = false;
|
||||
public boolean tadpoleRidableInWater = true;
|
||||
public boolean tadpoleControllable = true;
|
||||
@@ -290,7 +283,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
|
||||
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
|
||||
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
|
||||
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
|
||||
@@ -2991,7 +3027,15 @@ public class PurpurWorldConfig {
|
||||
@@ -3092,7 +3126,15 @@ public class PurpurWorldConfig {
|
||||
public boolean wardenRidable = false;
|
||||
public boolean wardenRidableInWater = true;
|
||||
public boolean wardenControllable = true;
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add option to change nether portal size
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
index afe6b2170846273b41b694aa53dca4c31bf78b3f..52043e451ca0641c93205aac62aba5427625b81f 100644
|
||||
index 6c07fc507df6070854f5950a8616d2949c040656..19f58609aedecec1ea1a552c135a0b4199ab5c2a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||
@@ -99,7 +99,7 @@ public class PortalShape {
|
||||
@@ -97,7 +97,7 @@ public class PortalShape {
|
||||
private int calculateWidth() {
|
||||
int i = this.getDistanceUntilEdgeAboveFrame(this.bottomLeft, this.rightDir);
|
||||
|
||||
@@ -17,7 +17,7 @@ index afe6b2170846273b41b694aa53dca4c31bf78b3f..52043e451ca0641c93205aac62aba542
|
||||
}
|
||||
|
||||
private int getDistanceUntilEdgeAboveFrame(BlockPos pos, Direction direction) {
|
||||
@@ -132,7 +132,7 @@ public class PortalShape {
|
||||
@@ -130,7 +130,7 @@ public class PortalShape {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
int i = this.getDistanceUntilTop(blockposition_mutableblockposition);
|
||||
|
||||
@@ -26,7 +26,7 @@ index afe6b2170846273b41b694aa53dca4c31bf78b3f..52043e451ca0641c93205aac62aba542
|
||||
}
|
||||
|
||||
private boolean hasTopFrame(BlockPos.MutableBlockPos pos, int height) {
|
||||
@@ -186,7 +186,7 @@ public class PortalShape {
|
||||
@@ -184,7 +184,7 @@ public class PortalShape {
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
@@ -34,9 +34,9 @@ index afe6b2170846273b41b694aa53dca4c31bf78b3f..52043e451ca0641c93205aac62aba542
|
||||
+ return this.bottomLeft != null && this.width >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.min() && this.width <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.max() && this.height >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.min() && this.height <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.max(); // Plazma - Configurable nether portal size
|
||||
}
|
||||
|
||||
// CraftBukkit start - return boolean
|
||||
// CraftBukkit start - return boolean, add entity
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 069a9f8504c74d939b1df569f082cc7bd33d9cfc..b5b4229ccdecd63bd3e689e8247e44341d7c30cc 100644
|
||||
index 8dce68cf7769fcd5ea03be32621ccb6bab174697..7bd566d6e15385850930a6c0b44d1d495a671e81 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -42,6 +42,21 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -7,10 +7,10 @@ Subject: [PATCH] Apply various optimizations
|
||||
Akarin - Swaps the predicate order of collision
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index f7201a74f66892c9d93616e9afb99d9499f0cdbc..3a9d8e64d0a02a40a89cd82e014ed1bebcd6b8b3 100644
|
||||
index 7aadcaa1785c6560eb1ce2f1179225facca47d84..2adc6f3400a2b914176d0ae0a85c479b00289fb4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2209,8 +2209,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2211,8 +2211,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public void playerTouch(Player player) {}
|
||||
|
||||
public void push(Entity entity) {
|
||||
@@ -21,7 +21,7 @@ index f7201a74f66892c9d93616e9afb99d9499f0cdbc..3a9d8e64d0a02a40a89cd82e014ed1be
|
||||
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
||||
double d0 = entity.getX() - this.getX();
|
||||
double d1 = entity.getZ() - this.getZ();
|
||||
@@ -2238,8 +2239,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2240,8 +2241,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
entity.push(d0, 0.0D, d1);
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,10 @@ index 04f67f7b43d2f461c776c76614dc3e5f060aea63..b3fe0dd152b3e2e1b83b4ec2270d387e
|
||||
FluidState fluid = world.getFluidState(blockposition1);
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 33544c734798d9fa1954c7806420f1e0b3653898..b83a1058484e3d4d46f91d659f795f59d7087b72 100644
|
||||
index 7bd566d6e15385850930a6c0b44d1d495a671e81..d5e7d74b0e203c9f2c03c9b4f8d1b9c57168e61f 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -32,6 +32,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
public Phantom phantom;
|
||||
public class Phantom extends ConfigurationPart {
|
||||
|
||||
@@ -1,319 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Wed, 27 Sep 2023 21:18:22 +0900
|
||||
Subject: [PATCH] Reduce create random instance
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 703e3720cf28c669000b663cba56b070ac4ed96a..4782f19409d300fbcaa952ae0dd6a0577ade5f7b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -232,6 +232,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@Nullable
|
||||
private ServerStatus.Favicon statusIcon;
|
||||
private final RandomSource random;
|
||||
+ public static RandomSource random() { return getServer().random; } // Plazma - Expose random
|
||||
public final DataFixer fixerUpper;
|
||||
private String localIp;
|
||||
private int port;
|
||||
diff --git a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
index b47a8a082170bcb630c4354be7c77a4cac71d105..7fe6b99e146e7374cd29534f1e89046edd340a82 100644
|
||||
--- a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
+++ b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
|
||||
@@ -66,7 +66,7 @@ public class SpreadPlayersCommand {
|
||||
if (maxY < j) {
|
||||
throw SpreadPlayersCommand.ERROR_INVALID_MAX_HEIGHT.create(maxY, j);
|
||||
} else {
|
||||
- RandomSource randomsource = RandomSource.create();
|
||||
+ RandomSource randomsource = worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
|
||||
double d0 = (double) (center.x - maxRange);
|
||||
double d1 = (double) (center.y - maxRange);
|
||||
double d2 = (double) (center.x + maxRange);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 4a29e90ff2a0fe9c5be094400d79ab89e61c437d..582cdbb7e2f25cdc533721e45a89ae15a8b05b8a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -483,7 +483,7 @@ public class ServerPlayer extends Player {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.getCoprime(i1);
|
||||
- int k1 = RandomSource.create().nextInt(i1);
|
||||
+ int k1 = (worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
@@ -520,7 +520,7 @@ public class ServerPlayer extends Player {
|
||||
long l = k * k;
|
||||
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
|
||||
int j1 = this.getCoprime(i1);
|
||||
- int k1 = RandomSource.create().nextInt(i1);
|
||||
+ int k1 = (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
|
||||
|
||||
for (int l1 = 0; l1 < i1; ++l1) {
|
||||
int i2 = (k1 + j1 * l1) % i1;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 3b4fadb37eafb2f7b0ce4d6b276d2fdaa8287521..ba041288f9619870ab08c2956262d35eed85b44b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -91,7 +91,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
this.serverId = "";
|
||||
this.server = server;
|
||||
this.connection = connection;
|
||||
- this.challenge = Ints.toByteArray(RandomSource.create().nextInt());
|
||||
+ this.challenge = Ints.toByteArray((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? MinecraftServer.random() : RandomSource.create()).nextInt()); // Plazma - Reduce create random instance
|
||||
this.transferred = transferred;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
index 0e0867d7add9a024bbe9471f8ff92bbb25996a3d..c0fad810538ede0f248898db2e68625b96e56c16 100644
|
||||
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
|
||||
@@ -341,7 +341,7 @@ public class QueryThreadGs4 extends GenericThread {
|
||||
this.identBytes[2] = bs[5];
|
||||
this.identBytes[3] = bs[6];
|
||||
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
|
||||
- this.challenge = RandomSource.create().nextInt(16777216);
|
||||
+ this.challenge = (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create()).nextInt(16777216); // Plazma - Reduce create random instance
|
||||
this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
index 3fac11bf02652b5f51f30f99bdf516504467d0d2..9d939624756e8a7a07a787f9807f095c5033b234 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.util.RandomSource;
|
||||
|
||||
public class ShufflingList<U> implements Iterable<U> {
|
||||
protected final List<ShufflingList.WeightedEntry<U>> entries;
|
||||
- private final RandomSource random = RandomSource.create();
|
||||
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - Reduce create random instance
|
||||
private final boolean isUnsafe; // Paper - Fix Concurrency issue in ShufflingList during worldgen
|
||||
|
||||
public ShufflingList() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||
index 09a7b418ddf564c0be13297f7c216db2e7ae1578..703006eb5df8099c4f51cdb4e41f95cacfbe43a6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
|
||||
|
||||
public abstract class Sensor<E extends LivingEntity> {
|
||||
- private static final RandomSource RANDOM = RandomSource.createThreadSafe();
|
||||
+ private static final RandomSource RANDOM = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom && org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.createThreadSafe(); // Plazma - Reduce create random instance
|
||||
private static final int DEFAULT_SCAN_RATE = 20;
|
||||
protected static final int TARGETING_RANGE = 16;
|
||||
private static final TargetingConditions TARGET_CONDITIONS = TargetingConditions.forNonCombat().range(16.0);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
||||
index 3d792957f27fd4bdfad8d76262a8e2a2012bf35f..71539b5910692489cad6f78ac90f3aabc4e58236 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
|
||||
@@ -33,7 +33,7 @@ public class AngerManagement {
|
||||
@VisibleForTesting
|
||||
protected static final int MAX_ANGER = 150;
|
||||
private static final int DEFAULT_ANGER_DECREASE = 1;
|
||||
- private int conversionDelay = Mth.randomBetweenInclusive(RandomSource.create(), 0, 2);
|
||||
+ private int conversionDelay = Mth.randomBetweenInclusive((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create()), 0, 2); // Plazma - Reduce create random instance
|
||||
int highestAnger;
|
||||
private static final Codec<Pair<UUID, Integer>> SUSPECT_ANGER_PAIR = RecordCodecBuilder.create(
|
||||
instance -> instance.group(
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
index 96e9fce5f9084737d2fcf4deb83305733b480179..43da8ea227b2b01d6975a3f4f209099d350386f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
|
||||
@@ -32,7 +32,7 @@ public class WanderingTraderSpawner implements CustomSpawner {
|
||||
private static final int SPAWN_CHANCE_INCREASE = 25;
|
||||
private static final int SPAWN_ONE_IN_X_CHANCE = 10;
|
||||
private static final int NUMBER_OF_SPAWN_ATTEMPTS = 10;
|
||||
- private final RandomSource random = RandomSource.create();
|
||||
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - reduce create random instace
|
||||
private final ServerLevelData serverLevelData;
|
||||
private int tickDelay;
|
||||
private int spawnDelay;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 7dd5e0b935d98d552c916f8412569ff4aa0e9b04..4d0f209df602f017500c1d56423fa482423f9702 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -87,7 +87,7 @@ public class FishingHook extends Projectile {
|
||||
|
||||
private FishingHook(EntityType<? extends FishingHook> type, Level world, int luckOfTheSeaLevel, int lureLevel) {
|
||||
super(type, world);
|
||||
- this.syncronizedRandom = RandomSource.create();
|
||||
+ this.syncronizedRandom = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
|
||||
this.openWater = true;
|
||||
this.currentState = FishingHook.FishHookState.FLYING;
|
||||
this.noCulling = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
index fdff9788eaf663be79214b2ca491f0f0444f6136..de50b06f13df481fa59e1abe16d5181b8124b427 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
||||
@@ -118,7 +118,7 @@ public class Raid {
|
||||
|
||||
public Raid(int id, ServerLevel world, BlockPos pos) {
|
||||
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
|
||||
- this.random = RandomSource.create();
|
||||
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
||||
this.waveSpawnPos = Optional.empty();
|
||||
this.id = id;
|
||||
this.level = world;
|
||||
@@ -132,7 +132,7 @@ public class Raid {
|
||||
|
||||
public Raid(ServerLevel world, CompoundTag nbt) {
|
||||
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
|
||||
- this.random = RandomSource.create();
|
||||
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
||||
this.waveSpawnPos = Optional.empty();
|
||||
this.level = world;
|
||||
this.id = nbt.getInt("Id");
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
index 6d28f1097caa3e37c2917eb401018ebf48c13a39..9397f1fa3b53423deabbedc6f7bb0f98d68c89a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
|
||||
@@ -96,7 +96,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
|
||||
}
|
||||
// Purpur end
|
||||
};
|
||||
- this.random = RandomSource.create();
|
||||
+ this.random = playerInventory.player.level().plazmaConfig().misc.reduceRandom ? playerInventory.player.level().random : RandomSource.create(); // Plazma - Reduce create random instace
|
||||
this.enchantmentSeed = DataSlot.standalone();
|
||||
this.costs = new int[3];
|
||||
this.enchantClue = new int[]{-1, -1, -1};
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 0022263a41b74fc339c5a5629aee3cd2cd05c5ae..0b553c9e90b53cdf84b14a5d5d20dc3cf1ffb44f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -93,7 +93,7 @@ public class Explosion {
|
||||
}
|
||||
|
||||
public Explosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent) {
|
||||
- this.random = RandomSource.create();
|
||||
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
|
||||
this.toBlow = new ObjectArrayList();
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 0a0ab76144aa7d0970638924878f1eb130b2e3e3..a2ffd16c9351c484f0163f19f9352cd643f9b437 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -121,16 +121,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Thread thread;
|
||||
private final boolean isDebug;
|
||||
private int skyDarken;
|
||||
- protected int randValue = RandomSource.create().nextInt();
|
||||
protected final int addend = 1013904223;
|
||||
protected float oRainLevel;
|
||||
public float rainLevel;
|
||||
protected float oThunderLevel;
|
||||
public float thunderLevel;
|
||||
public final RandomSource random = RandomSource.create();
|
||||
+ protected int randValue = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? random.nextInt() : RandomSource.create().nextInt(); // Plazma - Reduce create random instace
|
||||
/** @deprecated */
|
||||
@Deprecated
|
||||
- private final RandomSource threadSafeRandom = RandomSource.createThreadSafe();
|
||||
+ private final RandomSource threadSafeRandom = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? random : RandomSource.createThreadSafe(); // Plazma - Reduce create random instace
|
||||
private final Holder<DimensionType> dimensionTypeRegistration;
|
||||
public final WritableLevelData levelData;
|
||||
// private final Supplier<ProfilerFiller> profiler; // Plazma - Completely remove Mojang's Profiler
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
index fb9611866671880fc7a1a969da928b8f2ad15269..44962ecedf724e941e59913188afe4cfad252fc8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
@@ -357,7 +357,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
}
|
||||
|
||||
private static void spawnGatewayPortal(ServerLevel world, BlockPos pos, EndGatewayConfiguration config) {
|
||||
- Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), RandomSource.create(), pos);
|
||||
+ Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instance
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
||||
index a6b6e5ea191c0e2cd7a2e4f01b89d8af40a83c1b..19769ac9fa688969fd2db7c9a5e92eaadac124c4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
|
||||
@@ -224,7 +224,7 @@ public class ChunkGeneratorStructureState {
|
||||
List<CompletableFuture<ChunkPos>> list = new ArrayList(j);
|
||||
int k = placement.spread();
|
||||
HolderSet<Biome> holderset = placement.preferredBiomes();
|
||||
- RandomSource randomsource = RandomSource.create();
|
||||
+ RandomSource randomsource = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - Reduce create random instace
|
||||
|
||||
// Paper start - Add missing structure set seed configs
|
||||
if (this.conf.strongholdSeed != null && structureSetEntry.is(net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
||||
index 7bbe93966fa00b7001da53bf2f22f4d942b7cc22..6c5eececc83571b0f60e7f672ed185e1d262e99c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
|
||||
@@ -81,7 +81,7 @@ public enum DragonRespawnAnimation {
|
||||
world.explode((Entity) null, (double) ((float) worldgenender_spike.getCenterX() + 0.5F), (double) worldgenender_spike.getHeight(), (double) ((float) worldgenender_spike.getCenterZ() + 0.5F), 5.0F, Level.ExplosionInteraction.BLOCK);
|
||||
SpikeConfiguration worldgenfeatureendspikeconfiguration = new SpikeConfiguration(true, ImmutableList.of(worldgenender_spike), new BlockPos(0, 128, 0));
|
||||
|
||||
- Feature.END_SPIKE.place(worldgenfeatureendspikeconfiguration, world, world.getChunkSource().getGenerator(), RandomSource.create(), new BlockPos(worldgenender_spike.getCenterX(), 45, worldgenender_spike.getCenterZ()));
|
||||
+ Feature.END_SPIKE.place(worldgenfeatureendspikeconfiguration, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), new BlockPos(worldgenender_spike.getCenterX(), 45, worldgenender_spike.getCenterZ())); // Plazma - Reduce create random instance
|
||||
}
|
||||
} else if (flag1) {
|
||||
fight.setRespawnStage(SUMMONING_DRAGON); // CraftBukkit - decompile error
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 18a1b4325cac81b040596071dab99ef9bf6f3142..ab492b184a4ecdefc423823fc72abd800b71f016 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -472,7 +472,7 @@ public class EndDragonFight {
|
||||
this.level.registryAccess().registry(Registries.CONFIGURED_FEATURE).flatMap((iregistry) -> {
|
||||
return iregistry.getHolder(EndFeatures.END_GATEWAY_DELAYED);
|
||||
}).ifPresent((holder_c) -> {
|
||||
- ((ConfiguredFeature) holder_c.value()).place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos);
|
||||
+ holder_c.value().place(this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instace
|
||||
});
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ public class EndDragonFight {
|
||||
this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
|
||||
}
|
||||
// Paper end - Prevent "softlocked" exit portal generation
|
||||
- if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation)) {
|
||||
+ if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), this.portalLocation)) { // Plazma - Reduce create random instace
|
||||
int i = Mth.positiveCeilDiv(4, 16);
|
||||
|
||||
this.level.getChunkSource().chunkMap.waitForLightBeforeSending(new ChunkPos(this.portalLocation), i);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index 95e35c223f2ad9b6de6749544abd68de71e4f1ab..492e0c1d00e8098d9a974f46c087a404ec67764e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@@ -14,11 +14,12 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class CraftFirework extends CraftProjectile implements Firework {
|
||||
|
||||
- private final Random random = new Random();
|
||||
+ private final net.minecraft.util.RandomSource random; // Plazma - Reduce create random instance
|
||||
//private CraftItemStack item; // Paper - Remove usage, not accurate representation of current item.
|
||||
|
||||
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
|
||||
super(server, entity);
|
||||
+ this.random = this.getHandle().level().plazmaConfig().misc.reduceRandom ? this.getHandle().level().getRandom() : net.minecraft.util.RandomSource.create(); // Plazma - Reduce create random instance
|
||||
|
||||
// Paper start - Expose firework item directly
|
||||
// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM);
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index e725f6e8205976a7b137aefb98b874cf4ae14893..dad5379066140b1eadab0a283cc7d8c019d8f4b6 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -65,6 +65,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Miscellaneous misc;
|
||||
public class Miscellaneous extends ConfigurationPart {
|
||||
|
||||
+ public boolean reduceRandom = OPTIMIZE;
|
||||
+ public boolean ignoreThreadSafeRandom = false;
|
||||
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index b5b4229ccdecd63bd3e689e8247e44341d7c30cc..33544c734798d9fa1954c7806420f1e0b3653898 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -22,6 +22,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
public Miscellaneous misc;
|
||||
public class Miscellaneous extends ConfigurationPart {
|
||||
|
||||
+ public boolean reduceRandom = OPTIMIZE;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 176e54f1c5f4feb98bee8876c304f6e248909e9c..2133251cc2ee2e50f0b830c9f5123d3d9e7a6430 100644
|
||||
index fd22a6709c7ffd828fbab5b8723f2b723af92f3d..79cfaf78840ac9052b83666d44cdd27f1ed3ae4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1469,6 +1469,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1462,6 +1462,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
// Paper end - Prevent moving into unloaded chunks
|
||||
|
||||
@@ -18,7 +18,7 @@ index 176e54f1c5f4feb98bee8876c304f6e248909e9c..2133251cc2ee2e50f0b830c9f5123d3d
|
||||
float f2 = flag ? 300.0F : 100.0F;
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index dad5379066140b1eadab0a283cc7d8c019d8f4b6..b6c5fc90654a9d89d4c70948124be6ae66c86cdf 100644
|
||||
index 3ec9c947ac19412ad81d0cc85e0eff289a285d1e..af89ad0fcaebb5776ae3c18d02441c48f4227251 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Configurable cave lava sea level
|
||||
This patch also fix MC-237017.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
index 8ce870a5341a61fbbaf42021ef7f7f615a6a3e09..6650f74b01285c1dba8243ca11dbde06419a90e7 100644
|
||||
index 68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8..688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
@@ -72,14 +72,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
@@ -71,14 +71,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
}
|
||||
|
||||
private static Aquifer.FluidPicker createFluidPicker(NoiseGeneratorSettings settings) {
|
||||
@@ -33,7 +33,7 @@ index 8ce870a5341a61fbbaf42021ef7f7f615a6a3e09..6650f74b01285c1dba8243ca11dbde06
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index b6c5fc90654a9d89d4c70948124be6ae66c86cdf..ae6b4ee0add2de0b7568424abeab1bd441653bcb 100644
|
||||
index af89ad0fcaebb5776ae3c18d02441c48f4227251..aa8b0a9b3d98e2c2fb1bd3c374cd2e742e6e17cf 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -35,6 +35,24 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -49,7 +49,7 @@ index b6c5fc90654a9d89d4c70948124be6ae66c86cdf..ae6b4ee0add2de0b7568424abeab1bd4
|
||||
+ public net.minecraft.world.level.block.state.BlockState seaBlock() {
|
||||
+ if (this.seaBlock.equalsIgnoreCase("default")) return net.minecraft.world.level.block.Blocks.LAVA.defaultBlockState();
|
||||
+ return net.minecraft.core.registries.BuiltInRegistries.BLOCK
|
||||
+ .getOptional(new net.minecraft.resources.ResourceLocation(this.seaBlock))
|
||||
+ .getOptional(net.minecraft.resources.ResourceLocation.tryParse(this.seaBlock))
|
||||
+ .orElseGet(() -> {
|
||||
+ PlazmaConfigurations.LOGGER.warn("Invalid custom sea level block: {}, defaulting to lava", this.seaBlock);
|
||||
+ return net.minecraft.world.level.block.Blocks.LAVA;
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable entity sensor tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 05c41e1c2f4a1c714dc842dc019acda46fc41e7b..ba6295ce11236c7eadaeaa042482d6cec0945bd1 100644
|
||||
index 4b4bdaf8c43e15ba953c160a003a719aaf730318..35f150d348c3bd27416c60840988d381b85f9ccf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -997,10 +997,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||
@@ -953,10 +953,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
//ProfilerFiller gameprofilerfiller = this.level().getProfiler(); // Purpur
|
||||
|
||||
//gameprofilerfiller.push("sensing"); // Purpur
|
||||
@@ -22,14 +22,15 @@ index 05c41e1c2f4a1c714dc842dc019acda46fc41e7b..ba6295ce11236c7eadaeaa042482d6ce
|
||||
//gameprofilerfiller.push("targetSelector"); // Purpur
|
||||
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 9debf554deb5b7aa021502ff7d600905f56fa25c..dceb5b2cec5f0c20be74d892e8cab98823d2f59a 100644
|
||||
index d5e7d74b0e203c9f2c03c9b4f8d1b9c57168e61f..eff241544ba009f62179fb1668bd9d78795e7002 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
public Entity entity;
|
||||
public class Entity extends ConfigurationPart {
|
||||
|
||||
public boolean ignoreUselessPackets = OPTIMIZE;
|
||||
+ public int sensorTick = 1;
|
||||
|
||||
+
|
||||
public Phantom phantom;
|
||||
public class Phantom extends ConfigurationPart {
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Variable entity wakeup duration
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index dceb5b2cec5f0c20be74d892e8cab98823d2f59a..bc35244533621436e3c0fb871edf7834ad937f81 100644
|
||||
index eff241544ba009f62179fb1668bd9d78795e7002..8690dc9d818d7991c7b05d471c547b4cb1713bbe 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -39,6 +39,20 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ index dceb5b2cec5f0c20be74d892e8cab98823d2f59a..bc35244533621436e3c0fb871edf7834
|
||||
|
||||
public Structure structure;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 56e52b16b419c882440a15947f037ae1a902bc70..583647f6c9ca0fb092f30c97693bd548f692dfd3 100644
|
||||
index ed1cdea66dd117ecafd14a52727f094430f39b60..2c30e659d0ec28c0ec4f8ccb0fa29de5a31d3881 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -68,29 +68,36 @@ public class ActivationRange
|
||||
@@ -67,29 +67,36 @@ public class ActivationRange
|
||||
Activity.PANIC
|
||||
};
|
||||
|
||||
@@ -61,10 +61,10 @@ index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa3
|
||||
return nbt;
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index a9c8a5918184a2ea364261e279edf7169ae270c7..ffbe18cd212fda0a67d13cb5ccf32068670988aa 100644
|
||||
index 8690dc9d818d7991c7b05d471c547b4cb1713bbe..e5989010aa752c23eda58a6df87aa6925f45671a 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -54,6 +54,14 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Improve SwingTime ticking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index f0d611f370966c12e076252ffd020a05c40f3588..8da257e5d305e4ec978f4933d5011f84976e6bb9 100644
|
||||
index f714e2dc212a3b70977e93c55e94f8b272c5b02d..0d48209efc607dd7f81deffa96af2ff05ccd37b7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2670,6 +2670,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2722,6 +2722,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void updateSwingTime() {
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Mon, 4 Dec 2023 23:15:43 +0900
|
||||
Subject: [PATCH] Suppress errors from dirty attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 2b4d3db901784a82e1ed91520a5e3d1fb8ca6b3e..b66a56ea65cb323953278f80d210473f9f571722 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -415,7 +415,8 @@ public class ServerEntity {
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes();
|
||||
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - Suppress errors from dirty attributes
|
||||
+ final Set<AttributeInstance> set = this.level.plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress errors from dirty attributes
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
// CraftBukkit start - Send scaled max health
|
||||
@@ -426,7 +427,7 @@ public class ServerEntity {
|
||||
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set));
|
||||
}
|
||||
|
||||
- set.clear();
|
||||
+ attributes.clear(); // Plazma - Suppress errors from dirty attributes
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index bc35244533621436e3c0fb871edf7834ad937f81..a9c8a5918184a2ea364261e279edf7169ae270c7 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
public boolean ignoreUselessPackets = OPTIMIZE;
|
||||
public int sensorTick = 1;
|
||||
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
|
||||
|
||||
public Phantom phantom;
|
||||
public class Phantom extends ConfigurationPart {
|
||||
@@ -464,7 +464,7 @@ index 0000000000000000000000000000000000000000..3456f38d381643b0461669b0b5fec6bf
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
index 6499e3fe49e453db11e51eaf717ca8b3b682056b..09aca895b56cc564f2b2c5da0256ae27b6b433f6 100644
|
||||
index ecd1bbd17cb0134cf1f4e99a3fea9e205d38f46b..a064bca7d59dc645b28d5c4d92611d7aff5d3c7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||
@@ -76,6 +76,35 @@ public class AcquirePoi {
|
||||
@@ -903,10 +903,10 @@ index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa6306
|
||||
// Paper end - optimise POI access
|
||||
if (path != null && path.canReach()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
index 539170813921de2dfcd7ef84dd7512d73cd27e68..4722e95397fbec585a0ce5240bdfd08d9d5e7a07 100644
|
||||
index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..d1a31e04899e3bce3f884f60916abd4e25dd3afd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -1135,7 +1135,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -1147,7 +1147,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
} else {
|
||||
Bee.this.pathfindRandomlyTowards(Bee.this.hivePos);
|
||||
}
|
||||
@@ -915,7 +915,7 @@ index 539170813921de2dfcd7ef84dd7512d73cd27e68..4722e95397fbec585a0ce5240bdfd08d
|
||||
boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos);
|
||||
|
||||
if (!flag) {
|
||||
@@ -1197,7 +1197,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -1209,7 +1209,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
} else {
|
||||
Path pathentity = Bee.this.navigation.getPath();
|
||||
|
||||
@@ -955,7 +955,7 @@ index 651f30b4fb02dc03fabad34b62d7d86fa0889754..2fb5e4fc7422c81c67a026143c92f5e7
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
index 15afee3c4f6307557321424560d2340e23cd472b..8b52add9080dd664c4e34393f535145d37ea9a78 100644
|
||||
index 94de51bf9acb32421838ffe54602310f0263b3c4..1afa876e6abac59320c10d37ec8664db1af751b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||
@@ -296,7 +296,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||
@@ -968,10 +968,10 @@ index 15afee3c4f6307557321424560d2340e23cd472b..8b52add9080dd664c4e34393f535145d
|
||||
|
||||
if (blockposition != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
index 5ea5bf9c0e11b0e1f9fe50093899c6e35ee6cf4f..310d942dca115d2048812e7d7e6e7fab8086f993 100644
|
||||
index 70650cc6f76bed79a31a9e8c86205910994a920f..ca521f6ddaf898f17473e9b87e302ddaf9f30380 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||
@@ -609,12 +609,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
@@ -610,10 +610,23 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||
super(entity, world);
|
||||
}
|
||||
|
||||
@@ -985,24 +985,21 @@ index 5ea5bf9c0e11b0e1f9fe50093899c6e35ee6cf4f..310d942dca115d2048812e7d7e6e7fab
|
||||
+ evaluator.setCanFloat(features.canFloat());
|
||||
+ return evaluator;
|
||||
+ };
|
||||
+ // Plazma end - Process pathfinding asynchronously
|
||||
+
|
||||
@Override
|
||||
protected PathFinder createPathFinder(int range) {
|
||||
this.nodeEvaluator = new WalkNodeEvaluator();
|
||||
this.nodeEvaluator.setCanPassDoors(true);
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
|
||||
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
|
||||
return new PathFinder(this.nodeEvaluator, range);
|
||||
}
|
||||
+ // Plazma end - Process pathfinding asynchronously
|
||||
|
||||
@Override
|
||||
protected boolean hasValidPathType(PathType pathType) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index 16891921341f8967c9115f415f91ec379fcd5b0c..524d2304a1dbc873a47c95c55ad70c4120f07ad4 100644
|
||||
index c0398f21cb2ecc9e07f01163a4432a603ff26f03..78a5631753e5bdc16b786ac6951c8d39c4337767 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -636,6 +636,15 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
@@ -634,6 +634,15 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
protected PathFinder createPathFinder(int range) {
|
||||
this.nodeEvaluator = new WalkNodeEvaluator();
|
||||
this.nodeEvaluator.setCanPassDoors(true);
|
||||
@@ -1040,11 +1037,11 @@ index d9d0fff9962131808d54cca20f209df50b8e4af1..420dd323790e72aa12c942d31a94bcb8
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
buf.writeCollection(this.targetNodes, (bufx, node) -> node.writeToStream(bufx));
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c087e61c8e 100644
|
||||
index 404080976208c30e9e95e5bee47c2a749e709a45..e31ee7508a1af51bec628141c3a153997dc75672 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.core.BlockPos;
|
||||
// import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.util.profiling.metrics.MetricCategory;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.level.PathNavigationRegion;
|
||||
+import dev.kaiijumc.kaiiju.path.*; // Plazma - Process pathfinding asynchronously
|
||||
@@ -1101,7 +1098,7 @@ index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c0
|
||||
- map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
||||
- }
|
||||
- // Paper end - Perf: remove streams and optimize collection
|
||||
- Path path = this.findPath(/*world.getProfiler(), */node, map, followRange, distance, rangeMultiplier); // Plazma - Completely remove Mojang's Profiler
|
||||
- Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
||||
- this.nodeEvaluator.done();
|
||||
- return path;
|
||||
}
|
||||
@@ -1128,7 +1125,7 @@ index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c0
|
||||
|
||||
@Nullable
|
||||
// Paper start - Perf: remove streams and optimize collection
|
||||
- private Path findPath(/*ProfilerFiller profiler, */Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // Plazma - Completely remove Mojang's Profiler
|
||||
- private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||
- //profiler.push("find_path"); // Purpur
|
||||
- //profiler.markForCharting(MetricCategory.PATH_FINDING); // Purpur
|
||||
- // Set<Target> set = positions.keySet();
|
||||
@@ -1239,19 +1236,7 @@ index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,15 +165,18 @@ public class PathFinder {
|
||||
boolean entryListIsEmpty = entryList.isEmpty();
|
||||
Comparator<Path> comparator = entryListIsEmpty ? Comparator.comparingInt(Path::getNodeCount)
|
||||
: Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
|
||||
+
|
||||
for (Map.Entry<Target, BlockPos> entry : entryListIsEmpty ? positions : entryList) {
|
||||
Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !entryListIsEmpty);
|
||||
+
|
||||
if (best == null || comparator.compare(path, best) < 0)
|
||||
best = path;
|
||||
}
|
||||
- //profiler.pop(); // Purpur
|
||||
+
|
||||
@@ -126,6 +174,7 @@ public class PathFinder {
|
||||
return best;
|
||||
// Paper end - Perf: remove streams and optimize collection
|
||||
}
|
||||
@@ -1285,12 +1270,12 @@ index 1c83926923f50fb4da1a83dc91614c20a831555f..aec2d0f9a957be65d031957dbff874d8
|
||||
|
||||
Command.broadcastCommandMessage(sender, text("Successfully reloaded Plazma configuration files.", NamedTextColor.GREEN));
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index ae6b4ee0add2de0b7568424abeab1bd441653bcb..d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4 100644
|
||||
index aa8b0a9b3d98e2c2fb1bd3c374cd2e742e6e17cf..516a4545b67a4bf0d37cee3d1e26772831944fe6 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -62,6 +62,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
boolean skipSqrWhenNoDeltaChanges = OPTIMIZE;
|
||||
public boolean spookyOptimize = OPTIMIZE;
|
||||
@@ -60,6 +60,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public class Entity extends ConfigurationPart {
|
||||
|
||||
|
||||
+ public AsyncPathProcess asyncPathProcess;
|
||||
+ public class AsyncPathProcess extends ConfigurationPart {
|
||||
@@ -1314,4 +1299,4 @@ index ae6b4ee0add2de0b7568424abeab1bd441653bcb..d0a1b97bacf9978b4955b1c2c4502c2c
|
||||
+
|
||||
@PostProcess
|
||||
public void post() {
|
||||
net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Mon, 6 May 2024 12:25:59 +0900
|
||||
Subject: [PATCH] Use Akair's flag when running the test server with gradle
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 95df5b7c437f95849b193345640e6001aed71a3d..9dcd555a7f3c6855d72718f46a2792298a33c56d 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -141,7 +141,7 @@ fun TaskContainer.registerRunTask(
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||
})
|
||||
- jvmArgs("-DPlazma.DevelopmentEnvironment", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") // Plazma - Always agree EULA on development mode
|
||||
+ jvmArgs("-DPlazma.DevelopmentEnvironment", "--add-modules=jdk.incubator.vector", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods", "-XX:+UseG1GC", "-XX:+ParallelRefProcEnabled", "-XX:MaxGCPauseMillis=200", "-XX:+UnlockExperimentalVMOptions", "-XX:+DisableExplicitGC", "-XX:+AlwaysPreTouch", "-XX:G1HeapWastePercent=5", "-XX:G1MixedGCCountTarget=4", "-XX:InitiatingHeapOccupancyPercent=15", "-XX:G1MixedGCLiveThresholdPercent=90", "-XX:G1RSetUpdatingPauseTimePercent=5", "-XX:SurvivorRatio=32", "-XX:+PerfDisableSharedMem", "-XX:MaxTenuringThreshold=1", "-Dusing.aikars.flags=https://mcflags.emc.gs", "-Daikars.new.flags=true", "-XX:G1NewSizePercent=40", "-XX:G1MaxNewSizePercent=50", "-XX:G1HeapRegionSize=16M", "-XX:G1ReservePercent=15") // Plazma - Always agree EULA on development mode; Use Akair's flag when running the test server with gradle
|
||||
|
||||
if (rootProject.childProjects["test-plugin"] != null) {
|
||||
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
||||
@@ -5,14 +5,14 @@ Subject: [PATCH] Use Plazma logo instead if server favicon doesn't exist
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a5296631276511 100644
|
||||
index ccfeda1ba3f89112eccf29f382b5526934db1d91..94eb4e0686d8235f06ea7950c178cdec8bd6e037 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1555,29 +1555,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1584,29 +1584,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
private Optional<ServerStatus.Favicon> loadStatusIcon() {
|
||||
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png").toPath()).filter((path) -> {
|
||||
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png")).filter((path) -> {
|
||||
- return Files.isRegularFile(path, new LinkOption[0]);
|
||||
- }).or(() -> {
|
||||
- return this.storageSource.getIconFile().filter((path) -> {
|
||||
@@ -36,9 +36,8 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
|
||||
- }
|
||||
- });
|
||||
+ // Plazma start - Use Plazma logo instead if server favicon doesn't exist
|
||||
+ @Nullable File file = Optional.of(this.getFile("server-icon.png").toPath()).filter(Files::isRegularFile)
|
||||
+ @Nullable File file = Optional.of(this.getFile("server-icon.png").toAbsolutePath()).filter(Files::isRegularFile)
|
||||
+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)).map(Path::toFile).orElse(null);
|
||||
+
|
||||
+ try (
|
||||
+ java.io.InputStream stream = (file != null)
|
||||
+ ? new java.io.FileInputStream(file)
|
||||
@@ -51,13 +50,10 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
|
||||
+ if (stream == null) return Optional.empty();
|
||||
+ if (file == null && !org.plazmamc.plazma.Options.VANILLA_ICO)
|
||||
+ LOGGER.info("No server icon found, using the logo instead.");
|
||||
+
|
||||
+ BufferedImage bufferedimage = ImageIO.read(stream);
|
||||
+
|
||||
+ Preconditions.checkState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide");
|
||||
+ Preconditions.checkState(bufferedimage.getHeight() == 64, "Must be 64 pixels high");
|
||||
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
|
||||
+
|
||||
+ ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
|
||||
+ return Optional.of(new ServerStatus.Favicon(bytearrayoutputstream.toByteArray()));
|
||||
+ } catch (Exception exception) {
|
||||
@@ -69,13 +65,13 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
|
||||
|
||||
public Optional<Path> getWorldScreenshotFile() {
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 3e0e67c089e269d0bccd4a0d2de5ac1ac515997e..2e75ca5d2b7d8f35814fe9a0814b19a9135d80cb 100644
|
||||
index a8711b8a66b443d40cad8dfec31cca357e0877b4..4b3ae18ef8cd09a2d9c9eaee2bf402d0dd7ee1cd 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -8,5 +8,6 @@ public interface Options {
|
||||
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||
boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||
+ boolean VANILLA_ICO = Boolean.getBoolean("Plazma.useVanillaFavicon");
|
||||
@@ -11,5 +11,6 @@ public interface Options {
|
||||
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||
+ boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
|
||||
|
||||
}
|
||||
@@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 95105a7ffaa71f8eaa00c617fc112872aa2e2e78..dc24e0d9d7811de89ff94c49365c537d7211aa7d 100644
|
||||
index 560962109d43d27ba0681afe36e6324ae2a93867..97df4706150dd198dc9bbdd3bdcecea9094d3b62 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -708,6 +708,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -710,6 +710,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// Paper start - Add setting for proxy online mode status
|
||||
return dedicatedserverproperties.enforceSecureProfile
|
||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
@@ -32,7 +32,7 @@ index 95105a7ffaa71f8eaa00c617fc112872aa2e2e78..dc24e0d9d7811de89ff94c49365c537d
|
||||
// Paper end - Add setting for proxy online mode status
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index c36ebab552c480d34e7fd48a45f0a320a97b9677..fdfe8f5bc5ad0e5f5ded41d87756a5866d041df1 100644
|
||||
index f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9..69ff5380eedb3e0b214324dec50bb5c0eb65001b 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -135,6 +135,7 @@ public abstract class PlayerList {
|
||||
@@ -52,7 +52,7 @@ index c36ebab552c480d34e7fd48a45f0a320a97b9677..fdfe8f5bc5ad0e5f5ded41d87756a586
|
||||
player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error
|
||||
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583b8234621 100644
|
||||
index 516a4545b67a4bf0d37cee3d1e26772831944fe6..451723377d505f1fe15ddd4ac535ca61fa253f17 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -29,6 +29,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -73,7 +73,7 @@ index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583
|
||||
@Setting("world-generation")
|
||||
diff --git a/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c4744f5f1b0
|
||||
index 0000000000000000000000000000000000000000..49290983ef6b63bbacdef30f774ce683228e5755
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java
|
||||
@@ -0,0 +1,103 @@
|
||||
@@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c47
|
||||
+@ChannelHandler.Sharable
|
||||
+public class FreedomChat extends MessageToByteEncoder<Packet<?>> {
|
||||
+
|
||||
+ private static final StreamCodec<ByteBuf, Packet<? super ClientGamePacketListener>> CODEC = GameProtocols.CLIENTBOUND
|
||||
+ private static final StreamCodec<ByteBuf, Packet<? super ClientGamePacketListener>> CODEC = GameProtocols.CLIENTBOUND_TEMPLATE
|
||||
+ .bind(RegistryFriendlyByteBuf.decorator(MinecraftServer.getServer().registryAccess())).codec();
|
||||
+
|
||||
+ @Override
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add some missing Pufferfish configurations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
index f8790ab5b7c1279719271ee57c00f4f2d6ce9714..9a9d6c05ceb5b62c4c0c72f64b047f783ae4aeb6 100644
|
||||
index 5b024bc6166a9034eeba729bf3a53236446a03de..d4d6e9f0d8bf15315412ce5193e45c147b047575 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -128,9 +128,11 @@ public class Armadillo extends Animal {
|
||||
@@ -161,9 +161,11 @@ public class Armadillo extends Animal {
|
||||
return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic));
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ index f8790ab5b7c1279719271ee57c00f4f2d6ce9714..9a9d6c05ceb5b62c4c0c72f64b047f78
|
||||
//this.level().getProfiler().pop(); // Purpur
|
||||
//this.level().getProfiler().push("armadilloActivityUpdate"); // Purpur
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
index fdc3aa9672077787e841d240fe1e690dcd9ca321..47d5db93adbb740c7b29dd9059bd31be91097a17 100644
|
||||
index 00803dcc2d990046013b8a175af20359883a15fe..6781c9cda8118842e24712f335de6e5b817af82c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||
@@ -161,11 +161,13 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
@@ -164,11 +164,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
||||
return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@ index fdc3aa9672077787e841d240fe1e690dcd9ca321..47d5db93adbb740c7b29dd9059bd31be
|
||||
protected void customServerAiStep() {
|
||||
//this.level().getProfiler().push("camelBrain"); // Purpur
|
||||
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
|
||||
|
||||
-
|
||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
||||
behaviorcontroller.tick((ServerLevel) this.level(), this);
|
||||
//this.level().getProfiler().pop(); // Purpur
|
||||
//this.level().getProfiler().push("camelActivityUpdate"); // Purpur
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
index a2cc1efaa621861828b007759536ac49d7e3646e..6637bdb953428473edd3429740c75b67b634059a 100644
|
||||
index bc931f54d1087f2515b8185368ade3e8dd55a00d..65ce4ccbb91ff87762da5f9ef53e6d069149abd8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -514,9 +514,11 @@ public class Sniffer extends Animal {
|
||||
@@ -515,9 +515,11 @@ public class Sniffer extends Animal {
|
||||
return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES);
|
||||
}
|
||||
|
||||
@@ -55,13 +55,13 @@ index a2cc1efaa621861828b007759536ac49d7e3646e..6637bdb953428473edd3429740c75b67
|
||||
//this.level().getProfiler().popPush("snifferActivityUpdate"); // Purpur
|
||||
SnifferAi.updateActivity(this);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
index 524d2304a1dbc873a47c95c55ad70c4120f07ad4..c9a8cbcaae0693c63ccdd05d271a524524c36754 100644
|
||||
index 78a5631753e5bdc16b786ac6951c8d39c4337767..7b1bf1449c2e1f1e2ea2a9f258624b128eb80918 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -318,7 +318,7 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
ServerLevel worldserver = (ServerLevel) this.level();
|
||||
@@ -320,7 +320,7 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
|
||||
//worldserver.getProfiler().push("wardenBrain"); // Purpur
|
||||
//if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - TODO: Move to Ridables patch
|
||||
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing pufferfish configurations
|
||||
this.getBrain().tick(worldserver, this);
|
||||
@@ -61,18 +61,18 @@ index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..03be23690a94a14d7343526acad67ccf
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||
index 62484ebf4550b05182f693a3180bbac5d5fd906d..8b39c463b90db2d4faa33471ddce65f775908f2f 100644
|
||||
index c03608fec96b51e1867f43d8f42e5aefb1520e46..93180066224345c0332fb33744f84204f15bba29 100644
|
||||
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||
@@ -41,6 +41,7 @@ public final class EntityScheduler {
|
||||
|
||||
private long tickCount = 0L;
|
||||
private static final long RETIRED_TICK_COUNT = -1L;
|
||||
+ private static final net.minecraft.server.MinecraftServer SERVER = net.minecraft.server.MinecraftServer.getServer();
|
||||
+ private static final net.minecraft.server.MinecraftServer SERVER = net.minecraft.server.MinecraftServer.getServer(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
private final Object stateLock = new Object();
|
||||
private final Long2ObjectOpenHashMap<List<ScheduledTask>> oneTimeDelayed = new Long2ObjectOpenHashMap<>();
|
||||
|
||||
@@ -61,14 +62,15 @@ public final class EntityScheduler {
|
||||
@@ -61,15 +62,15 @@ public final class EntityScheduler {
|
||||
* @throws IllegalStateException If the scheduler is already retired.
|
||||
*/
|
||||
public void retire() {
|
||||
@@ -86,26 +86,19 @@ index 62484ebf4550b05182f693a3180bbac5d5fd906d..8b39c463b90db2d4faa33471ddce65f7
|
||||
}
|
||||
|
||||
- final Entity thisEntity = this.entity.getHandleRaw();
|
||||
|
||||
-
|
||||
// correctly handle and order retiring while running executeTick
|
||||
for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) {
|
||||
@@ -124,9 +126,12 @@ public final class EntityScheduler {
|
||||
final ScheduledTask task = this.currentlyExecuting.pollFirst();
|
||||
@@ -124,6 +125,7 @@ public final class EntityScheduler {
|
||||
if (this.tickCount == RETIRED_TICK_COUNT) {
|
||||
return false;
|
||||
}
|
||||
- this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
|
||||
- return new ArrayList<>();
|
||||
- }).add(task);
|
||||
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
+ SERVER.entitiesWithScheduledTasks.add(this.entity.getHandleRaw());
|
||||
+ this.oneTimeDelayed.computeIfAbsent(
|
||||
+ this.tickCount + Math.max(1L, delay), (final long keyInMap) -> new ArrayList<>()
|
||||
+ ).add(task);
|
||||
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -143,6 +148,12 @@ public final class EntityScheduler {
|
||||
+ SERVER.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
|
||||
return new ArrayList<>();
|
||||
}).add(task);
|
||||
@@ -143,6 +145,12 @@ public final class EntityScheduler {
|
||||
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
|
||||
final List<ScheduledTask> toRun;
|
||||
synchronized (this.stateLock) {
|
||||
@@ -118,29 +111,11 @@ index 62484ebf4550b05182f693a3180bbac5d5fd906d..8b39c463b90db2d4faa33471ddce65f7
|
||||
if (this.tickCount == RETIRED_TICK_COUNT) {
|
||||
throw new IllegalStateException("Ticking retired scheduler");
|
||||
}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00aab846d6 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
@@ -106,6 +106,13 @@ public final class NearbyPlayers {
|
||||
return chunk == null ? null : chunk.players[type.ordinal()];
|
||||
}
|
||||
|
||||
+ // Plazma start - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
+ public ReferenceList<ServerPlayer> getPlayers(final long nearbyCoordKey, final NearbyMapType type) {
|
||||
+ final TrackedChunk chunk = this.byChunk.get(nearbyCoordKey);
|
||||
+ return chunk == null ? null : chunk.players[type.ordinal()];
|
||||
+ }
|
||||
+ // Plazma end - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
+
|
||||
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
|
||||
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6..2452dae1e55165bd8c49c4670e3f2adb523de5da 100644
|
||||
index 94eb4e0686d8235f06ea7950c178cdec8bd6e037..118832d94f96d7624f9faee35b9da0aeb9d9ded8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -321,6 +321,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -327,6 +327,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
|
||||
@@ -148,12 +123,12 @@ index 79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6..2452dae1e55165bd8c49c4670e3f2adb
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -1739,17 +1740,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1776,17 +1777,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
|
||||
// Paper start - Folia scheduler API
|
||||
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
||||
- getAllLevels().forEach(level -> {
|
||||
- for (final Entity entity : level.getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system
|
||||
- for (final Entity entity : level.moonrise$getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system
|
||||
- if (entity.isRemoved()) {
|
||||
- continue;
|
||||
- }
|
||||
@@ -165,58 +140,48 @@ index 79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6..2452dae1e55165bd8c49c4670e3f2adb
|
||||
- });
|
||||
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
+ for (final Entity entity : entitiesWithScheduledTasks) {
|
||||
+ if (entity.isRemoved()) continue;
|
||||
+
|
||||
+ final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
|
||||
+ //noinspection ConstantValue
|
||||
+ if (bukkit != null) bukkit.taskScheduler.executeTick();
|
||||
+ if (entity.isRemoved() || entity.getBukkitEntityRaw() == null) continue;
|
||||
+ entity.getBukkitEntityRaw().taskScheduler.executeTick();
|
||||
+ }
|
||||
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
||||
// Paper end - Folia scheduler API
|
||||
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||
//this.profiler.push("commandFunctions"); // Purpur
|
||||
@@ -1816,7 +1815,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1852,8 +1848,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//this.profiler.push("tick"); // Purpur
|
||||
|
||||
try {
|
||||
//worldserver.timings.doTick.startTiming(); // Spigot // Purpur
|
||||
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
||||
- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
|
||||
- worldserver.tick(shouldKeepTicking);
|
||||
+ //worldserver.timings.doTick.startTiming(); // Spigot // Purpur// Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
||||
+ long before = Util.getNanos();
|
||||
worldserver.tick(shouldKeepTicking);
|
||||
+ worldserver.tick(shouldKeepTicking); // diff on changes
|
||||
+ long after = Util.getNanos() - before;
|
||||
+
|
||||
+ worldserver.tickTimes5s.add(this.tickCount, after);
|
||||
+ worldserver.tickTimes10s.add(this.tickCount, after);
|
||||
+ worldserver.tickTimes60s.add(this.tickCount, after);
|
||||
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
||||
// Paper start
|
||||
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
|
||||
regionManager.recalculateRegions();
|
||||
@@ -2595,7 +2602,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public ProfilerFiller getProfiler() {
|
||||
- //if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
|
||||
+ //if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
|
||||
return this.profiler;
|
||||
}
|
||||
|
||||
//worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 6cbbe9c692068edee7e66f85081ec95b8dd12101..3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9 100644
|
||||
index 97df4706150dd198dc9bbdd3bdcecea9094d3b62..d31fabbca11b1f619bfa62487eed2cd5f19844ce 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -224,6 +224,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -227,6 +227,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||
+ net.sparklypower.sparklypaper.HalloweenManager.startSyncEpochTask(); // Plazma - Port SparklyPaper patches; Optimize Spooky Season
|
||||
// Paper end - initialize global and world-defaults configuration
|
||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||
if (this.convertOldUsers()) {
|
||||
// Paper start - detect running as root // Plazma - Tweak console logging (moved down)
|
||||
if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 4b8776e760cca21e558c8fcb1e0e8d07c3589490..dd1a38488802080f961f87b73dfbb8229fb69e99 100644
|
||||
index 1883abec14e05f8eb2e865446b4d81091b1aa5e0..adfc891ae8868bb562910ad169c116e5d30348c7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1439,7 +1439,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1262,7 +1262,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - Configurable entity tracking range by Y
|
||||
|
||||
// CraftBukkit start - respect vanish API
|
||||
@@ -225,21 +190,8 @@ index 4b8776e760cca21e558c8fcb1e0e8d07c3589490..dd1a38488802080f961f87b73dfbb822
|
||||
flag = false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 5eb7bcf492ee354ef775cd8d09c7ca2bdfeb7ce2..697cb18bce2f2470a0a2347ba6709e1449b360fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
// Paper start - optimise chunk tick iteration
|
||||
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
||||
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
if (playersNearby == null) {
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index e16dcb7f60bc3cf2cbef4674b23f12e1e5bd59d3..c3a4fcf600e72f9e95e9df673619ce37d0480cca 100644
|
||||
index dfd09004063a8d8d93357633c8d23b6acff67b73..7458cd657e809bba7483da31ddeb8f77aab1203d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -78,6 +78,7 @@ public class ServerEntity {
|
||||
@@ -250,32 +202,47 @@ index e16dcb7f60bc3cf2cbef4674b23f12e1e5bd59d3..c3a4fcf600e72f9e95e9df673619ce37
|
||||
|
||||
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
||||
this.trackedPlayers = trackedPlayers;
|
||||
@@ -217,12 +218,15 @@ public class ServerEntity {
|
||||
@@ -218,20 +219,21 @@ public class ServerEntity {
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
Vec3 vec3d1 = this.entity.getDeltaMovement();
|
||||
- double d0 = vec3d1.distanceToSqr(this.ap);
|
||||
- double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
||||
-
|
||||
- if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
||||
- this.ap = vec3d1;
|
||||
- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
|
||||
- this.lastSentMovement = vec3d1;
|
||||
- Entity entity1 = this.entity;
|
||||
-
|
||||
- if (entity1 instanceof AbstractHurtingProjectile) {
|
||||
- AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1;
|
||||
-
|
||||
- this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower))));
|
||||
- } else {
|
||||
- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
||||
- }
|
||||
- }
|
||||
+ // Plazma start - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
|
||||
+ if (!skipSqrWhenNoDeltaChanges && vec3d1 != this.ap) {
|
||||
+ double d0 = vec3d1.distanceToSqr(this.ap);
|
||||
+ if (!skipSqrWhenNoDeltaChanges && vec3d1 != this.lastSentMovement) {
|
||||
+ double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
||||
+ if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
||||
+ this.ap = vec3d1;
|
||||
+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
|
||||
+ this.lastSentMovement = vec3d1;
|
||||
+ Entity entity1 = this.entity;
|
||||
+ if (entity1 instanceof AbstractHurtingProjectile) {
|
||||
+ AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1;
|
||||
+ this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower))));
|
||||
+ } else {
|
||||
+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
||||
+ }
|
||||
}
|
||||
+ } // diff on changes
|
||||
+ } // diff on changes
|
||||
+ // Plazma end - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
|
||||
}
|
||||
|
||||
if (packet1 != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 5456d2ded6f6e75c48868147e5a2dde5eb23bec8..e2de0c343098d65d830f27b4f80c3f8a9f18a7ae 100644
|
||||
index dfcd3989ffbd4aa5dc9368a34b95c1c2748c23a2..f5f944899d860d8363db43d430f3daab96e0d774 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -233,6 +233,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -233,6 +233,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||
public boolean hasRidableMoveEvent = false; // Purpur
|
||||
|
||||
@@ -289,7 +256,7 @@ index 5456d2ded6f6e75c48868147e5a2dde5eb23bec8..e2de0c343098d65d830f27b4f80c3f8a
|
||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index f890738d3bb9fb5e70a9d323c6cec97f9948f9cf..eb3fc1af68768383d524cf0f50c4f4b304b9d5ca 100644
|
||||
index fb7342f7a5008a283c3400c6313c637de8210dfa..8b068f6b4c52cdba60a7fbe21bc1f7a86891800a 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -325,10 +292,10 @@ index f890738d3bb9fb5e70a9d323c6cec97f9948f9cf..eb3fc1af68768383d524cf0f50c4f4b3
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
index a70255995f380a9b0f7057cb5cb820f7655b93fc..2bffc790496fd9b09516d0d908b5319c9dbb1c63 100644
|
||||
index 36e5a6462675ceb3cef236c451321b1656d9fcc0..bdc2391aed4fedc2e15a0b51a6930a2d85905c90 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -306,7 +306,7 @@ public class Bat extends AmbientCreature {
|
||||
@@ -307,7 +307,7 @@ public class Bat extends AmbientCreature {
|
||||
int i = world.getMaxLocalRawBrightness(pos);
|
||||
byte b0 = 4;
|
||||
|
||||
@@ -337,12 +304,11 @@ index a70255995f380a9b0f7057cb5cb820f7655b93fc..2bffc790496fd9b09516d0d908b5319c
|
||||
b0 = 7;
|
||||
} else if (random.nextBoolean()) {
|
||||
return false;
|
||||
@@ -320,7 +320,25 @@ public class Bat extends AmbientCreature {
|
||||
@@ -321,7 +321,24 @@ public class Bat extends AmbientCreature {
|
||||
private static boolean isSpookySeason = false;
|
||||
private static final int ONE_HOUR = 20 * 60 * 60;
|
||||
private static int lastSpookyCheck = -ONE_HOUR;
|
||||
- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
|
||||
+
|
||||
+ // Plazma start - Port SparklyPaper patches; Optimize Spooky Season
|
||||
+ private static boolean isSpookySeason(Level level) {
|
||||
+ if (level.purpurConfig.forceHalloweenSeason) return true;
|
||||
@@ -383,11 +349,11 @@ index 608390ed36710a419de1542b80340dd3fcc7299c..043f068345ca3c50209c1c3cc1feb627
|
||||
mapItemSavedData.tickCarriedBy(player, stack);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index df73867ee5682fb966b69dd85da61a6928d8dab3..5712ab081e9534f60248caaceea44445ff855e30 100644
|
||||
index 253d47418b4e9cbce74584c2461d12e17effd7bb..f3c44a2ddc52661984cc07b2ee23b3a3431a4b0a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1339,6 +1339,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
boolean flag = this.tickRateManager().runsNormally();
|
||||
@@ -1456,6 +1456,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
int tickedEntities = 0; // Paper - rewrite chunk system
|
||||
|
||||
int tilesThisCycle = 0;
|
||||
+ int shouldTickBlocksAtLastResult = -1; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
||||
@@ -395,15 +361,18 @@ index df73867ee5682fb966b69dd85da61a6928d8dab3..5712ab081e9534f60248caaceea44445
|
||||
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
|
||||
@@ -1351,14 +1353,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1468,14 +1470,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
tilesThisCycle--;
|
||||
toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
|
||||
// Spigot end
|
||||
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||
- tickingblockentity.tick();
|
||||
- // Paper start - execute chunk tasks during tick
|
||||
- if ((this.tileTickPosition & 7) == 0) {
|
||||
- MinecraftServer.getServer().executeMidTickTasks();
|
||||
- // Paper start - rewrite chunk system
|
||||
- if ((++tickedEntities & 7) == 0) {
|
||||
- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
||||
- }
|
||||
- // Paper end - rewrite chunk system
|
||||
- }
|
||||
+ // Plazma start - Port SparklyPaper patches; Optimize tickingBlockEntities
|
||||
+ } else if (flag) {
|
||||
+ long chunkPos = tickingblockentity.getChunkCoordinateKey();
|
||||
@@ -414,18 +383,17 @@ index df73867ee5682fb966b69dd85da61a6928d8dab3..5712ab081e9534f60248caaceea44445
|
||||
+ shouldTick = this.shouldTickBlocksAt(chunkPos);
|
||||
+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0;
|
||||
+ shouldTickBlocksAtChunkPos = chunkPos;
|
||||
+ }
|
||||
+ } // diff on changes
|
||||
+
|
||||
+ if (shouldTick) {
|
||||
+ tickingblockentity.tick();
|
||||
+ // Paper start - execute chunk tasks during tick
|
||||
+ if ((this.tileTickPosition & 7) == 0) {
|
||||
+ MinecraftServer.getServer().executeMidTickTasks();
|
||||
+ if ((++tickedEntities & 7) == 0) {
|
||||
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
||||
+ }
|
||||
+ // Paper end - execute chunk tasks during tick
|
||||
}
|
||||
- // Paper end - execute chunk tasks during tick
|
||||
}
|
||||
+ } // diff on changes
|
||||
+ } // diff on changes
|
||||
+ // Plazma end - Port SparklyPaper patches; Optimize tickingBlockEntities
|
||||
}
|
||||
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
|
||||
@@ -679,7 +647,7 @@ index 28e3b73507b988f7234cbf29c4024c88180d0aef..6239c171ca996f3f5c23060f728a6223
|
||||
+ long getChunkCoordinateKey(); // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
index 1aac95b03a9e2e37c24f2a30bcb259c1424e1c78..e7c0c36fd3455c0536e98259b46dbcc952d90e01 100644
|
||||
index 75c8125e20b70433fe9d143a3193d821043327c3..80511433c184c6918c8d2e7cff6ca257e8fbf676 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
@@ -66,6 +66,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
@@ -690,19 +658,19 @@ index 1aac95b03a9e2e37c24f2a30bcb259c1424e1c78..e7c0c36fd3455c0536e98259b46dbcc9
|
||||
private long inhabitedTime;
|
||||
/** @deprecated */
|
||||
@Nullable
|
||||
@@ -140,6 +141,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
// Paper end - rewrite light engine
|
||||
@@ -144,6 +145,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) {
|
||||
this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
|
||||
this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
|
||||
+ this.nearbyPlayersCoordinateKey = io.papermc.paper.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
+ this.nearbyPlayersCoordinateKey = ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
this.upgradeData = upgradeData;
|
||||
this.levelHeightAccessor = heightLimitView;
|
||||
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index ab4dd0c8b4b17ff1b54c06b72dc8b3caba430fe2..e026dc9ed15284f55cdd4bc99c0718aba6d2e8c6 100644
|
||||
index a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..9cc1a79dd25c63af6986e721ceff5560cf56b7d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -75,6 +75,8 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -74,6 +74,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
public String getType() {
|
||||
return "<null>";
|
||||
}
|
||||
@@ -711,7 +679,7 @@ index ab4dd0c8b4b17ff1b54c06b72dc8b3caba430fe2..e026dc9ed15284f55cdd4bc99c0718ab
|
||||
};
|
||||
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel;
|
||||
public boolean loaded;
|
||||
@@ -1101,7 +1103,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -966,7 +968,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
}
|
||||
|
||||
private <T extends BlockEntity> TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker<T> blockEntityTicker) {
|
||||
@@ -720,7 +688,7 @@ index ab4dd0c8b4b17ff1b54c06b72dc8b3caba430fe2..e026dc9ed15284f55cdd4bc99c0718ab
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
@@ -1152,17 +1154,21 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1017,6 +1019,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
public String toString() {
|
||||
return String.valueOf(this.ticker) + " <wrapped>";
|
||||
}
|
||||
@@ -729,21 +697,21 @@ index ab4dd0c8b4b17ff1b54c06b72dc8b3caba430fe2..e026dc9ed15284f55cdd4bc99c0718ab
|
||||
}
|
||||
|
||||
private class BoundTickingBlockEntity<T extends BlockEntity> implements TickingBlockEntity {
|
||||
|
||||
+ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
||||
@@ -1024,10 +1028,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private final T blockEntity;
|
||||
private final BlockEntityTicker<T> ticker;
|
||||
private boolean loggedInvalidBlockState;
|
||||
+ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
||||
|
||||
- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||
+ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) {
|
||||
+ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) { // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
||||
this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
||||
this.ticker = blockentityticker;
|
||||
+ this.chunkCoordinateKey = chunkCoordinateKey;
|
||||
+ this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1230,5 +1236,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
@@ -1095,5 +1101,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
return "Level ticker for " + s + "@" + String.valueOf(this.getPos());
|
||||
}
|
||||
@@ -836,10 +804,10 @@ index 0000000000000000000000000000000000000000..f8c26e26025d7a7b5489ed5b3274ba73
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 241340a6d66f17f2a31fb03ff0dfab121b856368..a6cf73d104e66971a61ac979d4a6d58a97478613 100644
|
||||
index 173e4a075078af67f030750c9a6294ab3f796677..92ad49e0ff5dc17bc8e181578ff93bc96e3503ef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -976,7 +976,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -978,7 +978,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges) {
|
||||
if (this.getHandle().connection == null) return;
|
||||
|
||||
@@ -848,7 +816,7 @@ index 241340a6d66f17f2a31fb03ff0dfab121b856368..a6cf73d104e66971a61ac979d4a6d58a
|
||||
|
||||
for (Map.Entry<? extends io.papermc.paper.math.Position, BlockData> entry : blockChanges.entrySet()) {
|
||||
BlockData blockData = entry.getValue();
|
||||
@@ -2237,9 +2237,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2259,9 +2259,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
@Override
|
||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
||||
@@ -879,23 +847,27 @@ index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..b9a303f6280a2f6ad3616da152922a4f
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb..73dd69941a004b4a2ec244f28d8683e9bdb0a445 100644
|
||||
index 451723377d505f1fe15ddd4ac535ca61fa253f17..7ccf554610bd00b602eb7be11df7028d2f6a7008 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -40,9 +40,12 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -68,6 +68,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Entity entity;
|
||||
public class Entity extends ConfigurationPart {
|
||||
|
||||
+ boolean skipSqrWhenNoDeltaChanges = OPTIMIZE;
|
||||
+ public boolean spookyOptimize = OPTIMIZE;
|
||||
|
||||
public AsyncPathProcess asyncPathProcess;
|
||||
public class AsyncPathProcess extends ConfigurationPart {
|
||||
@@ -91,6 +93,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
@PostProcess
|
||||
public void post() {
|
||||
+ net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,9 +53,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
@@ -98,9 +101,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public World world;
|
||||
public class World extends ConfigurationPart {
|
||||
|
||||
@@ -908,10 +880,10 @@ index 57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb..73dd69941a004b4a2ec244f28d8683e9
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 8dce68cf7769fcd5ea03be32621ccb6bab174697..069a9f8504c74d939b1df569f082cc7bd33d9cfc 100644
|
||||
index e5989010aa752c23eda58a6df87aa6925f45671a..00ab417a8b7da0457b6f8e18e4f877373774672e 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -49,7 +49,22 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
@@ -89,7 +89,22 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
public Block block;
|
||||
public class Block extends ConfigurationPart {
|
||||
@@ -94,10 +94,10 @@ index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678
|
||||
)
|
||||
);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4782f19409d300fbcaa952ae0dd6a0577ade5f7b..f926376ee95b28a9c09a1ad87223f89f1c28f50e 100644
|
||||
index 118832d94f96d7624f9faee35b9da0aeb9d9ded8..1c3bb7cd27d97e54cbe74465bd8a7c5faeafdf4a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -254,8 +254,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -259,8 +259,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private final long[] tickTimesNanos;
|
||||
private long aggregatedTickTimesNanos;
|
||||
// Paper start - Add tick times API and /mspt command
|
||||
@@ -108,8 +108,8 @@ index 4782f19409d300fbcaa952ae0dd6a0577ade5f7b..f926376ee95b28a9c09a1ad87223f89f
|
||||
public final TickTimes tickTimes60s = new TickTimes(1200);
|
||||
// Paper end - Add tick times API and /mspt command
|
||||
@Nullable
|
||||
@@ -1821,8 +1823,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.tick(shouldKeepTicking);
|
||||
@@ -1853,8 +1855,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.tick(shouldKeepTicking); // diff on changes
|
||||
long after = Util.getNanos() - before;
|
||||
|
||||
+ worldserver.tickTimes1s.add(this.tickCount, after); // Plazma - Add more MSPT
|
||||
@@ -118,12 +118,12 @@ index 4782f19409d300fbcaa952ae0dd6a0577ade5f7b..f926376ee95b28a9c09a1ad87223f89f
|
||||
+ worldserver.tickTimes30s.add(this.tickCount, after); // Plazma - Add more MSPT
|
||||
worldserver.tickTimes60s.add(this.tickCount, after);
|
||||
// Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
||||
// Paper start
|
||||
//worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 508e01e9ef41f006e6d9be71969c0d82dc646628..15548aac320ae6d707cab4a61dfc99eaebb06634 100644
|
||||
index f5f944899d860d8363db43d430f3daab96e0d774..6fbf3a479ee1927b1099d2678db693341491b2b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -234,8 +234,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -234,8 +234,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
public boolean hasRidableMoveEvent = false; // Purpur
|
||||
|
||||
// Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Mon, 6 May 2024 12:25:59 +0900
|
||||
Subject: [PATCH] Use Akair's flag when running the test server with gradle
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 54a30184392815a01f20b8fc841690e4ae5b3cc6..10bff15cd8b52fd6973aa3565ae75aabdf7dff53 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -137,7 +137,7 @@ fun TaskContainer.registerRunTask(
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||
})
|
||||
- jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods")
|
||||
+ jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods", "-XX:+UseG1GC", "-XX:+ParallelRefProcEnabled", "-XX:MaxGCPauseMillis=200", "-XX:+UnlockExperimentalVMOptions", "-XX:+DisableExplicitGC", "-XX:+AlwaysPreTouch", "-XX:G1HeapWastePercent=5", "-XX:G1MixedGCCountTarget=4", "-XX:InitiatingHeapOccupancyPercent=15", "-XX:G1MixedGCLiveThresholdPercent=90", "-XX:G1RSetUpdatingPauseTimePercent=5", "-XX:SurvivorRatio=32", "-XX:+PerfDisableSharedMem", "-XX:MaxTenuringThreshold=1", "-Dusing.aikars.flags=https://mcflags.emc.gs", "-Daikars.new.flags=true", "-XX:G1NewSizePercent=40", "-XX:G1MaxNewSizePercent=50", "-XX:G1HeapRegionSize=16M", "-XX:G1ReservePercent=15")
|
||||
|
||||
if (rootProject.childProjects["test-plugin"] != null) {
|
||||
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
||||
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Fri, 25 Oct 2024 19:11:40 +0900
|
||||
Subject: [PATCH] Reset dirty flag when loading maps from the disk
|
||||
|
||||
Based on SparklyPaper, Copyright (C) 2024 SparklyPower
|
||||
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
index 769d283cd98cba829262e45020ce3936c484938a..726c3e81d04731fe6ac92f0b612ce33e53803132 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||
@@ -209,6 +209,7 @@ public class MapItemSavedData extends SavedData {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.resetDirtyWhenLoadingMapsFromDisk) worldmap.setDirty(false); // Plazma - Reset dirty flag when loading maps from the disk
|
||||
return worldmap;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 7ccf554610bd00b602eb7be11df7028d2f6a7008..2f5b59ec72fff421e1bc254ebeba78647c7409fe 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -113,6 +113,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public Miscellaneous misc;
|
||||
public class Miscellaneous extends ConfigurationPart {
|
||||
|
||||
+ public boolean resetDirtyWhenLoadingMapsFromDisk = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Fri, 25 Oct 2024 19:13:21 +0900
|
||||
Subject: [PATCH] Allow throttling hopper checks if the target container is
|
||||
full
|
||||
|
||||
Based on SparklyPaper, Copyright (C) 2024 SparklyPower.
|
||||
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index cab403efd471bb61835224eea4e99570d34dcaaa..4b4d31cb3c379a59c43c7356522a5b67c5a87de5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -441,6 +441,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
Direction enumdirection = blockEntity.facing.getOpposite();
|
||||
|
||||
if (HopperBlockEntity.isFullContainer(iinventory, enumdirection)) {
|
||||
+ if (world.plazmaConfig().block.hopper.fullCooldown != 0) blockEntity.setCooldown(world.plazmaConfig().block.hopper.fullCooldown); // Plazma - Allow throttling hopper checks if the target container is full
|
||||
return false;
|
||||
} else {
|
||||
// Paper start - Perf: Optimize Hoppers
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 00ab417a8b7da0457b6f8e18e4f877373774672e..f5880a045343e8d84492b61241ac1e514a0eb73d 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -106,6 +106,13 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public Hopper hopper;
|
||||
+ public class Hopper extends ConfigurationPart {
|
||||
+
|
||||
+ public int fullCooldown = 0;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Fri, 25 Oct 2024 19:26:15 +0900
|
||||
Subject: [PATCH] Suppress errors from dirty attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0d48209efc607dd7f81deffa96af2ff05ccd37b7..9ab19aa8d05384bc03c8250f8ea628a9b0a00fa2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1348,7 +1348,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
private void refreshDirtyAttributes() {
|
||||
- Set<AttributeInstance> set = this.getAttributes().getAttributesToUpdate();
|
||||
+ Set<AttributeInstance> attr = this.getAttributes().getAttributesToUpdate(); // Plazma - Suppress errors from dirty attributes
|
||||
+ final Set<AttributeInstance> set = level().plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? java.util.Collections.synchronizedSet(attr) : attr; // Plazma - Suppress errors from dirty attributes
|
||||
Iterator iterator = set.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1357,7 +1358,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
this.onAttributeUpdated(attributemodifiable.getAttribute());
|
||||
}
|
||||
|
||||
- set.clear();
|
||||
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
|
||||
}
|
||||
|
||||
private void onAttributeUpdated(Holder<Attribute> attribute) {
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index f5880a045343e8d84492b61241ac1e514a0eb73d..97da147ae867500a343af7beea51ed5e89543a47 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
public class Entity extends ConfigurationPart {
|
||||
|
||||
public int sensorTick = 1;
|
||||
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
|
||||
|
||||
public Phantom phantom;
|
||||
public class Phantom extends ConfigurationPart {
|
||||
372
patches/server/0038-Implement-Rail-Optimazition.patch
Normal file
372
patches/server/0038-Implement-Rail-Optimazition.patch
Normal file
@@ -0,0 +1,372 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sat, 26 Oct 2024 12:33:57 +0900
|
||||
Subject: [PATCH] Implement Rail Optimazition
|
||||
|
||||
Based on EasterGhost/RailOptimization, Original by FxMorin.
|
||||
Copyright (C) 2024 EasterGhost, Licensed under GPL v3.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/ca/fxco/railoptimization/RailLogic.java b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf041fa4ed
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
||||
@@ -0,0 +1,301 @@
|
||||
+package ca.fxco.railoptimization;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.core.Direction;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.PoweredRailBlock;
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+
|
||||
+import static net.minecraft.world.level.block.PoweredRailBlock.POWERED;
|
||||
+import static net.minecraft.world.level.block.PoweredRailBlock.SHAPE;
|
||||
+
|
||||
+public class RailLogic {
|
||||
+
|
||||
+ private static final Direction[] EAST_WEST_DIR = new Direction[]{Direction.WEST, Direction.EAST};
|
||||
+ private static final Direction[] NORTH_SOUTH_DIR = new Direction[]{Direction.SOUTH, Direction.NORTH};
|
||||
+
|
||||
+ private static final int UPDATE_FORCE_PLACE = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS;
|
||||
+
|
||||
+ public static void customUpdateState(PoweredRailBlock self, BlockState state, Level level, BlockPos pos) {
|
||||
+ boolean shouldBePowered = level.hasNeighborSignal(pos) ||
|
||||
+ self.findPoweredRailSignal(level, pos, state, true, 0) ||
|
||||
+ self.findPoweredRailSignal(level, pos, state, false, 0);
|
||||
+ if (shouldBePowered == state.getValue(POWERED)) return;
|
||||
+
|
||||
+ RailShape railShape = state.getValue(SHAPE);
|
||||
+ if (railShape.isAscending()) {
|
||||
+ level.setBlock(pos, state.setValue(POWERED, shouldBePowered), 3);
|
||||
+ level.updateNeighborsAtExceptFromFacing(pos.below(), self, Direction.UP);
|
||||
+ level.updateNeighborsAtExceptFromFacing(pos.above(), self, Direction.DOWN); //isAscending
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (shouldBePowered) powerLane(self, level, pos, state, railShape);
|
||||
+ else dePowerLane(self, level, pos, state, railShape);
|
||||
+ }
|
||||
+
|
||||
+ private static void giveShapeUpdate(Level level, BlockState state, BlockPos pos, BlockPos fromPos, Direction direction) {
|
||||
+ BlockState oldState = level.getBlockState(pos);
|
||||
+ Block.updateOrDestroy(
|
||||
+ oldState,
|
||||
+ oldState.updateShape(direction.getOpposite(), state, level, pos, fromPos),
|
||||
+ level,
|
||||
+ pos,
|
||||
+ Block.UPDATE_CLIENTS & -34,
|
||||
+ 0
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, boolean bl, int distance, RailShape shape, HashMap<BlockPos,Boolean> checkedPos) {
|
||||
+ BlockState blockState = level.getBlockState(pos);
|
||||
+ if (checkedPos.containsKey(pos) && checkedPos.get(pos))
|
||||
+ return level.hasNeighborSignal(pos) || findPoweredRailSignalFaster(self, level, pos, blockState, bl, distance + 1, checkedPos);
|
||||
+
|
||||
+ if (!blockState.is(self)) return false;
|
||||
+
|
||||
+ RailShape railShape = blockState.getValue(SHAPE);
|
||||
+ if (shape == RailShape.EAST_WEST && (railShape == RailShape.NORTH_SOUTH || railShape == RailShape.ASCENDING_NORTH || railShape == RailShape.ASCENDING_SOUTH) ||
|
||||
+ shape == RailShape.NORTH_SOUTH && (railShape == RailShape.EAST_WEST || railShape == RailShape.ASCENDING_EAST || railShape == RailShape.ASCENDING_WEST)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (!blockState.getValue(POWERED)) return false;
|
||||
+
|
||||
+ return level.hasNeighborSignal(pos) ||
|
||||
+ findPoweredRailSignalFaster(self, level, pos, blockState, bl, distance + 1, checkedPos);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, boolean bl, int distance, HashMap<BlockPos, Boolean> checkedPos) {
|
||||
+ if (distance >= level.purpurConfig.railActivationRange) return false;
|
||||
+
|
||||
+ int x = pos.getX();
|
||||
+ int y = pos.getY();
|
||||
+ int z = pos.getZ();
|
||||
+ boolean bl2 = true;
|
||||
+ RailShape railShape = state.getValue(SHAPE);
|
||||
+
|
||||
+ switch (railShape.ordinal()) {
|
||||
+ case 0 -> {
|
||||
+ if (bl) ++z;
|
||||
+ else --z;
|
||||
+ }
|
||||
+ case 1 -> {
|
||||
+ if (bl) --x;
|
||||
+ else ++x;
|
||||
+ }
|
||||
+ case 2 -> {
|
||||
+ if (bl) {
|
||||
+ --x;
|
||||
+ } else {
|
||||
+ ++x;
|
||||
+ ++y;
|
||||
+ bl2 = false;
|
||||
+ }
|
||||
+ railShape = RailShape.EAST_WEST;
|
||||
+ }
|
||||
+ case 3 -> {
|
||||
+ if (bl) {
|
||||
+ --x;
|
||||
+ ++y;
|
||||
+ bl2 = false;
|
||||
+ } else {
|
||||
+ ++x;
|
||||
+ }
|
||||
+ railShape = RailShape.EAST_WEST;
|
||||
+ }
|
||||
+ case 4 -> {
|
||||
+ if (bl) {
|
||||
+ ++z;
|
||||
+ } else {
|
||||
+ --z;
|
||||
+ ++y;
|
||||
+ bl2 = false;
|
||||
+ }
|
||||
+ railShape = RailShape.NORTH_SOUTH;
|
||||
+ }
|
||||
+ case 5 -> {
|
||||
+ if (bl) {
|
||||
+ ++z;
|
||||
+ ++y;
|
||||
+ bl2 = false;
|
||||
+ } else {
|
||||
+ --z;
|
||||
+ }
|
||||
+ railShape = RailShape.NORTH_SOUTH;
|
||||
+ }
|
||||
+ }
|
||||
+ return findPoweredRailSignalFaster(self, level, new BlockPos(x, y, z), bl, distance, railShape, checkedPos) ||
|
||||
+ (bl2 && findPoweredRailSignalFaster(self, level, new BlockPos(x, y - 1, z), bl, distance, railShape, checkedPos));
|
||||
+ }
|
||||
+
|
||||
+ private static void powerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, RailShape shape) {
|
||||
+ level.setBlock(pos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE);
|
||||
+ HashMap<BlockPos,Boolean> checkedPos = new HashMap<>();
|
||||
+ checkedPos.put(pos, true);
|
||||
+ int[] count = new int[2];
|
||||
+ if (shape == RailShape.NORTH_SOUTH) { //Order: +z, -z
|
||||
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
|
||||
+ setRailPositionsPower(self, level, pos, checkedPos, count, i, NORTH_SOUTH_DIR[i]);
|
||||
+ }
|
||||
+ updateRailsNS(self, level, pos, state, count);
|
||||
+ } else if (shape == RailShape.EAST_WEST) { //Order: -x, +x
|
||||
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
|
||||
+ setRailPositionsPower(self, level, pos, checkedPos, count, i, EAST_WEST_DIR[i]);
|
||||
+ }
|
||||
+ updateRailsEW(self, level, pos, state, count);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void dePowerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, RailShape shape) {
|
||||
+ level.setBlock(pos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE);
|
||||
+ int[] count = new int[2];
|
||||
+ if (shape == RailShape.NORTH_SOUTH) { //Order: +z, -z
|
||||
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
|
||||
+ setRailPositionsDePower(self, level, pos, count, i, NORTH_SOUTH_DIR[i]);
|
||||
+ }
|
||||
+ updateRailsNS(self, level, pos, state, count);
|
||||
+ } else if (shape == RailShape.EAST_WEST) { //Order: -x, +x
|
||||
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
|
||||
+ setRailPositionsDePower(self, level, pos, count, i, EAST_WEST_DIR[i]);
|
||||
+ }
|
||||
+ updateRailsEW(self, level, pos, state, count);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void setRailPositionsPower(PoweredRailBlock self, Level level, BlockPos pos, HashMap<BlockPos, Boolean> checkedPos, int[] count, int i, Direction dir) {
|
||||
+ for (int z = 1; z < level.purpurConfig.railActivationRange; z++) {
|
||||
+ BlockPos newPos = pos.relative(dir, z);
|
||||
+ BlockState state = level.getBlockState(newPos);
|
||||
+
|
||||
+ if (checkedPos.containsKey(newPos)) {
|
||||
+ if (!checkedPos.get(newPos)) break;
|
||||
+ count[i]++;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!state.is(self) || state.getValue(POWERED) || !(
|
||||
+ level.hasNeighborSignal(newPos) ||
|
||||
+ findPoweredRailSignalFaster(self, level, newPos, state, true, 0, checkedPos) ||
|
||||
+ findPoweredRailSignalFaster(self, level, newPos, state, false, 0, checkedPos)
|
||||
+ )) {
|
||||
+ checkedPos.put(newPos,false);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ checkedPos.put(newPos,true);
|
||||
+ level.setBlock(newPos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE);
|
||||
+ count[i]++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void setRailPositionsDePower(PoweredRailBlock self, Level level, BlockPos pos, int[] count, int i, Direction dir) {
|
||||
+ for (int z = 1; z < level.purpurConfig.railActivationRange; z++) {
|
||||
+ BlockPos newPos = pos.relative(dir, z);
|
||||
+ BlockState state = level.getBlockState(newPos);
|
||||
+ if (!state.is(self) || !state.getValue(POWERED) || level.hasNeighborSignal(newPos) ||
|
||||
+ self.findPoweredRailSignal(level, newPos, state, true, 0) ||
|
||||
+ self.findPoweredRailSignal(level, newPos, state, false, 0)) break;
|
||||
+ level.setBlock(newPos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE);
|
||||
+ count[i]++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void shapeUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int endPos, Direction direction, int currentPos, BlockPos blockPos) {
|
||||
+ if (currentPos != endPos) return;
|
||||
+
|
||||
+ BlockPos newPos = pos.relative(direction, currentPos+1);
|
||||
+ giveShapeUpdate(level, state, newPos, pos, direction);
|
||||
+
|
||||
+ BlockState blockState = level.getBlockState(blockPos);
|
||||
+ if (blockState.is(self) && blockState.getValue(SHAPE).isAscending()) giveShapeUpdate(level, state, newPos.above(), pos, direction);
|
||||
+ }
|
||||
+
|
||||
+ private static void neighborUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, int endPos, Direction dir, Block block, int currentPos, BlockPos blockPos) {
|
||||
+ if (currentPos != endPos) return;
|
||||
+
|
||||
+ BlockPos newPos = pos.relative(dir, currentPos+1);
|
||||
+ level.neighborChanged(newPos, block, pos);
|
||||
+
|
||||
+ BlockState blockState = level.getBlockState(blockPos);
|
||||
+ if (blockState.is(self) && blockState.getValue(SHAPE).isAscending()) level.neighborChanged(newPos.above(), block, blockPos);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsNeighborEW(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
||||
+ BlockPos pos1 = pos.relative(dir, c);
|
||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, pos);
|
||||
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
||||
+ level.neighborChanged(pos1.below(), block, pos);
|
||||
+ level.neighborChanged(pos1.above(), block, pos);
|
||||
+ level.neighborChanged(pos1.north(), block, pos);
|
||||
+ level.neighborChanged(pos1.south(), block, pos);
|
||||
+ BlockPos pos2 = pos.relative(dir, c).below();
|
||||
+ level.neighborChanged(pos2.below(), block, pos);
|
||||
+ level.neighborChanged(pos2.north(), block, pos);
|
||||
+ level.neighborChanged(pos2.south(), block, pos);
|
||||
+ if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, pos);
|
||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, pos);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsSectionEW(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) {
|
||||
+ BlockPos blockPos = pos.relative(dir, c);
|
||||
+ if (c == 0 && count[1] == 0) giveShapeUpdate(level, mainState, blockPos.relative(dir.getOpposite()), pos, dir.getOpposite());
|
||||
+ shapeUpdateEnd(self, level, pos, mainState, countAmt, dir, c, blockPos);
|
||||
+ giveShapeUpdate(level, mainState, blockPos.below(), pos, Direction.DOWN);
|
||||
+ giveShapeUpdate(level, mainState, blockPos.above(), pos, Direction.UP);
|
||||
+ giveShapeUpdate(level, mainState, blockPos.north(), pos, Direction.NORTH);
|
||||
+ giveShapeUpdate(level, mainState, blockPos.south(), pos, Direction.SOUTH);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsNeighborNS(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
||||
+ BlockPos pos1 = pos.relative(dir,c);
|
||||
+ level.neighborChanged(pos1.west(), block, pos);
|
||||
+ level.neighborChanged(pos1.east(), block, pos);
|
||||
+ level.neighborChanged(pos1.below(), block, pos);
|
||||
+ level.neighborChanged(pos1.above(), block, pos);
|
||||
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, pos);
|
||||
+ BlockPos pos2 = pos.relative(dir,c).below();
|
||||
+ level.neighborChanged(pos2.west(), block, pos);
|
||||
+ level.neighborChanged(pos2.east(), block, pos);
|
||||
+ level.neighborChanged(pos2.below(), block, pos);
|
||||
+ if (c == countAmt) level.neighborChanged(pos.relative(dir,c + 1).below(), block, pos);
|
||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, pos);
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsSectionNS(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState state, Direction dir, int[] count, int countAmt) {
|
||||
+ BlockPos blockPos = pos.relative(dir, c);
|
||||
+ giveShapeUpdate(level, state, blockPos.west(), pos, Direction.WEST);
|
||||
+ giveShapeUpdate(level, state, blockPos.east(), pos, Direction.EAST);
|
||||
+ giveShapeUpdate(level, state, blockPos.below(), pos, Direction.DOWN);
|
||||
+ giveShapeUpdate(level, state, blockPos.above(), pos, Direction.UP);
|
||||
+ shapeUpdateEnd(self, level, pos, state, countAmt, dir, c, blockPos);
|
||||
+ if (c == 0 && count[1] == 0) giveShapeUpdate(level, state, blockPos.relative(dir.getOpposite()), pos, dir.getOpposite());
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsEW(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int[] count) {
|
||||
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
|
||||
+ int countAmt = count[i];
|
||||
+ if (i == 1 && countAmt == 0) continue;
|
||||
+ Direction dir = EAST_WEST_DIR[i];
|
||||
+ Block block = state.getBlock();
|
||||
+ for (int c = countAmt; c >= i; c--) updateRailsNeighborEW(self, level, pos, c, block, dir, count, countAmt);
|
||||
+ for (int c = countAmt; c >= i; c--) updateRailsSectionEW(self, level, pos, c, state, dir, count, countAmt);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void updateRailsNS(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int[] count) {
|
||||
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
|
||||
+ int countAmt = count[i];
|
||||
+ if (i == 1 && countAmt == 0) continue;
|
||||
+ Direction dir = NORTH_SOUTH_DIR[i];
|
||||
+ Block block = state.getBlock();
|
||||
+ for (int c = countAmt; c >= i; c--) updateRailsNeighborNS(self, level, pos, c, block, dir, count, countAmt);
|
||||
+ for (int c = countAmt; c >= i; c--) updateRailsSectionNS(self, level, pos, c, state, dir, count, countAmt);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
index 8fc65c32a3c6e6842a76b36f45e1b1c23abbc480..364b161a1e22b9b3a7de4de954969fa4d2731dd7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||
@@ -29,7 +29,7 @@ public class PoweredRailBlock extends BaseRailBlock {
|
||||
this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(PoweredRailBlock.SHAPE, RailShape.NORTH_SOUTH)).setValue(PoweredRailBlock.POWERED, false)).setValue(PoweredRailBlock.WATERLOGGED, false));
|
||||
}
|
||||
|
||||
- protected boolean findPoweredRailSignal(Level world, BlockPos pos, BlockState state, boolean flag, int distance) {
|
||||
+ public boolean findPoweredRailSignal(Level world, BlockPos pos, BlockState state, boolean flag, int distance) { // Plazma - protected -> public
|
||||
if (distance >= world.purpurConfig.railActivationRange) { // Purpur
|
||||
return false;
|
||||
} else {
|
||||
@@ -117,6 +117,12 @@ public class PoweredRailBlock extends BaseRailBlock {
|
||||
|
||||
@Override
|
||||
protected void updateState(BlockState state, Level world, BlockPos pos, Block neighbor) {
|
||||
+ // Plazma start - Optimize powered rail processing
|
||||
+ if (world.plazmaConfig().block.rail.useFasterSignalSearch) {
|
||||
+ ca.fxco.railoptimization.RailLogic.customUpdateState(this, state, world, pos);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Plazma end - Optimize powered rail processing
|
||||
boolean flag = (Boolean) state.getValue(PoweredRailBlock.POWERED);
|
||||
boolean flag1 = world.hasNeighborSignal(pos) || this.findPoweredRailSignal(world, pos, state, true, 0) || this.findPoweredRailSignal(world, pos, state, false, 0);
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 97da147ae867500a343af7beea51ed5e89543a47..db87e8d98aeeeb89566dac8f94c02846cb287fb9 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -114,6 +114,13 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public Rail rail;
|
||||
+ public class Rail extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean useFasterSignalSearch = OPTIMIZE;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sat, 26 Oct 2024 13:42:26 +0900
|
||||
Subject: [PATCH] Implement alternative noise chunk generator
|
||||
|
||||
Based on Steveplays28/noisium.
|
||||
Copyright (C) 2024 Darion Spaargaren, Licensed under GPL v3.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index a28366b8ed0da356dad6941e0a817d0b7ec43738..a4e655e40282def5d94a598230485f2a02b14eab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -19,9 +19,9 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
public static final int SECTION_HEIGHT = 16;
|
||||
public static final int SECTION_SIZE = 4096;
|
||||
public static final int BIOME_CONTAINER_BITS = 2;
|
||||
- short nonEmptyBlockCount; // Paper - package private
|
||||
- private short tickingBlockCount;
|
||||
- private short tickingFluidCount;
|
||||
+ public short nonEmptyBlockCount; // Paper - package private // Plazma -> public
|
||||
+ public short tickingBlockCount; // Plazma - private -> public
|
||||
+ public short tickingFluidCount; // Plazma - private -> public
|
||||
public short fluidStateCount; // Pufferfish
|
||||
public final PalettedContainer<BlockState> states;
|
||||
// CraftBukkit start - read/write
|
||||
@@ -35,8 +35,8 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
}
|
||||
|
||||
- private int specialCollidingBlocks;
|
||||
- private final ca.spottedleaf.moonrise.common.list.IBlockDataList tickingBlocks = new ca.spottedleaf.moonrise.common.list.IBlockDataList();
|
||||
+ public int specialCollidingBlocks; // Plazma - private -> public
|
||||
+ public final ca.spottedleaf.moonrise.common.list.IBlockDataList tickingBlocks = new ca.spottedleaf.moonrise.common.list.IBlockDataList(); // Plazma - private -> public
|
||||
|
||||
@Override
|
||||
public final int moonrise$getSpecialCollidingBlocks() {
|
||||
@@ -271,17 +271,13 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
// CraftBukkit end
|
||||
|
||||
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
|
||||
- PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
|
||||
- boolean flag = true;
|
||||
+ // Plazma start - Optimize noise
|
||||
+ PalettedContainer<Holder<Biome>> block = this.biomes.recreate();
|
||||
|
||||
- for (int l = 0; l < 4; ++l) {
|
||||
- for (int i1 = 0; i1 < 4; ++i1) {
|
||||
- for (int j1 = 0; j1 < 4; ++j1) {
|
||||
- datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeSupplier.getNoiseBiome(x + l, y + i1, z + j1, sampler));
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ for (int dY = 0; dY < 4; ++dY) for (int dZ = 0; dZ < 4; ++dZ) for (int dX = 0; dX < 4; ++dX)
|
||||
+ block.getAndSetUnchecked(dX, dY, dZ, biomeSupplier.getNoiseBiome(x + dX, y + dY, z + dZ, sampler));
|
||||
|
||||
- this.biomes = datapaletteblock;
|
||||
+ this.biomes = block;
|
||||
+ // Plazma end - Optimize noise
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 13d3c877b006a4975e7370713e3919c661e7890f..f3e7dcd0a5625c7b4e8a3512ee05637ab298a598 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -30,7 +30,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public final IdMap<T> registry;
|
||||
private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values
|
||||
public volatile PalettedContainer.Data<T> data; // Paper - optimise collisions - public
|
||||
- private final PalettedContainer.Strategy strategy;
|
||||
+ public final PalettedContainer.Strategy strategy; // Plazma - private -> public
|
||||
// private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
|
||||
|
||||
public void acquire() {
|
||||
@@ -386,7 +386,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
void accept(T object, int count);
|
||||
}
|
||||
|
||||
- static record Data<T>(PalettedContainer.Configuration<T> configuration, BitStorage storage, Palette<T> palette) {
|
||||
+ public record Data<T>(PalettedContainer.Configuration<T> configuration, BitStorage storage, Palette<T> palette) { // Plazma - package-private -> public
|
||||
public void copyFrom(Palette<T> palette, BitStorage storage) {
|
||||
for (int i = 0; i < storage.getSize(); i++) {
|
||||
T object = palette.valueFor(storage.get(i));
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
index 688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e..e22a7d4f2831b4d03b797cfb043a17c0d61b5f3b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
||||
public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
|
||||
+ public static boolean PLAZMA_USE_NOISIUM = false; // Plazma - Optimize noise chunk generation
|
||||
public static final MapCodec<NoiseBasedChunkGenerator> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((chunkgeneratorabstract) -> {
|
||||
return chunkgeneratorabstract.biomeSource;
|
||||
@@ -270,6 +271,24 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
int k = Mth.floorDiv(noisesettings.height(), noisesettings.getCellHeight());
|
||||
|
||||
return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(Util.wrapThreadWithTaskName("wgen_fill_noise", () -> {
|
||||
+ // Plazma start - Optimize noise chunk generation
|
||||
+ if (PLAZMA_USE_NOISIUM) {
|
||||
+ int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
||||
+ int i1 = chunk.getSectionIndex(i);
|
||||
+
|
||||
+ var set = chunk.getSections();
|
||||
+ for (int j1 = l; j1 >= i1; --j1) set[j1].acquire();
|
||||
+
|
||||
+ ChunkAccess ichunkaccess1;
|
||||
+ try {
|
||||
+ ichunkaccess1 = this.doFill(blender, structureAccessor, noiseConfig, chunk, j, k);
|
||||
+ } finally {
|
||||
+ for (int j1 = l; j1 >= i1; --j1) set[j1].release();
|
||||
+ }
|
||||
+
|
||||
+ return ichunkaccess1;
|
||||
+ }
|
||||
+ // Plazma end - Optimize noise chunk generation
|
||||
int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
||||
int i1 = chunk.getSectionIndex(i);
|
||||
Set<LevelChunkSection> set = Sets.newHashSet();
|
||||
@@ -377,6 +396,25 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
|
||||
iblockdata = this.debugPreliminarySurfaceLevel(noisechunk, j4, j3, i5, iblockdata);
|
||||
if (iblockdata != NoiseBasedChunkGenerator.AIR && !SharedConstants.debugVoidTerrain(chunk.getPos())) {
|
||||
+ // Plazma start - Optimize noise
|
||||
+ if (PLAZMA_USE_NOISIUM) {
|
||||
+ ++chunksection.nonEmptyBlockCount;
|
||||
+ if (!iblockdata.getFluidState().isEmpty()) ++chunksection.tickingFluidCount;
|
||||
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata))
|
||||
+ ++chunksection.specialCollidingBlocks;
|
||||
+
|
||||
+ if (!iblockdata.isRandomlyTicking()) {
|
||||
+ ++chunksection.tickingBlockCount;
|
||||
+ chunksection.tickingBlocks.remove(k4, k3, j5);
|
||||
+ chunksection.tickingBlocks.add(k4, k3, j5, iblockdata);
|
||||
+ }
|
||||
+
|
||||
+ chunksection.states.data.storage().set(
|
||||
+ chunksection.states.strategy.getIndex(k4, k3, j5),
|
||||
+ chunksection.states.data.palette().idFor(iblockdata)
|
||||
+ );
|
||||
+ } else
|
||||
+ // Plazma end - Optimize noise
|
||||
chunksection.setBlockState(k4, k3, j5, iblockdata, false);
|
||||
heightmap.update(k4, j3, j5, iblockdata);
|
||||
heightmap1.update(k4, j3, j5, iblockdata);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||
index 52fcf1b92854e5c67c51a83d31b4a136413b54e0..e8fbf1408102681fabb588c2bcc4a56df9b0152f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.core.QuartPos;
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
|
||||
-public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int noiseSizeVertical) {
|
||||
+public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int noiseSizeVertical, int horizontalCellBlockCount, int verticalCellBlockCount) { // Plazma - Optimize noise
|
||||
public static final Codec<NoiseSettings> CODEC = RecordCodecBuilder.<NoiseSettings>create(
|
||||
instance -> instance.group(
|
||||
Codec.intRange(DimensionType.MIN_Y, DimensionType.MAX_Y).fieldOf("min_y").forGetter(NoiseSettings::minY),
|
||||
@@ -16,7 +16,7 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
|
||||
Codec.intRange(1, 4).fieldOf("size_horizontal").forGetter(NoiseSettings::noiseSizeHorizontal),
|
||||
Codec.intRange(1, 4).fieldOf("size_vertical").forGetter(NoiseSettings::noiseSizeVertical)
|
||||
)
|
||||
- .apply(instance, NoiseSettings::new)
|
||||
+ .apply(instance, NoiseSettings::create) // Plazma - Optimize noise
|
||||
)
|
||||
.comapFlatMap(NoiseSettings::guardY, Function.identity());
|
||||
protected static final NoiseSettings OVERWORLD_NOISE_SETTINGS = create(-64, 384, 1, 2);
|
||||
@@ -36,7 +36,7 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
|
||||
}
|
||||
|
||||
public static NoiseSettings create(int minimumY, int height, int horizontalSize, int verticalSize) {
|
||||
- NoiseSettings noiseSettings = new NoiseSettings(minimumY, height, horizontalSize, verticalSize);
|
||||
+ NoiseSettings noiseSettings = new NoiseSettings(minimumY, height, horizontalSize, verticalSize, QuartPos.toBlock(horizontalSize), QuartPos.toBlock(verticalSize)); // Plazma - Optimize noise
|
||||
guardY(noiseSettings).error().ifPresent(error -> {
|
||||
throw new IllegalStateException(error.message());
|
||||
});
|
||||
@@ -44,16 +44,16 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
|
||||
}
|
||||
|
||||
public int getCellHeight() {
|
||||
- return QuartPos.toBlock(this.noiseSizeVertical());
|
||||
+ return this.noiseSizeHorizontal; // Plazma - Optimize noise
|
||||
}
|
||||
|
||||
public int getCellWidth() {
|
||||
- return QuartPos.toBlock(this.noiseSizeHorizontal());
|
||||
+ return this.noiseSizeVertical; // Plazma - Optimize noise
|
||||
}
|
||||
|
||||
public NoiseSettings clampToHeightAccessor(LevelHeightAccessor world) {
|
||||
int i = Math.max(this.minY, world.getMinBuildHeight());
|
||||
int j = Math.min(this.minY + this.height, world.getMaxBuildHeight()) - i;
|
||||
- return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical);
|
||||
+ return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical, QuartPos.toBlock(this.noiseSizeHorizontal), QuartPos.toBlock(this.noiseSizeVertical)); // Plazma - Optimize noise
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
index afdbc74a3012fa717f59ecef613567338d285b7b..89dbfdb315c02a15deae51b176fdd3e0d8b03496 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||
@@ -10,13 +10,15 @@ public record MaterialRuleList(List<NoiseChunk.BlockStateFiller> materialRuleLis
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockState calculate(DensityFunction.FunctionContext pos) {
|
||||
- for (NoiseChunk.BlockStateFiller blockStateFiller : this.materialRuleList) {
|
||||
- BlockState blockState = blockStateFiller.calculate(pos);
|
||||
- if (blockState != null) {
|
||||
- return blockState;
|
||||
- }
|
||||
+ // Plazma start - Optimize noise
|
||||
+ for (int i = 0; i < this.materialRuleList.size(); i++) {
|
||||
+ BlockState state = this.materialRuleList.get(i).calculate(pos);
|
||||
+ if (state == null) continue;
|
||||
+
|
||||
+ return state;
|
||||
}
|
||||
|
||||
return null;
|
||||
+ // Plazma end - Optimize noise
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 2f5b59ec72fff421e1bc254ebeba78647c7409fe..7ef541c5d8306ef66214e7150aca0fa53c14d12a 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -44,6 +44,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public WorldGeneration worldgen;
|
||||
public class WorldGeneration extends ConfigurationPart {
|
||||
|
||||
+ boolean useAlternativeNoiseGenerator = OPTIMIZE;
|
||||
+
|
||||
public LavaSea lavaSea;
|
||||
public class LavaSea extends ConfigurationPart {
|
||||
|
||||
@@ -63,6 +65,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ @PostProcess
|
||||
+ void post() {
|
||||
+ net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.PLAZMA_USE_NOISIUM = this.useAlternativeNoiseGenerator;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
public Entity entity;
|
||||
69
patches/server/0040-Load-player-data-asynchronously.patch
Normal file
69
patches/server/0040-Load-player-data-asynchronously.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sat, 26 Oct 2024 18:09:08 +0900
|
||||
Subject: [PATCH] Load player data asynchronously
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 19d3423644a6a394743c09eb6935bb7633a329a2..7c9edbe4073bb63c680c9839aa38d92139a90b81 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -76,7 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
// CraftBukkit end
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
- private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads
|
||||
+ public static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads // Plazma - private -> public
|
||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
||||
private final byte[] challenge;
|
||||
final MinecraftServer server;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 69ff5380eedb3e0b214324dec50bb5c0eb65001b..a044b9393e54bb46794ec477cb11bdacf62e0181 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -183,6 +183,16 @@ public abstract class PlayerList {
|
||||
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
|
||||
|
||||
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
|
||||
+ // Plazma start - load player information asynchronously
|
||||
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.loadAsynchronously)
|
||||
+ this.placeNewPlayer(connection, player, clientData, this.load(player));
|
||||
+ else java.util.concurrent.CompletableFuture
|
||||
+ .supplyAsync(() -> this.load(player), net.minecraft.server.network.ServerLoginPacketListenerImpl.authenticatorPool)
|
||||
+ .thenAcceptAsync(nbt -> this.placeNewPlayer(connection, player, clientData, nbt), this.server);
|
||||
+ }
|
||||
+
|
||||
+ private void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData, Optional<CompoundTag> optional) {
|
||||
+ // Plazma end - load player information asynchronously
|
||||
player.isRealPlayer = true; // Paper
|
||||
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
|
||||
GameProfile gameprofile = player.getGameProfile();
|
||||
@@ -191,14 +201,13 @@ public abstract class PlayerList {
|
||||
String s;
|
||||
|
||||
if (usercache != null) {
|
||||
- Optional<GameProfile> optional = usercache.get(gameprofile.getId()); // CraftBukkit - decompile error
|
||||
- s = (String) optional.map(GameProfile::getName).orElse(gameprofile.getName());
|
||||
+ s = usercache.get(gameprofile.getId()).map(GameProfile::getName).orElse(gameprofile.getName()); // CraftBukkit - decompile error // Plazma - varname conflict
|
||||
usercache.add(gameprofile);
|
||||
} else {
|
||||
s = gameprofile.getName();
|
||||
}
|
||||
|
||||
- Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error
|
||||
+ // Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error // Plazma - extract
|
||||
ResourceKey<Level> resourcekey = null; // Paper
|
||||
// CraftBukkit start - Better rename detection
|
||||
if (optional.isPresent()) {
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 7ef541c5d8306ef66214e7150aca0fa53c14d12a..9de9b3f2148216df41258d503fa1de896cca4771 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -28,6 +28,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public class Player extends ConfigurationPart {
|
||||
|
||||
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
|
||||
+ public boolean loadAsynchronously = OPTIMIZE;
|
||||
|
||||
public FreedomChat freedomChat;
|
||||
public class FreedomChat extends ConfigurationPart {
|
||||
@@ -0,0 +1,847 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sat, 26 Oct 2024 18:30:26 +0900
|
||||
Subject: [PATCH] Configurable RandomSource factory/provider
|
||||
|
||||
Xorshift Random: https://gist.github.com/Xyene/4637619
|
||||
|
||||
Based on AnOpenSauceDev/FastRandom
|
||||
|
||||
Copyright (C) 2024 AnOpenSauceDev
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
index cd61276a45894a02cbefc41a63c27e2cf6361d1e..77007cdfd2e423d26d407d0403f4d1033f9c276a 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||
@@ -21,7 +21,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class PaperLootableInventoryData {
|
||||
|
||||
- private static final Random RANDOM = new Random();
|
||||
+ private static final Random RANDOM = java.util.concurrent.ThreadLocalRandom.current(); // Plazma - reduce creating random instance
|
||||
|
||||
private long lastFill = -1;
|
||||
private long nextRefill = -1;
|
||||
diff --git a/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java b/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a060fdbdc4daaffd9aafc707dc567cb56067d1e2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java
|
||||
@@ -0,0 +1,115 @@
|
||||
+package com.github.anopensaucedev.fasterrandom.util.math.random;
|
||||
+
|
||||
+import com.google.common.annotations.VisibleForTesting;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.util.Mth;
|
||||
+import net.minecraft.world.level.levelgen.BitRandomSource;
|
||||
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
|
||||
+import net.minecraft.util.RandomSource;
|
||||
+import org.jspecify.annotations.NonNull;
|
||||
+
|
||||
+import java.util.random.RandomGenerator;
|
||||
+import java.util.random.RandomGeneratorFactory;
|
||||
+
|
||||
+public class RandomGeneratorRandom implements BitRandomSource {
|
||||
+ private static final @NonNull RandomGeneratorFactory<RandomGenerator.SplittableGenerator> FACTORY = RandomGeneratorFactory.of(org.plazmamc.plazma.Options.RANDOM_ALGOL);
|
||||
+ private static final int INT_BITS = 48;
|
||||
+ private static final long SEED_MASK = 0xFFFFFFFFFFFFL;
|
||||
+ private static final long MULTIPLIER = 25214903917L;
|
||||
+ private static final long INCREMENT = 11L;
|
||||
+
|
||||
+ private long seed;
|
||||
+ private RandomGenerator.SplittableGenerator randomGenerator;
|
||||
+
|
||||
+ public RandomGeneratorRandom(long seed) {
|
||||
+ this.seed = seed;
|
||||
+ this.randomGenerator = FACTORY.create(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fork() {
|
||||
+ return new RandomGeneratorRandom(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull PositionalRandomFactory forkPositional() {
|
||||
+ return new RandomGeneratorRandomFactory(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSeed(long seed) {
|
||||
+ this.seed = seed;
|
||||
+ this.randomGenerator = FACTORY.create(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int next(int bits) {
|
||||
+ // >>> instead of Mojang's >> fixes MC-239059
|
||||
+ return (int) ((seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> INT_BITS - bits);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt() {
|
||||
+ return randomGenerator.nextInt();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt(int bound) {
|
||||
+ return randomGenerator.nextInt(bound);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public long nextLong() {
|
||||
+ return randomGenerator.nextLong();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean nextBoolean() {
|
||||
+ return randomGenerator.nextBoolean();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float nextFloat() {
|
||||
+ return randomGenerator.nextFloat();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextDouble() {
|
||||
+ return randomGenerator.nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextGaussian() {
|
||||
+ return randomGenerator.nextGaussian();
|
||||
+ }
|
||||
+
|
||||
+ private record RandomGeneratorRandomFactory(long seed) implements PositionalRandomFactory {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(int x, int y, int z) {
|
||||
+ return new RandomGeneratorRandom(Mth.getSeed(x, y, z) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
|
||||
+ return new RandomGeneratorRandom(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
|
||||
+ return new RandomGeneratorRandom((long) seed.hashCode() ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromSeed(final long seed) {
|
||||
+ return new RandomGeneratorRandom(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @VisibleForTesting
|
||||
+ public void parityConfigString(@NonNull StringBuilder info) {
|
||||
+ info.append("RandomGeneratorRandom$RandomGeneratorRandomFactory{").append(this.seed).append("}");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
|
||||
index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..4d41cd53f7f892df5f2f67968dbe001046b185bc 100644
|
||||
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
||||
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
||||
@@ -10,18 +10,39 @@ import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
|
||||
public interface RandomSource {
|
||||
@Deprecated
|
||||
double GAUSSIAN_SPREAD_FACTOR = 2.297;
|
||||
+ // Plazma start - Implement RandomGenerator support
|
||||
+ java.util.function.LongFunction<RandomSource> FACTORY = switch (org.plazmamc.plazma.Options.RANDOM_FACTORY) {
|
||||
+ case "legacy" -> LegacyRandomSource::new;
|
||||
+ case "xoroshiro" -> net.minecraft.world.level.levelgen.XoroshiroRandomSource::new;
|
||||
+ case "xorshift" -> org.plazmamc.plazma.util.random.XorshiftRandomSource::new;
|
||||
+ case "secure" -> org.plazmamc.plazma.util.random.SecureRandomSource::new;
|
||||
+ case "generator" -> {
|
||||
+ try {
|
||||
+ java.util.random.RandomGeneratorFactory.of(org.plazmamc.plazma.Options.RANDOM_ALGOL).create();
|
||||
+ yield com.github.anopensaucedev.fasterrandom.util.math.random.RandomGeneratorRandom::new;
|
||||
+ } catch (IllegalArgumentException ignored) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.error("Your JDK does not support RandomGenerator! Update JDK or remove \"-DPlazma.randomSourceFactory\" from the startup flag");
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("Falling back to legacy random");
|
||||
+ yield LegacyRandomSource::new;
|
||||
+ }
|
||||
+ }
|
||||
+ default -> throw new IllegalArgumentException("Invalid RandomSource: " + org.plazmamc.plazma.Options.RANDOM_FACTORY + ". Valid RandomSources are: legacy, xoroshiro, xorshift, generator");
|
||||
+ };
|
||||
+ @org.jspecify.annotations.Nullable RandomSource SHARED = org.plazmamc.plazma.Options.SHARED_RANDOM ? create() : null;
|
||||
+ // Plazma end - Implement RandomGenerator support
|
||||
|
||||
static RandomSource create() {
|
||||
- return create(RandomSupport.generateUniqueSeed());
|
||||
+ return SHARED == null ? create(RandomSupport.generateUniqueSeed()) : SHARED; // Plazma - Configurable RandomSource
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
static RandomSource createThreadSafe() {
|
||||
+ if (org.plazmamc.plazma.Options.NO_THREAD_SAFE) return create(); // Plazma - Configurable RandomSource
|
||||
return new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed());
|
||||
}
|
||||
|
||||
static RandomSource create(long seed) {
|
||||
- return new LegacyRandomSource(seed);
|
||||
+ return org.plazmamc.plazma.Options.IGNORE_SEED ? create() : FACTORY.apply(seed); // Plazma - Configurable RandomSource
|
||||
}
|
||||
|
||||
static RandomSource createNewThreadLocalInstance() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
index d6cac5ed7916040104f2a79ed38eb8b453ea3db6..a16eaefaf146add122f128fa9ed03b7cdd74d198 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||
@@ -393,7 +393,7 @@ public class PiglinAi {
|
||||
}
|
||||
|
||||
private static boolean wantsToDance(LivingEntity piglin, LivingEntity target) {
|
||||
- return target.getType() != EntityType.HOGLIN ? false : RandomSource.create(piglin.level().getGameTime()).nextFloat() < 0.1F;
|
||||
+ return target.getType() != EntityType.HOGLIN ? false : (org.plazmamc.plazma.Options.SHARED_RANDOM ? piglin.random.nextFloat() : RandomSource.create(piglin.level().getGameTime()).nextFloat()) < 0.1F; // Plazma - reduce creating random instance
|
||||
}
|
||||
|
||||
protected static boolean wantsToPickup(Piglin piglin, ItemStack stack) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||
index ab3e35069a069040f72900a9581f41848e4c4653..30a31c21aa941f518eff542721e25450565368ba 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||
@@ -343,7 +343,7 @@ public class StructureBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
public static RandomSource createRandom(long seed) {
|
||||
- return seed == 0L ? RandomSource.create(Util.getMillis()) : RandomSource.create(seed);
|
||||
+ return seed == 0L ? RandomSource.create() : RandomSource.create(seed); // Plazma - reduce creating random instance
|
||||
}
|
||||
|
||||
public boolean placeStructureIfSameSize(ServerLevel world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
|
||||
index f1e0d3d7b1f458fcce83cf67762a16309123cdcb..6a8d5948f127ea87a0b4554ece4ad2c4c49a47c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
|
||||
@@ -120,7 +120,7 @@ public class StructurePlaceSettings {
|
||||
}
|
||||
|
||||
public RandomSource getRandom(@Nullable BlockPos pos) {
|
||||
- return this.random != null ? this.random : (pos == null ? RandomSource.create(Util.getMillis()) : RandomSource.create(Mth.getSeed(pos)));
|
||||
+ return this.random != null ? this.random : (pos == null ? RandomSource.create() : RandomSource.create(Mth.getSeed(pos))); // Plazma - reduce creating random instance
|
||||
}
|
||||
|
||||
public boolean isIgnoreEntities() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 0921894dbc0d81b943827ecda6e6befdbfd715f5..95df118e292422cc11c833bfe6e741c1fd3aa421 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -291,7 +291,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
- private static final Random rand = new Random();
|
||||
+ private static final Random rand = java.util.concurrent.ThreadLocalRandom.current(); // Plazma - reduce creating random instance
|
||||
|
||||
public CraftWorld(ServerLevel world, ChunkGenerator gen, BiomeProvider biomeProvider, Environment env) {
|
||||
this.world = world;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index 759b6e54db93792c9862b1f1625118ac6fa49d7a..e81fa9aefc76af906ed1b6903f416f4d123689f5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@@ -14,7 +14,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
public class CraftFirework extends CraftProjectile implements Firework {
|
||||
|
||||
- private final Random random = new Random();
|
||||
+ private final net.minecraft.util.RandomSource random = net.minecraft.util.RandomSource.create(); // Plazma - Configurable RandomSource
|
||||
//private CraftItemStack item; // Paper - Remove usage, not accurate representation of current item.
|
||||
|
||||
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
index 4b3ae18ef8cd09a2d9c9eaee2bf402d0dd7ee1cd..016a1cd625091fe9b93b27a9782cdc13057a0c8a 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||
@@ -12,5 +12,10 @@ public interface Options {
|
||||
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||
boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
|
||||
+ String RANDOM_FACTORY = getProperty("Plazma.randomSourceFactory", "legacy");
|
||||
+ String RANDOM_ALGOL = getProperty("Plazma.randomSourceAlgorithm", "L64X128MixRandom");
|
||||
+ boolean SHARED_RANDOM = getBoolean("Plazma.sharedRandomSource");
|
||||
+ boolean IGNORE_SEED = getBoolean("Plazma.ignoreSeed") && SHARED_RANDOM;
|
||||
+ boolean NO_THREAD_SAFE = getBoolean("Plazma.overrideThreadSafeRandom");
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java b/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5d08f040a05df5d24f4bf9747177c1720fe246fe
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java
|
||||
@@ -0,0 +1,100 @@
|
||||
+package org.plazmamc.plazma.util.random;
|
||||
+
|
||||
+import com.google.common.annotations.VisibleForTesting;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.util.Mth;
|
||||
+import net.minecraft.util.RandomSource;
|
||||
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jspecify.annotations.NonNull;
|
||||
+import java.security.SecureRandom;
|
||||
+
|
||||
+public class SecureRandomSource implements RandomSource {
|
||||
+
|
||||
+ private final SecureRandom random = new SecureRandom();
|
||||
+
|
||||
+ public SecureRandomSource(long seed) {
|
||||
+ this.setSeed(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull RandomSource fork() {
|
||||
+ return new SecureRandomSource(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull PositionalRandomFactory forkPositional() {
|
||||
+ return new SecureRandomSourceFactory(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSeed(final long seed) {
|
||||
+ this.random.setSeed(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt() {
|
||||
+ return this.random.nextInt();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt(final int bound) {
|
||||
+ return this.random.nextInt(bound);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public long nextLong() {
|
||||
+ return this.random.nextLong();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean nextBoolean() {
|
||||
+ return this.random.nextBoolean();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float nextFloat() {
|
||||
+ return this.random.nextFloat();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextDouble() {
|
||||
+ return this.random.nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextGaussian() {
|
||||
+ return this.random.nextGaussian();
|
||||
+ }
|
||||
+
|
||||
+ private record SecureRandomSourceFactory(long seed) implements PositionalRandomFactory {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(int x, int y, int z) {
|
||||
+ return new SecureRandomSource(Mth.getSeed(x, y, z) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
|
||||
+ return new SecureRandomSource(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
|
||||
+ return new SecureRandomSource((long) seed.hashCode() ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromSeed(final long seed) {
|
||||
+ return new SecureRandomSource(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @VisibleForTesting
|
||||
+ public void parityConfigString(@NonNull StringBuilder info) {
|
||||
+ info.append("SecureRandomSource$SecureRandomSourceFactory{").append(this.seed).append("}");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d9f08546997adb7e4f9b70ce913a4e92eced3a95
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java
|
||||
@@ -0,0 +1,391 @@
|
||||
+package org.plazmamc.plazma.util.random;
|
||||
+
|
||||
+import java.util.Random;
|
||||
+
|
||||
+/**
|
||||
+ * A random number generator based on the simple and fast xor-shift pseudo
|
||||
+ * random number generator (RNG) specified in:
|
||||
+ * Marsaglia, George. (2003). <a href="https://web.archive.org/web/20070211044403/http://www.jstatsoft.org/v08/i14/xorshift.pdf">Xorshift RNGs.</a>
|
||||
+ * Translated from: <a href="https://web.archive.org/web/20230919193645/https://www.codeproject.com/Articles/9187/A-fast-equivalent-for-System-Random">A fast equivalent for System.Random</a>.
|
||||
+ * Original Code from: <a href="https://gist.github.com/Xyene/4637619">Xyene/Random.java</a>
|
||||
+ */
|
||||
+@SuppressWarnings("SuspiciousNameCombination")
|
||||
+public class XorshiftRandom extends Random {
|
||||
+ final double REAL_UNIT_INT = 1.0 / (0x7FFFFFFFL);
|
||||
+ final double REAL_UNIT_UINT = 1.0 / (0xFFFFFFFFL);
|
||||
+ final long Y = 842502087L, Z = 3579807591L, W = 273326509L;
|
||||
+ long x, y, z, w;
|
||||
+
|
||||
+ public XorshiftRandom() {
|
||||
+ seed((int) System.currentTimeMillis());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSeed(long seed) {
|
||||
+ seed((int) seed);
|
||||
+ }
|
||||
+
|
||||
+ public void seed(int seed) {
|
||||
+ // The only stipulation stated for the xorshift RNG is that at least one of
|
||||
+ // the seeds x,y,z,w is non-zero. We fulfill that requirement by only allowing
|
||||
+ // resetting of the x seed
|
||||
+ x = seed;
|
||||
+ y = Y;
|
||||
+ z = Z;
|
||||
+ w = W;
|
||||
+ }
|
||||
+
|
||||
+ long boolBuffer;
|
||||
+ int boolBufferBits = 0;
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean nextBoolean() {
|
||||
+ if (boolBufferBits == 0) {
|
||||
+ boolBuffer = nextUInt();
|
||||
+ boolBufferBits = 32;
|
||||
+ }
|
||||
+ boolBuffer >>= 1;
|
||||
+ boolean bit = (boolBuffer & 1) == 0;
|
||||
+ --boolBufferBits;
|
||||
+ return bit;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void nextBytes(byte[] buffer) {
|
||||
+ // Fill up the bulk of the buffer in chunks of 4 bytes at a time.
|
||||
+ long x = this.x, y = this.y, z = this.z, w = this.w;
|
||||
+ int i = 0;
|
||||
+ long t;
|
||||
+ for (int bound = buffer.length - 3; i < bound; ) {
|
||||
+ // Generate 4 bytes.
|
||||
+ // Increased performance is achieved by generating 4 random bytes per loop.
|
||||
+ // Also note that no mask needs to be applied to zero out the higher order bytes before
|
||||
+ // casting because the cast ignores thos bytes. Thanks to Stefan Trosch黷z for pointing this out.
|
||||
+ t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+ w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
|
||||
+
|
||||
+ buffer[i++] = (byte) w;
|
||||
+ buffer[i++] = (byte) (w >> 8);
|
||||
+ buffer[i++] = (byte) (w >> 16);
|
||||
+ buffer[i++] = (byte) (w >> 24);
|
||||
+ }
|
||||
+
|
||||
+ // Fill up any remaining bytes in the buffer.
|
||||
+ if (i < buffer.length) {
|
||||
+ // Generate 4 bytes.
|
||||
+ t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+ w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
|
||||
+
|
||||
+ buffer[i++] = (byte) w;
|
||||
+ if (i < buffer.length) {
|
||||
+ buffer[i++] = (byte) (w >> 8);
|
||||
+ if (i < buffer.length) {
|
||||
+ buffer[i++] = (byte) (w >> 16);
|
||||
+ if (i < buffer.length) {
|
||||
+ buffer[i] = (byte) (w >> 24);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.x = x;
|
||||
+ this.y = y;
|
||||
+ this.z = z;
|
||||
+ this.w = w;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double nextDouble() {
|
||||
+ long t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+
|
||||
+ // Here we can gain a 2x speed improvement by generating a value that can be cast to
|
||||
+ // an int instead of the more easily available uint. If we then explicitly cast to an
|
||||
+ // int the compiler will then cast the int to a double to perform the multiplication,
|
||||
+ // this final cast is a lot faster than casting from a uint to a double. The extra cast
|
||||
+ // to an int is very fast (the allocated bits remain the same) and so the overall effect
|
||||
+ // of the extra cast is a significant performance improvement.
|
||||
+ //
|
||||
+ // Also note that the loss of one bit of precision is equivalent to what occurs within
|
||||
+ // System.Random.
|
||||
+ return (REAL_UNIT_INT * (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)))));
|
||||
+ }
|
||||
+
|
||||
+ public double random() {
|
||||
+ return nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public float nextFloat() {
|
||||
+ return (float) nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt() {
|
||||
+ long t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+ return (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int nextInt(int upperBound) {
|
||||
+ if (upperBound < 0)
|
||||
+ throw new IllegalArgumentException("upperBound must be >=0");
|
||||
+
|
||||
+ long t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+
|
||||
+ return (int) ((REAL_UNIT_INT * (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))))) * upperBound);
|
||||
+ }
|
||||
+
|
||||
+ public int nextInt(int lowerBound, int upperBound) {
|
||||
+ if (lowerBound > upperBound)
|
||||
+ throw new IllegalArgumentException("upperBound must be >=lowerBound");
|
||||
+
|
||||
+ long t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+
|
||||
+ // The explicit int cast before the first multiplication gives better performance.
|
||||
+ // See comments in NextDouble.
|
||||
+ int range = upperBound - lowerBound;
|
||||
+ if (range < 0) {
|
||||
+ // If range is <0 then an overflow has occured and must resort to using long integer arithmetic instead (slower).
|
||||
+ // We also must use all 32 bits of precision, instead of the normal 31, which again is slower.
|
||||
+ return lowerBound + (int) ((REAL_UNIT_UINT * (double) (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)))) * (double) ((long) upperBound - (long) lowerBound));
|
||||
+ }
|
||||
+ // 31 bits of precision will suffice if range<=int.MaxValue. This allows us to cast to an int and gain
|
||||
+ // a little more performance.
|
||||
+ return lowerBound + (int) ((REAL_UNIT_INT * (double) (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))))) * (double) range);
|
||||
+ }
|
||||
+
|
||||
+ public long nextUInt() {
|
||||
+ long t = (x ^ (x << 11));
|
||||
+ x = y;
|
||||
+ y = z;
|
||||
+ z = w;
|
||||
+ return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))) & (0xFFFFFFFFL);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public long nextLong() {
|
||||
+ return nextUInt() << 32 + nextUInt();
|
||||
+ }
|
||||
+
|
||||
+ double gaussNext;
|
||||
+ boolean hasGaussNext;
|
||||
+ final double TWOPI = Math.PI * 2;
|
||||
+
|
||||
+ /**
|
||||
+ * Get a random number in the range [min, max) or [min, max] depending on rounding.
|
||||
+ *
|
||||
+ * @param min Low bound
|
||||
+ * @param max High bound
|
||||
+ * @return A uniformly distributed double
|
||||
+ */
|
||||
+ public double uniform(double min, double max) {
|
||||
+ return min + (max - min) * nextDouble();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Triangular distribution.
|
||||
+ * <p/>
|
||||
+ * Continuous distribution bounded by given lower and upper limits,
|
||||
+ * and having a given mode value in-between.
|
||||
+ * See: <a href="http://en.wikipedia.org/wiki/Triangular_distribution">Triangular distribution</a>
|
||||
+ *
|
||||
+ * @param low Low bound
|
||||
+ * @param high High bound
|
||||
+ * @param mode Mode
|
||||
+ * @return A number from the triangular distribution specified
|
||||
+ */
|
||||
+ public double triangular(int low, int high, int mode) {
|
||||
+ double u = nextDouble();
|
||||
+ double c = (double) (mode - low) / (high - low);
|
||||
+ if (u > c) {
|
||||
+ u = 1.0 - u;
|
||||
+ c = 1.0 - c;
|
||||
+ int k = low;
|
||||
+ low = high;
|
||||
+ high = k;
|
||||
+ }
|
||||
+ return low + (high - low) * Math.sqrt(u * c);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gaussian distribution, mean is 0 and standard deviation is 1.
|
||||
+ * <p/>
|
||||
+ * mu is the mean, and sigma is the standard deviation.
|
||||
+ *
|
||||
+ * @return A double in Gaussian distribution
|
||||
+ */
|
||||
+ public double gauss() {
|
||||
+ return nextGaussian();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gaussian distribution, with user-specified mean and standard deviation.
|
||||
+ * <p/>
|
||||
+ * mu is the mean, and sigma is the standard deviation.
|
||||
+ *
|
||||
+ * @return A double in Gaussian distribution
|
||||
+ */
|
||||
+ public double gauss(double mu, double sigma) {
|
||||
+ return mu + sigma * nextGaussian();
|
||||
+ }
|
||||
+
|
||||
+ public double gaussUnsigned(double mu, double sigma) {
|
||||
+ double out = gauss(mu, sigma);
|
||||
+ return out > 1 ? out : 1;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Log normal distribution.
|
||||
+ * <p/>
|
||||
+ * If you take the natural logarithm of this distribution, you'll get a
|
||||
+ * normal distribution with mean mu and standard deviation sigma.
|
||||
+ * mu can have any value, and sigma must be greater than zero.
|
||||
+ *
|
||||
+ * @param mu Mean
|
||||
+ * @param sigma Standard deviation
|
||||
+ * @return A number from the log normal distribution specified
|
||||
+ */
|
||||
+ public double logNormal(double mu, double sigma) {
|
||||
+ return Math.exp(gauss(mu, sigma));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Exponential distribution.
|
||||
+ * <p/>
|
||||
+ * lambda is 1.0 divided by the desired mean. It should be
|
||||
+ * nonzero. Returned values range from 0 to positive infinity
|
||||
+ * if lambda is positive, and from negative infinity to 0
|
||||
+ * if lambda is negative.
|
||||
+ *
|
||||
+ * @param lambda A non-zero value
|
||||
+ */
|
||||
+ public double exponential(double lambda) {
|
||||
+ return -Math.log(1.0 - random()) / lambda;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Circular data distribution.
|
||||
+ * <p/>
|
||||
+ * If kappa is equal to zero, this distribution reduces
|
||||
+ * to a uniform random angle over the range 0 to 2*pi.
|
||||
+ *
|
||||
+ * @param mu the mean angle, expressed in radians between 0 and 2*pi.
|
||||
+ * @param kappa the concentration parameter, which must be greater than or
|
||||
+ * equal to zero.
|
||||
+ * @return A number from the circular data distribution specified
|
||||
+ */
|
||||
+ public double circularData(double mu, double kappa) {
|
||||
+ if (kappa <= 1e-6)
|
||||
+ return TWOPI * nextDouble();
|
||||
+
|
||||
+ double a = 1.0 + Math.sqrt(1.0 + 4.0 * kappa * kappa);
|
||||
+ double b = (a - Math.sqrt(2.0 * a)) / (2.0 * kappa);
|
||||
+ double r = (1.0 + b * b) / (2.0 * b);
|
||||
+ double u1, u2, u3, f, c, z, theta = 0;
|
||||
+
|
||||
+ while (true) {
|
||||
+ u1 = nextDouble();
|
||||
+
|
||||
+ z = Math.cos(Math.PI * u1);
|
||||
+ f = (1.0 + r * z) / (r + z);
|
||||
+ c = kappa * (r - f);
|
||||
+
|
||||
+ u2 = nextDouble();
|
||||
+
|
||||
+ if (u2 < c * (2.0 - c) || u2 <= c * Math.exp(1.0 - c))
|
||||
+ break;
|
||||
+
|
||||
+ u3 = nextDouble();
|
||||
+ if (u3 > 0.5)
|
||||
+ theta = (mu % TWOPI) + Math.acos(f);
|
||||
+ else
|
||||
+ theta = (mu % TWOPI) - Math.acos(f);
|
||||
+ }
|
||||
+ return theta;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ final double LOG4 = Math.log(4);
|
||||
+ final double SG_MAGICCONST = 1.0 + Math.log(4.5);
|
||||
+
|
||||
+ /**
|
||||
+ * Gamma distribution. Not the gamma function!
|
||||
+ * Conditions on the parameters are alpha > 0 and beta > 0.
|
||||
+ * <p/>
|
||||
+ * The probability distribution function is:
|
||||
+ * pdf(x) = (x ** (alpha - 1) * math.exp(-x / beta)) / (math.gamma(alpha) * beta ** alpha)
|
||||
+ *
|
||||
+ * @param alpha Alpha
|
||||
+ * @param beta Beta
|
||||
+ * @return A number from the gamma distribution specified
|
||||
+ */
|
||||
+ public double gamma(double alpha, double beta) {
|
||||
+ if (alpha <= 0.0 || beta <= 0.0)
|
||||
+ throw new IllegalArgumentException("alpha and beta must be > 0.0");
|
||||
+
|
||||
+ if (alpha > 1.0) {
|
||||
+ double ainv = Math.sqrt(2.0 * alpha - 1.0);
|
||||
+ double bbb = alpha - LOG4;
|
||||
+ double ccc = alpha + ainv;
|
||||
+ double u1, u2, v, x, z, r;
|
||||
+
|
||||
+ while (true) {
|
||||
+ u1 = random();
|
||||
+ if (!(1e-7 < u1 && u1 < .9999999))
|
||||
+ continue;
|
||||
+ u2 = 1.0 - random();
|
||||
+ v = Math.log(u1 / (1.0 - u1)) / ainv;
|
||||
+ x = alpha * Math.exp(v);
|
||||
+ z = u1 * u1 * u2;
|
||||
+ r = bbb + ccc * v - x;
|
||||
+ if (r + SG_MAGICCONST - 4.5 * z >= 0.0 || r >= Math.log(z))
|
||||
+ return x * beta;
|
||||
+ }
|
||||
+ } else if (alpha == 1.0) {
|
||||
+ // exponential(1)
|
||||
+ double u;
|
||||
+ u = random();
|
||||
+ while (u <= 1e-7)
|
||||
+ u = random();
|
||||
+ return -Math.log(u) * beta;
|
||||
+ } else {
|
||||
+ // alpha is between 0 and 1 (exclusive)
|
||||
+ // Uses ALGORITHM GS of Statistical Computing -Kennedy & Gentle
|
||||
+
|
||||
+ double u, b, p, x, u1;
|
||||
+ while (true) {
|
||||
+ u = random();
|
||||
+ b = (Math.E + alpha) / Math.E;
|
||||
+ p = b * u;
|
||||
+ if (p <= 1.0)
|
||||
+ x = Math.pow(p, (1.0 / alpha));
|
||||
+ else
|
||||
+ x = -Math.log((b - p) / alpha);
|
||||
+ u1 = random();
|
||||
+ if (p > 1.0) {
|
||||
+ if (u1 <= Math.pow(x, (alpha - 1.0)))
|
||||
+ break;
|
||||
+ } else if (u1 <= Math.exp(-x))
|
||||
+ break;
|
||||
+ }
|
||||
+ return x * beta;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..646e9689f17211112f8d253099fb075666d942e9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java
|
||||
@@ -0,0 +1,56 @@
|
||||
+package org.plazmamc.plazma.util.random;
|
||||
+
|
||||
+import com.google.common.annotations.VisibleForTesting;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.util.Mth;
|
||||
+import net.minecraft.util.RandomSource;
|
||||
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
|
||||
+import org.jspecify.annotations.NonNull;
|
||||
+
|
||||
+public class XorshiftRandomSource extends XorshiftRandom implements RandomSource {
|
||||
+
|
||||
+ public XorshiftRandomSource(long seed) {
|
||||
+ this.setSeed(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fork() {
|
||||
+ return new XorshiftRandomSource(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull PositionalRandomFactory forkPositional() {
|
||||
+ return new XorshiftRandomSourceFactory(this.nextLong());
|
||||
+ }
|
||||
+
|
||||
+ private record XorshiftRandomSourceFactory(long seed) implements PositionalRandomFactory {
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(int x, int y, int z) {
|
||||
+ return new XorshiftRandomSource(Mth.getSeed(x, y, z) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
|
||||
+ return new XorshiftRandomSource(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
|
||||
+ return new XorshiftRandomSource((long) seed.hashCode() ^ this.seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NonNull RandomSource fromSeed(final long seed) {
|
||||
+ return new XorshiftRandomSource(seed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @VisibleForTesting
|
||||
+ public void parityConfigString(@NonNull StringBuilder info) {
|
||||
+ info.append("XorshiftRandomSource$XorshiftRandomSourceFactory{").append(this.seed).append("}");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
@@ -0,0 +1,74 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sun, 27 Oct 2024 00:16:25 +0900
|
||||
Subject: [PATCH] Optimize advancement criteria triggering
|
||||
|
||||
Based on bigenergy/achievements-optimizer
|
||||
Copyright (C) 2024 bigenergy, Licensed under MIT License
|
||||
|
||||
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.
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
||||
index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6df92db2fc 100644
|
||||
--- a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
||||
+++ b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
||||
@@ -22,7 +22,21 @@ public class InventoryChangeTrigger extends SimpleCriterionTrigger<InventoryChan
|
||||
return InventoryChangeTrigger.TriggerInstance.CODEC;
|
||||
}
|
||||
|
||||
+ // Plazma start - Optimize advancement criteria triggering
|
||||
+ public static int idleTick;
|
||||
+ private int ticksSkipped;
|
||||
+
|
||||
+ private boolean shouldTick() {
|
||||
+ if (++this.ticksSkipped <= idleTick) return false;
|
||||
+
|
||||
+ this.ticksSkipped = 0;
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Plazma end - Optimize advancement criteria triggering
|
||||
+
|
||||
public void trigger(ServerPlayer player, Inventory inventory, ItemStack stack) {
|
||||
+ if (idleTick > 0 && !this.shouldTick()) return; // Plazma - Optimize advancement criteria triggering
|
||||
+
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int k = 0;
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 9de9b3f2148216df41258d503fa1de896cca4771..49bce6e28e12f3729cab5628cf3e0f508a56d0d7 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -134,4 +134,16 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public Advancements advancements;
|
||||
+ public class Advancements extends ConfigurationPart {
|
||||
+
|
||||
+ int criteriaTriggerIdleTick = OPTIMIZE ? 5 : 0;
|
||||
+
|
||||
+ @PostProcess
|
||||
+ void post() {
|
||||
+ net.minecraft.advancements.critereon.InventoryChangeTrigger.idleTick = this.criteriaTriggerIdleTick;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
32
patches/server/0043-Configurable-water-flowing-speed.patch
Normal file
32
patches/server/0043-Configurable-water-flowing-speed.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sun, 27 Oct 2024 13:48:01 +0900
|
||||
Subject: [PATCH] Configurable water flowing speed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 9dcdb2f4001115db0c26fdbf86531dbe6098485d..0fc89b33864000a262ec5369708f7aedeaf6dc0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -122,7 +122,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
- return 5;
|
||||
+ return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index db87e8d98aeeeb89566dac8f94c02846cb287fb9..f3ac159231768b9b39550e6f5fd512c340738e61 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -91,6 +91,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
public Block block;
|
||||
public class Block extends ConfigurationPart {
|
||||
|
||||
+ public int waterFlowingTick = 5;
|
||||
+
|
||||
public OptimizeFarmCheck optimizeFarmCheck;
|
||||
public class OptimizeFarmCheck extends ConfigurationPart {
|
||||
|
||||
353
patches/server/0044-TickControl-System.patch
Normal file
353
patches/server/0044-TickControl-System.patch
Normal file
@@ -0,0 +1,353 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaKR93 <dev@alpha93.kr>
|
||||
Date: Sun, 27 Oct 2024 15:07:43 +0900
|
||||
Subject: [PATCH] TickControl System
|
||||
|
||||
Based on snackbag/TT20
|
||||
Copyright (C) 2024 snackbag, Licensed under AGPL v3.0
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1c3bb7cd27d97e54cbe74465bd8a7c5faeafdf4a..fd23107e3777b79ac7d598bdd5ec9b9fb8822dbb 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1704,6 +1704,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//this.profiler.pop(); // Purpur
|
||||
org.spigotmc.WatchdogThread.tick(); // Spigot
|
||||
//co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
|
||||
+ org.plazmamc.plazma.util.TickControl.tick(); // Plazma - TickControl System
|
||||
}
|
||||
|
||||
private void logTickMethodTime(long tickStartTime) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||
index a08159bf2fcfe343ca21eb996f085aa71681a7af..48e2a040f60f843493f363d2f218d2c151b27464 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||
@@ -34,6 +34,7 @@ public class ServerWatchdog implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
while (this.server.isRunning()) {
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.enabled) return; // Plazma - TickControl System
|
||||
long l = this.server.getNextTickTime();
|
||||
long m = Util.getNanos();
|
||||
long n = m - l;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index ebe872c4643038f0c99b289d4d5afdbedd76c6ef..eb75a457c207059591d5e42d1cd46a50facc65db 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -504,7 +504,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
||||
}
|
||||
// Paper end - PlayerNaturallySpawnCreaturesEvent
|
||||
- int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
+ int l = org.plazmamc.plazma.util.TickControl.calc(this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING), it -> it.accelerate.randomTick, false); // Plazma - TickControl system
|
||||
boolean flag1 = 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
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 6fbf3a479ee1927b1099d2678db693341491b2b7..e5721ae2d55c614bcee58868acfcd06025d9e3c8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -832,9 +832,14 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
if (incrementTicks != 12000) {
|
||||
this.preciseTime += 12000 / (double) incrementTicks;
|
||||
this.setDayTime(this.preciseTime);
|
||||
- } else
|
||||
+ } // Plazma - TickControl System
|
||||
// Purpur end
|
||||
- this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||
+ // Plazma start - TickControl System
|
||||
+ else if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime)
|
||||
+ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickControl.missedTicks() + 1L);
|
||||
+ else
|
||||
+ this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||
+ // Plazma end - TickControl System
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 9ab19aa8d05384bc03c8250f8ea628a9b0a00fa2..794c012ebc2c46a1f31a71eec1753374bb2ea88c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -545,6 +545,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
this.tickEffects();
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System
|
||||
this.animStepO = this.animStep;
|
||||
this.yBodyRotO = this.yBodyRot;
|
||||
this.yHeadRotO = this.yHeadRot;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/PortalProcessor.java b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||
index 45761c113116ae7417e6ae99069bff35dbccdf30..1727d9d7a3787220f09b6574ce6e4c828106d680 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||
@@ -24,7 +24,7 @@ public class PortalProcessor {
|
||||
return false;
|
||||
} else {
|
||||
this.insidePortalThisTick = false;
|
||||
- return canUsePortals && this.portalTime++ >= this.portal.getPortalTransitionTime(world, entity);
|
||||
+ return canUsePortals && this.increaseTick() >= this.portal.getPortalTransitionTime(world, entity); // Plazma - TickControl System
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,14 @@ public class PortalProcessor {
|
||||
this.portalTime = Math.max(this.portalTime - 4, 0);
|
||||
}
|
||||
|
||||
+ // Plazma start - TickControl System
|
||||
+ private int increaseTick() {
|
||||
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.portalUse)
|
||||
+ this.portalTime += org.plazmamc.plazma.util.TickControl.missedTicks();
|
||||
+ return this.portalTime++;
|
||||
+ }
|
||||
+ // Plazma end - TickControl System
|
||||
+
|
||||
public boolean hasExpired() {
|
||||
return this.portalTime <= 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index ffc754aa6ed61f62a0c94e9117f3008d24c0c163..744385f34727729f7ac4222ed140a9c7326147a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -158,6 +158,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
if (this.getItem().isEmpty()) {
|
||||
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
} else {
|
||||
+ if (this.pickupDelay > 0 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickControl.missedTicks(), 0); // Plazma - TickControl System
|
||||
super.tick();
|
||||
// Paper start - remove anti tick skipping measures / wall time - revert to vanilla
|
||||
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 330b21946564e6a7b463a258c02fee3f91e0f057..f8e09f24e818f960ea24446675996a25ed06d9a9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -302,6 +302,11 @@ public abstract class Player extends LivingEntity {
|
||||
if (this.sleepCounter > 100) {
|
||||
this.sleepCounter = 100;
|
||||
}
|
||||
+ // Plazma start - TickControl System
|
||||
+ else if (this.sleepCounter < 100 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickControl.missedTicks() > 0) {
|
||||
+ this.sleepCounter += org.plazmamc.plazma.util.TickControl.missedTicks();
|
||||
+ }
|
||||
+ // Plazma end - TickControl System
|
||||
|
||||
if (!this.level().isClientSide && this.level().isDay()) {
|
||||
this.stopSleepInBed(false, true);
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java
|
||||
index 8fd54bccb7af59da9113d8a289d12d8fad1fb467..e295b6b920dbb678bafe2042e4b82dc193bae4ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Item.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Item.java
|
||||
@@ -268,7 +268,7 @@ public class Item implements FeatureElement, ItemLike {
|
||||
|
||||
public int getUseDuration(ItemStack stack, LivingEntity user) {
|
||||
FoodProperties foodProperties = stack.get(DataComponents.FOOD);
|
||||
- return foodProperties != null ? foodProperties.eatDurationTicks() : 0;
|
||||
+ return foodProperties != null ? org.plazmamc.plazma.util.TickControl.calc(foodProperties.eatDurationTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System
|
||||
}
|
||||
|
||||
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..0e022da01f4526b589774a7d304d32a5562d8ce4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -339,13 +339,14 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
protected float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) {
|
||||
float f = state.getDestroySpeed(world, pos);
|
||||
|
||||
- if (f == -1.0F) {
|
||||
- return 0.0F;
|
||||
- } else {
|
||||
- int i = player.hasCorrectToolForDrops(state) ? 30 : 100;
|
||||
-
|
||||
- return player.getDestroySpeed(state) / f / (float) i;
|
||||
- }
|
||||
+ // Plazma start - TickControl system
|
||||
+ if (f == -1.0F) return 0.0F;
|
||||
+ return org.plazmamc.plazma.util.TickControl.calc(
|
||||
+ player.getDestroySpeed(state) / f / (player.hasCorrectToolForDrops(state) ? 30 : 100),
|
||||
+ it -> it.delay.blockBreak,
|
||||
+ false
|
||||
+ );
|
||||
+ // Plazma end - TickControl system
|
||||
}
|
||||
|
||||
protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 9cc1a79dd25c63af6986e721ceff5560cf56b7d1..c45224e142905921305da51139d5fd3f51583cca 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1036,8 +1036,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
||||
}
|
||||
|
||||
+ // Plazma start - TickControl System
|
||||
+ private void tickTicker(BlockState iblockdata) {
|
||||
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
||||
+
|
||||
+ if (!org.plazmamc.plazma.util.TickControl.shouldTickAgain(iblockdata.getBlock())) return;
|
||||
+ for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++)
|
||||
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
||||
+ }
|
||||
+ // Plazma end - TickControl System
|
||||
+
|
||||
@Override
|
||||
- public void tick() {
|
||||
+ public final void tick() { // Plazma - TickControl System (make final)
|
||||
if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) {
|
||||
BlockPos blockposition = this.blockEntity.getBlockPos();
|
||||
|
||||
@@ -1050,7 +1060,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
||||
|
||||
if (this.blockEntity.getType().isValid(iblockdata)) {
|
||||
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
||||
+ this.tickTicker(iblockdata); // Plazma - TickControl System
|
||||
this.loggedInvalidBlockState = false;
|
||||
// Paper start - Remove the Block Entity if it's invalid
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
index 2d492d849ff73a738dfbcb16507feb89bf19a962..67206b9c754dfe90002e0bcf6995eae60b852acd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||
@@ -180,7 +180,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
- return world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur
|
||||
+ return org.plazmamc.plazma.util.TickControl.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
index 0fc89b33864000a262ec5369708f7aedeaf6dc0b..5055730053d9d9c1da0a5252654c936c75d04fb6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||
@@ -122,7 +122,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||
|
||||
@Override
|
||||
public int getTickDelay(LevelReader world) {
|
||||
- return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
|
||||
+ return org.plazmamc.plazma.util.TickControl.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed; TickControl System
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 49bce6e28e12f3729cab5628cf3e0f508a56d0d7..2a88a25793e6d963a9a08e615a72c6ed1677a18b 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -146,4 +146,39 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public TickControl tickControl;
|
||||
+ public class TickControl extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean enabled = false;
|
||||
+
|
||||
+ public Delay delay;
|
||||
+ public class Delay extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean sleep = true;
|
||||
+ public boolean itemUse = true;
|
||||
+ public boolean portalUse = true;
|
||||
+ public boolean lavaFluid = true;
|
||||
+ public boolean waterFluid = true;
|
||||
+ public boolean blockBreak = true;
|
||||
+ public boolean itemPickup = true;
|
||||
+ public boolean potionEffect = true;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public Accelerate accelerate;
|
||||
+ public class Accelerate extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean dayTime = true;
|
||||
+ public boolean randomTick = true;
|
||||
+ public boolean blockEntity = true;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @PostProcess
|
||||
+ void post() {
|
||||
+ org.plazmamc.plazma.util.TickControl.post(this);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/util/TickControl.java b/src/main/java/org/plazmamc/plazma/util/TickControl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd73eab8d8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/util/TickControl.java
|
||||
@@ -0,0 +1,57 @@
|
||||
+package org.plazmamc.plazma.util;
|
||||
+
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import org.jspecify.annotations.NonNull;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+import org.plazmamc.plazma.configurations.GlobalConfiguration;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+import static net.minecraft.server.MinecraftServer.getServer;
|
||||
+
|
||||
+public final class TickControl {
|
||||
+
|
||||
+
|
||||
+ private static @Nullable TickControl INSTANCE;
|
||||
+ private final GlobalConfiguration.TickControl configuration;
|
||||
+ private int missedTicks = 0;
|
||||
+
|
||||
+ private TickControl(GlobalConfiguration.TickControl configuration) {
|
||||
+ this.configuration = configuration;
|
||||
+ }
|
||||
+
|
||||
+ public static void tick() {
|
||||
+ if (INSTANCE == null) return;
|
||||
+ INSTANCE.missedTicks -= INSTANCE.missedTicks;
|
||||
+ INSTANCE.missedTicks += (int) (getServer().tickTimes5s.getAverage() / 50 - 1);
|
||||
+ }
|
||||
+
|
||||
+ public static void post(GlobalConfiguration.TickControl configuration) {
|
||||
+ if (!configuration.enabled) {
|
||||
+ INSTANCE = null;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ INSTANCE = new TickControl(configuration);
|
||||
+ }
|
||||
+
|
||||
+ public static float calc(float original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAffected, boolean swap) {
|
||||
+ if (INSTANCE == null || !isAffected.apply(INSTANCE.configuration) || original == 0) return original;
|
||||
+ if (swap) return (float) Math.max(original * getServer().tps5s.getAverage() / 20, 1);
|
||||
+ return (float) (original * 20 / getServer().tps5s.getAverage());
|
||||
+ }
|
||||
+
|
||||
+ public static int calc(int original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAccelerated, boolean swap) {
|
||||
+ return (int) Math.ceil(calc((float) original, isAccelerated, swap));
|
||||
+ }
|
||||
+
|
||||
+ public static int missedTicks() {
|
||||
+ if (INSTANCE == null) return 0;
|
||||
+ return INSTANCE.missedTicks;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean shouldTickAgain(Block block) {
|
||||
+ // TODO: Configurable block masking
|
||||
+ return INSTANCE != null && !INSTANCE.configuration.accelerate.blockEntity;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 5 May 2019 12:58:19 -0500
|
||||
Subject: [PATCH] LivingEntity safeFallDistance
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index b777e530122549455dcce6fac8d4a151c1c0af42..57a3e330043077f042a284c99e2631e1582cb32c 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1447,4 +1447,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void setBodyYaw(float bodyYaw);
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Gets the distance (in blocks) this entity can safely fall without taking damage
|
||||
+ *
|
||||
+ * @return Safe fall distance
|
||||
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ float getSafeFallDistance();
|
||||
+
|
||||
+ /**
|
||||
+ * Set the distance (in blocks) this entity can safely fall without taking damage
|
||||
+ *
|
||||
+ * @param safeFallDistance Safe fall distance
|
||||
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setSafeFallDistance(float safeFallDistance);
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 17 Aug 2020 21:50:32 -0500
|
||||
Subject: [PATCH] LivingEntity#broadcastItemBreak
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 5c29956c6db53440322330ff723c7087193641f1..e1079c5c4be99e75a646c090189678dd131f210e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1447,4 +1447,13 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void setBodyYaw(float bodyYaw);
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Play item break animation for the item in specified equipment slot
|
||||
+ *
|
||||
+ * @param slot Equipment slot to play break animation for
|
||||
+ */
|
||||
+ void broadcastItemBreak(@NotNull org.bukkit.inventory.EquipmentSlot slot);
|
||||
+ // Purpur end
|
||||
}
|
||||
204
patches/unapplied/api/purpur/0032-Potion-NamespacedKey.patch
Normal file
204
patches/unapplied/api/purpur/0032-Potion-NamespacedKey.patch
Normal file
@@ -0,0 +1,204 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Racci <tangentmoons@gmail.com>
|
||||
Date: Fri, 3 Dec 2021 23:48:26 +1100
|
||||
Subject: [PATCH] Potion NamespacedKey
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionEffect.java b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
index c8ab330ef171795d08fa201cf8320703c7f1c66b..93e2ea220dc03c122f82af65d5e9fda5b582290c 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionEffect.java
|
||||
@@ -33,6 +33,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
private static final String AMBIENT = "ambient";
|
||||
private static final String PARTICLES = "has-particles";
|
||||
private static final String ICON = "has-icon";
|
||||
+ private static final String KEY = "namespacedKey"; // Purpur
|
||||
private final int amplifier;
|
||||
private final int duration;
|
||||
private final PotionEffectType type;
|
||||
@@ -40,6 +41,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
private final boolean particles;
|
||||
private final boolean icon;
|
||||
private final PotionEffect hiddenEffect; // Paper
|
||||
+ @Nullable private final NamespacedKey key; // Purpur
|
||||
|
||||
/**
|
||||
* Creates a potion effect.
|
||||
@@ -50,11 +52,12 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
|
||||
* @param particles the particle status, see {@link PotionEffect#hasParticles()}
|
||||
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
+ * @param key the namespacedKey, see {@link PotionEffect#getKey()}
|
||||
* @param hiddenEffect the hidden PotionEffect
|
||||
* @hidden Internal-- hidden effects are only shown internally
|
||||
*/
|
||||
@org.jetbrains.annotations.ApiStatus.Internal // Paper
|
||||
- public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect) { // Paper
|
||||
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable PotionEffect hiddenEffect, @Nullable NamespacedKey key) { // Paper // Purpur
|
||||
Preconditions.checkArgument(type != null, "effect type cannot be null");
|
||||
this.type = type;
|
||||
this.duration = duration;
|
||||
@@ -62,6 +65,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
this.ambient = ambient;
|
||||
this.particles = particles;
|
||||
this.icon = icon;
|
||||
+ this.key = key; // Purpur
|
||||
// Paper start
|
||||
this.hiddenEffect = hiddenEffect;
|
||||
}
|
||||
@@ -77,10 +81,27 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
*/
|
||||
public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) {
|
||||
- this(type, duration, amplifier, ambient, particles, icon, null);
|
||||
+ this(type, duration, amplifier, ambient, particles, icon, null, null); // Purpur
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Creates a potion effect.
|
||||
+ * @param type effect type
|
||||
+ * @param duration measured in ticks, see {@link
|
||||
+ * PotionEffect#getDuration()}
|
||||
+ * @param amplifier the amplifier, see {@link PotionEffect#getAmplifier()}
|
||||
+ * @param ambient the ambient status, see {@link PotionEffect#isAmbient()}
|
||||
+ * @param particles the particle status, see {@link PotionEffect#hasParticles()}
|
||||
+ * @param icon the icon status, see {@link PotionEffect#hasIcon()}
|
||||
+ * @param key the namespacedKey, see {@link PotionEffect#getKey()}
|
||||
+ */
|
||||
+ public PotionEffect(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon, @Nullable NamespacedKey key) {
|
||||
+ this(type, duration, amplifier, ambient, particles, icon, null, key);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
/**
|
||||
* Creates a potion effect with no defined color.
|
||||
*
|
||||
@@ -126,33 +147,33 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
* @param map the map to deserialize from
|
||||
*/
|
||||
public PotionEffect(@NotNull Map<String, Object> map) {
|
||||
- this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT)); // Paper
|
||||
+ this(getEffectType(map), getInt(map, DURATION), getInt(map, AMPLIFIER), getBool(map, AMBIENT, false), getBool(map, PARTICLES, true), getBool(map, ICON, getBool(map, PARTICLES, true)), (PotionEffect) map.get(HIDDEN_EFFECT), getKey(map)); // Paper // Purpur - getKey
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@NotNull
|
||||
public PotionEffect withType(@NotNull PotionEffectType type) {
|
||||
- return new PotionEffect(type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
@NotNull
|
||||
public PotionEffect withDuration(int duration) {
|
||||
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
@NotNull
|
||||
public PotionEffect withAmplifier(int amplifier) {
|
||||
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
@NotNull
|
||||
public PotionEffect withAmbient(boolean ambient) {
|
||||
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
@NotNull
|
||||
public PotionEffect withParticles(boolean particles) {
|
||||
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
@NotNull
|
||||
public PotionEffect withIcon(boolean icon) {
|
||||
- return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon);
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key); // Purpur - add key
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,6 +190,13 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Purpur start
|
||||
+ @NotNull
|
||||
+ public PotionEffect withKey(@Nullable NamespacedKey key) {
|
||||
+ return new PotionEffect(this.type, duration, amplifier, ambient, particles, icon, key);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@NotNull
|
||||
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
|
||||
PotionEffectType effect;
|
||||
@@ -201,6 +229,17 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
return def;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ @Nullable
|
||||
+ private static NamespacedKey getKey(@NotNull Map<?, ?> map) {
|
||||
+ Object key = map.get(KEY);
|
||||
+ if (key instanceof String stringKey) {
|
||||
+ return NamespacedKey.fromString(stringKey);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<String, Object> serialize() {
|
||||
@@ -215,6 +254,11 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
if (this.hiddenEffect != null) {
|
||||
builder.put(HIDDEN_EFFECT, this.hiddenEffect);
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (key != null) {
|
||||
+ builder.put(KEY, key.toString());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return builder.build();
|
||||
// Paper end
|
||||
}
|
||||
@@ -243,7 +287,7 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
return false;
|
||||
}
|
||||
PotionEffect that = (PotionEffect) obj;
|
||||
- return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect); // Paper
|
||||
+ return this.type.equals(that.type) && this.ambient == that.ambient && this.amplifier == that.amplifier && this.duration == that.duration && this.particles == that.particles && this.icon == that.icon && java.util.Objects.equals(this.hiddenEffect, that.hiddenEffect) && this.key == that.key; // Paper // Purpur - add key
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,6 +383,24 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
return icon;
|
||||
}
|
||||
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * @return if the key isn't the default namespacedKey
|
||||
+ */
|
||||
+ public boolean hasKey() {
|
||||
+ return key != null;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return the key attached to the potion
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public NamespacedKey getKey() {
|
||||
+ return key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 1;
|
||||
@@ -354,6 +416,6 @@ public class PotionEffect implements ConfigurationSerializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
- return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + '}'; // Paper
|
||||
+ return "PotionEffect{" + "amplifier=" + amplifier + ", duration=" + duration + ", type=" + type + ", ambient=" + ambient + ", particles=" + particles + ", icon=" + icon + ", hiddenEffect=" + hiddenEffect + ", key=" + key + '}'; // Paper // Purpur - add key
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MelnCat <melncatuwu@gmail.com>
|
||||
Date: Sat, 24 Sep 2022 10:50:33 -0700
|
||||
Subject: [PATCH] Add item packet serialize event
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/event/packet/NetworkItemSerializeEvent.java b/src/main/java/org/purpurmc/purpur/event/packet/NetworkItemSerializeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c0da73d2ea83a6055e34894ba1c7506fc8667712
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/event/packet/NetworkItemSerializeEvent.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+package org.purpurmc.purpur.event.packet;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when an item is about to be written to a packet.
|
||||
+ */
|
||||
+public class NetworkItemSerializeEvent extends Event {
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ public NetworkItemSerializeEvent(@NotNull ItemStack itemStack) {
|
||||
+ super(!org.bukkit.Bukkit.isPrimaryThread());
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return The item that is about to be serialized. Not mutable
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the item that will be serialized.
|
||||
+ *
|
||||
+ * @param itemStack The item
|
||||
+ */
|
||||
+ public void setItemStack(@Nullable ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
44
patches/unapplied/api/purpur/0049-Add-hover-lines-API.patch
Normal file
44
patches/unapplied/api/purpur/0049-Add-hover-lines-API.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Meln Cat <melncatuwu@gmail.com>
|
||||
Date: Mon, 2 Oct 2023 17:42:19 -0700
|
||||
Subject: [PATCH] Add hover lines API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
index 98a970a6582dca22e719a31559c7becea4725cb2..1cd2962ceb4fa0a0a3e28a09fa4ccef5802cd5c4 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
||||
@@ -353,4 +353,14 @@ public interface ItemFactory {
|
||||
*/
|
||||
@NotNull ItemStack enchantWithLevels(@NotNull ItemStack itemStack, @org.jetbrains.annotations.Range(from = 1, to = 30) int levels, boolean allowTreasure, @NotNull java.util.Random random);
|
||||
// Paper end - enchantWithLevels API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ /**
|
||||
+ * Returns the lines of text shown when hovering over an item
|
||||
+ * @param itemStack The ItemStack
|
||||
+ * @param advanced Whether advanced tooltips are shown
|
||||
+ * @return the list of Components
|
||||
+ */
|
||||
+ @NotNull java.util.List<net.kyori.adventure.text.@NotNull Component> getHoverLines(@NotNull ItemStack itemStack, boolean advanced);
|
||||
+ // Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 6e9b4cbc81878616b1c48add5db534286d267b05..e497575b2f44bb8b3bb6fdda3ae2f5247cbb4679 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -1644,5 +1644,14 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||
}
|
||||
return random.nextInt(unbreaking + 1) > 0;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the lines of text shown when hovering over the item
|
||||
+ * @param advanced Whether advanced tooltips are shown
|
||||
+ * @return the list of Components
|
||||
+ */
|
||||
+ public @NotNull List<net.kyori.adventure.text.@NotNull Component> getHoverLines(boolean advanced) {
|
||||
+ return Bukkit.getItemFactory().getHoverLines(this, advanced);
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
index c867796f6..ecced2072 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||
@@ -181,7 +222,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||
@MergeMap
|
||||
public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
|
||||
@MergeMap
|
||||
- public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance())));
|
||||
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations
|
||||
@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)));
|
||||
|
||||
311
patches/unapplied/server/0038-Implement-CarpetFixes.patch
Normal file
311
patches/unapplied/server/0038-Implement-CarpetFixes.patch
Normal file
@@ -0,0 +1,311 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?IPECTER=20=EC=9D=B4=ED=8C=A9=ED=84=B0?=
|
||||
<80433772+IPECTER@users.noreply.github.com>
|
||||
Date: Wed, 21 Aug 2024 16:16:22 +0900
|
||||
Subject: [PATCH] Implement-CarpetFixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
index 658f7943d275267d3fc556572831cc095259d12e..8ad02b079c729320f5968eee5e6284371d11250e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||
@@ -460,17 +460,25 @@ public class Sheep extends Animal implements Shearable {
|
||||
private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) {
|
||||
DyeColor enumcolor = ((Sheep) firstParent).getColor();
|
||||
DyeColor enumcolor1 = ((Sheep) secondParent).getColor();
|
||||
- CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1);
|
||||
- Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
- return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
- }).map(ItemStack::getItem);
|
||||
-
|
||||
- Objects.requireNonNull(DyeItem.class);
|
||||
- optional = optional.filter(DyeItem.class::isInstance);
|
||||
- Objects.requireNonNull(DyeItem.class);
|
||||
- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
||||
- return this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
||||
- });
|
||||
+ // Plazma start - Implement CarpetFixes
|
||||
+ if (this.level().plazmaConfig().carpetFixes.preparedSheepChildColor()) {
|
||||
+ DyeColor col = org.plazmamc.plazma.util.CarpetFixesUtils.properDyeMixin(enumcolor, enumcolor1);
|
||||
+ if (col == null) col = this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
||||
+ return col;
|
||||
+ } else {
|
||||
+ CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1);
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
+ return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
+ }).map(ItemStack::getItem);
|
||||
+
|
||||
+ Objects.requireNonNull(DyeItem.class);
|
||||
+ optional = optional.filter(DyeItem.class::isInstance);
|
||||
+ Objects.requireNonNull(DyeItem.class);
|
||||
+ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
||||
+ return this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
||||
+ });
|
||||
+ }
|
||||
+ // Plazma end
|
||||
}
|
||||
|
||||
private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
index 681e3fcd759a26578e054f88e8048e392312b84b..253819783d577c4c2abe737e0c76ac88121387db 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
||||
@@ -137,7 +137,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
||||
}
|
||||
|
||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getAllRecipesFor(RecipeType<T> type) {
|
||||
- return List.copyOf(this.byType(type).values());
|
||||
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.fasterRecipeList() ? new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma - Implement CarpetFixes
|
||||
}
|
||||
|
||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getRecipesFor(RecipeType<T> type, C inventory, Level world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
index 01352cc83b25eb0e30b7e0ff521fc7c1b3d5155b..e6544cf89bc5e85d9b7fb9b278ffc765c5268f37 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||
@@ -12,6 +12,7 @@ public class BiomeManager {
|
||||
private static final int ZOOM_BITS = 2;
|
||||
private static final int ZOOM = 4;
|
||||
private static final int ZOOM_MASK = 3;
|
||||
+ private static final double maxOffset = 0.4500000001D; // Plazma - Implement CarpetFixes
|
||||
private final BiomeManager.NoiseBiomeSource noiseBiomeSource;
|
||||
private final long biomeZoomSeed;
|
||||
|
||||
@@ -29,39 +30,104 @@ public class BiomeManager {
|
||||
}
|
||||
|
||||
public Holder<Biome> getBiome(BlockPos pos) {
|
||||
- int i = pos.getX() - 2;
|
||||
- int j = pos.getY() - 2;
|
||||
- int k = pos.getZ() - 2;
|
||||
- int l = i >> 2;
|
||||
- int m = j >> 2;
|
||||
- int n = k >> 2;
|
||||
- double d = (double)(i & 3) / 4.0;
|
||||
- double e = (double)(j & 3) / 4.0;
|
||||
- double f = (double)(k & 3) / 4.0;
|
||||
- int o = 0;
|
||||
- double g = Double.POSITIVE_INFINITY;
|
||||
-
|
||||
- for (int p = 0; p < 8; p++) {
|
||||
- boolean bl = (p & 4) == 0;
|
||||
- boolean bl2 = (p & 2) == 0;
|
||||
- boolean bl3 = (p & 1) == 0;
|
||||
- int q = bl ? l : l + 1;
|
||||
- int r = bl2 ? m : m + 1;
|
||||
- int s = bl3 ? n : n + 1;
|
||||
- double h = bl ? d : d - 1.0;
|
||||
- double t = bl2 ? e : e - 1.0;
|
||||
- double u = bl3 ? f : f - 1.0;
|
||||
- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
||||
- if (g > v) {
|
||||
- o = p;
|
||||
- g = v;
|
||||
+ // Plazma start - Implement CarpetFixes
|
||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedBiomeAccess()) {
|
||||
+ int xMinus2 = pos.getX() - 2;
|
||||
+ int yMinus2 = pos.getY() - 2;
|
||||
+ int zMinus2 = pos.getZ() - 2;
|
||||
+ int x = xMinus2 >> 2; // BlockPos to BiomePos
|
||||
+ int y = yMinus2 >> 2;
|
||||
+ int z = zMinus2 >> 2;
|
||||
+ double quartX = (double) (xMinus2 & 3) / 4.0D; // quartLocal divided by 4
|
||||
+ double quartY = (double) (yMinus2 & 3) / 4.0D; // 0/4, 1/4, 2/4, 3/4
|
||||
+ double quartZ = (double) (zMinus2 & 3) / 4.0D; // [0, 0.25, 0.5, 0.75]
|
||||
+ int smallestX = 0;
|
||||
+ double smallestDist = Double.POSITIVE_INFINITY;
|
||||
+ for (int biomeX = 0; biomeX < 8; ++biomeX) {
|
||||
+ boolean everyOtherQuad = (biomeX & 4) == 0; // 1 1 1 1 0 0 0 0
|
||||
+ boolean everyOtherPair = (biomeX & 2) == 0; // 1 1 0 0 1 1 0 0
|
||||
+ boolean everyOther = (biomeX & 1) == 0; // 1 0 1 0 1 0 1 0
|
||||
+ double quartXX = everyOtherQuad ? quartX : quartX - 1.0D; //[-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5,0.75]
|
||||
+ double quartYY = everyOtherPair ? quartY : quartY - 1.0D;
|
||||
+ double quartZZ = everyOther ? quartZ : quartZ - 1.0D;
|
||||
+
|
||||
+ //This code block is new
|
||||
+ double maxQuartYY = 0.0D, maxQuartZZ = 0.0D;
|
||||
+ if (biomeX != 0) {
|
||||
+ maxQuartYY = Mth.square(Math.max(quartYY + maxOffset, Math.abs(quartYY - maxOffset)));
|
||||
+ maxQuartZZ = Mth.square(Math.max(quartZZ + maxOffset, Math.abs(quartZZ - maxOffset)));
|
||||
+ double maxQuartXX = Mth.square(Math.max(quartXX + maxOffset, Math.abs(quartXX - maxOffset)));
|
||||
+ if (smallestDist < maxQuartXX + maxQuartYY + maxQuartZZ) continue;
|
||||
+ }
|
||||
+
|
||||
+ int xx = everyOtherQuad ? x : x + 1;
|
||||
+ int yy = everyOtherPair ? y : y + 1;
|
||||
+ int zz = everyOther ? z : z + 1;
|
||||
+
|
||||
+ //I transferred the code from method_38106 to here, so I could call continue halfway through
|
||||
+ long seed = LinearCongruentialGenerator.next(this.biomeZoomSeed, xx);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, xx);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
||||
+ double offsetX = getFiddle(seed);
|
||||
+ double sqrX = Mth.square(quartXX + offsetX);
|
||||
+ if (biomeX != 0 && smallestDist < sqrX + maxQuartYY + maxQuartZZ) continue; //skip the rest of the loop
|
||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||
+ double offsetY = getFiddle(seed);
|
||||
+ double sqrY = Mth.square(quartYY + offsetY);
|
||||
+ if (biomeX != 0 && smallestDist < sqrX + sqrY + maxQuartZZ) continue; // skip the rest of the loop
|
||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||
+ double offsetZ = getFiddle(seed);
|
||||
+ double biomeDist = sqrX + sqrY + Mth.square(quartZZ + offsetZ);
|
||||
+
|
||||
+ if (smallestDist > biomeDist) {
|
||||
+ smallestX = biomeX;
|
||||
+ smallestDist = biomeDist;
|
||||
+ }
|
||||
+ }
|
||||
+ return this.noiseBiomeSource.getNoiseBiome(
|
||||
+ (smallestX & 4) == 0 ? x : x + 1,
|
||||
+ (smallestX & 2) == 0 ? y : y + 1,
|
||||
+ (smallestX & 1) == 0 ? z : z + 1
|
||||
+ );
|
||||
+ } else {
|
||||
+ int i = pos.getX() - 2;
|
||||
+ int j = pos.getY() - 2;
|
||||
+ int k = pos.getZ() - 2;
|
||||
+ int l = i >> 2;
|
||||
+ int m = j >> 2;
|
||||
+ int n = k >> 2;
|
||||
+ double d = (double) (i & 3) / 4.0;
|
||||
+ double e = (double) (j & 3) / 4.0;
|
||||
+ double f = (double) (k & 3) / 4.0;
|
||||
+ int o = 0;
|
||||
+ double g = Double.POSITIVE_INFINITY;
|
||||
+
|
||||
+ for (int p = 0; p < 8; p++) {
|
||||
+ boolean bl = (p & 4) == 0;
|
||||
+ boolean bl2 = (p & 2) == 0;
|
||||
+ boolean bl3 = (p & 1) == 0;
|
||||
+ int q = bl ? l : l + 1;
|
||||
+ int r = bl2 ? m : m + 1;
|
||||
+ int s = bl3 ? n : n + 1;
|
||||
+ double h = bl ? d : d - 1.0;
|
||||
+ double t = bl2 ? e : e - 1.0;
|
||||
+ double u = bl3 ? f : f - 1.0;
|
||||
+ double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
||||
+ if (g > v) {
|
||||
+ o = p;
|
||||
+ g = v;
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- int w = (o & 4) == 0 ? l : l + 1;
|
||||
- int x = (o & 2) == 0 ? m : m + 1;
|
||||
- int y = (o & 1) == 0 ? n : n + 1;
|
||||
- return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
||||
+ int w = (o & 4) == 0 ? l : l + 1;
|
||||
+ int x = (o & 2) == 0 ? m : m + 1;
|
||||
+ int y = (o & 1) == 0 ? n : n + 1;
|
||||
+ return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
||||
+ }
|
||||
+ // Plazma end
|
||||
}
|
||||
|
||||
public Holder<Biome> getNoiseBiomeAtPosition(double x, double y, double z) {
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
index 98f26e3de66a881163e84295e9156c7f362bf7cb..9af184b55fd32d16194b669c42bfbf9b18e96e26 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||
@@ -109,4 +109,21 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public CarpetFixes carpetFixes;
|
||||
+ public class CarpetFixes extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean enabled = OPTIMIZE;
|
||||
+ boolean optimizedBiomeAccess = true;
|
||||
+ boolean fasterRecipeList = true;
|
||||
+
|
||||
+ public boolean optimizedBiomeAccess() {
|
||||
+ return enabled && optimizedBiomeAccess;
|
||||
+ }
|
||||
+
|
||||
+ public boolean fasterRecipeList() {
|
||||
+ return enabled && fasterRecipeList;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 6a0cfec24618227d9a5ddc6c71e37d1986147799..9d6d4400be8bf189308cbd0cb14afa1ff0191a57 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -90,4 +90,16 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public CarpetFixes carpetFixes;
|
||||
+ public class CarpetFixes extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean enabled = OPTIMIZE;
|
||||
+ boolean preparedSheepChildColor = true;
|
||||
+
|
||||
+ public boolean preparedSheepChildColor() {
|
||||
+ return enabled && preparedSheepChildColor;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5d6deb61ef10039a551849e9b83798916f1dc58c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+package org.plazmamc.plazma.util;
|
||||
+
|
||||
+import net.minecraft.world.item.DyeColor;
|
||||
+
|
||||
+public class CarpetFixesUtils {
|
||||
+
|
||||
+ //If I was actually implementing this, the color values would have been binary in order for fast calculations.
|
||||
+ //Never do this in a production build, although this is better than using the RecipeManager xD
|
||||
+ public static DyeColor properDyeMixin(DyeColor col1, DyeColor col2) {
|
||||
+ if (col1.equals(col2)) return col1;
|
||||
+ switch(col1) {
|
||||
+ case WHITE -> {
|
||||
+ switch(col2) {
|
||||
+ case BLUE -> {return DyeColor.LIGHT_BLUE;}
|
||||
+ case GRAY -> {return DyeColor.LIGHT_GRAY;}
|
||||
+ case BLACK -> {return DyeColor.GRAY;}
|
||||
+ case GREEN -> {return DyeColor.LIME;}
|
||||
+ case RED -> {return DyeColor.PINK;}
|
||||
+ }
|
||||
+ }
|
||||
+ case BLUE -> {
|
||||
+ switch(col2) {
|
||||
+ case WHITE -> {return DyeColor.LIGHT_BLUE;}
|
||||
+ case GREEN -> {return DyeColor.CYAN;}
|
||||
+ case RED -> {return DyeColor.PURPLE;}
|
||||
+ }
|
||||
+ }
|
||||
+ case RED -> {
|
||||
+ switch(col2) {
|
||||
+ case YELLOW -> {return DyeColor.ORANGE;}
|
||||
+ case WHITE -> {return DyeColor.PINK;}
|
||||
+ case BLUE -> {return DyeColor.PURPLE;}
|
||||
+ }
|
||||
+ }case GREEN -> {
|
||||
+ switch(col2) {
|
||||
+ case BLUE -> {return DyeColor.CYAN;}
|
||||
+ case WHITE -> {return DyeColor.LIME;}
|
||||
+ }
|
||||
+ }
|
||||
+ case YELLOW -> {if (col2.equals(DyeColor.RED)) return DyeColor.ORANGE;}
|
||||
+ case PURPLE -> {if (col2.equals(DyeColor.PINK)) return DyeColor.MAGENTA;}
|
||||
+ case PINK -> {if (col2.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA;}
|
||||
+ case GRAY -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY;}
|
||||
+ case BLACK -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.GRAY;}
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
282
patches/unapplied/server/0041-Blazingly-simple-farm-checks.patch
Normal file
282
patches/unapplied/server/0041-Blazingly-simple-farm-checks.patch
Normal file
@@ -0,0 +1,282 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?IPECTER=20=EC=9D=B4=ED=8C=A9=ED=84=B0?=
|
||||
<80433772+IPECTER@users.noreply.github.com>
|
||||
Date: Sun, 25 Aug 2024 05:21:35 +0900
|
||||
Subject: [PATCH] Blazingly-simple-farm-checks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
index 2077cb5dcf2352c9d5b502744aeb9a66df256939..e5db5467863e7e408e3ca23dbaed3879d9b31110 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||
@@ -81,28 +81,81 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||
int i = this.getAge(state);
|
||||
|
||||
if (i < this.getMaxAge()) {
|
||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
-
|
||||
- // Spigot start
|
||||
- int modifier;
|
||||
- if (this == Blocks.BEETROOTS) {
|
||||
- modifier = world.spigotConfig.beetrootModifier;
|
||||
- } else if (this == Blocks.CARROTS) {
|
||||
- modifier = world.spigotConfig.carrotModifier;
|
||||
- } else if (this == Blocks.POTATOES) {
|
||||
- modifier = world.spigotConfig.potatoModifier;
|
||||
- // Paper start - Fix Spigot growth modifiers
|
||||
- } else if (this == Blocks.TORCHFLOWER_CROP) {
|
||||
- modifier = world.spigotConfig.torchFlowerModifier;
|
||||
- // Paper end - Fix Spigot growth modifiers
|
||||
+ // Plazma start - Blazingly simple farm checks
|
||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
||||
+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on
|
||||
+ // Is the block below us moisturised?
|
||||
+ BlockPos farmlandBelowTheCurrentBlock = pos.below();
|
||||
+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock);
|
||||
+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed;
|
||||
+ boolean isCurrentFarmlandStateMoist = false;
|
||||
+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) {
|
||||
+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) {
|
||||
+ // If we are currently moist, increase the speed!
|
||||
+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed;
|
||||
+ isCurrentFarmlandStateMoist = true;
|
||||
+ }
|
||||
+ }
|
||||
+ // If we are skipping the middle aging stages, we need to change the growth speed and the next stage accordingly
|
||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.skipMiddleAgingStagesForCrops) {
|
||||
+ f = f / getMaxAge();
|
||||
+ i = getMaxAge() - 1;
|
||||
+ }
|
||||
+
|
||||
+ // Spigot start
|
||||
+ int modifier;
|
||||
+ if (this == Blocks.BEETROOTS) {
|
||||
+ modifier = world.spigotConfig.beetrootModifier;
|
||||
+ } else if (this == Blocks.CARROTS) {
|
||||
+ modifier = world.spigotConfig.carrotModifier;
|
||||
+ } else if (this == Blocks.POTATOES) {
|
||||
+ modifier = world.spigotConfig.potatoModifier;
|
||||
+ // Paper start
|
||||
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
||||
+ modifier = world.spigotConfig.torchFlowerModifier;
|
||||
+ // Paper end
|
||||
+ } else {
|
||||
+ modifier = world.spigotConfig.wheatModifier;
|
||||
+ }
|
||||
+
|
||||
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
+ // Spigot end
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
||||
+ if (i + 1 == getMaxAge() && isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
||||
+ // Whoops, farm land ain't moist!
|
||||
+ // From FarmBlock, set the moisture to 0
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
||||
+ }
|
||||
+ }
|
||||
} else {
|
||||
- modifier = world.spigotConfig.wheatModifier;
|
||||
- }
|
||||
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
+
|
||||
+ // Spigot start
|
||||
+ int modifier;
|
||||
+ if (this == Blocks.BEETROOTS) {
|
||||
+ modifier = world.spigotConfig.beetrootModifier;
|
||||
+ } else if (this == Blocks.CARROTS) {
|
||||
+ modifier = world.spigotConfig.carrotModifier;
|
||||
+ } else if (this == Blocks.POTATOES) {
|
||||
+ modifier = world.spigotConfig.potatoModifier;
|
||||
+ // Paper start - Fix Spigot growth modifiers
|
||||
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
||||
+ modifier = world.spigotConfig.torchFlowerModifier;
|
||||
+ // Paper end - Fix Spigot growth modifiers
|
||||
+ } else {
|
||||
+ modifier = world.spigotConfig.wheatModifier;
|
||||
+ }
|
||||
|
||||
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
- // Spigot end
|
||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
||||
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
+ // Spigot end
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
||||
+ }
|
||||
}
|
||||
+ // Plazma end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index 0c39126ce51439cce05747161aba43bce33a12d8..2016e3d7832ba75331697c46803f8e4142bf01ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -92,6 +92,19 @@ public class FarmBlock extends Block {
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
||||
+ // Plazma start - Blazingly simple farm checks
|
||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
||||
+ if (i == 0) { // We only care about non-moisturised farm blocks
|
||||
+ if (FarmBlock.isNearWater(world, pos)) {
|
||||
+ // Make it MOIST!
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit
|
||||
+ } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) {
|
||||
+ FarmBlock.turnToDirt((Entity) null, state, world, pos);
|
||||
+ }
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // Plazma end
|
||||
if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||
|
||||
@@ -166,7 +179,7 @@ public class FarmBlock extends Block {
|
||||
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
|
||||
}
|
||||
|
||||
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
|
||||
+ public static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - Blazingly simple farm checks - private -> public
|
||||
// Paper start - Perf: remove abstract block iteration
|
||||
int xOff = pos.getX();
|
||||
int yOff = pos.getY();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
index 121a872cd750a87b779895687ae1abf5bb77b088..53e55b51c53995e2ec9314e1fc656dd5cd22dd67 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||
@@ -73,36 +73,87 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
if (world.getRawBrightness(pos, 0) >= 9) {
|
||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
-
|
||||
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
- int i = (Integer) state.getValue(StemBlock.AGE);
|
||||
-
|
||||
- if (i < 7) {
|
||||
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
||||
- } else {
|
||||
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||
- BlockPos blockposition1 = pos.relative(enumdirection);
|
||||
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
||||
-
|
||||
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
||||
- Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
||||
- Optional<Block> optional = iregistry.getOptional(this.fruit);
|
||||
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
||||
-
|
||||
- if (optional.isPresent() && optional1.isPresent()) {
|
||||
- // CraftBukkit start
|
||||
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
||||
- return;
|
||||
+ // Plazma start - Blazingly simple farm checks
|
||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
||||
+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on
|
||||
+ // Is the block below us moisturised?
|
||||
+ BlockPos farmlandBelowTheCurrentBlock = pos.below();
|
||||
+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock);
|
||||
+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed;
|
||||
+ boolean isCurrentFarmlandStateMoist = false;
|
||||
+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) {
|
||||
+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) {
|
||||
+ // If we are currently moist, increase the speed!
|
||||
+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed;
|
||||
+ isCurrentFarmlandStateMoist = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
+ int i = (Integer) state.getValue(StemBlock.AGE);
|
||||
+
|
||||
+ if (i < 7) {
|
||||
+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
||||
+ } else {
|
||||
+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||
+ BlockPos blockposition1 = pos.relative(enumdirection);
|
||||
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
||||
+
|
||||
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
||||
+ Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
||||
+ Optional<Block> optional = iregistry.getOptional(this.fruit);
|
||||
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
||||
+
|
||||
+ if (optional.isPresent() && optional1.isPresent()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
||||
+ if (isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
||||
+ // Whoops, farm land ain't moist!
|
||||
+ // From FarmBlock, set the moisture to 0
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
||||
+ }
|
||||
+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||
+
|
||||
+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||
+ int i = (Integer) state.getValue(StemBlock.AGE);
|
||||
+
|
||||
+ if (i < 7) {
|
||||
+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
||||
+ } else {
|
||||
+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||
+ BlockPos blockposition1 = pos.relative(enumdirection);
|
||||
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
||||
+
|
||||
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
||||
+ Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
||||
+ Optional<Block> optional = iregistry.getOptional(this.fruit);
|
||||
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
||||
+
|
||||
+ if (optional.isPresent() && optional1.isPresent()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||
}
|
||||
- // CraftBukkit end
|
||||
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // Plazma end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
index 9d6d4400be8bf189308cbd0cb14afa1ff0191a57..f96305be3b6e7c33d553764bdf4d8f2635939f9d 100644
|
||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||
@@ -102,4 +102,15 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||
|
||||
}
|
||||
|
||||
+ public BlazinglySimpleFarmChecks blazinglySimpleFarmChecks;
|
||||
+ public class BlazinglySimpleFarmChecks extends ConfigurationPart {
|
||||
+
|
||||
+ public boolean enabled = OPTIMIZE;ㅈ
|
||||
+ public double defaultGrowthSpeed = 1.0;
|
||||
+ public double moistGrowthSpeed = 5.0;
|
||||
+ public boolean skipMiddleAgingStagesForCrops = false;
|
||||
+
|
||||
+
|
||||
+ }
|
||||
+
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00aab846d6 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
||||
@@ -106,6 +106,13 @@ public final class NearbyPlayers {
|
||||
return chunk == null ? null : chunk.players[type.ordinal()];
|
||||
}
|
||||
|
||||
+ // Plazma start - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
+ public ReferenceList<ServerPlayer> getPlayers(final long nearbyCoordKey, final NearbyMapType type) {
|
||||
+ final TrackedChunk chunk = this.byChunk.get(nearbyCoordKey);
|
||||
+ return chunk == null ? null : chunk.players[type.ordinal()];
|
||||
+ }
|
||||
+ // Plazma end - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
||||
+
|
||||
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
|
||||
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 5eb7bcf492ee354ef775cd8d09c7ca2bdfeb7ce2..697cb18bce2f2470a0a2347ba6709e1449b360fd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
|
||||
// Paper start - optimise chunk tick iteration
|
||||
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
||||
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
||||
if (playersNearby == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 5 May 2019 12:58:45 -0500
|
||||
Subject: [PATCH] LivingEntity safeFallDistance
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index aa351df679f300018367244c7ccb3e5a59e9276f..39c2a9f732b8e2452fd2dca07193a173d0c2ba1c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1173,4 +1173,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.getHandle().setYBodyRot(bodyYaw);
|
||||
}
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public float getSafeFallDistance() {
|
||||
+ return (float) getHandle().getAttributeValue(Attributes.SAFE_FALL_DISTANCE);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSafeFallDistance(float safeFallDistance) {
|
||||
+ getHandle().getAttribute(Attributes.SAFE_FALL_DISTANCE).setBaseValue(safeFallDistance);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 21 Mar 2020 18:33:05 -0500
|
||||
Subject: [PATCH] End gateway should check if entity can use portal
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
index 93bd70c1dc2ba8b893a6087730071c81fb1132f4..60b343edc4383c8bc450f106f483349850432fa3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
|
||||
@@ -167,6 +167,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
|
||||
|
||||
public static void teleportEntity(Level world, BlockPos pos, BlockState state, Entity entity, TheEndGatewayBlockEntity blockEntity) {
|
||||
if (world instanceof ServerLevel worldserver && !blockEntity.isCoolingDown()) {
|
||||
+ if (!entity.canChangeDimensions()) return; // Purpur
|
||||
blockEntity.teleportCooldown = 100;
|
||||
BlockPos blockposition1;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 17 Aug 2020 21:50:39 -0500
|
||||
Subject: [PATCH] LivingEntity#broadcastItemBreak
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index a1e715629313346f670bce92483996122b0f1d7b..386647f6000c71c59ab8d7875219eefdc5a3d7ef 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1181,4 +1181,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.getHandle().setYBodyRot(bodyYaw);
|
||||
}
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void broadcastItemBreak(org.bukkit.inventory.EquipmentSlot slot) {
|
||||
+ if (slot == null) return;
|
||||
+ getHandle().broadcastBreakEvent(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Tue, 13 Oct 2020 20:04:33 -0500
|
||||
Subject: [PATCH] Allow infinite and mending enchantments together
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java
|
||||
index 81cc05c929d612898609965d82454b89cd18f9f5..fa73c3d4b58ad8379963a9866d8f09e1d6abd663 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/enchantment/ArrowInfiniteEnchantment.java
|
||||
@@ -7,6 +7,6 @@ public class ArrowInfiniteEnchantment extends Enchantment {
|
||||
|
||||
@Override
|
||||
public boolean checkCompatibility(Enchantment other) {
|
||||
- return !(other instanceof MendingEnchantment) && super.checkCompatibility(other);
|
||||
+ return !(other instanceof MendingEnchantment) && super.checkCompatibility(other) || other instanceof MendingEnchantment && org.purpurmc.purpur.PurpurConfig.allowInfinityMending; // Purpur
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 2f68cf2fc064a38ca059504a39d563d95d01643e..6d621a93aaf94927fa6c73e649dcdb8bbbaadd2a 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -246,6 +246,16 @@ public class PurpurConfig {
|
||||
cryingObsidianValidForPortalFrame = getBoolean("settings.blocks.crying_obsidian.valid-for-portal-frame", cryingObsidianValidForPortalFrame);
|
||||
}
|
||||
|
||||
+ public static boolean allowInfinityMending = false;
|
||||
+ private static void enchantmentSettings() {
|
||||
+ if (version < 5) {
|
||||
+ boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
|
||||
+ set("settings.enchantment.allow-infinity-and-mending-together", oldValue);
|
||||
+ set("settings.enchantment.allow-infinite-and-mending-together", null);
|
||||
+ }
|
||||
+ allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
|
||||
+ }
|
||||
+
|
||||
public static boolean endermanShortHeight = false;
|
||||
private static void entitySettings() {
|
||||
endermanShortHeight = getBoolean("settings.entity.enderman.short-height", endermanShortHeight);
|
||||
@@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Thu, 18 Mar 2021 12:25:29 -0400
|
||||
Subject: [PATCH] Allow infinity on crossbows
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
index 1f52feb5684ee1bab710e1557cf69b43b4d4dfd4..d2bb5c84e1895f28afed03d1868a79338e4f3e58 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
|
||||
@@ -107,7 +107,7 @@ public class CrossbowItem extends ProjectileWeaponItem {
|
||||
return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true);
|
||||
}
|
||||
private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) {
|
||||
- List<ItemStack> list = draw(crossbow, shooter.getProjectile(crossbow), shooter, consume);
|
||||
+ List<ItemStack> list = draw(crossbow, shooter.getProjectile(crossbow), shooter, (org.purpurmc.purpur.PurpurConfig.allowCrossbowInfinity && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY, crossbow) > 0) || consume);
|
||||
// Paper end - Add EntityLoadCrossbowEvent
|
||||
if (!list.isEmpty()) {
|
||||
crossbow.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.of(list));
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 0587b0c7f34ae90f0d06f29d58fafbcf5b80ff13..c60d0d1861fd24b74bfa93228357f27d524f4ce7 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -284,6 +284,7 @@ public class PurpurConfig {
|
||||
}
|
||||
|
||||
public static boolean allowInfinityMending = false;
|
||||
+ public static boolean allowCrossbowInfinity = true;
|
||||
private static void enchantmentSettings() {
|
||||
if (version < 5) {
|
||||
boolean oldValue = getBoolean("settings.enchantment.allow-infinite-and-mending-together", false);
|
||||
@@ -291,6 +292,7 @@ public class PurpurConfig {
|
||||
set("settings.enchantment.allow-infinite-and-mending-together", null);
|
||||
}
|
||||
allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending);
|
||||
+ allowCrossbowInfinity = getBoolean("settings.enchantment.allow-infinity-on-crossbow", allowCrossbowInfinity);
|
||||
}
|
||||
|
||||
public static boolean endermanShortHeight = false;
|
||||
223
patches/unapplied/server/purpur/0220-Potion-NamespacedKey.patch
Normal file
223
patches/unapplied/server/purpur/0220-Potion-NamespacedKey.patch
Normal file
@@ -0,0 +1,223 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Racci <tangentmoons@gmail.com>
|
||||
Date: Sat, 4 Dec 2021 00:07:05 +1100
|
||||
Subject: [PATCH] Potion NamespacedKey
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
index 32cf6ea96aaa2e6bd0cc28fa88492ceea3d34052..9787dd4fc6ca2ed8aba3db7674ad2dc26a529a7a 100644
|
||||
--- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
+++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java
|
||||
@@ -53,6 +53,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
private boolean showIcon;
|
||||
@Nullable
|
||||
public MobEffectInstance hiddenEffect;
|
||||
+ private org.bukkit.NamespacedKey key; // Purpur - add key
|
||||
private final MobEffectInstance.BlendState blendState = new MobEffectInstance.BlendState();
|
||||
|
||||
public MobEffectInstance(Holder<MobEffect> effect) {
|
||||
@@ -71,8 +72,14 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this(effect, duration, amplifier, ambient, visible, visible);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public MobEffectInstance(Holder<MobEffect> effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon, @Nullable org.bukkit.NamespacedKey key) {
|
||||
+ this(effect, duration, amplifier, ambient, showParticles, showIcon, null, key);
|
||||
+ // Purpur end
|
||||
+ }
|
||||
+
|
||||
public MobEffectInstance(Holder<MobEffect> effect, int duration, int amplifier, boolean ambient, boolean showParticles, boolean showIcon) {
|
||||
- this(effect, duration, amplifier, ambient, showParticles, showIcon, null);
|
||||
+ this(effect, duration, amplifier, ambient, showParticles, showIcon, null, null); // Purpur
|
||||
}
|
||||
|
||||
public MobEffectInstance(
|
||||
@@ -82,7 +89,8 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
boolean ambient,
|
||||
boolean showParticles,
|
||||
boolean showIcon,
|
||||
- @Nullable MobEffectInstance hiddenEffect
|
||||
+ @Nullable MobEffectInstance hiddenEffect,
|
||||
+ @Nullable org.bukkit.NamespacedKey key // Purpur
|
||||
) {
|
||||
this.effect = effect;
|
||||
this.duration = duration;
|
||||
@@ -90,6 +98,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this.ambient = ambient;
|
||||
this.visible = showParticles;
|
||||
this.showIcon = showIcon;
|
||||
+ this.key = key; // Purpur - add key
|
||||
this.hiddenEffect = hiddenEffect;
|
||||
}
|
||||
|
||||
@@ -135,6 +144,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
this.ambient = that.ambient;
|
||||
this.visible = that.visible;
|
||||
this.showIcon = that.showIcon;
|
||||
+ this.key = that.key; // Purpur - add key
|
||||
}
|
||||
|
||||
public boolean update(MobEffectInstance that) {
|
||||
@@ -179,6 +189,13 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
bl = true;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (that.key != this.key) {
|
||||
+ this.key = that.key;
|
||||
+ bl = true;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return bl;
|
||||
}
|
||||
|
||||
@@ -222,6 +239,17 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
return this.showIcon;
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public boolean hasKey() {
|
||||
+ return this.key != null;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public org.bukkit.NamespacedKey getKey() {
|
||||
+ return this.key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
public boolean tick(LivingEntity entity, Runnable overwriteCallback) {
|
||||
if (this.hasRemainingDuration()) {
|
||||
int i = this.isInfiniteDuration() ? entity.tickCount : this.duration;
|
||||
@@ -286,6 +314,12 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
string = string + ", Show Icon: false";
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (this.hasKey()) {
|
||||
+ string = string + ", Key: " + this.key;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -300,6 +334,7 @@ public class MobEffectInstance implements Comparable<MobEffectInstance> {
|
||||
&& this.duration == mobEffectInstance.duration
|
||||
&& this.amplifier == mobEffectInstance.amplifier
|
||||
&& this.ambient == mobEffectInstance.ambient
|
||||
+ && this.key == mobEffectInstance.key // Purpur - add key
|
||||
&& this.effect.equals(mobEffectInstance.effect);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
index 4a9e6a679530025caa710a152c5249299ceffdf9..ea4f3f606aad69965384c73eb1273ed0644297b8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java
|
||||
@@ -42,6 +42,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
static final ItemMetaKey POTION_EFFECTS = new ItemMetaKey("custom-effects");
|
||||
static final ItemMetaKey POTION_COLOR = new ItemMetaKey("custom-color");
|
||||
static final ItemMetaKey DEFAULT_POTION = new ItemMetaKey("potion-type");
|
||||
+ static final ItemMetaKey KEY = new ItemMetaKey("key", "namespacedkey"); // Purpur - add key
|
||||
|
||||
private PotionType type;
|
||||
private List<PotionEffect> customEffects;
|
||||
@@ -91,7 +92,13 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
boolean ambient = effect.isAmbient();
|
||||
boolean particles = effect.isVisible();
|
||||
boolean icon = effect.showIcon();
|
||||
- this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon));
|
||||
+ // Purpur start
|
||||
+ NamespacedKey key = null;
|
||||
+ if (tag.contains(CraftMetaPotion.KEY.NBT)) {
|
||||
+ key = NamespacedKey.fromString(effect.getString(CraftMetaPotion.KEY.NBT));
|
||||
+ }
|
||||
+ this.customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon, key));
|
||||
+ // Purpur end
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -130,6 +137,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
if (this.customEffects != null) {
|
||||
for (PotionEffect effect : this.customEffects) {
|
||||
effectList.add(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()));
|
||||
+ // Purpur start
|
||||
+ if (effect.hasKey()) {
|
||||
+ effectData.putString(CraftMetaPotion.KEY.NBT, effect.getKey().toString());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +208,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
if (index != -1) {
|
||||
if (overwrite) {
|
||||
PotionEffect old = this.customEffects.get(index);
|
||||
- if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient()) {
|
||||
+ if (old.getAmplifier() == effect.getAmplifier() && old.getDuration() == effect.getDuration() && old.isAmbient() == effect.isAmbient() && old.getKey() == effect.getKey()) { // Purpur - add key
|
||||
return false;
|
||||
}
|
||||
this.customEffects.set(index, effect);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
index 14c58cf8d255c51473fd3d0092faeaf5a3c1ae0c..3ee9c14440046872b83de628b7f460d0782e9315 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
|
||||
@@ -11,7 +11,7 @@ public class CraftPotionUtil {
|
||||
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
||||
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
|
||||
// Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over.
|
||||
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
|
||||
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon(), effect.getKey()); // Paper // Purpur - add key
|
||||
}
|
||||
|
||||
public static PotionEffect toBukkit(MobEffectInstance effect) {
|
||||
@@ -20,7 +20,7 @@ public class CraftPotionUtil {
|
||||
int duration = effect.getDuration();
|
||||
boolean ambient = effect.isAmbient();
|
||||
boolean particles = effect.isVisible();
|
||||
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper
|
||||
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect), effect.getKey()); // Paper // Purpur - add key
|
||||
}
|
||||
|
||||
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {
|
||||
diff --git a/src/test/java/org/bukkit/potion/PotionTest.java b/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
index cbcd1c21646308b2a9706095e2e12177ca06734d..b3ccaea713e858e334cc91d1ae498e589e3daafa 100644
|
||||
--- a/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
+++ b/src/test/java/org/bukkit/potion/PotionTest.java
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import org.bukkit.craftbukkit.legacy.FieldRename;
|
||||
+import org.bukkit.NamespacedKey; // Purpur
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionEffectType;
|
||||
import org.bukkit.support.AbstractTestingBase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -47,4 +48,27 @@ public class PotionTest extends AbstractTestingBase {
|
||||
assertEquals(bukkit, byName, "Same type not returned by name " + key);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Test
|
||||
+ public void testNamespacedKey() {
|
||||
+ NamespacedKey key = new NamespacedKey("testnamespace", "testkey");
|
||||
+ PotionEffect namedSpacedEffect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true, key);
|
||||
+ assertNotNull(namedSpacedEffect.getKey());
|
||||
+ assertTrue(namedSpacedEffect.hasKey());
|
||||
+ assertFalse(namedSpacedEffect.withKey(null).hasKey());
|
||||
+
|
||||
+ PotionEffect effect = new PotionEffect(PotionEffectType.DOLPHINS_GRACE, 20, 0, true, true, true);
|
||||
+ assertNull(effect.getKey());
|
||||
+ assertFalse(effect.hasKey());
|
||||
+ assertTrue(namedSpacedEffect.withKey(key).hasKey());
|
||||
+
|
||||
+ Map<String, Object> s1 = namedSpacedEffect.serialize();
|
||||
+ Map<String, Object> s2 = effect.serialize();
|
||||
+ assertTrue(s1.containsKey("namespacedKey"));
|
||||
+ assertFalse(s2.containsKey("namespacedKey"));
|
||||
+ assertNotNull(new PotionEffect(s1).getKey());
|
||||
+ assertNull(new PotionEffect(s2).getKey());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
|
||||
Date: Tue, 18 Jan 2022 04:51:51 -0600
|
||||
Subject: [PATCH] Configurable food attributes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodProperties.java b/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
index 9967ba762567631f2bdb1e4f8fe16a13ea927b46..6c945ae8fe8b1517e312c688f829fab41f12d9f4 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodProperties.java
|
||||
@@ -2,15 +2,22 @@ package net.minecraft.world.food;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
|
||||
public class FoodProperties {
|
||||
- private final int nutrition;
|
||||
- private final float saturationModifier;
|
||||
- private final boolean isMeat;
|
||||
- private final boolean canAlwaysEat;
|
||||
- private final boolean fastFood;
|
||||
+ // Purpur start
|
||||
+ private int nutrition; public void setNutrition(int nutrition) { this.nutrition = nutrition; }
|
||||
+ private float saturationModifier; public void setSaturationModifier(float saturation) { this.saturationModifier = saturation; }
|
||||
+ private boolean isMeat; public void setIsMeat(boolean isMeat) { this.isMeat = isMeat; }
|
||||
+ private boolean canAlwaysEat; public void setCanAlwaysEat(boolean canAlwaysEat) { this.canAlwaysEat = canAlwaysEat; }
|
||||
+ private boolean fastFood; public void setFastFood(boolean isFastFood) { this.fastFood = isFastFood; }
|
||||
+ public FoodProperties copy() {
|
||||
+ return new FoodProperties(this.nutrition, this.saturationModifier, this.isMeat, this.canAlwaysEat, this.fastFood, new ArrayList<>(this.effects));
|
||||
+ }
|
||||
+ // Purpur end
|
||||
private final List<Pair<MobEffectInstance, Float>> effects;
|
||||
|
||||
FoodProperties(int hunger, float saturationModifier, boolean meat, boolean alwaysEdible, boolean snack, List<Pair<MobEffectInstance, Float>> statusEffects) {
|
||||
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
index 4569cf30b33167a415256a8542820557ad38f89e..9c65eefa855f3622b6c9ae2a698cf332ba225c7f 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/Foods.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
@@ -4,6 +4,8 @@ import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
|
||||
public class Foods {
|
||||
+ public static final java.util.Map<String, FoodProperties> ALL_PROPERTIES = new java.util.HashMap<>(); // Purpur
|
||||
+ public static final java.util.Map<String, FoodProperties> DEFAULT_PROPERTIES = new java.util.HashMap<>(); // Purpur
|
||||
public static final FoodProperties APPLE = new FoodProperties.Builder().nutrition(4).saturationMod(0.3F).build();
|
||||
public static final FoodProperties BAKED_POTATO = new FoodProperties.Builder().nutrition(5).saturationMod(0.6F).build();
|
||||
public static final FoodProperties BEEF = new FoodProperties.Builder().nutrition(3).saturationMod(0.3F).meat().build();
|
||||
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
||||
index bb2103a488964f25335393fa91e8ae5749eca333..249c887af68f56739c3609bad2405ba2cbe11762 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/Items.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
||||
@@ -1715,6 +1715,13 @@ public class Items {
|
||||
((BlockItem)item).registerBlocks(Item.BY_BLOCK, item);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (item.getFoodProperties() != null) {
|
||||
+ Foods.ALL_PROPERTIES.put(key.location().getPath(), item.getFoodProperties());
|
||||
+ Foods.DEFAULT_PROPERTIES.put(key.location().getPath(), item.getFoodProperties().copy());
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
return Registry.register(BuiltInRegistries.ITEM, key, item);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 0e28cf20a870f3f3662bd1d8f7a4f2cbf13c48bf..ce3ab604e6ed6669f38abf83d40b500148277b9d 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -466,4 +466,75 @@ public class PurpurConfig {
|
||||
String setPattern = getString("settings.username-valid-characters", defaultPattern);
|
||||
usernameValidCharactersPattern = java.util.regex.Pattern.compile(setPattern == null || setPattern.isBlank() ? defaultPattern : setPattern);
|
||||
}
|
||||
+
|
||||
+ private static void foodSettings() {
|
||||
+ ConfigurationSection properties = config.getConfigurationSection("settings.food-properties");
|
||||
+ if (properties == null) {
|
||||
+ config.addDefault("settings.food-properties", new HashMap<>());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Map<MobEffect, Map<String, Object>> effectDefaults = new HashMap<>();
|
||||
+ Map<String, Object> EFFECT_DEFAULT = Map.of(
|
||||
+ "chance", 0.0F,
|
||||
+ "duration", 0,
|
||||
+ "amplifier", 0,
|
||||
+ "ambient", false,
|
||||
+ "visible", true,
|
||||
+ "show-icon", true
|
||||
+ );
|
||||
+
|
||||
+ properties.getKeys(false).forEach(foodKey -> {
|
||||
+ FoodProperties food = Foods.ALL_PROPERTIES.get(foodKey);
|
||||
+ if (food == null) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid food property: " + foodKey);
|
||||
+ return;
|
||||
+ }
|
||||
+ FoodProperties foodDefaults = Foods.DEFAULT_PROPERTIES.get(foodKey);
|
||||
+ food.setNutrition(properties.getInt(foodKey + ".nutrition", foodDefaults.getNutrition()));
|
||||
+ food.setSaturationModifier((float) properties.getDouble(foodKey + ".saturation-modifier", foodDefaults.getSaturationModifier()));
|
||||
+ food.setIsMeat(properties.getBoolean(foodKey + ".is-meat", foodDefaults.isMeat()));
|
||||
+ food.setCanAlwaysEat(properties.getBoolean(foodKey + ".can-always-eat", foodDefaults.canAlwaysEat()));
|
||||
+ food.setFastFood(properties.getBoolean(foodKey + ".fast-food", foodDefaults.isFastFood()));
|
||||
+ ConfigurationSection effects = properties.getConfigurationSection(foodKey + ".effects");
|
||||
+ if (effects != null) {
|
||||
+ effectDefaults.clear();
|
||||
+ foodDefaults.getEffects().forEach(pair -> {
|
||||
+ MobEffectInstance effect = pair.getFirst();
|
||||
+ effectDefaults.put(effect.getEffect(), Map.of(
|
||||
+ "chance", pair.getSecond(),
|
||||
+ "duration", effect.getDuration(),
|
||||
+ "amplifier", effect.getAmplifier(),
|
||||
+ "ambient", effect.isAmbient(),
|
||||
+ "visible", effect.isVisible(),
|
||||
+ "show-icon", effect.showIcon()
|
||||
+ ));
|
||||
+ });
|
||||
+ effects.getKeys(false).forEach(effectKey -> {
|
||||
+ MobEffect effect = BuiltInRegistries.MOB_EFFECT.get(new ResourceLocation(effectKey));
|
||||
+ if (effect == null) {
|
||||
+ PurpurConfig.log(Level.SEVERE, "Invalid food property effect for " + foodKey + ": " + effectKey);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Map<String, Object> effectDefault = effectDefaults.get(effect);
|
||||
+ if (effectDefault == null) {
|
||||
+ effectDefault = EFFECT_DEFAULT;
|
||||
+ }
|
||||
+
|
||||
+ food.getEffects().removeIf(pair -> pair.getFirst().getEffect() == effect);
|
||||
+ float chance = (float) effects.getDouble(effectKey + ".chance", ((Float) effectDefault.get("chance")).doubleValue());
|
||||
+ int duration = effects.getInt(effectKey + ".duration", (int) effectDefault.get("duration"));
|
||||
+ if (chance <= 0.0F || duration < 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int amplifier = effects.getInt(effectKey + ".amplifier", (int) effectDefault.get("amplifier"));
|
||||
+ boolean ambient = effects.getBoolean(effectKey + ".ambient", (boolean) effectDefault.get("ambient"));
|
||||
+ boolean visible = effects.getBoolean(effectKey + ".visible", (boolean) effectDefault.get("visible"));
|
||||
+ boolean showIcon = effects.getBoolean(effectKey + ".show-icon", (boolean) effectDefault.get("show-icon"));
|
||||
+ food.getEffects().add(Pair.of(new MobEffectInstance(effect, duration, amplifier, ambient, visible, showIcon), chance));
|
||||
+ });
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Kerllenevich <ben@omega24.dev>
|
||||
Date: Wed, 13 Jul 2022 16:27:43 -0400
|
||||
Subject: [PATCH] Send client custom name of BE
|
||||
|
||||
https://modrinth.com/mod/know-my-name
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
index 4ea15e17a1393864422edb6d5c57962651abf69a..a78ed43288cfefaeb2592ed0a33fd11565dea2b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
||||
@@ -256,10 +256,24 @@ public abstract class BlockEntity {
|
||||
|
||||
@Nullable
|
||||
public Packet<ClientGamePacketListener> getUpdatePacket() {
|
||||
+ // Purpur start
|
||||
+ if (this instanceof net.minecraft.world.Nameable nameable && nameable.hasCustomName()) {
|
||||
+ CompoundTag nbt = this.saveWithoutMetadata();
|
||||
+ nbt.remove("Items");
|
||||
+ return net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.create(this, $ -> nbt);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return null;
|
||||
}
|
||||
|
||||
public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) {
|
||||
+ // Purpur start
|
||||
+ if (this instanceof net.minecraft.world.Nameable nameable && nameable.hasCustomName()) {
|
||||
+ CompoundTag nbt = this.saveWithoutMetadata();
|
||||
+ nbt.remove("Items");
|
||||
+ return nbt;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
return new CompoundTag();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Tue, 20 Sep 2022 17:56:21 -0500
|
||||
Subject: [PATCH] Allay respect item NBT
|
||||
|
||||
https://github.com/PurpurMC/Purpur/discussions/1127
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
index bca7b7192debb3a34a08047010a2438e7b7e2a78..53765198483e137d411e227119e4f912964aefe3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -399,9 +399,31 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||
|
||||
@Override
|
||||
public boolean wantsToPickUp(ItemStack stack) {
|
||||
- ItemStack itemstack1 = this.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
-
|
||||
- return !itemstack1.isEmpty() && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.inventory.canAddItem(stack) && this.allayConsidersItemEqual(itemstack1, stack);
|
||||
+ // Purpur start
|
||||
+ if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ ItemStack itemStack = this.getItemInHand(InteractionHand.MAIN_HAND);
|
||||
+ if (itemStack.isEmpty()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!allayConsidersItemEqual(itemStack, stack)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!this.inventory.canAddItem(stack)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ for (String tag : this.level().purpurConfig.allayRespectNBT) {
|
||||
+ if (stack.hasTag() && itemStack.hasTag()) {
|
||||
+ Tag tag1 = stack.getTag().get(tag);
|
||||
+ Tag tag2 = itemStack.getTag().get(tag);
|
||||
+ if (!Objects.equals(tag1, tag2)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return true;
|
||||
+ // Purpur end
|
||||
}
|
||||
|
||||
private boolean allayConsidersItemEqual(ItemStack stack, ItemStack stack2) {
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 5b12c08a1d8e6f62c5653c95071a1d36d735d039..94e29919ddc7f507d54e14c3360f7a3e8bb831a7 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -1138,10 +1138,13 @@ public class PurpurWorldConfig {
|
||||
public boolean allayRidable = false;
|
||||
public boolean allayRidableInWater = true;
|
||||
public boolean allayControllable = true;
|
||||
+ public List<String> allayRespectNBT = new ArrayList<>();
|
||||
private void allaySettings() {
|
||||
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
|
||||
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
|
||||
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
|
||||
+ allayRespectNBT.clear();
|
||||
+ getList("mobs.allay.respect-nbt", new ArrayList<>()).forEach(key -> allayRespectNBT.add(key.toString()));
|
||||
}
|
||||
|
||||
public boolean axolotlRidable = false;
|
||||
@@ -0,0 +1,80 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MelnCat <melncatuwu@gmail.com>
|
||||
Date: Sat, 24 Sep 2022 09:56:28 -0700
|
||||
Subject: [PATCH] Add item packet serialize event
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index b863249ff7e13cf4939c8961601f0564c62fd661..bdcfd80f937c34956911373905d66424bbff8e1d 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -95,6 +95,8 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
private static final int MAX_PUBLIC_KEY_LENGTH = 512;
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
+ public static boolean hasItemSerializeEvent = false; // Purpur
|
||||
+
|
||||
public FriendlyByteBuf(ByteBuf parent) {
|
||||
this.source = parent;
|
||||
}
|
||||
@@ -640,6 +642,17 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
+ // Purpur start
|
||||
+ if (hasItemSerializeEvent) {
|
||||
+ var event = new org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent(stack.asBukkitCopy());
|
||||
+ event.callEvent();
|
||||
+ ItemStack newStack = ItemStack.fromBukkitCopy(event.getItemStack());
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.fixNetworkSerializedItemsInCreative && !ItemStack.matches(stack, newStack)) {
|
||||
+ stack.save(newStack.getOrCreateTagElement("Purpur.OriginalItem"));
|
||||
+ }
|
||||
+ stack = newStack;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
Item item = stack.getItem();
|
||||
|
||||
this.writeId(BuiltInRegistries.ITEM, item);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4611116f3328c0f8d5b37c8765feca36b2448ffe..60b5e0643d933393b5473681ac9261db29fe2416 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1731,6 +1731,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
//MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper // Purpur
|
||||
|
||||
this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
|
||||
+ net.minecraft.network.FriendlyByteBuf.hasItemSerializeEvent = org.purpurmc.purpur.event.packet.NetworkItemSerializeEvent.getHandlerList().getRegisteredListeners().length > 0; // Purpur
|
||||
Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
|
||||
while (iterator.hasNext()) {
|
||||
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 872be72e24017fdcb3060f6e4e9a92c342d59fc1..f7ac60e1aa188ec25a4c5d326cdd4a109a54101c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3382,6 +3382,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Purpur start
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.fixNetworkSerializedItemsInCreative) {
|
||||
+ var tag = itemstack.getTagElement("Purpur.OriginalItem");
|
||||
+ if (tag != null) itemstack = ItemStack.of(tag);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
|
||||
boolean flag1 = packet.getSlotNum() >= 1 && packet.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
index 5313ba91ffc625b27d5bb99395f0e719829f6bda..5329ad6493950a561bd46045e35a9bd70ac4405f 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||
@@ -568,4 +568,9 @@ public class PurpurConfig {
|
||||
}
|
||||
});
|
||||
}
|
||||
+
|
||||
+ public static boolean fixNetworkSerializedItemsInCreative = false;
|
||||
+ private static void fixNetworkSerializedCreativeItems() {
|
||||
+ fixNetworkSerializedItemsInCreative = getBoolean("settings.fix-network-serialized-items-in-creative", fixNetworkSerializedItemsInCreative);
|
||||
+ }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: rafaelflromao <12960698+rafaelflromao@users.noreply.github.com>
|
||||
Date: Mon, 8 May 2023 20:43:29 +0100
|
||||
Subject: [PATCH] Add mending multiplier
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 7130d483ccdce26526e715bd7e68d2e896e6215f..40d168d225932717b8ac8bdd27dfe2a202bc2808 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -372,13 +372,15 @@ public class ExperienceOrb extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
public int durabilityToXp(int repairAmount) {
|
||||
- return repairAmount / 2;
|
||||
+ return (int) (repairAmount / (2 * level().purpurConfig.mendingMultiplier));
|
||||
}
|
||||
|
||||
public int xpToDurability(int experienceAmount) {
|
||||
- return experienceAmount * 2;
|
||||
+ return (int) ((experienceAmount * 2) * level().purpurConfig.mendingMultiplier);
|
||||
}
|
||||
+ // Purpur end
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 02b8333222668c3419296ec5513c1c4e8e8d1a79..3c614b8f62c0d3839ebc4e948c952d52c4f66819 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -119,6 +119,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public boolean useBetterMending = false;
|
||||
+ public double mendingMultiplier = 1.0;
|
||||
public boolean alwaysTameInCreative = false;
|
||||
public boolean boatEjectPlayersOnLand = false;
|
||||
public boolean boatsDoFallDamage = false;
|
||||
@@ -147,6 +148,7 @@ public class PurpurWorldConfig {
|
||||
public int mobLastHurtByPlayerTime = 100;
|
||||
private void miscGameplayMechanicsSettings() {
|
||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||
+ mendingMultiplier = getDouble("gameplay-mechanics.mending-multiplier", mendingMultiplier);
|
||||
alwaysTameInCreative = getBoolean("gameplay-mechanics.always-tame-in-creative", alwaysTameInCreative);
|
||||
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
||||
boatsDoFallDamage = getBoolean("gameplay-mechanics.boat.do-fall-damage", boatsDoFallDamage);
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Meln Cat <melncatuwu@gmail.com>
|
||||
Date: Mon, 2 Oct 2023 17:42:26 -0700
|
||||
Subject: [PATCH] Add hover lines API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index 6e2a6ce5cf456bd9f6c8c18a58f08e2285dc77ed..b27d16e74c3f99aa693b38590c1fb62db8204509 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -619,4 +619,17 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
return CraftItemStack.asCraftMirror(enchanted);
|
||||
}
|
||||
// Paper end - enchantWithLevels API
|
||||
+
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public @org.jetbrains.annotations.NotNull java.util.List<net.kyori.adventure.text.@org.jetbrains.annotations.NotNull Component> getHoverLines(@org.jetbrains.annotations.NotNull ItemStack itemStack, boolean advanced) {
|
||||
+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(
|
||||
+ CraftItemStack.asNMSCopy(itemStack).getTooltipLines(
|
||||
+ null,
|
||||
+ advanced ? net.minecraft.world.item.TooltipFlag.ADVANCED
|
||||
+ : net.minecraft.world.item.TooltipFlag.NORMAL
|
||||
+ )
|
||||
+ );
|
||||
+ }
|
||||
+ // Purpur end
|
||||
}
|
||||
Reference in New Issue
Block a user