Implement CarpetFixes Optimizations
This commit is contained in:
@@ -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
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 916b9a9f05c0e83109bc9a4eb1692e2ed6e81eaf..ef14d669bc49b7b3694b0743b6085944647e0a29 100644
|
index aaef58468a3c31f35e5067ed4263e9dd3fbddddd..0852f1a18106a81a60726756aae1d9c2ba30b111 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2030,6 +2030,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -2121,6 +2121,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
|
|||||||
86
patches/api/0004-Bump-Dependencies.patch
Normal file
86
patches/api/0004-Bump-Dependencies.patch
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: IPECTER <ipectert@gmail.com>
|
||||||
|
Date: Wed, 6 Sep 2023 12:43:06 +0900
|
||||||
|
Subject: [PATCH] Bump-Dependencies
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
|
index c954a7776811c4127563a410e8080f5466e75024..8f6b683d2cf300724a024e3e76284d582c8ff3d6 100644
|
||||||
|
--- a/build.gradle.kts
|
||||||
|
+++ b/build.gradle.kts
|
||||||
|
@@ -11,8 +11,8 @@ java {
|
||||||
|
val annotationsVersion = "24.0.1"
|
||||||
|
val bungeeCordChatVersion = "1.20-R0.1"
|
||||||
|
val adventureVersion = "4.14.0"
|
||||||
|
-val slf4jVersion = "1.8.0-beta4"
|
||||||
|
-val log4jVersion = "2.17.1"
|
||||||
|
+val slf4jVersion = "2.0.9" // Plazma - Bump Dependencies
|
||||||
|
+val log4jVersion = "2.20.0" // Plazma - Bump Dependencies
|
||||||
|
val apiAndDocs: Configuration by configurations.creating {
|
||||||
|
attributes {
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||||
|
@@ -27,16 +27,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("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:$bungeeCordChatVersion-deprecated+build.14") // Paper
|
||||||
|
- api("org.yaml:snakeyaml:2.0")
|
||||||
|
+ api("org.yaml:snakeyaml:2.2") // 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")
|
||||||
|
@@ -46,31 +46,31 @@ dependencies {
|
||||||
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
|
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
|
||||||
|
api("org.slf4j:slf4j-api:$slf4jVersion")
|
||||||
|
- api("io.sentry:sentry:5.4.0") // Pufferfish
|
||||||
|
+ 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")
|
||||||
|
- 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") // 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:$annotationsVersion" // Paper - we don't want Java 5 annotations...
|
||||||
|
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("junit:junit:4.13.2")
|
||||||
|
- testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||||
|
+ testImplementation("org.apache.commons:commons-lang3:3.13.0") // Plazma - Bump Dependencies
|
||||||
|
+ testImplementation("junit:junit:4.13.2") // Plazma - Bump Dependencies
|
||||||
|
+ testImplementation("org.hamcrest:hamcrest-library:2.2") // Plazma - Bump Dependencies
|
||||||
|
testImplementation("org.ow2.asm:asm-tree:9.5")
|
||||||
|
}
|
||||||
|
|
||||||
79
patches/api/0006-Optimize-spigot-event-bus.patch
Normal file
79
patches/api/0006-Optimize-spigot-event-bus.patch
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
93
patches/server/0006-Bump-Dependencies.patch
Normal file
93
patches/server/0006-Bump-Dependencies.patch
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: IPECTER <ipectert@gmail.com>
|
||||||
|
Date: Wed, 6 Sep 2023 13:31:43 +0900
|
||||||
|
Subject: [PATCH] Bump-Dependencies
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
|
index d8b27e3f2fa1ede41125ec27e129b1e1ad42caa7..9211713c5b09e2d715aec5b2187ef0f27a56a9fe 100644
|
||||||
|
--- a/build.gradle.kts
|
||||||
|
+++ b/build.gradle.kts
|
||||||
|
@@ -20,7 +20,7 @@ dependencies {
|
||||||
|
}
|
||||||
|
// Purpur end
|
||||||
|
// 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")
|
||||||
|
implementation("net.kyori:adventure-text-serializer-ansi:4.14.0") // Keep in sync with adventureVersion from Paper-API build file
|
||||||
|
implementation("net.kyori:ansi:1.0.3") // Manually bump beyond above transitive dep
|
||||||
|
@@ -30,48 +30,48 @@ 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.19.0") // Paper - implementation
|
||||||
|
- log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.19.0") // Paper - Needed to generate meta for our Log4j plugins
|
||||||
|
+ implementation("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - implementation
|
||||||
|
+ log4jPlugins.annotationProcessorConfigurationName("org.apache.logging.log4j:log4j-core:2.20.0") // Paper - Needed to generate meta for our Log4j plugins
|
||||||
|
runtimeOnly(log4jPlugins.output)
|
||||||
|
alsoShade(log4jPlugins.output)
|
||||||
|
- implementation("io.netty:netty-codec-haproxy:4.1.87.Final") // Paper - Add support for proxy protocol
|
||||||
|
+ implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
|
||||||
|
// Paper end
|
||||||
|
- implementation("org.apache.logging.log4j:log4j-iostreams:2.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
|
||||||
|
+ implementation("org.ow2.asm:asm:9.5")
|
||||||
|
+ implementation("org.ow2.asm:asm-commons:9.5") // Paper - ASM event executor generation
|
||||||
|
+ testImplementation("org.mockito:mockito-core:5.5.0") // Paper - switch to mockito
|
||||||
|
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.42.0.0")
|
||||||
|
- runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
|
||||||
|
+ implementation("net.fabricmc:mapping-io:0.4.2") // Paper - needed to read mappings for stacktrace deobfuscation
|
||||||
|
+ runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
|
||||||
|
+ runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
|
||||||
|
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
|
||||||
|
// Paper start - Use Velocity cipher
|
||||||
|
- implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
|
||||||
|
+ implementation("com.velocitypowered:velocity-native:3.2.0-SNAPSHOT") {
|
||||||
|
isTransitive = false
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
|
- 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")
|
||||||
|
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.15")
|
||||||
|
+ runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.15")
|
||||||
|
|
||||||
|
implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur
|
||||||
|
implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
|
||||||
|
implementation("dev.omega24:upnp4j:1.0") // Purpur
|
||||||
|
|
||||||
|
// Pufferfish start
|
||||||
|
- implementation("org.yaml:snakeyaml:1.32")
|
||||||
|
+ implementation("org.yaml:snakeyaml:2.2")
|
||||||
|
implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") {
|
||||||
|
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
|
||||||
|
testImplementation("junit:junit:4.13.2")
|
||||||
|
- testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||||
|
+ testImplementation("org.hamcrest:hamcrest-library:2.2")
|
||||||
|
|
||||||
|
- implementation("io.netty:netty-all:4.1.87.Final"); // Paper - Bump netty
|
||||||
|
+ implementation("io.netty:netty-all:4.1.97.Final"); // Paper - Bump netty
|
||||||
|
}
|
||||||
|
|
||||||
|
val craftbukkitPackageVersion = "1_20_R1" // Paper
|
||||||
|
@@ -225,3 +225,6 @@ tasks.registerRunTask("runDev") {
|
||||||
|
description = "Spin up a non-relocated Mojang-mapped test server"
|
||||||
|
classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||||
|
}
|
||||||
|
+repositories {
|
||||||
|
+ mavenCentral()
|
||||||
|
+}
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] ChunkSending Configuration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 857ddc62dd9affbbebcd7cde8a6d675dbb5f68ae..8ba1c5b6731d43c02b415e4d79a20c1de0c03ad5 100644
|
index 857ddc62dd9affbbebcd7cde8a6d675dbb5f68ae..7df971a1bd47862918f4c7342eae19226c4c9fbe 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -22,4 +22,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -22,4 +22,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -16,7 +16,7 @@ index 857ddc62dd9affbbebcd7cde8a6d675dbb5f68ae..8ba1c5b6731d43c02b415e4d79a20c1d
|
|||||||
+ public ChunkSending chunkSending;
|
+ public ChunkSending chunkSending;
|
||||||
+ public class ChunkSending extends ConfigurationPart {
|
+ public class ChunkSending extends ConfigurationPart {
|
||||||
+
|
+
|
||||||
+ public boolean enabled = true;
|
+ public boolean enabled = DO_OPTIMIZE;
|
||||||
+ public int maxChunksPerTick = 5;
|
+ public int maxChunksPerTick = 5;
|
||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
@@ -8,7 +8,7 @@ Original by Irochi <me@irochi.moe>
|
|||||||
Licensed under the GPL 3.0
|
Licensed under the GPL 3.0
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 49601ffa5a1a67e8572078fa9bd7780b096b6e67..5435897c040868e4d3c3c39db2fd42977e747de0 100644
|
index e6f14bb0825e3b6987ebb2ec782c8316e3b7c094..191bebab12c94756e9f98cfacbf06eb9a7c2f2f9 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -180,16 +180,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -180,16 +180,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Structure Configuration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 8ba1c5b6731d43c02b415e4d79a20c1de0c03ad5..4ee9f3ca88e89a8dcbfe6c807036386ef679da0a 100644
|
index 7df971a1bd47862918f4c7342eae19226c4c9fbe..b1a75e865e61f9cdfb6a6a57cbab3db1f2a709d3 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -30,4 +30,21 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -30,4 +30,21 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -36,7 +36,7 @@ index e7554ec800f321e4e34c926c53f2375a8c3aa979..677f546cee0ebda24a6e77cb5fedd410
|
|||||||
|
|
||||||
// CraftBukkit start - return boolean
|
// CraftBukkit start - return boolean
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 4ee9f3ca88e89a8dcbfe6c807036386ef679da0a..1cf5344d3ade76f6c24c7ea68d98b02e0dc62001 100644
|
index b1a75e865e61f9cdfb6a6a57cbab3db1f2a709d3..3ca0f64bf5dcf104a84db91f22fae75790468052 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -40,7 +40,43 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -40,7 +40,43 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -22,7 +22,7 @@ index 4f54ae58bd20481f02aaec3f8406996a5e01b24f..61477d98f10ce7d0ec29d51de8c7a3b4
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 1cf5344d3ade76f6c24c7ea68d98b02e0dc62001..9416ce600d46fad167befe8d42f9a1a7d891a37f 100644
|
index 3ca0f64bf5dcf104a84db91f22fae75790468052..843cf772c18d2e9386bf5a7b1731a86c349d6b98 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -82,5 +82,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -82,5 +82,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -18,7 +18,7 @@ index f5bc3497831877e0c2b7dc1cbd8abe3a67d7695b..d157758282cc79d58134c056c52a43a2
|
|||||||
double d1 = (double) (center.y - maxRange);
|
double d1 = (double) (center.y - maxRange);
|
||||||
double d2 = (double) (center.x + 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
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
index ae04c5f4fd340c6bce0be29d4288dad37f260c7d..4a67650da636da5a6d5b5dfaaa86077d0cc9269c 100644
|
index f39b3f1b5b37d1939766952a985684279cb2bf2d..69d22bc9f0087dc419b840c6626746e12f621012 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -447,7 +447,7 @@ public class ServerPlayer extends Player {
|
@@ -447,7 +447,7 @@ public class ServerPlayer extends Player {
|
||||||
@@ -162,7 +162,7 @@ index 61477d98f10ce7d0ec29d51de8c7a3b42026dd2d..3e0d0d21dc73b2a5d033d8bcd43b0886
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 9416ce600d46fad167befe8d42f9a1a7d891a37f..2836447cf43e145d1fc1d24f6d054be49e9a14d9 100644
|
index 843cf772c18d2e9386bf5a7b1731a86c349d6b98..14987ceec693397602b5c8e1fe460a6fc212a0ee 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -87,7 +87,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -87,7 +87,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Entity Configuration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 2836447cf43e145d1fc1d24f6d054be49e9a14d9..f560db0cd544c96264ebad8af3ed3dd8379bab1b 100644
|
index 14987ceec693397602b5c8e1fe460a6fc212a0ee..5dcabaf3fa198a05afc25753f6d062fe7d86972e 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -90,4 +90,21 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -90,4 +90,21 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -94,7 +94,7 @@ index 3e0d0d21dc73b2a5d033d8bcd43b08866e0d6923..e91b404fca2823748c2ed343cbd83301
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index f560db0cd544c96264ebad8af3ed3dd8379bab1b..80ee8293d73ecdb1a942ca88f1aa00813d600849 100644
|
index 5dcabaf3fa198a05afc25753f6d062fe7d86972e..504913e8e05869f8f0b88f0faaf684d39eb14ea7 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -100,7 +100,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -100,7 +100,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -19,7 +19,7 @@ index 9cc3ab8cd3f7ab7f8fbf4d9d14f25ea0bd757eec..09183dbac0e8ca2cc2c8da57b105b80e
|
|||||||
// Paper start - Add fail move event
|
// Paper start - Add fail move event
|
||||||
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
|
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 80ee8293d73ecdb1a942ca88f1aa00813d600849..e6c22ab535ab8fecaadbf06d4982440fd5863f17 100644
|
index 504913e8e05869f8f0b88f0faaf684d39eb14ea7..61c06213b4ceb8e38e9aa41c3517f152d0d669ad 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -88,6 +88,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -88,6 +88,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Do not send useless entity packets
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
index 1a4658db86e89d57b0a52923773a0983ff60989c..f39e7fb4aabf319785f134ecc0c81e4a1830712e 100644
|
index fb11b020d52988360562db23d8568e5ef37e21c8..80ab684a33876d62186dcf86f555e46db1594b09 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
@@ -203,6 +203,7 @@ public class ServerEntity {
|
@@ -203,6 +203,7 @@ public class ServerEntity {
|
||||||
@@ -7,7 +7,7 @@ Original: Bloom-host/Petal
|
|||||||
Copyright (C) 2023 peaches94
|
Copyright (C) 2023 peaches94
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 0b08cf7b26731ffd6f3909342f4e3a92fe0c813e..5c3df4d7b12bd942780ff74e6353a07d489de74f 100644
|
index 4cd04661b39a7055f5767a3dff88f9a3e197d810..ea7e40d91c314f4a58b80c978f6d7f290825856d 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -1037,20 +1037,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1037,20 +1037,20 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
@@ -24,7 +24,7 @@ index 19d9d3a9f634631e2ec5a6fa7f2cd9dd18f62f89..ba20f60588b980f49423307ff20fc24c
|
|||||||
//this.level().getProfiler().push("targetSelector"); // Purpur
|
//this.level().getProfiler().push("targetSelector"); // Purpur
|
||||||
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
|
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index e6c22ab535ab8fecaadbf06d4982440fd5863f17..185e2627596314d979188468f838d008442f2d2e 100644
|
index 61c06213b4ceb8e38e9aa41c3517f152d0d669ad..8dadc3fd21d507bf88f7f75935f7477375f21344 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -107,5 +107,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -107,5 +107,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -7,7 +7,7 @@ Original: GaleMC/Gale
|
|||||||
Copyright (C) 2023 Martijn Muijsers
|
Copyright (C) 2023 Martijn Muijsers
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 185e2627596314d979188468f838d008442f2d2e..238e10a35a9e4b300b11c838cda39b8799f16fe2 100644
|
index 8dadc3fd21d507bf88f7f75935f7477375f21344..6db3defbf2634ae37af12246c17f852e6786d0ba 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -114,5 +114,20 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -114,5 +114,20 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
@@ -29,7 +29,7 @@ index 80ab684a33876d62186dcf86f555e46db1594b09..21b18d85563ffd5f93234455dca4dc30
|
|||||||
|
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
index 238e10a35a9e4b300b11c838cda39b8799f16fe2..a1b55bb5431d1712fc06da0cf06857a986efeea0 100644
|
index 6db3defbf2634ae37af12246c17f852e6786d0ba..7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
||||||
@@ -89,6 +89,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
@@ -89,6 +89,7 @@ public class LevelConfigurations extends ConfigurationPart {
|
||||||
33
patches/server/0040-Optimize-spigot-event-bus.patch
Normal file
33
patches/server/0040-Optimize-spigot-event-bus.patch
Normal 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;
|
||||||
40
patches/server/0042-CarpetFixes-Configuration.patch
Normal file
40
patches/server/0042-CarpetFixes-Configuration.patch
Normal 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 c1ff5d20dd3b74062837fd30a7b3966e16bdf54c..0810cb07d7e5b7752fd27e6cc4bfc02c5b1497c4 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -71,4 +71,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;
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
}
|
||||||
179
patches/server/0043-CarpetFixes-Optimizations-BiomeManager.patch
Normal file
179
patches/server/0043-CarpetFixes-Optimizations-BiomeManager.patch
Normal 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 0810cb07d7e5b7752fd27e6cc4bfc02c5b1497c4..42b0ec06d0e5ed1f947d6c14067b1dd725ec839a 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -77,6 +77,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;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 9ffb6999171f602f0b113dac40e0130410cad870..49b5fece692cd5da99ed21d7fd0864cea1609495 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) {
|
||||||
|
@@ -134,7 +159,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 42b0ec06d0e5ed1f947d6c14067b1dd725ec839a..4348486b8d5eef32132652ceaa890fff0d50ab98 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -78,10 +78,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;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
131
patches/server/0045-CarpetFixes-Optimizations-Sheep.patch
Normal file
131
patches/server/0045-CarpetFixes-Optimizations-Sheep.patch
Normal 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 54de1f782e45cb3e3b1442aeb56b6e8547b065c0..3a7b1d85f06f9abdac427aa736b6d4c79fdbbd14 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||||
|
@@ -432,19 +432,27 @@ public class Sheep extends Animal implements Shearable {
|
||||||
|
}
|
||||||
|
|
||||||
|
private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) {
|
||||||
|
+ // Plazma start - CarpetFixes - Optimized sheep child 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;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
Reference in New Issue
Block a user