mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
* rebase * optimize LivingEntity#travel * cleanup * Replace fluid height map * reuse array list in Entity#collide * cleanup * fix fire and liquid collision shape * fix checkInside * inline betweenClosed * cleanup * optimize getOnPos * optimize equals in getOnPos * update mainSupportingBlockPos on dirty * cleanup * rename * merge same patch * rebase and remove properly * [ci skip] cleanup * rebase and rebuild * fix async locator * remove async locator * cleanup * rebase --------- Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
42 lines
2.5 KiB
Diff
42 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Wed, 26 Mar 2025 15:47:14 -0400
|
|
Subject: [PATCH] Prevent double chunk retrieving in entity fluid pushing check
|
|
and fluid height updating
|
|
|
|
This patch is based on the following patch:
|
|
"Reduce entity fluid lookups if no fluids"
|
|
By: Paul Sauve <paul@technove.co>
|
|
As part of: Airplane (https://github.com/TECHNOVE/Airplane)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 6286aa8196a4e3a388f2ed3a472417d84f535970..043ae5e2783d60b295a11d85fad60d87f729cb9b 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -4780,10 +4780,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
|
|
// Paper start - optimise collisions
|
|
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
|
|
- if (this.touchingUnloadedChunk()) {
|
|
- return false;
|
|
- }
|
|
-
|
|
+ // Leaf - Prevent double chunk retrieving in entity fluid pushing check and fluid height updating
|
|
final AABB boundingBox = this.getBoundingBox().deflate(1.0E-3);
|
|
|
|
final Level world = this.level;
|
|
@@ -4819,7 +4816,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
|
|
for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
|
for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {
|
|
- final net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunkSource.getChunk(currChunkX, currChunkZ, net.minecraft.world.level.chunk.status.ChunkStatus.FULL, false).getSections();
|
|
+ // 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);
|
|
+ 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
|
|
|
|
// bound y
|
|
for (int currChunkY = minChunkY; currChunkY <= maxChunkY; ++currChunkY) {
|