-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
47 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 18 additions & 23 deletions
41
...ver/0028-Optimise-state-lookup-more.patch → ...ver/0028-Optimise-state-lookup-more.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,54 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 30 Sep 2023 22:02:58 +0900 | ||
Date: Tue, 7 Nov 2023 15:47:45 +0900 | ||
Subject: [PATCH] Optimise state lookup more | ||
|
||
|
||
diff --git a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java | ||
index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..0832e4fa92b6464a6206475fbceb3b36462757b3 100644 | ||
index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..50d97c5ab33f33b81dbafd7cf42da5afd9856eeb 100644 | ||
--- a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java | ||
+++ b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java | ||
@@ -17,6 +17,7 @@ public final class ZeroCollidingReferenceStateTable { | ||
protected final StateHolder<?, ?> this_state; | ||
|
||
protected long[] index_table; | ||
+ public long[] index_table() { return this.index_table; } // Plazma - getter | ||
+ public long[] index_table() { return this.index_table; } // Plazma - Getter | ||
protected StateHolder<?, ?>[][] value_table; | ||
|
||
public ZeroCollidingReferenceStateTable(final StateHolder<?, ?> state, final Map<Property<?>, Comparable<?>> this_map) { | ||
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java | ||
index 5f285d190186a2ff5a61d05070593e1d633dd79a..7b61a956892e90c7556db46d9277da8d252547cd 100644 | ||
index 5f285d190186a2ff5a61d05070593e1d633dd79a..25a2d70ce34fe57dc3838d4351ac88794acb7109 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java | ||
@@ -114,21 +114,15 @@ public abstract class StateHolder<O, S> { | ||
@@ -114,6 +114,13 @@ public abstract class StateHolder<O, S> { | ||
} | ||
|
||
public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) { | ||
- Comparable<?> comparable = this.values.get(property); | ||
- if (comparable != null && !comparable.equals(value)) { | ||
- S object = this.neighbours.get(property, value); | ||
- if (object == null) { | ||
- throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); | ||
- } else { | ||
- return object; | ||
- } | ||
- } else { | ||
- return (S)this; | ||
- } | ||
+ // Plazma start - optimise state lookup more | ||
+ final S ret = (S) this.optimisedTable.get(property, value); | ||
+ if (ret == null) throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); | ||
+ return ret; | ||
+ // Plazma start - Optimise state lookup more | ||
+ if (true) { | ||
+ final S ret = (S) this.optimisedTable.get(property, value); | ||
+ if (ret == null) throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value"); | ||
+ return ret; | ||
+ } | ||
+ // Plazma end | ||
Comparable<?> comparable = this.values.get(property); | ||
if (comparable != null && !comparable.equals(value)) { | ||
S object = this.neighbours.get(property, value); | ||
@@ -128,7 +135,7 @@ public abstract class StateHolder<O, S> { | ||
} | ||
|
||
public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) { | ||
- if (this.neighbours != null) { | ||
+ if (this.optimisedTable.index_table() != null) { // Plazma - optimise state lookup more | ||
+ if (this.optimisedTable.index_table() != null) { // Plazma - Optimise state holder more | ||
throw new IllegalStateException(); | ||
} else { | ||
Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create(); | ||
@@ -143,7 +137,7 @@ public abstract class StateHolder<O, S> { | ||
@@ -143,7 +150,7 @@ public abstract class StateHolder<O, S> { | ||
} | ||
} | ||
|
||
- this.neighbours = (Table<Property<?>, Comparable<?>, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup | ||
+ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Paper - optimise state lookup // Plazma - more | ||
+ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Plazma - Optimize state lookup more | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 30 Sep 2023 22:06:00 +0900 | ||
Subject: [PATCH] Suppress error from dirty attributes | ||
Date: Tue, 7 Nov 2023 15:52:24 +0900 | ||
Subject: [PATCH] Suppress errors from dirty attributes | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
index b2770e053f6db173dedbf044d67aa315e2fd7302..30b4c6bf1a0c847d00fc466ca9c997f9049bb697 100644 | ||
index e2dcdc9f317a4ab1a9b30e482607dc041abb7035..46e489dd059bc3bf8f1c5efa073fbcd892bc389d 100644 | ||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java | ||
@@ -395,7 +395,8 @@ public class ServerEntity { | ||
|
@@ -14,7 +14,7 @@ index b2770e053f6db173dedbf044d67aa315e2fd7302..30b4c6bf1a0c847d00fc466ca9c997f9 | |
if (this.entity instanceof LivingEntity) { | ||
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); | ||
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - Suppress error from dirty attributes | ||
+ final Set<AttributeInstance> set = this.entity.level().plazmaLevelConfiguration().entity.suppressErrorFromDirtyAttributes ? java.util.Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress error from dirty attributes | ||
+ final Set<AttributeInstance> set = this.level.plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress error from dirty attributes | ||
|
||
if (!set.isEmpty()) { | ||
// CraftBukkit start - Send scaled max health | ||
|
@@ -27,15 +27,15 @@ index b2770e053f6db173dedbf044d67aa315e2fd7302..30b4c6bf1a0c847d00fc466ca9c997f9 | |
} | ||
|
||
} | ||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java | ||
index cb21da3cff4dbb08c7786c09b39e381abdf45c33..dfd408dc42a6000eb5fa56bbdb64f2329e545078 100644 | ||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java | ||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java | ||
@@ -36,6 +36,7 @@ public class LevelConfigurations extends ConfigurationPart { | ||
public int sensorTick = DO_OPTIMIZE ? 10 : 1; | ||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java | ||
index fae1913ec6b3689388f14f4b9c925dd53954cf62..ee84ac47adc29c54d668fc9e1729444e51649659 100644 | ||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java | ||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java | ||
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart { | ||
|
||
public boolean ignoreUselessPackets = DO_OPTIMIZE; | ||
+ public boolean suppressErrorFromDirtyAttributes = false; | ||
public boolean ignoreUselessPackets = OPTIMIZE; | ||
public int sensorTick = 1; | ||
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE; | ||
|
||
public Player player; | ||
public class Player extends ConfigurationPart { | ||
public Phantom phantom; | ||
public class Phantom extends ConfigurationPart { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 30 Sep 2023 22:10:59 +0900 | ||
Date: Tue, 7 Nov 2023 15:56:21 +0900 | ||
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..6016c304ddbeb6ffbd591f30914c85fcb6371e80 100644 | ||
index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..fb4135cb5d9e4162336c43d3b61c9d9a175a4dd5 100644 | ||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java | ||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java | ||
@@ -26,7 +26,7 @@ import java.util.Map; | ||
import java.util.Set; | ||
import java.util.logging.Level; | ||
|
||
-class PaperEventManager { | ||
+public class PaperEventManager { // Plazma - package -> public | ||
|
||
private final Server server; | ||
|
||
@@ -36,15 +36,17 @@ class PaperEventManager { | ||
@@ -36,15 +36,18 @@ class PaperEventManager { | ||
|
||
// SimplePluginManager | ||
public void callEvent(@NotNull Event event) { | ||
|
@@ -26,6 +17,7 @@ index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..6016c304ddbeb6ffbd591f30914c85fc | |
+ 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()) { | ||
|
@@ -38,15 +30,3 @@ index 7ce9ebba8ce304d1f3f21d4f15ee5f3560d7700b..6016c304ddbeb6ffbd591f30914c85fc | |
for (RegisteredListener registration : listeners) { | ||
if (!registration.getPlugin().isEnabled()) { | ||
continue; | ||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java | ||
index d17df5621717b1c8d1d9a5549feb73c3600ecf3d..ddbc37857bd2706844074925bc27b7a84efa5832 100644 | ||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java | ||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java | ||
@@ -31,7 +31,6 @@ public class GlobalConfiguration extends ConfigurationPart { | ||
@Override | ||
public void postProcess() { | ||
|
||
- | ||
} | ||
|
||
public boolean reduceCreateRandomInstance = DO_OPTIMIZE; |
16 changes: 9 additions & 7 deletions
16
...rver/0031-Optimize-Spigot-event-bus.patch → ...rver/0031-Optimize-spigot-event-bus.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: AlphaKR93 <[email protected]> | ||
Date: Sat, 30 Sep 2023 22:17:02 +0900 | ||
Subject: [PATCH] Optimize Spigot event bus | ||
Date: Tue, 7 Nov 2023 15:59:07 +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 6016c304ddbeb6ffbd591f30914c85fcb6371e80..482e2cdbd4f76f2a56c62bec12bfc39d7193b6ce 100644 | ||
index fb4135cb5d9e4162336c43d3b61c9d9a175a4dd5..b0ea2013433429cb0ae0314d8c483e4536a8d04f 100644 | ||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java | ||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java | ||
@@ -41,11 +41,14 @@ public class PaperEventManager { // Plazma - package -> public | ||
@@ -40,13 +40,15 @@ class PaperEventManager { | ||
HandlerList handlers = event.getHandlers(); | ||
RegisteredListener[] listeners = handlers.getRegisteredListeners(); | ||
if (listeners.length == 0) return; | ||
// Plazma end | ||
- // 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) { | ||
+ // Optimize Spigot event bus | ||
+ if (event.asynchronous() == net.kyori.adventure.util.TriState.NOT_SET) { | ||
+ final boolean async = event.isAsynchronous(); | ||
+ final boolean primary = this.server.isPrimaryThread(); | ||
+ if (async && primary) throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously."); | ||
|
28 changes: 0 additions & 28 deletions
28
patches/unapplied/server/0024-Improve-biome-temperature-cache.patch
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
patches/unapplied/server/0026-Configurable-sensor-tick.patch
This file was deleted.
Oops, something went wrong.