9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 20:39:21 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0156-Remove-stream-in-updateFluidOnEyes.patch

78 lines
3.2 KiB
Diff

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);
}