mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-28 03:19:21 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
44 lines
2.7 KiB
Diff
44 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Sat, 9 Aug 2025 15:44:06 +0900
|
|
Subject: [PATCH] optimize updateFluidHeightAndDoFluidPushing
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 29fa9cfa1aa2d507da852f5fe33ea6e4143da194..0366217ac729a967ba69fb256481479255d347be 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -4939,12 +4939,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
final int minChunkZ = minBlockZ >> 4;
|
|
final int maxChunkZ = maxBlockZ >> 4;
|
|
|
|
- final net.minecraft.world.level.chunk.ChunkSource chunkSource = world.getChunkSource();
|
|
+ final net.minecraft.server.level.ServerChunkCache chunkSource = ((ServerLevel) world).chunkSource; // Leaf - optimize get chunk
|
|
|
|
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
|
for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {
|
|
// Leaf start - Prevent double chunk retrieving in entity fluid pushing check and fluid height updating
|
|
- final net.minecraft.world.level.chunk.ChunkAccess chunk = chunkSource.getChunk(currChunkX, currChunkZ, net.minecraft.world.level.chunk.status.ChunkStatus.FULL, false);
|
|
+ final net.minecraft.world.level.chunk.LevelChunk chunk = chunkSource.fullChunksNonSync.get(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(currChunkX, currChunkZ));
|
|
if (chunk == null) continue;
|
|
final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections();
|
|
// Leaf end - Prevent double chunk retrieving in entity fluid pushing check and fluid height updating
|
|
@@ -4956,7 +4956,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
continue;
|
|
}
|
|
final net.minecraft.world.level.chunk.LevelChunkSection section = sections[sectionIdx];
|
|
- if (section.hasOnlyAir()) {
|
|
+ if (section.hasOnlyAir() || (fluid == FluidTags.WATER && section.waterFluidCount == 0) || (fluid == FluidTags.LAVA && section.lavaFluidCount == 0)) {
|
|
// empty
|
|
continue;
|
|
}
|
|
@@ -5013,7 +5013,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
|
|
this.fluidHeight.put(fluid, maxHeightDiff);
|
|
|
|
- if (pushVector.lengthSqr() == 0.0) {
|
|
+ if (pushVector == Vec3.ZERO || pushVector.lengthSqr() == 0.0) {
|
|
return inFluid;
|
|
}
|
|
|