diff --git a/patches/server/0012-Console-log-tweaks.patch b/patches/server/0012-Console-log-tweaks.patch index 16e333a..a2cdcfe 100644 --- a/patches/server/0012-Console-log-tweaks.patch +++ b/patches/server/0012-Console-log-tweaks.patch @@ -86,7 +86,7 @@ index 1a288ebcaade0cc44c7d09478f4f2f8eee7a4269..916b42ffaf5d60aebc0cc3f3c0ee37bd 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 bb64e51eb20dc72661a6d84545361530dbd0fc3e..c408e9ccee77022c5d2172252e62c5c75c853610 100644 +index bb64e51eb20dc72661a6d84545361530dbd0fc3e..5dcc234f189dfc86b1585c1eaa6335949d3b53d6 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -23,6 +23,9 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -95,7 +95,7 @@ index bb64e51eb20dc72661a6d84545361530dbd0fc3e..c408e9ccee77022c5d2172252e62c5c7 + public boolean enableOfflineWarnings = true; + public boolean enableRootUserWarnings = true; -+ public boolean enableSecureChatMarker = Boolean.getBoolean("plazma.disableAutoOptimizeConfigurations"); ++ public boolean enableSecureChatMarker = Boolean.getBoolean("Plazma.disableConfigOptimization"); } } diff --git a/patches/server/0013-Player-configuration-section.patch b/patches/server/0013-Player-configuration-section.patch index 5aaf54f..4fe1059 100644 --- a/patches/server/0013-Player-configuration-section.patch +++ b/patches/server/0013-Player-configuration-section.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Player configuration section diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java -index c408e9ccee77022c5d2172252e62c5c75c853610..6c85924291a09252031ec404c7a8d2f12e175d0f 100644 +index 5dcc234f189dfc86b1585c1eaa6335949d3b53d6..1d6c9e45ddb8711ed253bb8daa1de1f72e27dc89 100644 --- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java @@ -27,5 +27,12 @@ public class GlobalConfiguration extends ConfigurationPart { public boolean enableRootUserWarnings = true; - public boolean enableSecureChatMarker = Boolean.getBoolean("plazma.disableAutoOptimizeConfigurations"); + public boolean enableSecureChatMarker = Boolean.getBoolean("Plazma.disableConfigOptimization"); + } + diff --git a/patches/server/0019-Misc-configuration.patch b/patches/server/0019-Misc-configuration.patch new file mode 100644 index 0000000..080c2ba --- /dev/null +++ b/patches/server/0019-Misc-configuration.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 25 Mar 2023 19:52:12 +0900 +Subject: [PATCH] Misc configuration + + +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index 83358425666a01ea7868ab02b2edab56e965e27a..2c19dddef15791964815d5ebd1c5c87f836be152 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -34,5 +34,12 @@ public class GlobalConfiguration extends ConfigurationPart { + + public boolean allowAnyUsername = false; + ++ } ++ ++ public Misc misc; ++ public class Misc extends ConfigurationPart { ++ ++ ++ + } + } +diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +index 553d6d68a84cd42754d8aa7d1359bc278e36ba15..d545ed7a95264505d0b3bedff56454ea5dc47918 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +@@ -81,5 +81,12 @@ public class LevelConfigurations extends ConfigurationPart { + + } + ++ } ++ ++ public Misc misc; ++ public class Misc extends ConfigurationPart { ++ ++ ++ + } + } diff --git a/patches/server/0020-Reduce-create-random-instance.patch b/patches/server/0020-Reduce-create-random-instance.patch new file mode 100644 index 0000000..3aab188 --- /dev/null +++ b/patches/server/0020-Reduce-create-random-instance.patch @@ -0,0 +1,202 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sat, 25 Mar 2023 20:02:59 +0900 +Subject: [PATCH] Reduce create random instance + + +diff --git a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java +index 591163d8f8300b084ac734800efee902c4def958..d74401ca3182145d136ad668704f5c043b163317 100644 +--- a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java ++++ b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java +@@ -65,7 +65,7 @@ public class SpreadPlayersCommand { + if (maxY < j) { + throw SpreadPlayersCommand.ERROR_INVALID_MAX_HEIGHT.create(maxY, j); + } else { +- RandomSource randomsource = RandomSource.create(); ++ RandomSource randomsource = worldserver.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? worldserver.getRandom() : RandomSource.create(); // Plazma + double d0 = (double) (center.x - maxRange); + double d1 = (double) (center.y - maxRange); + double d2 = (double) (center.x + maxRange); +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index c79e2b5160c41ce77ebd5355aebcefb3cb9151ca..735655847f75584a985c896637f47c2481b0cae6 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -402,7 +402,7 @@ public class ServerPlayer extends Player { + long l = k * k; + int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; + int j1 = this.getCoprime(i1); +- int k1 = RandomSource.create().nextInt(i1); ++ int k1 = (worldserver.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? worldserver.getRandom() : RandomSource.create()).nextInt(i1); // Plazma + + for (int l1 = 0; l1 < i1; ++l1) { + int i2 = (k1 + j1 * l1) % i1; +@@ -439,7 +439,7 @@ public class ServerPlayer extends Player { + long l = k * k; + int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l; + int j1 = this.getCoprime(i1); +- int k1 = RandomSource.create().nextInt(i1); ++ int k1 = (world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create()).nextInt(i1); + + for (int l1 = 0; l1 < i1; ++l1) { + int i2 = (k1 + j1 * l1) % i1; +diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java +index 1ef089dbf83de35d875c00efdf468c397be56978..dc111e0d1e7303c56cd12fa83be3ff85ab989e1b 100644 +--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java +@@ -349,7 +349,7 @@ public class QueryThreadGs4 extends GenericThread { + this.identBytes[2] = bs[5]; + this.identBytes[3] = bs[6]; + this.ident = new String(this.identBytes, StandardCharsets.UTF_8); +- this.challenge = RandomSource.create().nextInt(16777216); ++ this.challenge = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceCreateRandomInstance ? java.util.concurrent.ThreadLocalRandom.current().nextInt(16777216) : RandomSource.create().nextInt(16777216); // Plazma + this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8); + } + +diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +index d77410588a1c10d8ac902f21a8bd7e35f74fecd2..95bf0537d7793391eae9dd67655dc0189eb047df 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +@@ -80,7 +80,7 @@ public class FishingHook extends Projectile { + + private FishingHook(EntityType type, Level world, int luckOfTheSeaLevel, int lureLevel) { + super(type, world); +- this.syncronizedRandom = RandomSource.create(); ++ this.syncronizedRandom = world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create(); // Plazma + this.openWater = true; + this.currentState = FishingHook.FishHookState.FLYING; + this.noCulling = true; +diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java +index 879c3bb661e24b9682b654def57c2800f4f8ca92..4c465466543e51ff1e8343d3af7ee31a8b04b839 100644 +--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java ++++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java +@@ -110,7 +110,7 @@ public class Raid { + + public Raid(int id, ServerLevel world, BlockPos pos) { + this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); +- this.random = RandomSource.create(); ++ this.random = world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create(); // Plazma + this.waveSpawnPos = Optional.empty(); + this.id = id; + this.level = world; +@@ -124,7 +124,7 @@ public class Raid { + + public Raid(ServerLevel world, CompoundTag nbt) { + this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10); +- this.random = RandomSource.create(); ++ this.random = world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create(); // Plazma + this.waveSpawnPos = Optional.empty(); + this.level = world; + this.id = nbt.getInt("Id"); +diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +index 69ae671be07b1928e778399551991777829e432a..e39ac3557c7abd6081ae25df71d0fd134c9cc342 100644 +--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +@@ -94,7 +94,7 @@ public class EnchantmentMenu extends AbstractContainerMenu { + } + // Purpur end + }; +- this.random = RandomSource.create(); ++ this.random = playerInventory.player.level.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? playerInventory.player.getRandom() : RandomSource.create(); // Plazma + this.enchantmentSeed = DataSlot.standalone(); + this.costs = new int[3]; + this.enchantClue = new int[]{-1, -1, -1}; +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index 4beaedc5ec3562df62a7a9e6b2f40728bd933044..62c1b93ef872a40832ae6c223e99409aba2427db 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -81,7 +81,7 @@ public class Explosion { + } + + public Explosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType) { +- this.random = RandomSource.create(); ++ this.random = world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create(); // Plazma + this.toBlow = new ObjectArrayList(); + this.hitPlayers = Maps.newHashMap(); + this.level = world; +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index 058449f24eb3260dc230dad2a0b4c552d0b7f40e..cf0ad841267cac84ed058dee6cdd62a835325feb 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -125,7 +125,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + public final Thread thread; + private final boolean isDebug; + private int skyDarken; +- protected int randValue = RandomSource.create().nextInt(); ++ protected int randValue = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceCreateRandomInstance ? java.util.concurrent.ThreadLocalRandom.current().nextInt() : RandomSource.create().nextInt(); // Plazma + protected final int addend = 1013904223; + protected float oRainLevel; + public float rainLevel; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +index 43ca8471d7d4d2d561cba7e2a952a16ed200a961..2260ddd570e40ce97c6a14de99afa550d9686178 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +@@ -369,7 +369,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { + } + + private static void spawnGatewayPortal(ServerLevel world, BlockPos pos, EndGatewayConfiguration config) { +- Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), RandomSource.create(), pos); ++ Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), (world.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? world.getRandom() : RandomSource.create()), pos); // Plazma + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +index e9eb32469a5c03f7a3677ef50fd4541c1ed662ad..75665373c291faaea1cbf5f54c3634fdb042556c 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +@@ -411,7 +411,7 @@ public class EndDragonFight { + this.level.registryAccess().registry(Registries.CONFIGURED_FEATURE).flatMap((registry) -> { + return registry.getHolder(EndFeatures.END_GATEWAY_DELAYED); + }).ifPresent((reference) -> { +- reference.value().place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos); ++ reference.value().place(this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? this.level.getRandom() : RandomSource.create()), pos); // Plazma + }); + } + +@@ -427,7 +427,7 @@ public class EndDragonFight { + this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1); + } + // Paper end +- endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation); ++ endPodiumFeature.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? this.level.getRandom() : RandomSource.create()), this.portalLocation); // Plazma + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java +index 9e9ac64764cf0a84e25e75d8d6f516cde6047284..2d197a7de77657a19b1b527c0aa53ef9918eb15f 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java +@@ -202,7 +202,7 @@ public class LootContext { + } else { + RandomSource randomSource = this.random; + if (randomSource == null) { +- randomSource = RandomSource.create(); ++ randomSource = this.level.plazmaLevelConfiguration().misc.reduceCreateRandomInstance ? this.level.getRandom() : RandomSource.create(); + } + + MinecraftServer minecraftServer = this.level.getServer(); +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index 2c19dddef15791964815d5ebd1c5c87f836be152..065615b36237dc3b9aa21e31204c3af2c1c12084 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -39,7 +39,7 @@ public class GlobalConfiguration extends ConfigurationPart { + public Misc misc; + public class Misc extends ConfigurationPart { + +- ++ public boolean reduceCreateRandomInstance = Boolean.getBoolean("Plazma.disableConfigOptimization"); + + } + } +diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +index d545ed7a95264505d0b3bedff56454ea5dc47918..85daae0d6eb70379471239da41b75e179b341a55 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java +@@ -86,7 +86,7 @@ public class LevelConfigurations extends ConfigurationPart { + public Misc misc; + public class Misc extends ConfigurationPart { + +- ++ public boolean reduceCreateRandomInstance = !Boolean.getBoolean("Plazma.disableConfigOptimization"); + + } + }