9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-24 01:19:25 +00:00

Some fixes

This commit is contained in:
Dreeam
2025-04-02 21:19:23 -04:00
parent 8b8cc98e30
commit b237afbcfd
5 changed files with 61 additions and 30 deletions

View File

@@ -169,7 +169,7 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..e30bb9c4046200c1a6e4e917d15b205f
}
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce3363e09a 100644
index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..2505000585f6b726914861faf8f731bd7e83a34a 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -113,19 +113,8 @@ import net.minecraft.util.TimeUtil;
@@ -263,7 +263,20 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
super.doRunTask(task);
}
@@ -1558,7 +1524,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1535,12 +1501,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.ticksUntilAutosave--;
// Paper start - Incremental chunk and player saving
- final ProfilerFiller profiler = Profiler.get();
int playerSaveInterval = io.papermc.paper.configuration.GlobalConfiguration.get().playerAutoSave.rate;
if (playerSaveInterval < 0) {
playerSaveInterval = autosavePeriod;
}
- profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && this.tickCount % autosavePeriod == 0;
try {
this.isSaving = true;
@@ -1558,7 +1522,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
profiler.pop();
// Paper end - Incremental chunk and player saving
@@ -271,7 +284,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
this.runAllTasks(); // Paper - move runAllTasks() into full server tick (previously for timings)
this.server.spark.executeMainThreadTasks(); // Paper - spark
// Paper start - Server Tick Events
@@ -1567,7 +1532,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1567,7 +1530,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
// Paper end - Server Tick Events
this.server.spark.tickEnd(((double)(endTime - lastTick) / 1000000D)); // Paper - spark
@@ -279,7 +292,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
long l = Util.getNanos() - nanos;
int i1 = this.tickCount % 100;
this.aggregatedTickTimesNanos = this.aggregatedTickTimesNanos - this.tickTimesNanos[i1];
@@ -1580,16 +1544,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1580,16 +1542,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimes60s.add(this.tickCount, l);
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(nanos);
@@ -296,7 +309,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
LOGGER.debug("Autosave finished");
}
@@ -1655,7 +1615,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1655,7 +1613,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void tickChildren(BooleanSupplier hasTimeLeft) {
@@ -304,7 +317,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
this.getPlayerList().getPlayers().forEach(serverPlayer1 -> serverPlayer1.connection.suspendFlushing());
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
// Paper start - Folia scheduler API
@@ -1673,9 +1632,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1673,9 +1630,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
@@ -314,7 +327,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
// CraftBukkit start
// Run tasks that are waiting on processing
@@ -1710,7 +1667,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1710,7 +1665,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
serverLevel.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent
serverLevel.updateLagCompensationTick(); // Paper - lag compensation
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = serverLevel.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers
@@ -322,7 +335,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
/* Drop global time updates
if (this.tickCount % 20 == 0) {
profilerFiller.push("timeSync");
@@ -1719,8 +1675,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1719,8 +1673,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end */
@@ -331,7 +344,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
try {
serverLevel.tick(hasTimeLeft);
} catch (Throwable var7) {
@@ -1729,34 +1683,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1729,34 +1681,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw new ReportedException(crashReport);
}
@@ -366,7 +379,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
}
public void tickConnection() {
@@ -1772,14 +1716,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1772,14 +1714,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void forceTimeSynchronization() {
@@ -381,7 +394,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
}
public boolean isLevelEnabled(Level level) {
@@ -2595,55 +2534,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2595,55 +2532,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end
@@ -437,7 +450,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
public Path getWorldPath(LevelResource levelResource) {
return this.storageSource.getLevelPath(levelResource);
}
@@ -2693,24 +2583,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2693,24 +2581,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.isSaving;
}
@@ -462,7 +475,7 @@ index d8179f1b7441679a96ac8ccbd67c2cb1c4fc4fd6..20fd5ea3922b93a00e4f55cfd33af1ce
public int getMaxChainedNeighborUpdates() {
return 1000000;
}
@@ -2816,55 +2688,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2816,55 +2686,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public record ServerResourcePackInfo(UUID id, String url, String hash, boolean isRequired, @Nullable Component prompt) {
}
@@ -2057,7 +2070,7 @@ index e0e0d2ea7fc60e3142c675404d152eca60263240..09d559adb603e3d34bb82b944a2a3e8c
this.assignProfessionWhenSpawned = false;
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index e2829222337ed5a5061b60a153c8224eb53de9e8..78b368886648f034b7f1a97a922b97cc62b2fa02 100644
index e2829222337ed5a5061b60a153c8224eb53de9e8..9a5447dfa8cba271fdb205d21e4236c94074a7da 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer;
@@ -2069,7 +2082,23 @@ index e2829222337ed5a5061b60a153c8224eb53de9e8..78b368886648f034b7f1a97a922b97cc
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.TickRateManager;
import net.minecraft.world.damagesource.DamageSource;
@@ -1452,8 +1450,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -215,7 +213,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final <T extends Entity> List<T> getEntitiesOfClass(final Class<T> entityClass, final AABB boundingBox, final Predicate<? super T> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<T> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate);
@@ -225,7 +222,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public final List<Entity> moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate<? super Entity> predicate) {
- Profiler.get().incrementCounter("getEntities");
final List<Entity> ret = new java.util.ArrayList<>();
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate);
@@ -1452,8 +1448,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
}
protected void tickBlockEntities() {
@@ -2078,7 +2107,7 @@ index e2829222337ed5a5061b60a153c8224eb53de9e8..78b368886648f034b7f1a97a922b97cc
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
@@ -1483,7 +1479,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -1483,7 +1477,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.tickingBlockEntities = false;
@@ -2086,7 +2115,7 @@ index e2829222337ed5a5061b60a153c8224eb53de9e8..78b368886648f034b7f1a97a922b97cc
this.spigotConfig.currentPrimedTnt = 0; // Spigot
}
@@ -1742,7 +1737,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -1742,7 +1735,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Override
public List<Entity> getEntities(@Nullable Entity entity, AABB boundingBox, Predicate<? super Entity> predicate) {
@@ -2094,7 +2123,7 @@ index e2829222337ed5a5061b60a153c8224eb53de9e8..78b368886648f034b7f1a97a922b97cc
List<Entity> list = Lists.newArrayList();
// Paper start - rewrite chunk system
@@ -1771,8 +1765,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -1771,8 +1763,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
final AABB boundingBox, final Predicate<? super T> predicate,
final List<? super T> into, final int maxCount) {

View File

@@ -31,7 +31,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 1d53c0b96ff781765155aac29256f4493f7d7c58..eb2a6b82dc38989bcc155281aaafaced6fce78a0 100644
index 1d53c0b96ff781765155aac29256f4493f7d7c58..45926483e727c5eb30969da461d2c5c0fa035e4a 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -784,7 +784,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -50,23 +50,25 @@ index 1d53c0b96ff781765155aac29256f4493f7d7c58..eb2a6b82dc38989bcc155281aaafaced
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ // Paper end - Prevent block entity and entity crashes
+ }
+ //this.moonrise$midTickTasks(); // Paper - rewrite chunk system
+ this.moonrise$midTickTasks(); // Paper - rewrite chunk system
+ // Gale end - Airplane - remove lambda from ticking guard - copied from guardEntityTick
}
}
}
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 78b368886648f034b7f1a97a922b97cc62b2fa02..fb213dc889abafaaf35a69b06b1c35041ac65b46 100644
index 9a5447dfa8cba271fdb205d21e4236c94074a7da..906cca5e27d3aae3834075a635d2f6865f0ab64f 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -1490,8 +1490,9 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -1488,10 +1488,10 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, var6);
getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, var6))); // Paper - ServerExceptionEvent
- entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick
// Paper end - Prevent block entity and entity crashes
+ //this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick
}
this.moonrise$midTickTasks(); // Paper - rewrite chunk system
- this.moonrise$midTickTasks(); // Paper - rewrite chunk system
+ this.moonrise$midTickTasks(); // Paper - rewrite chunk system // Gale - Airplane - remove lambda from ticking guard - diff on change ServerLevel#tick
}
// Paper start - Option to prevent armor stands from doing entity lookups

View File

@@ -7,10 +7,10 @@ Original license: MIT
Original project: https://github.com/PurpurMC/Purpur
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 0442e47bf445ae6d8e7348b5aaec3fbdacff9e3e..fc0588b98087e04e486b822507c1d98851005923 100644
index 99e9fe7562520e37f8b0fa938b53a973b23c65c3..c84f187395d6b2d4c2e891aa545324f213902457 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1806,7 +1806,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1804,7 +1804,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {

View File

@@ -7,10 +7,10 @@ Co-authored by: Martijn Muijsers <martijnmuijsers@live.nl>
Co-authored by: MachineBreaker <machinebreaker>
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index fb213dc889abafaaf35a69b06b1c35041ac65b46..4e9a050517cdbcdd08a970d8c163e8dbcb818944 100644
index 906cca5e27d3aae3834075a635d2f6865f0ab64f..8a9516025cf6569d57ca48693bb34dd7a96c2420 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -943,17 +943,19 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -941,17 +941,19 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
for (int i = 0, len = entities.size(); i < len; ++i) {
Entity entity = entities.get(i);

View File

@@ -349,7 +349,7 @@ index 9e09f14033818fcf9df161941e316c16d913705b..8d68b49ff0b1c4c829d97cd8ebe81be7
}
// Paper end
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 5f04b2dcff7c0e967647bde9dfa0f35f59e8524c..3d26df068b449aeafd882b9b93722aa9705d2fd5 100644
index 5f04b2dcff7c0e967647bde9dfa0f35f59e8524c..8fa769f1f18d05b6f037c84175dcb56bead15b24 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -75,6 +75,11 @@ public class CraftBlock implements Block {
@@ -382,7 +382,7 @@ index 5f04b2dcff7c0e967647bde9dfa0f35f59e8524c..3d26df068b449aeafd882b9b93722aa9
public static boolean setBlockState(LevelAccessor world, BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, boolean applyPhysics) {
+ // SparklyPaper start - parallel world ticking
+ if (org.dreeam.leaf.config.modules.async.SparklyPaperParallelWorldTicking.enabled && world instanceof ServerLevel serverWorld) { // Leaf - SparklyPaper - parallel world ticking mod (make configurable)
+ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, position, "Cannot modify world asynchronously");
+ ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(serverWorld, pos, "Cannot modify world asynchronously");
+ }
+ // SparklyPaper end - parallel world ticking
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in block entity cleanup