Skip to content

Commit

Permalink
More work (85% complete)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Sep 30, 2023
1 parent cb30991 commit 326a88d
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 153 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

![image](https://raw.githubusercontent.com/PlazmaMC/Plazma/main/src/resources/title-900.png)
[![image](https://raw.githubusercontent.com/PlazmaMC/Plazma/main/src/resources/title-900.png)](https://github.com/PlazmaMC/Plazma)

### A Server Platform for Minecraft: Java Edition based on [Paper](https://github.com/PaperMC/Paper)

Expand All @@ -19,8 +19,8 @@

[main]: https://github.com/PlazmaMC/Plazma

### This is the branch for Plazma 1.20.1. If you want to know more about Plazma, please check the [main branch][main].
이곳은 플라즈마의 1.20.1용 브랜치 입니다. 플라즈마에 대해 자세히 알고 싶다면 [main 브랜치][main]를 확인해주세요.
### This is the branch for Plazma 1.20.2. If you want to know more about Plazma, please check the [main branch][main].
이곳은 플라즈마의 1.20.2용 브랜치 입니다. 플라즈마에 대해 자세히 알고 싶다면 [main 브랜치][main]를 확인해주세요.

## ⬇️ Downloads
### If you don't know about Mojmap or Bundler, download **Reobf Paperclip**
Expand Down
14 changes: 10 additions & 4 deletions patches/server/0006-Plazma-Configurations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ index 005c854a10f343cd7488b282de002249bf5c4ced..3e8f42811e9254567f2522e68b601870
@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 e006351f07356fb42e5858bb3b8a74ffee215b35..8ecf47b458ace51df2bb9f76e1015bcefe882d7c 100644
index 01f581e6c3dfacb0ec6aff05c08539bbd2e580c7..f1b754fbf72cbf3c10a74192c66a9432d8218d4b 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 {
Expand Down Expand Up @@ -578,10 +578,10 @@ index 0000000000000000000000000000000000000000..85002144e0b350c4ae044e1a4a4c1734
+}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..b9a6c781684b080bcfb07495e561325d594eeafd
index 0000000000000000000000000000000000000000..d506e0c2b37f91e46e682652bd134ad91db28f84
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -0,0 +1,37 @@
@@ -0,0 +1,43 @@
+package org.plazmamc.plazma.configurations;
+
+import io.papermc.paper.configuration.Configuration;
Expand Down Expand Up @@ -610,7 +610,13 @@ index 0000000000000000000000000000000000000000..b9a6c781684b080bcfb07495e561325d
+ public int version = CURRENT_VERSION;
+
+ public Misc misc;
+ public class Misc extends ConfigurationPart {
+ public class Misc extends ConfigurationPart.Post {
+
+ @Override
+ public void postProcess() {
+
+
+ }
+
+ }
+
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0009-Console-logging-tweaks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ index 5c38df8170033dbfee267520991a3cc3285d219e..58cc1bed851994fb591e9b832b98d25e
this.server.logChatMessage((unsignedFunction == null ? message.decoratedContent() : unsignedFunction.apply(this.server.console)), params, flag ? null : "Not Secure"); // Paper
OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b9a6c781684b080bcfb07495e561325d594eeafd..81c6b6270fc7b74fdd1261fa1d14ec8221a36182 100644
index d506e0c2b37f91e46e682652bd134ad91db28f84..44df2c0a1ed3d006b455ba2a47d6bc9059d804e1 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -34,4 +34,13 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -40,4 +40,13 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Player extends ConfigurationPart {

}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0010-Add-option-to-allow-any-usernames.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index b875f4af9dcb45bcad0ee59a958442ba673268fe..d38685f82d2e6c4e71179bf3a85a8b18
// Paper start - validate usernames
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode() && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 59c862c0e8a4111d4e9aa14a424b15cd9c37e6d1..8636ec3e130b73af0ec1b069aea6e04bc54cebdf 100644
index 44df2c0a1ed3d006b455ba2a47d6bc9059d804e1..00c95194788d56f539d1c75e9a1ce48e950c096c 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -33,6 +33,8 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -39,6 +39,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public Player player;
public class Player extends ConfigurationPart {

Expand Down
8 changes: 4 additions & 4 deletions patches/server/0015-Reduce-create-random-instance.patch
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ index 0000000000000000000000000000000000000000..4421110e20a006c3773e922eb0facc88
+
+}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 8636ec3e130b73af0ec1b069aea6e04bc54cebdf..4ce28f5f7c47c77ca299d1ff9a99d26c4a066215 100644
index 00c95194788d56f539d1c75e9a1ce48e950c096c..9e26e598d7c381368de422ab0c3cc7936e3bbb6d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -18,7 +18,7 @@ public class GlobalConfiguration extends ConfigurationPart {
Expand All @@ -369,9 +369,9 @@ index 8636ec3e130b73af0ec1b069aea6e04bc54cebdf..4ce28f5f7c47c77ca299d1ff9a99d26c
}
}

@@ -28,6 +28,9 @@ public class GlobalConfiguration extends ConfigurationPart {
public Misc misc;
public class Misc extends ConfigurationPart {
@@ -34,6 +34,9 @@ public class GlobalConfiguration extends ConfigurationPart {

}

+ public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
+ public boolean suppressThreadSafeRandom = DO_OPTIMIZE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index 081691f9710ff1115e4308f79ed49fbc38941193..79a27755534384ab94e79e422c0a5e9c
LootTable lootTable = this.level.getServer().getLootData().getLootTable(this.lootTable);
if (player instanceof ServerPlayer) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 4ce28f5f7c47c77ca299d1ff9a99d26c4a066215..065a4113f0b1dc1ee122af34609d0de02f62f9de 100644
index 9e26e598d7c381368de422ab0c3cc7936e3bbb6d..5a62bffe495002b3bbf5fd995df135c5d174458a 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -30,6 +30,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -36,6 +36,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public boolean reduceCreateRandomInstance = DO_OPTIMIZE;
public boolean suppressThreadSafeRandom = DO_OPTIMIZE;
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0023-Implement-No-Chat-Reports.patch
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ index 58cc1bed851994fb591e9b832b98d25eda153b47..4fbe96813067d3ccf1d8f29151ac3fac
}

diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 10b42754e872a6c05005c2a129c016e7f53fe516..fa9e3df5be290acfbfecdda93d042b0797e3d0f6 100644
index 5a62bffe495002b3bbf5fd995df135c5d174458a..989aa0aeb05a878945849adc6fb6663027e15927 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -49,4 +49,22 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -55,4 +55,22 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean notSecurePrefix = true;

}
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0025-Implement-FixMySpawnR.patch
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ index 64d911bee1607880514061c75116d8672df8bb8f..7868590696f620cc5f0785125c9573d7
return nbt;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index fa9e3df5be290acfbfecdda93d042b0797e3d0f6..5aec79d987c2e9b401c98409460c032f111c37ba 100644
index 989aa0aeb05a878945849adc6fb6663027e15927..d17df5621717b1c8d1d9a5549feb73c3600ecf3d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -34,6 +34,24 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -40,6 +40,24 @@ public class GlobalConfiguration extends ConfigurationPart {

}

Expand Down
76 changes: 76 additions & 0 deletions patches/server/0027-Variable-entity-wakeup-duration.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Sat, 30 Sep 2023 21:56:32 +0900
Subject: [PATCH] Variable entity wakeup duration


diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
index 82975c1c92c84294740a411b4a351efb8a2e6769..cb21da3cff4dbb08c7786c09b39e381abdf45c33 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
@@ -51,6 +51,20 @@ public class LevelConfigurations extends ConfigurationPart {

}

+ public WakeUpDurationVariance wakeUpDurationVariance;
+ public class WakeUpDurationVariance extends ConfigurationPart {
+
+ double defaultValue() {
+ return DO_OPTIMIZE ? 0.2 : 0.0;
+ }
+
+ double animal = defaultValue(); public double animal() { return Math.max(0, this.animal); }
+ double monster = defaultValue(); public double monster() { return Math.max(0, this.monster); }
+ double flyingMonster = defaultValue(); public double flyingMonster() { return Math.max(0, this.flyingMonster); }
+ double villager = defaultValue(); public double villager() { return Math.max(0, this.villager); }
+
+ }
+
}

public Structure structure;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 062a793a134f774ebf918aab10443527c06c4fd1..3a362fef29c6fa29c37eff539e343eb3a56bf122 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -68,6 +68,13 @@ public class ActivationRange
Activity.PANIC
};

+ // Plazma start - Variable entity wakeup duration
+ private static final java.util.Random WAKEUP_DURATION_RANDOM = org.plazmamc.plazma.PlazmaOptions.useJavaRandom() ? new java.util.Random() : new org.plazmamc.plazma.Random();
+ private static int getWakeupDurationWithVariance(int duration, double deviation) {
+ if (deviation == 0) return duration;
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * WAKEUP_DURATION_RANDOM.nextGaussian(1, deviation))));
+ }
+ // Plazma end
private static int checkInactiveWakeup(Entity entity) {
Level world = entity.level();
SpigotWorldConfig config = world.spigotConfig;
@@ -75,22 +82,22 @@ public class ActivationRange
if (entity.activationType == ActivationType.VILLAGER) {
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
world.wakeupInactiveRemainingVillagers--;
- return config.wakeUpInactiveVillagersFor;
+ return getWakeupDurationWithVariance(config.wakeUpInactiveVillagersFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.ANIMAL) {
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
world.wakeupInactiveRemainingAnimals--;
- return config.wakeUpInactiveAnimalsFor;
+ return getWakeupDurationWithVariance(config.wakeUpInactiveAnimalsFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
world.wakeupInactiveRemainingFlying--;
- return config.wakeUpInactiveFlyingFor;
+ return getWakeupDurationWithVariance(config.wakeUpInactiveFlyingFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.flyingMonster()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
world.wakeupInactiveRemainingMonsters--;
- return config.wakeUpInactiveMonstersFor;
+ return getWakeupDurationWithVariance(config.wakeUpInactiveMonstersFor, world.plazmaLevelConfiguration().entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
}
}
return -1;
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: IPECTER <[email protected]>
Date: Wed, 10 May 2023 15:30:03 +0900
Subject: [PATCH] More optimise state lookup
From: AlphaKR93 <[email protected]>
Date: Sat, 30 Sep 2023 22:02:58 +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..5c03e26db0f9da992e9b0487a872e0ec8786650a 100644
index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..0832e4fa92b6464a6206475fbceb3b36462757b3 100644
--- a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
+++ b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
@@ -16,7 +16,7 @@ public final class ZeroCollidingReferenceStateTable {
protected final Comparable<?>[] this_table;
@@ -17,6 +17,7 @@ public final class ZeroCollidingReferenceStateTable {
protected final StateHolder<?, ?> this_state;

- protected long[] index_table;
+ protected long[] index_table; public long[] index_table() { return index_table; } // Plazma - Paper - optimise state lookup
protected long[] index_table;
+ 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..62934ef07ef856b917862c6f58ad391984da6327 100644
index 5f285d190186a2ff5a61d05070593e1d633dd79a..7b61a956892e90c7556db46d9277da8d252547cd 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,17 @@ public abstract class StateHolder<O, S> {
@@ -114,21 +114,15 @@ public abstract class StateHolder<O, S> {
}

public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
Expand All @@ -35,27 +34,26 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..62934ef07ef856b917862c6f58ad3919
- }
- } else {
- return (S)this;
+ // Plazma start - Paper - optimise state lookup
+ 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");
}
- }
+ // 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 end - Paper - optimise state lookup
+ // Plazma end
}

public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) {
- if (this.neighbours != null) {
+ if (this.optimisedTable.index_table() != null) {
+ if (this.optimisedTable.index_table() != null) { // Plazma - optimise state lookup more
throw new IllegalStateException();
} else {
Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
@@ -143,7 +139,7 @@ public abstract class StateHolder<O, S> {
@@ -143,7 +137,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
+ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Paper - optimise state lookup // Plazma - more
}
}

Loading

0 comments on commit 326a88d

Please sign in to comment.