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

Optimize fluidOnEyes update

Co-Authored-By: MrlingXD <90316914+wling-art@users.noreply.github.com>
This commit is contained in:
Dreeam
2025-06-28 10:37:38 +08:00
parent 655dd89c95
commit 35471da55b
130 changed files with 330 additions and 189 deletions

View File

@@ -1,77 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Mon, 11 Nov 2024 16:55:50 -0500
Subject: [PATCH] Remove stream in updateFluidOnEyes
diff --git a/net/minecraft/core/Holder.java b/net/minecraft/core/Holder.java
index 6c7edbbf3935c40ccb78bee680ea75431718b9bd..a1b4dc70d555cce5e06c0298736d8b89e04a96be 100644
--- a/net/minecraft/core/Holder.java
+++ b/net/minecraft/core/Holder.java
@@ -29,6 +29,8 @@ public interface Holder<T> {
Stream<TagKey<T>> tags();
+ Set<TagKey<T>> tagsAsSet(); // Leaf - Remove stream in updateFluidOnEyes
+
Either<ResourceKey<T>, T> unwrap();
Optional<ResourceKey<T>> unwrapKey();
@@ -105,6 +107,13 @@ public interface Holder<T> {
public Stream<TagKey<T>> tags() {
return Stream.of();
}
+
+ // Leaf start - Remove stream in updateFluidOnEyes
+ @Override
+ public Set<TagKey<T>> tagsAsSet() {
+ return Set.of();
+ }
+ // Leaf end - Remove stream in updateFluidOnEyes
}
public static enum Kind {
@@ -238,6 +247,13 @@ public interface Holder<T> {
return this.boundTags().stream();
}
+ // Leaf start - Remove stream in updateFluidOnEyes
+ @Override
+ public Set<TagKey<T>> tagsAsSet() {
+ return this.boundTags();
+ }
+ // Leaf end - Remove stream in updateFluidOnEyes
+
@Override
public String toString() {
return "Reference{" + this.key + "=" + this.value + "}";
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ddaaf29305a9cdb6dcccd38d4ec37fac6f0a1a51..c6bb3d9e1e9c2b38845e70c308fad41c813c600e 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1980,7 +1980,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
FluidState fluidState = this.level().getFluidState(blockPos);
double d = blockPos.getY() + fluidState.getHeight(this.level(), blockPos);
if (d > eyeY) {
- fluidState.getTags().forEach(this.fluidOnEyes::add);
+ this.fluidOnEyes.addAll(fluidState.getTagsAsSet()); // Leaf - Remove stream in updateFluidOnEyes
}
}
}
diff --git a/net/minecraft/world/level/material/FluidState.java b/net/minecraft/world/level/material/FluidState.java
index 0a5ae623a636923f3bbd3c01974497f39b7c4b62..f5bdd78b44881bd2b36b552165eca23d7dfac6b2 100644
--- a/net/minecraft/world/level/material/FluidState.java
+++ b/net/minecraft/world/level/material/FluidState.java
@@ -167,6 +167,12 @@ public final class FluidState extends StateHolder<Fluid, FluidState> implements
return this.owner.builtInRegistryHolder().tags();
}
+ // Leaf start - Remove stream in updateFluidOnEyes
+ public java.util.Set<TagKey<Fluid>> getTagsAsSet() {
+ return this.owner.builtInRegistryHolder().tagsAsSet();
+ }
+ // Leaf end - Remove stream in updateFluidOnEyes
+
public void entityInside(Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
this.getType().entityInside(level, pos, entity, effectApplier);
}

View File

@@ -8,7 +8,7 @@ avoids multiple casting in Entity#distanceTo, using Math#sqrt directly instead o
these methods more able to be inlined by the JIT compiler. these methods more able to be inlined by the JIT compiler.
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index c6bb3d9e1e9c2b38845e70c308fad41c813c600e..21dbc78baae89093ef9bc3a0620ab9e557e22910 100644 index ddaaf29305a9cdb6dcccd38d4ec37fac6f0a1a51..a3299cf2f1ac3e8794303b92a3662d3002846e96 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -2190,31 +2190,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -2190,31 +2190,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cache supporting block check
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 21dbc78baae89093ef9bc3a0620ab9e557e22910..69521086fca0c9fbc230817062b65c4269c575fd 100644 index a3299cf2f1ac3e8794303b92a3662d3002846e96..4cb3e182702d8fd69f880d00fa0c228cb1302ea0 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -1082,12 +1082,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1082,12 +1082,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -731,7 +731,7 @@ index 75393b9cdd564e55ba173828c2f7b40498e8ecd7..96202ffdb73cb9d8c63351b4538c6464
serverPlayer.connection = player.connection; serverPlayer.connection = player.connection;
serverPlayer.restoreFrom(player, keepInventory); serverPlayer.restoreFrom(player, keepInventory);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 69521086fca0c9fbc230817062b65c4269c575fd..82096e6b187e63ad3e848b9757ba2152e8c642b4 100644 index 4cb3e182702d8fd69f880d00fa0c228cb1302ea0..757ac420fb46042e707d05c343d8fa71e086c634 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -3321,15 +3321,40 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -3321,15 +3321,40 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -11,7 +11,7 @@ As part of: Airplane (https://github.com/TECHNOVE/Airplane)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) 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 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 82096e6b187e63ad3e848b9757ba2152e8c642b4..e0db9281f023a09d69479f28a7c8f681641f642f 100644 index 757ac420fb46042e707d05c343d8fa71e086c634..8618a9221bb4feb459ed50c20c9dc5edb6308aec 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -4610,10 +4610,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4610,10 +4610,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Sakura: Optimise check inside blocks and traverse blocks
Dreeam TODO: refactor checkinsideblcoks Dreeam TODO: refactor checkinsideblcoks
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index e0db9281f023a09d69479f28a7c8f681641f642f..cc6b6b442d72b4a974cedd8ceef710304e52ab18 100644 index 8618a9221bb4feb459ed50c20c9dc5edb6308aec..9305f790bd80df1d7d14065e6ad621ec9c2e1a49 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -1701,6 +1701,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1701,6 +1701,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Optimise player movement checks
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index cc6b6b442d72b4a974cedd8ceef710304e52ab18..65a75480831d882e8318f702a519fb172dbc888a 100644 index 9305f790bd80df1d7d14065e6ad621ec9c2e1a49..3bba6cd29f85bec2e98ce97313f1158e2836c6b9 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -1194,7 +1194,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1194,7 +1194,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess

Some files were not shown because too many files have changed in this diff Show More