9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 11:29:11 +00:00
This commit is contained in:
Dreeam
2025-01-24 05:52:39 -05:00
parent 26565ea357
commit 0c123ba166
9 changed files with 49 additions and 38 deletions

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] EMC: Don't use snapshots for TileEntity::getOwner
Original license: MIT
Original project: https://github.com/starlis/empirecraft
Also see Leaf's EMC-Default-don-t-use-blockstate-snapshots.patch
Also see Leaf's EMC-Don-t-use-snapshots-for-acquiring-blockstate
diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java
index 3fd0f42618e5c2c683335d1d3e0bb74c6d32ef66..8f4d13d897ac92c6ea239da22029c8058bd82eaa 100644

View File

@@ -51,7 +51,7 @@ index b78828e83d8128eace986aeb73213da3b3f905e4..f59879ae7d3c73cd4c4233d30667988b
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 2596e0ee4df5b96f181e28a742ef345981fc97e3..bbdda3b5263118ec00847e94dde761617db09df2 100644
index 2596e0ee4df5b96f181e28a742ef345981fc97e3..5b844d2fea387f2cb655169f458ec0ca627f1c65 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -32,6 +32,9 @@ public record ServerBuildInfoImpl(
@@ -60,7 +60,7 @@ index 2596e0ee4df5b96f181e28a742ef345981fc97e3..bbdda3b5263118ec00847e94dde76161
private static final String BRAND_GALE_NAME = "Gale"; // Gale - branding changes
+ // Leaf start - Rebrand
+ private static final String BRAND_LEAF_NAME = "Leaf";
+ // Leaf end- Rebrand
+ // Leaf end - Rebrand
private static final String BUILD_DEV = "DEV";
@@ -81,9 +81,9 @@ index 2596e0ee4df5b96f181e28a742ef345981fc97e3..bbdda3b5263118ec00847e94dde76161
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Gale - branding changes
+ // Leaf start - Rebrand
+ return brandId.equals(this.brandId)
+ || brandId.equals(BRAND_PAPER_ID)
+ // Leaf start - Rebrand
+ || brandId.equals(BRAND_GALE_ID); // Gale - branding changes
+ // Leaf end - Rebrand
}

View File

@@ -5,26 +5,37 @@ Subject: [PATCH] Fix Pufferfish and Purpur patches
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index bbdda3b5263118ec00847e94dde761617db09df2..3a23bebec1f2b0f61f2ada307a37046c29f8dcbe 100644
index 5b844d2fea387f2cb655169f458ec0ca627f1c65..f267abd6f905180cfa5cf4961cf79f57544a891c 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -33,6 +33,8 @@ public record ServerBuildInfoImpl(
@@ -32,9 +32,11 @@ public record ServerBuildInfoImpl(
private static final String BRAND_PAPER_NAME = "Paper";
private static final String BRAND_GALE_NAME = "Gale"; // Gale - branding changes
// Leaf start - Rebrand
- // Leaf start - Rebrand
+ // Leaf start - Rebrand & Fix Pufferfish and Purpur patches
+ private static final String BRAND_PUFFERFISH_NAME = "Pufferfish";
+ private static final String BRAND_PURPUR_NAME = "Purpur";
private static final String BRAND_LEAF_NAME = "Leaf";
// Leaf end- Rebrand
- // Leaf end - Rebrand
+ // Leaf end - Rebrand & Fix Pufferfish and Purpur patches
@@ -68,7 +70,9 @@ public record ServerBuildInfoImpl(
private static final String BUILD_DEV = "DEV";
@@ -65,11 +67,13 @@ public record ServerBuildInfoImpl(
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- // Leaf start - Rebrand
+ // Leaf start - Rebrand & Fix Pufferfish and Purpur patches
return brandId.equals(this.brandId)
|| brandId.equals(BRAND_PAPER_ID)
// Leaf start - Rebrand
- || brandId.equals(BRAND_GALE_ID); // Gale - branding changes
- // Leaf end - Rebrand
+ || brandId.equals(BRAND_GALE_ID) // Gale - branding changes
+ || brandId.equals(BRAND_PUFFERFISH_ID)
+ || brandId.equals(BRAND_PURPUR_ID);
// Leaf end - Rebrand
+ // Leaf end - Rebrand & Fix Pufferfish and Purpur patches
}
@Override

View File

@@ -14,7 +14,7 @@ Co-authored-by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
index de8b9048c8395c05b8688bc9d984b8ad680f15b3..3310a780aba946d7fe9cf2d1d9487e5286177233 100644
index de8b9048c8395c05b8688bc9d984b8ad680f15b3..fab62216edd7181585fbf1e5cd9870e88d51e99b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -206,7 +206,12 @@ public class CraftChunk implements Chunk {
@@ -22,17 +22,17 @@ index de8b9048c8395c05b8688bc9d984b8ad680f15b3..3310a780aba946d7fe9cf2d1d9487e52
public boolean isSlimeChunk() {
// 987234911L is deterimined in EntitySlime when seeing if a slime can spawn in a chunk
- return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper
+ // Leaf start - Matter - Feature Secure Seed
+ // Leaf start - Matter - Secure Seed
+ boolean isSlimeChunk = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled
+ ? worldServer.getChunk(this.getX(), this.getZ()).isSlimeChunk()
+ : WorldgenRandom.seedSlimeChunk(this.getX(), this.getZ(), this.getWorld().getSeed(), worldServer.spigotConfig.slimeSeed).nextInt(10) == 0; // Paper
+ return this.worldServer.paperConfig().entities.spawning.allChunksAreSlimeChunks || isSlimeChunk;
+ // Leaf end - Matter - Feature Secure Seed
+ // Leaf end - Matter - Secure Seed
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 926d85d1584fa0e9ff16c4079f60cde98e6927f7..c58a626e9ab72f45665cda40581e268ead322091 100644
index 926d85d1584fa0e9ff16c4079f60cde98e6927f7..ac4a964be491e85ef9e7b9d26e609f24387b5c45 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1412,7 +1412,11 @@ public final class CraftServer implements Server {
@@ -40,11 +40,11 @@ index 926d85d1584fa0e9ff16c4079f60cde98e6927f7..c58a626e9ab72f45665cda40581e268e
} else {
LevelSettings levelSettings;
- WorldOptions worldOptions = new WorldOptions(creator.seed(), creator.generateStructures(), false);
+ // Leaf start - Matter - Feature Secure Seed
+ // Leaf start - Matter - Secure Seed
+ WorldOptions worldOptions = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled
+ ? new WorldOptions(creator.seed(), su.plo.matter.Globals.createRandomWorldSeed(), creator.generateStructures(), false)
+ : new WorldOptions(creator.seed(), creator.generateStructures(), false);
+ // Leaf end - Matter - Feature Secure Seed
+ // Leaf end - Matter - Secure Seed
WorldDimensions worldDimensions;
DedicatedServerProperties.WorldDimensionData properties = new DedicatedServerProperties.WorldDimensionData(GsonHelper.parse((creator.generatorSettings().isEmpty()) ? "{}" : creator.generatorSettings()), creator.type().name().toLowerCase(Locale.ROOT));

View File

@@ -1,16 +1,17 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Tue, 9 Nov 2077 00:00:00 +0800
Subject: [PATCH] Faster Random Generator
Subject: [PATCH] Faster random generator
This patch replaces LegacyRandomSource with FasterRandomSource by default,
which is faster in general.
Benchmark results (10,000,000 iterations) (GraalVM 21)
SimpleRandom (Moonrise): 80ms
FasterRandomSource (Leaf) (Backed by Xoroshiro128PlusPlus): 35ms
LegacyRandomSource (Vanilla): 200ms
XoroshiroRandomSource (Vanilla): 47ms
Benchmark results (10,000,000 iterations) (Azul Zulu 23.0.1)
FasterRandomSource (Leaf) (Backed by Xoroshiro128PlusPlus): 51,633,700 ns
LegacyRandomSource (Vanilla): 254,857,500 ns
ThreadUnsafeRandom (Moonrise): 102,265,100 ns
SimpleThreadUnsafeRandom (Moonrise): 97,054,600 ns
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java
index c60c05b9e426f56ed3e812abb9aae9ef52bd20e8..268fd8e60630e835c750a8b67201cc63f0b5193d 100644

View File

@@ -8,14 +8,14 @@ and the results are always same, thus there is no need to do the convert process
Save ~0.16ms per tick, and improve 11660ms -> 60ms in around 1 hour.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
index 47db4546242974a40f7fc1e34f237fd1f06d5f37..5efe81d85ffb91614308c442ec1afcff4c7855a9 100644
index 47db4546242974a40f7fc1e34f237fd1f06d5f37..8ffc90b579338d3cf26046ecb497438ac7d02370 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityType.java
@@ -15,14 +15,26 @@ import org.bukkit.entity.EntityType;
public class CraftEntityType {
+ public static final java.util.Map<net.minecraft.world.entity.EntityType<?>, EntityType> MINECRAFT_TO_BUKKIT_KEY_CACHE = new java.util.concurrent.ConcurrentHashMap<>(); // Leaf - Cache CraftEntityType#minecraftToBukkit convert
+ private static final java.util.Map<net.minecraft.world.entity.EntityType<?>, EntityType> MINECRAFT_TO_BUKKIT_KEY_CACHE = new java.util.concurrent.ConcurrentHashMap<>(); // Leaf - Cache CraftEntityType#minecraftToBukkit convert
+
public static EntityType minecraftToBukkit(net.minecraft.world.entity.EntityType<?> minecraft) {
Preconditions.checkArgument(minecraft != null);

View File

@@ -7,36 +7,36 @@ Original license: MIT
Original project: https://github.com/thebrightspark/AsyncLocator
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
index 157e5edb507d6d2a922833c70a1c27abc93c9c34..152fc4347000bb14b3c3fbea3a2bef75efcfc784 100644
index 157e5edb507d6d2a922833c70a1c27abc93c9c34..0e2f43598575d3ed80ebfcd35144d56e6affe1a7 100644
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
@@ -101,6 +101,12 @@ public class TickThread extends Thread {
this(null, run, name);
}
+ // Leaf start - Async locator
+ // Leaf start - Asynchronous locator
+ public TickThread(final Runnable run, final String name, final int id) {
+ this(null, run, name, id);
+ }
+ // Leaf end - Async locator
+ // Leaf end - Asynchronous locator
+
public TickThread(final ThreadGroup group, final Runnable run, final String name) {
this(group, run, name, ID_GENERATOR.incrementAndGet());
}
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 361f4de9cdf0f7505628a2fed2a3f5366031e04b..befeb418c7d9021b9043b1f50b688b1870f7e591 100644
index 361f4de9cdf0f7505628a2fed2a3f5366031e04b..548fcd9646dee0c40b6ba9b3dafb9ca157dfe324 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -48,6 +48,12 @@ class PaperEventManager {
return;
}
// Leaf end - Multithreaded tracker
+ // Leaf start - Async locator
+ // Leaf start - Asynchronous locator
+ if (org.dreeam.leaf.config.modules.async.AsyncLocator.enabled) {
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(event::callEvent);
+ return;
+ }
+ // Leaf end - Async locator
+ // Leaf end - Asynchronous locator
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
}
// Leaves start - skip photographer

View File

@@ -1,13 +1,13 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 Jun 2018 22:13:44 -0400
Subject: [PATCH] EMC: Default don't use blockstate snapshots
Subject: [PATCH] EMC: Don't use snapshots for acquiring blockstate
Original license: MIT
Original project: https://github.com/starlis/empirecraft
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 5cb69d0b822e11a99a96aef4f59986d083b079f4..e9d43d9c4ad7cc1e12880e671f42e32dda85f17b 100644
index 5cb69d0b822e11a99a96aef4f59986d083b079f4..973b297a22c0cc53f966582c67c3688f4b2205c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -331,7 +331,7 @@ public class CraftBlock implements Block {
@@ -15,12 +15,12 @@ index 5cb69d0b822e11a99a96aef4f59986d083b079f4..e9d43d9c4ad7cc1e12880e671f42e32d
@Override
public BlockState getState() {
- return CraftBlockStates.getBlockState(this);
+ return CraftBlockStates.getBlockState(this, org.dreeam.leaf.config.modules.opt.TileEntitySnapshotCreation.enabled); // Leaf - EMC - default to not use snapshots
+ return CraftBlockStates.getBlockState(this, org.dreeam.leaf.config.modules.opt.TileEntitySnapshotCreation.enabled); // Leaf - EMC - Don't use snapshots for acquiring blockstate
}
// Paper start
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..99f9335e6e36bb97710b30135648c9dbf72d833b 100644
index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..55572e799b5c8a74a546ac8febc14f80d5731c52 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java
@@ -238,7 +238,7 @@ public final class CraftBlockStates {
@@ -28,7 +28,7 @@ index 56453454cbd4b9e9270fc833f8ab38d5fa7a3763..99f9335e6e36bb97710b30135648c9db
public static BlockState getBlockState(Block block) {
// Paper start
- return CraftBlockStates.getBlockState(block, true);
+ return CraftBlockStates.getBlockState(block, org.dreeam.leaf.config.modules.opt.TileEntitySnapshotCreation.enabled); // Leaf - default to not use snapshots
+ return CraftBlockStates.getBlockState(block, org.dreeam.leaf.config.modules.opt.TileEntitySnapshotCreation.enabled); // Leaf - EMC - Don't use snapshots for acquiring blockstate
}
public static BlockState getBlockState(Block block, boolean useSnapshot) {
// Paper end

View File

@@ -6,11 +6,10 @@
# Leaf TODOs
- [ ] refactor leaves protocol manager opt and pr it.
- [ ] check multithreaded tracker, that moonrise change
- [ ] Check and apply work patches
- [ ] Transfer patch notes to file for Gale and Leaf
- [ ] Add spigot config unknown message to leaf docs
- [ ] Add server full join config explaination to docs
- [ ] Add server full join config explanation to docs
- [ ] leaf at
- [ ] Add purpur config changes to docs moved config
- [ ] Merge changes from Tramontane