Compare commits

..

12 Commits

Author SHA1 Message Date
IPECTER
b0b38d4795 Fix Incompat with CoreProtect 2023-09-07 02:20:13 +09:00
IPECTER 이팩터
9c175e796c Fix Incompat with WorldGuard really! 2023-09-07 01:50:21 +09:00
IPECTER
224476289e Fix Incompat with WorldGuard 2023-09-07 01:08:32 +09:00
IPECTER
b8bd312430 Fix Optimize VarInts
Thank you, Martijn!
2023-09-07 00:54:10 +09:00
IPECTER
8441c27926 [CI-SKIP] typo~ 2023-09-06 16:53:57 +09:00
IPECTER
ab0fc1acd0 Implement CarpetFixes-Optimizations 2023-09-06 16:48:27 +09:00
IPECTER
25f409e4e7 Bump Dependencies Patch 2023-09-06 14:14:58 +09:00
IPECTER
073a7f2411 Fix! 2023-09-05 16:08:57 +09:00
github-actions[bot]
37d1596da8 [CI-Skip] Updated Dependencies ()
Dependency has released updates that appear to apply and compile correctly
2023-06-23 14:31:24 +00:00
IPECTER
8a64698c4e Updated Upstream (Paper & Pufferfish & Purpur) 2023-06-19 16:11:00 +09:00
IPECTER
acf6e2df01 Fix FerriteCore Port Mistake
slow-chunk-load bug may be fixed
2023-06-17 20:22:09 +09:00
github-actions[bot]
1f0f3fe45f Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@956062a Add transient modifiers (#9244)
2023-06-05 17:33:49 +00:00
53 changed files with 948 additions and 156 deletions

View File

@@ -1,2 +1,2 @@
purpurCommit = 561164b800712a7bd02ca0a7069c23bc71677b79
pufferfishCommit = 845c015664150048d0a7c02b706fe1c05a91ac16
purpurCommit = 68862729138c74fed22a97b582f399a9c6eb9d79
pufferfishCommit = cadfa71a2eaef4581e1163ff63d07fc596145fa1

View File

@@ -18,7 +18,7 @@ repositories {
}
dependencies {
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
remapper("net.fabricmc:tiny-remapper:0.8.7:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
paperclip("io.papermc:paperclip:3.0.3")
}

View File

@@ -1,7 +1,7 @@
group = org.plazmamc.plazma
version = 1.19.4-R0.1-SNAPSHOT
paperCommit = d8d3bd70b03f47f081d19860391e4c8b0963a5ef
paperCommit = 483368e480eb2ec060d8e68b30e14ec96aba6c4e
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 4 Jun 2023 07:52:25 +0000
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
Date: Tue, 4 Jan 2022 23:05:41 -0600
Subject: [PATCH] Purpur API Changes
Original: PurpurMC
@@ -169,10 +169,10 @@ index e801e79fa57c44b2e5d359647c920f88064826f1..1abfcee0f6d632f4cd8d74b4994a90c9
new ArrayList<String>(TIMINGS_SUBCOMMANDS.size()));
}
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 998f629852e1103767e005405d1f39c2251ecd28..3c05b03bb5ff3bfec6c69a5cc4b23f0633ab473f 100644
index b7a2cecb334ce39fa09d8ab949a29eedbdc44c36..b1f35c68373edfe666ca05b50f0ec022a1859ce9 100644
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -200,6 +200,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
@@ -201,6 +201,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Mob> CLIMB_ON_TOP_OF_POWDER_SNOW = GoalKey.of(Mob.class, NamespacedKey.minecraft("climb_on_top_of_powder_snow"));
GoalKey<Wolf> WOLF_PANIC = GoalKey.of(Wolf.class, NamespacedKey.minecraft("wolf_panic"));
@@ -209,10 +209,10 @@ index a736d7bcdc5861a01b66ba36158db1c716339346..22fc165fd9c95f0f3ae1be7a0857e48c
@Override
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 15a9993c2705e2dcc0366394ded57acffab589c0..74731f0d64d3bfc61baf816516b2bcef6515213e 100644
index b0bc2df41506770e2854a287813f1c53f003eda1..a2f617537292e3bac52d665a6e51b7d4ce4a227e 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2460,4 +2460,127 @@ public final class Bukkit {
@@ -2483,4 +2483,127 @@ public final class Bukkit {
public static Server.Spigot spigot() {
return server.spigot();
}
@@ -431,12 +431,12 @@ index ea4ceb643239c26851bacbf45fc3f2efef3bb4be..3b8395dcb73e3fb251adf7438cbc7e95
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index adb2416887cc3b544ec36c552bdf7105328c24a5..d334c963e16590c68ecd9d1d27434c7af6f7e21c 100644
index 9b290969b0e60f20450cd15e3fc6f37276f12ae6..77a885fd17f280649b95df758f1096fa38fe8d69 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -11156,4 +11156,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public String getItemTranslationKey() {
return Bukkit.getUnsafe().getItemTranslationKey(this);
@@ -11166,4 +11166,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public boolean isEnabledByFeature(@NotNull World world) {
return Bukkit.getDataPackManager().isEnabledByFeature(this, world);
}
+
+ // Purpur start
@@ -595,10 +595,10 @@ index 72175dcae49f75b494ab70958053ed994a8828f4..df642a55003517040be795b44a8bf107
+ // Purpur end - OfflinePlayer API
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 9f7029d327b55c8b1b9cfef8ea2678b87dad8ddb..d87e4d177b60957eee198c3f1791dbf26dbdddd6 100644
index 1d1a1d087dabc9794e0062a064da2cced4062309..96160bced90bb4cd84e48c85c645cad0eb672b85 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1967,6 +1967,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1994,6 +1994,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end
@@ -617,7 +617,7 @@ index 9f7029d327b55c8b1b9cfef8ea2678b87dad8ddb..d87e4d177b60957eee198c3f1791dbf2
/**
* Sends the component to the player
*
@@ -2135,4 +2147,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2162,4 +2174,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end
@@ -724,10 +724,10 @@ index 9f7029d327b55c8b1b9cfef8ea2678b87dad8ddb..d87e4d177b60957eee198c3f1791dbf2
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 2b45aa9b438d7856ec448c56832b2b2100961565..4561ca02052d774bc1424f7044c34f7affd415fc 100644
index 72f1576b8ce5b55b50f053f346ce42c52db4b568..adf8169d5baefa7a33c33ef066180a8116617756 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -3973,6 +3973,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -3974,6 +3974,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@Nullable
public DragonBattle getEnderDragonBattle();
@@ -812,8 +812,8 @@ index 2b45aa9b438d7856ec448c56832b2b2100961565..4561ca02052d774bc1424f7044c34f7a
+ // Purpur end
+
/**
* Represents various map environment types that a world may be
*/
* Get all {@link FeatureFlag} enabled in this world.
*
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index ac9a28922f8a556944a4c3649d74c32c622f0cb0..5349f16136d9348c374a7dfe5b89a71dfcb0e66d 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java

View File

@@ -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 d87e4d177b60957eee198c3f1791dbf26dbdddd6..3fbc6de9d49697baebd22f9e5977812eadff00d3 100644
index 96160bced90bb4cd84e48c85c645cad0eb672b85..cd7080c49b769dec6d5d80774bde02e9dd8ecc01 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1967,6 +1967,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1994,6 +1994,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Paper end

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <alphakr93@outlook.com>
Date: Thu, 22 Dec 2022 20:29:45 +0900
Subject: [PATCH] Bump Bungeecord Chat API to 1.19-R0.1-SNAPSHOT
diff --git a/build.gradle.kts b/build.gradle.kts
index b5835fa536f90b7f88a5ee4df78733cf43e1cb23..42de5c470a2fbb1e0bc9b809c033e3afe30502fa 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -25,7 +25,7 @@ dependencies {
// api dependencies are listed transitively to API consumers
api("com.google.guava:guava:31.1-jre")
api("com.google.code.gson:gson:2.10")
- api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.9") // Paper
+ api("net.md-5:bungeecord-chat:1.19-R0.1-SNAPSHOT") // Paper // Plazma
api("org.yaml:snakeyaml:1.33")
api("org.joml:joml:1.10.5")
// Paper start

View File

@@ -0,0 +1,91 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 12:40:40 +0900
Subject: [PATCH] Bump-Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 417c4324af22c870de669e338a1eee5d540184a4..6cb60894c2363d5c6a71b12008421d49d2c128a0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ java {
withJavadocJar()
}
-val adventureVersion = "4.13.1"
+val adventureVersion = "4.14.0" // Plazma - Bump Dependencies
val apiAndDocs: Configuration by configurations.creating {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@@ -23,16 +23,16 @@ configurations.api {
dependencies {
// api dependencies are listed transitively to API consumers
- api("com.google.guava:guava:31.1-jre")
- api("com.google.code.gson:gson:2.10")
- api("net.md-5:bungeecord-chat:1.16-R0.4-deprecated+build.9") // Paper
- api("org.yaml:snakeyaml:1.33")
+ api("com.google.guava:guava:32.1.2-jre") // Plazma - Bump Dependencies
+ api("com.google.code.gson:gson:2.10.1") // Plazma - Bump Dependencies
+ api("net.md-5:bungeecord-chat:1.19-R0.1-SNAPSHOT") // Paper // Plazma - Bump Dependencies
+ api("org.yaml:snakeyaml:1.33") // Plazma - Bump Dependencies
api("org.joml:joml:1.10.5")
// Paper start
api("com.googlecode.json-simple:json-simple:1.1.1") {
isTransitive = false // includes junit
}
- api("it.unimi.dsi:fastutil:8.5.6")
+ api("it.unimi.dsi:fastutil:8.5.12") // Plazma - Bump Dependencies
apiAndDocs(platform("net.kyori:adventure-bom:$adventureVersion"))
apiAndDocs("net.kyori:adventure-api")
apiAndDocs("net.kyori:adventure-text-minimessage")
@@ -40,34 +40,34 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
apiAndDocs("net.kyori:adventure-text-serializer-plain")
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
- api("org.apache.logging.log4j:log4j-api:2.17.1")
- api("org.slf4j:slf4j-api:1.8.0-beta4")
- api("io.sentry:sentry:5.4.0") // Pufferfish
+ api("org.apache.logging.log4j:log4j-api:2.20.0") // Plazma - Bump Dependencies
+ api("org.slf4j:slf4j-api:2.0.9") // Plazma - Bump Dependencies
+ api("io.sentry:sentry:6.28.0") // Pufferfish // Plazma - Bump Dependencies
- implementation("org.ow2.asm:asm:9.4")
- implementation("org.ow2.asm:asm-commons:9.4")
+ implementation("org.ow2.asm:asm:9.5") // Plazma - Bump Dependencies
+ implementation("org.ow2.asm:asm-commons:9.5") // Plazma - Bump Dependencies
// Paper end
- api("org.apache.maven:maven-resolver-provider:3.8.5") // Paper, expose
- compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
- compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
- compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
+ api("org.apache.maven:maven-resolver-provider:3.9.4") // Paper, expose // Plazma - Bump Dependencies
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15") // Plazma - Bump Dependencies
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15") // Plazma - Bump Dependencies
+ compileOnly("com.google.code.findbugs:jsr305:3.0.2") // Paper // Plazma - Bump Dependencies
- val annotations = "org.jetbrains:annotations:23.0.0" // Paper - we don't want Java 5 annotations...
+ val annotations = "org.jetbrains:annotations:24.0.1" // Paper - we don't want Java 5 annotations... // Plazma - Bump Dependencies
compileOnly(annotations)
testCompileOnly(annotations)
// Paper start - add checker
- val checkerQual = "org.checkerframework:checker-qual:3.21.0"
+ val checkerQual = "org.checkerframework:checker-qual:3.38.0" // Plazma - Bump Dependencies
compileOnlyApi(checkerQual)
testCompileOnly(checkerQual)
// Paper end
- testImplementation("org.mockito:mockito-core:4.9.0") // Paper - add mockito
+ testImplementation("org.mockito:mockito-core:5.5.0") // Paper - add mockito // Plazma - Bump Dependencies
- testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("org.apache.commons:commons-lang3:3.13.0") // Plazma - Bump Dependencies
testImplementation("junit:junit:4.13.2")
- testImplementation("org.hamcrest:hamcrest-library:1.3")
- testImplementation("org.ow2.asm:asm-tree:9.4")
+ testImplementation("org.hamcrest:hamcrest-library:2.2") // Plazma - Bump Dependencies
+ testImplementation("org.ow2.asm:asm-tree:9.5") // Plazma - Bump Dependencies
}
configure<PublishingExtension> {

View File

@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 15:04:25 +0900
Subject: [PATCH] Optimize-spigot-event-bus
diff --git a/src/main/java/org/bukkit/event/Event.java b/src/main/java/org/bukkit/event/Event.java
index 8ec56cd6b8e0f5c5dd8c7c88b4671e18dcf109d0..45b8ee1945202cc673905aab5c90985c01cb205e 100644
--- a/src/main/java/org/bukkit/event/Event.java
+++ b/src/main/java/org/bukkit/event/Event.java
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
*/
public abstract class Event {
private String name;
- private final boolean async;
+ private final net.kyori.adventure.util.TriState async; // Plazma - Optimize spigot event bus
/**
* The default constructor is defined for cleaner code. This constructor
@@ -32,9 +32,35 @@ public abstract class Event {
* by default from default constructor
*/
public Event(boolean isAsync) {
+ this(net.kyori.adventure.util.TriState.byBoolean(isAsync)); // Plazma - Optimize spigot event bus
+ }
+
+ // Plazma start - Optimize spigot event bus
+ /**
+ * This constructor is used to explicitly declare an event as synchronous
+ * or asynchronous or potentially unset.
+ *
+ * @param isAsync true indicates the event will fire asynchronously, false
+ * by default from default constructor, unset indicates that the event may be called on either the server thread or off the server
+ * thread.
+ */
+ public Event(@NotNull final net.kyori.adventure.util.TriState isAsync) {
this.async = isAsync;
}
+ /**
+ * Returns a tristate that, when resolving to true or false, has the exact indications defined by {@link #isAsynchronous()}.
+ * <p>
+ * If the tristate resolves to NOT_SET, the event may or may not have been fired off the main thread, meaning a plugin would have
+ * to validate what thread the spigot event bus was called on.
+ *
+ * @return the tristate enum.
+ */
+ public final @NotNull net.kyori.adventure.util.TriState asynchronous() {
+ return this.async;
+ }
+ // Plazma end
+
// Paper start
/**
* Calls the event and tests if cancelled.
@@ -92,7 +118,7 @@ public abstract class Event {
* @return false by default, true if the event fires asynchronously
*/
public final boolean isAsynchronous() {
- return async;
+ return this.async == net.kyori.adventure.util.TriState.TRUE; // Plazma - Optimize spigot event bus
}
public enum Result {
diff --git a/src/main/java/org/bukkit/plugin/RegisteredListener.java b/src/main/java/org/bukkit/plugin/RegisteredListener.java
index 3b3d9642a8d63798dc28f2f8df77f0466451cbff..0702e1692f7e671188ac18e22ca29f369b0b6352 100644
--- a/src/main/java/org/bukkit/plugin/RegisteredListener.java
+++ b/src/main/java/org/bukkit/plugin/RegisteredListener.java
@@ -62,8 +62,8 @@ public class RegisteredListener {
* @throws EventException If an event handler throws an exception.
*/
public void callEvent(@NotNull final Event event) throws EventException {
- if (event instanceof Cancellable) {
- if (((Cancellable) event).isCancelled() && isIgnoringCancelled()) {
+ if (isIgnoringCancelled()) { // Plazma - Optimize spigot event bus
+ if (event instanceof Cancellable cancellable && cancellable.isCancelled()) { // Plazma - Optimize spigot event bus
return;
}
}

View File

@@ -16,9 +16,6 @@ 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/build.gradle.kts b/build.gradle.kts
index 4f2fa65ade89c5703451dad4f80eeef162b277d1..3ee1160c796cc86db9bc9438055b307239e9a8f7 100644
--- a/build.gradle.kts
@@ -616,7 +613,7 @@ index 0000000000000000000000000000000000000000..020368da69b9a492155f6de6297f7473
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..f88e0b31b10b329fd8e94fc48148f490f31da646
index 0000000000000000000000000000000000000000..0dd3374468e05f7a312ba5856b9cf8a4787dfa59
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -0,0 +1,293 @@
@@ -890,14 +887,14 @@ index 0000000000000000000000000000000000000000..f88e0b31b10b329fd8e94fc48148f490
+
+ public static boolean throttleInactiveGoalSelectorTick;
+ private static void inactiveGoalSelectorThrottle() {
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
+ throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
+ "Throttles the AI goal selector in entity inactive ticks.",
+ "This can improve performance by a few percent, but has minor gameplay implications.");
+ }
+
+ public static boolean allowEndCrystalRespawn;
+ private static void allowEndCrystalRespawn() {
+ getBoolean("allow-end-crystal-respawn", true,
+ allowEndCrystalRespawn = getBoolean("allow-end-crystal-respawn", true,
+ "Allows end crystals to respawn the ender dragon.",
+ "On servers that expect end crystal fights in the end dimension, disabling this",
+ "will prevent the server from performing an expensive search to attempt respawning",
@@ -3452,10 +3449,10 @@ index ebe65474a4a05ff1637d7f37ebcfe690af59def5..42142c512b12e5b269c19f1e821c50e7
@Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 894c0d5bfa001def4374b657e3eb8f15a0caa1e9..a49520fbb3cbce866338c964dd0aadbd113bf411 100644
index 9f2536d9a73bdb15b5b3004d4da79ca32cee205b..6ff93df3e870ebc6e52f8b8a719908bfa16a839b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -259,7 +259,7 @@ import javax.annotation.Nullable; // Paper
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
@@ -3464,7 +3461,7 @@ index 894c0d5bfa001def4374b657e3eb8f15a0caa1e9..a49520fbb3cbce866338c964dd0aadbd
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
@@ -1042,6 +1042,11 @@ public final class CraftServer implements Server {
@@ -1062,6 +1062,11 @@ public final class CraftServer implements Server {
plugin.getPluginMeta().getDisplayName(),
"This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies."
));
@@ -3489,10 +3486,10 @@ index f7ea77dd82d978ad307f99c743efacfb34478b3d..009ab06182359862b8f543030ec4fe4e
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 64c50c52c11214740de7903e5592b8b6b2c170b3..d4f62940504e3ef7a70e13b1f4a7726f23b4c637 100644
index 1179e9fbff93ec8ff82aa3aae477f6bf4ce9b885..1ecf065c5323f65401412cb98d4a0b622f356759 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -464,7 +464,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -472,7 +472,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 4 Jun 2023 07:52:24 +0000
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Sun, 12 Jun 2022 09:18:57 -0500
Subject: [PATCH] Purpur Server Changes
Original: PurpurMC
@@ -249,7 +249,7 @@ index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf216
setListData(vector);
}
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index f88e0b31b10b329fd8e94fc48148f490f31da646..fd26eb27a2fcebe8c768305c587c908bcedacf1d 100644
index 0dd3374468e05f7a312ba5856b9cf8a4787dfa59..b4e5fbace85c67e7bd347e6a90514bbc2c132d5e 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -28,6 +28,7 @@ public class PufferfishConfig {
@@ -282,8 +282,8 @@ index f88e0b31b10b329fd8e94fc48148f490f31da646..fd26eb27a2fcebe8c768305c587c908b
public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() {
- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
- throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
+ throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
"Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications.");
}
@@ -2759,7 +2759,7 @@ index 3ee5c3c17d450dce54e051dc53c9df44d9b3dc1b..86b8485c0fb1dc5cd79c9e24546dc744
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72f09dfe3b 100644
index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..852266234cf3d63e3b23a71639e40defca91c1b8 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -277,6 +277,11 @@ public class ServerPlayer extends Player {
@@ -2955,13 +2955,13 @@ index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72
this.connection.send(new ClientboundResourcePackPacket(url, hash, required, resourcePackPrompt));
}
@@ -2041,8 +2103,63 @@ public class ServerPlayer extends Player {
@@ -2041,8 +2103,68 @@ public class ServerPlayer extends Player {
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
+ this.setAfk(false); // Purpur
}
+ }
+
+ // Purpur Start
+ private boolean isAfk = false;
+
@@ -2986,7 +2986,12 @@ index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72
+
+ msg = event.getBroadcastMsg();
+ if (msg != null && !msg.isEmpty()) {
+ server.getPlayerList().broadcastMiniMessage(String.format(msg, this.getGameProfile().getName()), false);
+ String playerName = this.getGameProfile().getName();
+ if (org.purpurmc.purpur.PurpurConfig.afkBroadcastUseDisplayName) {
+ net.kyori.adventure.text.Component playerDisplayNameComponent = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getBukkitEntity().getDisplayName());
+ playerName = net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer.plainText().serialize(playerDisplayNameComponent);
+ }
+ server.getPlayerList().broadcastMiniMessage(String.format(msg, playerName), false);
+ }
+
+ if (this.level.purpurConfig.idleTimeoutUpdateTabList) {
@@ -3008,8 +3013,8 @@ index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72
+ @Override
+ public boolean isAfk() {
+ return this.isAfk;
+ }
+
}
+ @Override
+ public boolean canBeCollidedWith() {
+ return !this.isAfk() && super.canBeCollidedWith();
@@ -3019,7 +3024,7 @@ index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72
public ServerStatsCounter getStats() {
return this.stats;
}
@@ -2514,8 +2631,16 @@ public class ServerPlayer extends Player {
@@ -2514,8 +2636,16 @@ public class ServerPlayer extends Player {
@Override
public boolean isImmobile() {
@@ -3037,7 +3042,7 @@ index 98df2463bf41fc736aa6a2b6ddf89e5abde6eb39..82402be7bbbf04388339c6a471946a72
@Override
public Scoreboard getScoreboard() {
@@ -2564,4 +2689,50 @@ public class ServerPlayer extends Player {
@@ -2564,4 +2694,50 @@ public class ServerPlayer extends Player {
return (CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end
@@ -4650,7 +4655,7 @@ index 8af0918d3a62de58a4b2af55022c812bb0e46092..3fc26a8976f4bfa28c2c6a862aac997d
}
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 89699aaccd45a5a928a97d1b3ad06f5de5b9fad1..186d6b06194eb2120c9cec6218c87e8cf2f11f65 100644
index 89699aaccd45a5a928a97d1b3ad06f5de5b9fad1..b3b371ee4850c90a3142c3c96761b032e6de6af0 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -306,7 +306,7 @@ public class ExperienceOrb extends Entity {
@@ -4671,6 +4676,24 @@ index 89699aaccd45a5a928a97d1b3ad06f5de5b9fad1..186d6b06194eb2120c9cec6218c87e8c
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
@@ -352,13 +352,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/net/minecraft/world/entity/GlowSquid.java b/src/main/java/net/minecraft/world/entity/GlowSquid.java
index c1e9b40a4a0f9cdc650caa88b5ea132e06ee2496..6f723171fa71d74b351b5cf0cd167bb6f7ca1691 100644
--- a/src/main/java/net/minecraft/world/entity/GlowSquid.java
@@ -20228,10 +20251,10 @@ index 714afc98b5150907b45a00060be4e41582333204..312a6d90c0a09570aef24c205dc2ff27
+ // Purpur end - OfflinePlayer API
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955005bf458 100644
index 6ff93df3e870ebc6e52f8b8a719908bfa16a839b..3310828edcabd2c24e3200dcb89d4e8ebd82cf16 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -259,7 +259,7 @@ import javax.annotation.Nullable; // Paper
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
@@ -20240,8 +20263,8 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
@@ -319,6 +319,20 @@ public final class CraftServer implements Server {
this.structureManager = new CraftStructureManager(console.getStructureManager());
@@ -324,6 +324,20 @@ public final class CraftServer implements Server {
this.dataPackManager = new CraftDataPackManager(this.getServer().getPackRepository());
Bukkit.setServer(this);
+ // Purpur start
@@ -20261,7 +20284,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
// Register all the Enchantments and PotionTypes now so we can stop new registration immediately after
Enchantments.SHARPNESS.getClass();
@@ -959,6 +973,7 @@ public final class CraftServer implements Server {
@@ -979,6 +993,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
@@ -20269,7 +20292,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
@@ -974,6 +989,7 @@ public final class CraftServer implements Server {
@@ -994,6 +1009,7 @@ public final class CraftServer implements Server {
}
}
world.spigotConfig.init(); // Spigot
@@ -20277,7 +20300,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
}
Plugin[] pluginClone = pluginManager.getPlugins().clone(); // Paper
@@ -989,6 +1005,7 @@ public final class CraftServer implements Server {
@@ -1009,6 +1025,7 @@ public final class CraftServer implements Server {
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@@ -20285,7 +20308,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -1431,6 +1448,55 @@ public final class CraftServer implements Server {
@@ -1451,6 +1468,55 @@ public final class CraftServer implements Server {
return true;
}
@@ -20341,7 +20364,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
@Override
public List<Recipe> getRecipesFor(ItemStack result) {
Validate.notNull(result, "Result cannot be null");
@@ -2702,6 +2768,7 @@ public final class CraftServer implements Server {
@@ -2722,6 +2788,7 @@ public final class CraftServer implements Server {
@Override
public double[] getTPS() {
return new double[] {
@@ -20349,7 +20372,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
net.minecraft.server.MinecraftServer.getServer().tps1.getAverage(),
net.minecraft.server.MinecraftServer.getServer().tps5.getAverage(),
net.minecraft.server.MinecraftServer.getServer().tps15.getAverage()
@@ -2748,6 +2815,18 @@ public final class CraftServer implements Server {
@@ -2768,6 +2835,18 @@ public final class CraftServer implements Server {
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
}
@@ -20368,7 +20391,7 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
@Override
public void restart() {
org.spigotmc.RestartCommand.restart();
@@ -2961,4 +3040,16 @@ public final class CraftServer implements Server {
@@ -2981,4 +3060,16 @@ public final class CraftServer implements Server {
}
// Paper end
@@ -20386,10 +20409,10 @@ index a49520fbb3cbce866338c964dd0aadbd113bf411..3f80b16c8d69f284a26b16cf2513a955
+ // Purpur end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index dafd2c85f89d8822e50db63c21631199c69a97a0..39a2ff8c34f995ab860aadc24d24136d602af646 100644
index 8f0234296397ca2d4a607dcea6093c6c606dc7d2..68df53648c9b76cf1b6abcaa90c5e8938e9e0d05 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -2282,6 +2282,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2284,6 +2284,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return (this.getHandle().dragonFight() == null) ? null : new CraftDragonBattle(this.getHandle().dragonFight());
}
@@ -20439,7 +20462,7 @@ index dafd2c85f89d8822e50db63c21631199c69a97a0..39a2ff8c34f995ab860aadc24d24136d
public PersistentDataContainer getPersistentDataContainer() {
return this.persistentDataContainer;
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c103f10dbb6c06e14bb7b5df73a797f456803301..2a8db3527f3680789125fca41097657063efb32d 100644
index bfa091f72d6f477bcaf63d364639a1b4df9b1987..288cf98287c6d3c073b9ab6696c3957c999cad32 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -173,6 +173,20 @@ public class Main {
@@ -20463,7 +20486,7 @@ index c103f10dbb6c06e14bb7b5df73a797f456803301..2a8db3527f3680789125fca410976570
// Paper start
acceptsAll(asList("server-name"), "Name of the server")
.withRequiredArg()
@@ -277,7 +291,7 @@ public class Main {
@@ -284,7 +298,7 @@ public class Main {
System.setProperty(net.minecrell.terminalconsole.TerminalConsoleAppender.JLINE_OVERRIDE_PROPERTY, "false"); // Paper
}
@@ -21339,10 +21362,10 @@ index 138407c2d4b0bc55ddb9aac5d2aa3edadda090fb..a6e9e503a496c18e2501b03ec84f4600
// Paper end - add timings for scoreboard search
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d4f62940504e3ef7a70e13b1f4a7726f23b4c637..1dd7f923dd6adb41eafc3ea0c063e3aae6670124 100644
index 1ecf065c5323f65401412cb98d4a0b622f356759..1bf9a11abf7884a421374cbca5ccc18480717b79 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -464,7 +464,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -472,7 +472,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
@@ -21387,10 +21410,10 @@ index ec771c480156db393c326fa2fbdc2d432fb76f53..71940bf3a4162d12a422a5b3100ad8de
DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "seed", "Allows the user to view the seed of the world", PermissionDefault.OP, commands);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..62ad4c6ad417e11e9152f74636b2ff0d187d0799
index 0000000000000000000000000000000000000000..be8b44daa0141151c973917a774aa07721647ed1
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -0,0 +1,636 @@
@@ -0,0 +1,638 @@
+package org.purpurmc.purpur;
+
+import com.google.common.base.Throwables;
@@ -21569,6 +21592,7 @@ index 0000000000000000000000000000000000000000..62ad4c6ad417e11e9152f74636b2ff0d
+ public static String cannotRideMob = "<red>You cannot mount that mob";
+ public static String afkBroadcastAway = "<yellow><italic>%s is now AFK";
+ public static String afkBroadcastBack = "<yellow><italic>%s is no longer AFK";
+ public static boolean afkBroadcastUseDisplayName = false;
+ public static String afkTabListPrefix = "[AFK] ";
+ public static String afkTabListSuffix = "";
+ public static String creditsCommandOutput = "<green>%s has been shown the end credits";
@@ -21586,6 +21610,7 @@ index 0000000000000000000000000000000000000000..62ad4c6ad417e11e9152f74636b2ff0d
+ cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob);
+ afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway);
+ afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack);
+ afkBroadcastUseDisplayName = getBoolean("settings.messages.afk-broadcast-use-display-name", afkBroadcastUseDisplayName);
+ afkTabListPrefix = MiniMessage.miniMessage().serialize(MiniMessage.miniMessage().deserialize(getString("settings.messages.afk-tab-list-prefix", afkTabListPrefix)));
+ afkTabListSuffix = MiniMessage.miniMessage().serialize(MiniMessage.miniMessage().deserialize(getString("settings.messages.afk-tab-list-suffix", afkTabListSuffix)));
+ creditsCommandOutput = getString("settings.messages.credits-command-output", creditsCommandOutput);
@@ -22029,10 +22054,10 @@ index 0000000000000000000000000000000000000000..62ad4c6ad417e11e9152f74636b2ff0d
+}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..0db8a1a51c857a3930d0b20028964fb355d8e5b4
index 0000000000000000000000000000000000000000..397c4afa8da85845f49974832674a6e45ee6edb7
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -0,0 +1,3201 @@
@@ -0,0 +1,3203 @@
+package org.purpurmc.purpur;
+
+import net.minecraft.core.registries.BuiltInRegistries;
@@ -22156,6 +22181,7 @@ index 0000000000000000000000000000000000000000..0db8a1a51c857a3930d0b20028964fb3
+ }
+
+ public boolean useBetterMending = false;
+ public double mendingMultiplier = 1.0;
+ public boolean alwaysTameInCreative = false;
+ public boolean boatEjectPlayersOnLand = false;
+ public boolean boatsDoFallDamage = false;
@@ -22183,6 +22209,7 @@ index 0000000000000000000000000000000000000000..0db8a1a51c857a3930d0b20028964fb3
+ 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);

View File

@@ -245,10 +245,10 @@ index bd502ca721de0cab438d995efa00ad0554c0d2fe..d72f61f545c3929825e628607b85e0d2
private static final int DEFAULT_SIZE_THRESHOLD = 1024 * 8;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3f80b16c8d69f284a26b16cf2513a955005bf458..26c4f8da23bf83abf2e78894b731312028bed191 100644
index 3310828edcabd2c24e3200dcb89d4e8ebd82cf16..5e6952a9d4c1137dc3d720ee2c944d95d4628065 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -259,7 +259,7 @@ import javax.annotation.Nullable; // Paper
@@ -262,7 +262,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
@@ -321,10 +321,10 @@ index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..0e695ea608c4e4770f5491d54ad47616
+ // Plazma end
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 62ad4c6ad417e11e9152f74636b2ff0d187d0799..562baddc030c6a7861f58438a630cfbe47847d38 100644
index be8b44daa0141151c973917a774aa07721647ed1..c93f6d275d0541e0751eefca45d17c4ccd39a62a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -227,7 +227,7 @@ public class PurpurConfig {
@@ -229,7 +229,7 @@ public class PurpurConfig {
deathMessageOnlyBroadcastToAffectedPlayer = getBoolean("settings.broadcasts.death.only-broadcast-to-affected-player", deathMessageOnlyBroadcastToAffectedPlayer);
}

View File

@@ -0,0 +1,84 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 11:41:06 +0900
Subject: [PATCH] Bump-Dependencies
diff --git a/build.gradle.kts b/build.gradle.kts
index 46fda579a95f9ab92a1ba61cad8218024a722208..5f38d64b1bcd9468ebdd6de6ef30580c6cfecadc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -10,7 +10,7 @@ dependencies {
implementation(project(":plazma-api")) // Purpur
implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") // Purpur
// Paper start
- implementation("org.jline:jline-terminal-jansi:3.21.0")
+ implementation("org.jline:jline-terminal-jansi:3.23.0") // Plazma - Bump Dependencies
implementation("net.minecrell:terminalconsoleappender:1.3.0")
/*
Required to add the missing Log4j2Plugins.dat file from log4j-core
@@ -18,22 +18,22 @@ dependencies {
all its classes to check if they are plugins.
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
- implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
- annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins
- implementation("io.netty:netty-codec-haproxy:4.1.87.Final") // Paper - Add support for proxy protocol
+ implementation("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - implementation // Plazma - Bump Dependencies
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - Needed to generate meta for our Log4j plugins // Plazma - Bump Dependencies
+ implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol // Plazma - Bump Dependencies
// Paper end
- implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
- implementation("org.ow2.asm:asm:9.4")
- implementation("org.ow2.asm:asm-commons:9.4") // Paper - ASM event executor generation
- testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito
+ implementation("org.apache.logging.log4j:log4j-iostreams:2.20.0") // Paper - remove exclusion // Plazma - Bump Dependencies
+ implementation("org.ow2.asm:asm:9.5") // Plazma - Bump Dependencies
+ implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation // Plazma - Bump Dependencies
+ testImplementation("org.mockito:mockito-core:5.5.0") // Paper - switch to mockito // Plazma - Bump Dependencies
implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
- implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
- runtimeOnly("org.xerial:sqlite-jdbc:3.41.2.2")
- runtimeOnly("com.mysql:mysql-connector-j:8.0.32")
+ implementation("net.fabricmc:mapping-io:0.4.2") // Paper - needed to read mappings for stacktrace deobfuscation // Plazma - Bump Dependencies
+ runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.1") // Plazma - Bump Dependencies
+ runtimeOnly("com.mysql:mysql-connector-j:8.1.0") // Plazma - Bump Dependencies
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.2.0-SNAPSHOT") { // Plazma - Bump Dependencies
isTransitive = false
}
// Paper end
@@ -42,22 +42,22 @@ dependencies {
implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
implementation("dev.omega24:upnp4j:1.0") // Purpur
- runtimeOnly("org.apache.maven:maven-resolver-provider:3.8.5")
- runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
- runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
+ runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.4") // Plazma - Bump Dependencies
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15") // Plazma - Bump Dependencies
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15") // Plazma - Bump Dependencies
// Pufferfish start
- implementation("org.yaml:snakeyaml:1.32")
- implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.2") {
+ implementation("org.yaml:snakeyaml:1.33") // Plazma - Bump Dependencies
+ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { // Plazma - Bump Dependencies
exclude(group="org.yaml", module="snakeyaml")
}
// Pufferfish end
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
+ testImplementation("io.github.classgraph:classgraph:4.8.162") // Paper - mob goal test // Plazma - Bump Dependencies
testImplementation("junit:junit:4.13.2")
- testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.hamcrest:hamcrest-library:2.2") // Plazma - Bump Dependencies
- implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
+ implementation("io.netty:netty-all:4.1.97.Final"); // Paper - Bump netty // Plazma - Bump Dependencies
}
val craftbukkitPackageVersion = "1_19_R3" // Paper

View File

@@ -300,10 +300,10 @@ index 92b440b24c6b083f81837611d08fbd6773a2a6e6..058449f24eb3260dc230dad2a0b4c552
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 26c4f8da23bf83abf2e78894b731312028bed191..bb5ec38711f369ffcbd184b4e144bc0d8d576013 100644
index 5e6952a9d4c1137dc3d720ee2c944d95d4628065..1367072684078c0e93c275c2159ece799f96428b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -973,6 +973,7 @@ public final class CraftServer implements Server {
@@ -993,6 +993,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
@@ -311,7 +311,7 @@ index 26c4f8da23bf83abf2e78894b731312028bed191..bb5ec38711f369ffcbd184b4e144bc0d
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
@@ -2815,6 +2816,13 @@ public final class CraftServer implements Server {
@@ -2835,6 +2836,13 @@ public final class CraftServer implements Server {
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
}
@@ -326,7 +326,7 @@ index 26c4f8da23bf83abf2e78894b731312028bed191..bb5ec38711f369ffcbd184b4e144bc0d
@Override
public YamlConfiguration getPurpurConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 2a8db3527f3680789125fca41097657063efb32d..b9f28e1c50e7d507ab151ff95f82dacc2da1ed3a 100644
index 288cf98287c6d3c073b9ab6696c3957c999cad32..4970b246356bbd04eb1f9715da3fc7c9494573e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -173,6 +173,14 @@ public class Main {

View File

@@ -7,7 +7,7 @@ Original: YouHaveTrouble/minecraft-optimization, AkiraDevelopment/SimplyMC
Copyright (C) 2023 YouHaveTrouble, AkiraDevelopment
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index 47e77541e558e18758ae0fcc2aa4e47261e928b6..dd3a29c49392910a38be14a638c6c9b6e825d772 100644
index b4e5fbace85c67e7bd347e6a90514bbc2c132d5e..edc8eba38af743167a8b78d34cb426d6929f9605 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -211,8 +211,8 @@ public class PufferfishConfig {
@@ -42,15 +42,6 @@ index 47e77541e558e18758ae0fcc2aa4e47261e928b6..dd3a29c49392910a38be14a638c6c9b6
"tick frequency. freq = (distanceToPlayer^2) / (2^value)",
"If you want further away entities to tick less often, use 7.",
"If you want further away entities to tick more often, try 9.");
@@ -269,7 +269,7 @@ public class PufferfishConfig {
public static boolean throttleInactiveGoalSelectorTick;
private static void inactiveGoalSelectorThrottle() {
- getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
+ getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", !Boolean.getBoolean("Plazma.disableConfigOptimization"), // Purpur // Plazma
"Throttles the AI goal selector in entity inactive ticks.",
"This can improve performance by a few percent, but has minor gameplay implications.");
}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 8d442c5a498ecf288a0cc0c54889c6e2fda849ce..205ce3456a3f6d28cc2c7cbc131ec0f63a461527 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -261,10 +252,10 @@ index 1ea3012995c738c67b31e997c138f824f9e69ba1..8ed00a650b712cbf4bc8796165a539d7
this.enableStatus = this.get("enable-status", true);
this.hideOnlinePlayers = this.get("hide-online-players", false);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bb5ec38711f369ffcbd184b4e144bc0d8d576013..5df6fd278a6555e483ea4ebc4e9625907585f77f 100644
index 1367072684078c0e93c275c2159ece799f96428b..84fb7f6cdad5e7a5389e2469bfd6fb961cd1b299 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -349,7 +349,7 @@ public final class CraftServer implements Server {
@@ -354,7 +354,7 @@ public final class CraftServer implements Server {
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.configuration.options().copyDefaults(true);
@@ -274,7 +265,7 @@ index bb5ec38711f369ffcbd184b4e144bc0d8d576013..5df6fd278a6555e483ea4ebc4e962590
if (!this.configuration.isString("aliases")) {
legacyAlias = this.configuration.getConfigurationSection("aliases");
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 562baddc030c6a7861f58438a630cfbe47847d38..529247dad9300b0abc024464fb0ca35c4bc0f410 100644
index c93f6d275d0541e0751eefca45d17c4ccd39a62a..38a8f79b0075279389f0b3dc7de4b16d9af05295 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -49,7 +49,10 @@ public class PurpurConfig {
@@ -289,7 +280,7 @@ index 562baddc030c6a7861f58438a630cfbe47847d38..529247dad9300b0abc024464fb0ca35c
private static File CONFIG_FILE;
public static YamlConfiguration config;
@@ -237,7 +240,7 @@ public class PurpurConfig {
@@ -239,7 +242,7 @@ public class PurpurConfig {
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
}
@@ -299,10 +290,10 @@ index 562baddc030c6a7861f58438a630cfbe47847d38..529247dad9300b0abc024464fb0ca35c
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 0db8a1a51c857a3930d0b20028964fb355d8e5b4..aca570efe2360d7d5f71e62433f6b1cd08f5214b 100644
index 397c4afa8da85845f49974832674a6e45ee6edb7..ce702e6b5fff3a54f9f254a61becd12eb5c11dd7 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -425,7 +425,7 @@ public class PurpurWorldConfig {
@@ -427,7 +427,7 @@ public class PurpurWorldConfig {
public boolean playerInvulnerableWhileAcceptingResourcePack = false;
public String playerDeathExpDropEquation = "expLevel * 7";
public int playerDeathExpDropMax = 100;
@@ -311,7 +302,7 @@ index 0db8a1a51c857a3930d0b20028964fb355d8e5b4..aca570efe2360d7d5f71e62433f6b1cd
public boolean teleportOnNetherCeilingDamage = false;
public boolean totemOfUndyingWorksInInventory = false;
public boolean playerFixStuckPortal = false;
@@ -3038,7 +3038,7 @@ public class PurpurWorldConfig {
@@ -3040,7 +3040,7 @@ public class PurpurWorldConfig {
public boolean zombieJockeyOnlyBaby = true;
public double zombieJockeyChance = 0.05D;
public boolean zombieJockeyTryExistingChickens = true;

View File

@@ -16,7 +16,7 @@ index 857ddc62dd9affbbebcd7cde8a6d675dbb5f68ae..8ba1c5b6731d43c02b415e4d79a20c1d
+ public ChunkSending chunkSending;
+ public class ChunkSending extends ConfigurationPart {
+
+ public boolean enabled = true;
+ public boolean enabled = DO_OPTIMIZE;
+ public int maxChunksPerTick = 5;
+
+ }

View File

@@ -7,7 +7,7 @@ Original: someaddons/chunksending
Copyright (C) 2023 someaddons
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..7f749579fe056a8436e6625204ae31f1fcc15f32 100644
index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..4841fcfd00ca5a1b0b7d39c934159a4bae841a1b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -362,15 +362,14 @@ public class ChunkHolder {
@@ -25,7 +25,7 @@ index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..7f749579fe056a8436e6625204ae31f1
+ for (Object o : backingSet) {
+ if (!(o instanceof ServerPlayer player)
+ || !this.chunkMap.playerChunkManager.isChunkSent(player, this.pos.x, this.pos.z, onlyOnWatchDistanceEdge)
+ || (this.chunkMap.level.plazmaLevelConfiguration().chunkSending.enabled && player.attachToPending(pos, packet))) continue;
+ || (this.chunkMap.level.plazmaLevelConfiguration().chunkSending.enabled && !player.attachToPending(pos, packet))) continue;
player.connection.send(packet);
}
+ // Plazma end
@@ -33,7 +33,7 @@ index 904fcdeb7937d36208cc9a8d5eca9ef3a5b2cd9e..7f749579fe056a8436e6625204ae31f1
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 82402be7bbbf04388339c6a471946a72f09dfe3b..40eda117db2e3f578ad9d25522b6aadfe319b5cc 100644
index 852266234cf3d63e3b23a71639e40defca91c1b8..4668eebc0776a470a42de94de1752986f76250d3 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -730,8 +730,36 @@ public class ServerPlayer extends Player {
@@ -73,7 +73,7 @@ index 82402be7bbbf04388339c6a471946a72f09dfe3b..40eda117db2e3f578ad9d25522b6aadf
public void doTick() {
try {
if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
@@ -2369,7 +2397,14 @@ public class ServerPlayer extends Player {
@@ -2374,7 +2402,14 @@ public class ServerPlayer extends Player {
return true; // Paper
}

View File

@@ -190,10 +190,10 @@ index 3a720375c3daa961a34363f78c2c51d301c3fa06..90bd114feb0924669e61f92f301cdcf7
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 529247dad9300b0abc024464fb0ca35c4bc0f410..b1cc96c751ae8f8befb0287d675d19c5a2768ba2 100644
index 38a8f79b0075279389f0b3dc7de4b16d9af05295..072cc011abded538ae643b36cfb1f861d564bcec 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -327,6 +327,7 @@ public class PurpurConfig {
@@ -329,6 +329,7 @@ public class PurpurConfig {
}
public static int barrelRows = 3;
@@ -201,7 +201,7 @@ index 529247dad9300b0abc024464fb0ca35c4bc0f410..b1cc96c751ae8f8befb0287d675d19c5
public static boolean enderChestSixRows = false;
public static boolean enderChestPermissionRows = false;
public static boolean cryingObsidianValidForPortalFrame = false;
@@ -367,6 +368,7 @@ public class PurpurConfig {
@@ -369,6 +370,7 @@ public class PurpurConfig {
case 1 -> 9;
default -> 27;
});
@@ -210,10 +210,10 @@ index 529247dad9300b0abc024464fb0ca35c4bc0f410..b1cc96c751ae8f8befb0287d675d19c5
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 aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c20c2f5d7c 100644
index ce702e6b5fff3a54f9f254a61becd12eb5c11dd7..7d553b0bb9ae478d54931682501afa9f532db5dd 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1096,7 +1096,15 @@ public class PurpurWorldConfig {
@@ -1098,7 +1098,15 @@ public class PurpurWorldConfig {
public boolean allayRidableInWater = true;
public boolean allayControllable = true;
public List<String> allayRespectNBT = new ArrayList<>();
@@ -229,7 +229,7 @@ index aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c2
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
@@ -1207,7 +1215,15 @@ public class PurpurWorldConfig {
@@ -1209,7 +1217,15 @@ public class PurpurWorldConfig {
public double camelJumpStrengthMax = 0.42D;
public double camelMovementSpeedMin = 0.09D;
public double camelMovementSpeedMax = 0.09D;
@@ -245,7 +245,7 @@ index aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c2
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
camelJumpStrengthMin = getDouble("mobs.camel.attributes.jump_strength.min", camelJumpStrengthMin);
@@ -1634,7 +1650,15 @@ public class PurpurWorldConfig {
@@ -1636,7 +1652,15 @@ public class PurpurWorldConfig {
public boolean frogControllable = true;
public float frogRidableJumpHeight = 0.65F;
public int frogBreedingTicks = 6000;
@@ -261,7 +261,7 @@ index aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c2
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
@@ -2585,7 +2609,13 @@ public class PurpurWorldConfig {
@@ -2587,7 +2611,13 @@ public class PurpurWorldConfig {
public boolean snifferControllable = true;
public double snifferMaxHealth = 14.0D;
public int snifferBreedingTicks = 6000;
@@ -275,7 +275,7 @@ index aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c2
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
@@ -2684,7 +2714,15 @@ public class PurpurWorldConfig {
@@ -2686,7 +2716,15 @@ public class PurpurWorldConfig {
public boolean tadpoleRidable = false;
public boolean tadpoleRidableInWater = true;
public boolean tadpoleControllable = true;
@@ -291,7 +291,7 @@ index aca570efe2360d7d5f71e62433f6b1cd08f5214b..b4cb7d12aa02b885ca48ba5b27cbb7c2
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
@@ -2894,7 +2932,15 @@ public class PurpurWorldConfig {
@@ -2896,7 +2934,15 @@ public class PurpurWorldConfig {
public boolean wardenRidable = false;
public boolean wardenRidableInWater = true;
public boolean wardenControllable = true;

View File

@@ -18,7 +18,7 @@ index 591163d8f8300b084ac734800efee902c4def958..d74401ca3182145d136ad668704f5c04
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 40eda117db2e3f578ad9d25522b6aadfe319b5cc..ef624a99c971aa5c4ce3869d10e2435c0bc8e0a4 100644
index 4668eebc0776a470a42de94de1752986f76250d3..2cf146a1d749fc965e5469988bbb95172383ae1c 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -405,7 +405,7 @@ public class ServerPlayer extends Player {

View File

@@ -31,10 +31,10 @@ index cc6968a064b30f7250d18c20efb2bb8602bb0cdd..3c80e14392ee7a6bf5040d7cb81b7d89
if (spawn != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 3013aeb442799aba5b2ae45edcb3c2c72a18a740..e9f6104e0f665f29b3fca9ff0d8d48613aee2295 100644
index 68df53648c9b76cf1b6abcaa90c5e8938e9e0d05..90cfe6f05f11f18a818857b1da8da75d8831c40c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -228,7 +228,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -230,7 +230,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
// Paper end

View File

@@ -6,10 +6,16 @@ Subject: [PATCH] Optimize VarInts
https://github.com/PaperMC/Paper/pull/8418
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index c0bd2997fe3ebbfe926de832a36d209cc875f3e2..6108f3aa438b96e817c3a2e582c2c817f096e2eb 100644
index c0bd2997fe3ebbfe926de832a36d209cc875f3e2..8bb552410207b39a3b4160a5df51410455107fcf 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
@@ -104,7 +104,20 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -99,12 +99,26 @@ public class FriendlyByteBuf extends ByteBuf {
private static final Gson GSON = new Gson();
public static boolean hasItemSerializeEvent = false; // Purpur
+ public static boolean optimizeVarInts = false; // Plazma
public FriendlyByteBuf(ByteBuf parent) {
this.source = parent;
}
@@ -24,18 +30,18 @@ index c0bd2997fe3ebbfe926de832a36d209cc875f3e2..6108f3aa438b96e817c3a2e582c2c817
+ // Plazma end
public static int getVarIntSize(int value) {
+ // Plazma start - Optimize VarInts
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.optimizeVarInts)
+ if (optimizeVarInts)
+ return VARINT_EXACT_BYTE_LENGTHS[Integer.numberOfLeadingZeros(value)];
+ // Plazma end
for (int j = 1; j < 5; ++j) {
if ((value & -1 << j * 7) == 0) {
return j;
@@ -620,6 +633,25 @@ public class FriendlyByteBuf extends ByteBuf {
@@ -620,6 +634,25 @@ public class FriendlyByteBuf extends ByteBuf {
}
public FriendlyByteBuf writeVarInt(int value) {
+ // Plazma start - Optimize VarInts
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.optimizeVarInts) {
+ if (optimizeVarInts) {
+ // Peel the one and two byte count cases explicitly as they are the most common VarInt sizes
+ // that the proxy will write, to improve inlining.
+ if ((value & (0xFFFFFFFF << 7)) == 0) {
@@ -57,14 +63,25 @@ index c0bd2997fe3ebbfe926de832a36d209cc875f3e2..6108f3aa438b96e817c3a2e582c2c817
this.writeByte(value & 127 | 128);
value >>>= 7;
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 39eca4acefa8f9cf143398cfc6cf157e8489947e..754ed13a04631c69e3fb2421a12b17d0a6f732c6 100644
index 39eca4acefa8f9cf143398cfc6cf157e8489947e..f473bd844210eb4372a617f499dcb3ce2f6ab6e9 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -42,6 +42,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -37,11 +37,17 @@ public class GlobalConfiguration extends ConfigurationPart {
}
public Misc misc;
- public class Misc extends ConfigurationPart {
+ public class Misc extends ConfigurationPart.Post {
public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean doNotTriggerLootTableRefreshForNonPlayerInteraction = DO_OPTIMIZE;
public boolean doNotSendUselessEntityPackets = DO_OPTIMIZE;
+ public boolean optimizeVarInts = DO_OPTIMIZE;
+
+ @Override
+ public void postProcess() {
+ net.minecraft.network.FriendlyByteBuf.optimizeVarInts = optimizeVarInts;
+ }
}

View File

@@ -7,30 +7,34 @@ Original: malte0811/FerriteCore
Copyright (C) 2023 malte0811
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 bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d1439be6c242 100644
index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..22f194956640b88c1d060b732e517f85d9091cf6 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
@@ -737,9 +737,16 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -737,6 +737,12 @@ public abstract class BlockBehaviour implements FeatureElement {
protected BlockBehaviour.BlockStateBase.Cache cache;
private FluidState fluidState;
private boolean isRandomlyTicking;
+ // Plazma start - FerriteCore
+ public final java.util.Map<net.minecraft.world.phys.shapes.VoxelShape, net.minecraft.world.phys.shapes.VoxelShape> CACHE_COLLIDE = new java.util.HashMap<>();
+ public final java.util.Map<VoxelShape, org.apache.commons.lang3.tuple.Pair<VoxelShape, VoxelShape[]>> CACHE_PROJECT = new java.util.HashMap<>();
+ public final java.util.Map<boolean[], boolean[]> CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY);
+ private final ThreadLocal<BlockBehaviour.BlockStateBase.Cache> LAST_CACHE = new ThreadLocal<>();
+ public static final java.util.Map<net.minecraft.world.phys.shapes.VoxelShape, net.minecraft.world.phys.shapes.VoxelShape> CACHE_COLLIDE = new java.util.HashMap<>();
+ public static final java.util.Map<VoxelShape, org.apache.commons.lang3.tuple.Pair<VoxelShape, VoxelShape[]>> CACHE_PROJECT = new java.util.HashMap<>();
+ public static final java.util.Map<boolean[], boolean[]> CACHE_FACE_STURDY = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap<>(it.unimi.dsi.fastutil.booleans.BooleanArrays.HASH_STRATEGY);
+ private static final ThreadLocal<BlockBehaviour.BlockStateBase.Cache> LAST_CACHE = new ThreadLocal<>();
+ // Plazma end
protected BlockStateBase(Block block, ImmutableMap<Property<?>, Comparable<?>> propertyMap, MapCodec<BlockState> codec) {
super(block, propertyMap, codec);
+ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore
this.fluidState = Fluids.EMPTY.defaultFluidState();
BlockBehaviour.Properties blockbase_info = block.properties;
@@ -795,6 +801,7 @@ public abstract class BlockBehaviour implements FeatureElement {
// Paper end
@@ -759,7 +766,60 @@ public abstract class BlockBehaviour implements FeatureElement {
this.offsetFunction = blockbase_info.offsetFunction;
this.spawnParticlesOnBreak = blockbase_info.spawnParticlesOnBreak;
this.conditionallyFullOpaque = this.isOpaque() & this.isTransparentOnSomeFaces(); // Paper
public void initCache() {
+ LAST_CACHE.set(asState().cache); // Plazma - FerriteCore
this.fluidState = ((Block) this.owner).getFluidState(this.asState());
this.isRandomlyTicking = ((Block) this.owner).isRandomlyTicking(this.asState());
if (!this.getBlock().hasDynamicShape()) {
@@ -832,7 +839,61 @@ public abstract class BlockBehaviour implements FeatureElement {
}
}
// Paper end
+ // Plazma start - FerriteCore
+ if (asState().cache != null) {
+ Cache newCache = asState().cache;
@@ -67,6 +71,7 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143
+ }
+ // Plazma end
+ }
+
+ // Plazma start - FerriteCore
+ private void replaceInternals(net.minecraft.world.phys.shapes.ArrayVoxelShape toKeep, net.minecraft.world.phys.shapes.ArrayVoxelShape toReplace) {
+ if (toKeep == toReplace) return;
@@ -85,10 +90,10 @@ index bee42ce7c1cb0f5ebd4890c02bc9c5dd727f7fd6..478802cedeef5166bf5662187038d143
+ return null;
}
+ // Plazma end
// Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time
private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData;
@@ -1205,10 +1265,10 @@ public abstract class BlockBehaviour implements FeatureElement {
public Block getBlock() {
return (Block) this.owner;
@@ -1205,10 +1266,10 @@ public abstract class BlockBehaviour implements FeatureElement {
final boolean propagatesSkylightDown;
final int lightBlock;
@Nullable

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 29 Jun 2023 05:49:26 +0000
Subject: [PATCH] Skip event if no listeners
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..32305a34bcebd53aa523102a6da59bc2eb765055 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -36,15 +36,17 @@ class PaperEventManager {
// SimplePluginManager
public void callEvent(@NotNull Event event) {
+ // Plazma start
+ HandlerList handlers = event.getHandlers();
+ RegisteredListener[] listeners = handlers.getRegisteredListeners();
+ if (listeners.length == 0) return;
+ // Plazma end
if (event.isAsynchronous() && this.server.isPrimaryThread()) {
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
} else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
}
- HandlerList handlers = event.getHandlers();
- RegisteredListener[] listeners = handlers.getRegisteredListeners();
-
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
continue;

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 14:55:37 +0900
Subject: [PATCH] Optimize-spigot-event-bus
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index 32305a34bcebd53aa523102a6da59bc2eb765055..6feb88b90831ec7106c9d777bdfa68fa185f1b89 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -41,12 +41,17 @@ class PaperEventManager {
RegisteredListener[] listeners = handlers.getRegisteredListeners();
if (listeners.length == 0) return;
// Plazma end
- if (event.isAsynchronous() && this.server.isPrimaryThread()) {
- throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
- } else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
- throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
+ // Plazma start - Optimize spigot event bus
+ if (event.asynchronous() != net.kyori.adventure.util.TriState.NOT_SET) {
+ final boolean isAsync = event.isAsynchronous();
+ final boolean onPrimaryThread = this.server.isPrimaryThread();
+ if (isAsync && onPrimaryThread) {
+ throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
+ } else if (!isAsync && !onPrimaryThread && !this.server.isStopping()) {
+ throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
+ }
}
-
+ // Plazma end
for (RegisteredListener registration : listeners) {
if (!registration.getPlugin().isEnabled()) {
continue;

View File

@@ -1100,7 +1100,7 @@ index 9a2ec50be757dfa3780a49ec96942fed89ed530c..d5b904a36d7c0a9d0f8787eccc770fd4
System.out.println("Starting server");
Thread runThread = new Thread(() -> {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 69fe6480a52dca86b09a331345347e88f77a298d..7fedc6f701167c5b1ef39a89abe96e81704878ff 100644
index e363891e8ab872ed24c557e3f94110f36c6fb277..409d2e1d936932177caebdb1e12278bdd58db3b2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -472,7 +472,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 15:40:34 +0900
Subject: [PATCH] CarpetFixes-Configuration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index f473bd844210eb4372a617f499dcb3ce2f6ab6e9..7040b1c97292bd58ce531065078fb2df2533e562 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -75,4 +75,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public int timerTimeOut = 0;
}
+
+ public CarpetFixes carpetFixes;
+
+ public class CarpetFixes extends ConfigurationPart {
+
+ public boolean enabled = DO_OPTIMIZE;
+
+ }
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef..b0deec445b5ea3cd3e4802eca04e99818b539bd8 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -131,4 +131,12 @@ public class LevelConfigurations extends ConfigurationPart {
}
}
+
+ public CarpetFixes carpetFixes;
+
+ public class CarpetFixes extends ConfigurationPart {
+
+ public boolean enabled = DO_OPTIMIZE;
+
+ }
}

View File

@@ -0,0 +1,179 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 15:53:37 +0900
Subject: [PATCH] CarpetFixes-Optimizations-BiomeManager
Original: fxmorin/carpet-fixes
Copyright (C) 2023 fxmorin
Optimized getBiome call: Reduce the number of calls to the mess of
LinearCongruentialGenerator#next(long, long) which is pretty heavy on performance.
We are able to do this by skipping around 370 of 512 possible calls to getBiome() by predicting the outcome
before doing the seed mixing. This seems to be around 25% - 75% faster depending on the use case.
We can predict much faster than the seed mixing.
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 5695c5116c8a338b2e41aafcb2dc9f2146856970..b2291854b9803fe01d40e8a1d76d6ff358cea114 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 - 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.0D;
- double e = (double)(j & 3) / 4.0D;
- double f = (double)(k & 3) / 4.0D;
- 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.0D;
- double t = bl2 ? e : e - 1.0D;
- double u = bl3 ? f : f - 1.0D;
- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
- if (g > v) {
- o = p;
- g = v;
+ // Plazma start - CarpetFixes - Optimized getBiome call
+ 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.0D;
+ double e = (double) (j & 3) / 4.0D;
+ double f = (double) (k & 3) / 4.0D;
+ 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.0D;
+ double t = bl2 ? e : e - 1.0D;
+ double u = bl3 ? f : f - 1.0D;
+ 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 7040b1c97292bd58ce531065078fb2df2533e562..bf323df50bc07e19ec6e3a4a11f3b7db466064c9 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -81,6 +81,11 @@ public class GlobalConfiguration extends ConfigurationPart {
public class CarpetFixes extends ConfigurationPart {
public boolean enabled = DO_OPTIMIZE;
+ boolean optimizedBiomeAccess = true;
+
+ public boolean optimizedBiomeAccess() {
+ return enabled && optimizedBiomeAccess;
+ }
}
}

View File

@@ -0,0 +1,106 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 16:23:56 +0900
Subject: [PATCH] CarpetFixes-Optimizations-RecipeManager
Original: fxmorin/carpet-fixes
Copyright (C) 2023 fxmorin
RecipeManager optimization.
Optimized by taking out streams & doing extra early checks to quickly remove unrelated recipes
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 ab6dc3449a1d3b7acf1d7bf5ac1c24224cc252c7..53756f780dd0315fc18bf93cf4607b51a8d5059e 100644
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
@@ -103,13 +103,38 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
public <C extends Container, T extends Recipe<C>> Optional<T> getRecipeFor(RecipeType<T> type, C inventory, Level world) {
- // CraftBukkit start
- Optional<T> recipe = this.byType(type).values().stream().filter((irecipe) -> {
- return irecipe.matches(inventory, world);
- }).findFirst();
- inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
- // CraftBukkit end
- return recipe;
+ // Plazma start - CarpetFixes - Optimized RecipeManager
+ if (world.plazmaLevelConfiguration().carpetFixes.optimizedRecipeManager() && type == RecipeType.CRAFTING) {
+ int slots = 0;
+ int count;
+ //compare size to quickly remove recipes that are not even close. Plus remove streams
+ for (int slot = 0; slot < inventory.getContainerSize(); slot++)
+ if (!inventory.getItem(slot).isEmpty()) slots++;
+ for (Recipe<C> recipe : this.byType(type).values()) {
+ count = 0;
+ if (recipe instanceof CustomRecipe) {
+ if (recipe.matches(inventory, world)) {
+ return (Optional<T>) Optional.of(recipe);
+ }
+ } else {
+ for (Ingredient ingredient : recipe.getIngredients())
+ if (ingredient != Ingredient.EMPTY) count++;
+ if (count == slots && recipe.matches(inventory, world)) {
+ return (Optional<T>) Optional.of(recipe);
+ }
+ }
+ }
+ return Optional.empty();
+ } else {
+ // CraftBukkit start
+ Optional<T> recipe = this.byType(type).values().stream().filter((irecipe) -> {
+ return irecipe.matches(inventory, world);
+ }).findFirst();
+ inventory.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
+ // CraftBukkit end
+ return recipe;
+ }
+ // Plazma end
}
public <C extends Container, T extends Recipe<C>> Optional<Pair<ResourceLocation, T>> getRecipeFor(RecipeType<T> type, C inventory, Level world, @Nullable ResourceLocation id) {
@@ -131,7 +156,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
}
public <C extends Container, T extends Recipe<C>> List<T> getAllRecipesFor(RecipeType<T> type) {
- return List.copyOf(this.byType(type).values());
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedRecipeManager() ? (List<T>) new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma start - CarpetFixes - Optimized RecipeManager
}
public <C extends Container, T extends Recipe<C>> List<T> getRecipesFor(RecipeType<T> type, C inventory, Level world) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index bf323df50bc07e19ec6e3a4a11f3b7db466064c9..e68ec6e28b0b3a1e3ced2bbcad029d6e1fac17b6 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -82,10 +82,15 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean enabled = DO_OPTIMIZE;
boolean optimizedBiomeAccess = true;
+ boolean optimizedRecipeManager = true;
public boolean optimizedBiomeAccess() {
return enabled && optimizedBiomeAccess;
}
+ public boolean optimizedRecipeManager() {
+ return enabled && optimizedRecipeManager;
+ }
+
}
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index b0deec445b5ea3cd3e4802eca04e99818b539bd8..e089a881600b61060bae1135b89703f6c0b5c7e8 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -137,6 +137,11 @@ public class LevelConfigurations extends ConfigurationPart {
public class CarpetFixes extends ConfigurationPart {
public boolean enabled = DO_OPTIMIZE;
+ boolean optimizedRecipeManager = true;
+
+ public boolean optimizedRecipeManager() {
+ return enabled && optimizedRecipeManager;
+ }
}
}

View File

@@ -0,0 +1,131 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <ipectert@gmail.com>
Date: Wed, 6 Sep 2023 16:35:34 +0900
Subject: [PATCH] CarpetFixes-Optimizations-Sheep
Original: fxmorin/carpet-fixes
Copyright (C) 2023 fxmorin
The game determines the child sheep's color by getting a wool block from the parents, putting them in a crafting
recipe, getting the output wool and getting the color from that.
I don't know in what world we would consider a data-driven method with that much overhead as a smart idea. Instead,
we used a prebaked list of all the possible colors and combinations, however this means that you can't use a
datapack to change it.
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 9399361c8d26a140fa6042988a30a1d3d552e418..5bfb246bfabf82feb805665b0be1a36ce62996ca 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
@@ -431,19 +431,27 @@ public class Sheep extends Animal implements Shearable {
}
private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) {
+ // Plazma start - CarpetFixes - Optimized sheep chile color
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((recipecrafting) -> { // CraftBukkit - decompile error
- return recipecrafting.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;
- });
+ if (this.level.plazmaLevelConfiguration().carpetFixes.optimizedSheepChildColor()) {
+ 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((recipecrafting) -> { // CraftBukkit - decompile error
+ return recipecrafting.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/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index e089a881600b61060bae1135b89703f6c0b5c7e8..29d451f55dabc15478e9c32d2c37bd0ea2d9bebc 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -138,10 +138,15 @@ public class LevelConfigurations extends ConfigurationPart {
public boolean enabled = DO_OPTIMIZE;
boolean optimizedRecipeManager = true;
+ boolean optimizedSheepChildColor = false;
public boolean optimizedRecipeManager() {
return enabled && optimizedRecipeManager;
}
+ public boolean optimizedSheepChildColor() {
+ return enabled && optimizedSheepChildColor;
+ }
+
}
}
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..aae3cf170bca4b3e6cdd0a964967dfafe2759f65
--- /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;
+ }
+}