Yatopia/patches/server-remap-in-progress/remap in progress/0026-Nuke-streams-off-BlockPosition.patch
2021-06-16 19:58:18 +02:00

40 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Tue, 1 Sep 2020 19:11:50 +0300
Subject: [PATCH] Nuke streams off BlockPosition
diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java
index 963c1c56732d8c44d9abc1a04cf9fd6f1cc1224d..092de56e31257c1817a04cc9fc2f9c300bbfa058 100644
--- a/src/main/java/net/minecraft/core/BlockPosition.java
+++ b/src/main/java/net/minecraft/core/BlockPosition.java
@@ -324,7 +324,15 @@ public class BlockPosition extends BaseBlockPosition {
}
public static Optional<BlockPosition> a(BlockPosition blockposition, int i, int j, Predicate<BlockPosition> predicate) {
- return b(blockposition, i, j, i).filter(predicate).findFirst();
+ // Yatopia start - avoid using stream
+ // return b(blockposition, i, j, i).filter(predicate).findFirst();
+ for (BlockPosition pos : a(blockposition, i, j, i)) {
+ if (predicate.test(pos)) {
+ return Optional.of(pos);
+ }
+ }
+ return Optional.empty();
+ // Yatopia end
}
public static Stream<BlockPosition> b(BlockPosition blockposition, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
index d894e7f16d232596ec308f3de3ea5da410588cbe..81cf123cf445716ecaa8496b56b763cb4ae02d68 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
@@ -735,6 +735,7 @@ public abstract class BlockBase {
return this.getBlock().getInventory(this.p(), world, blockposition);
}
+ public final boolean hasTag(Tag<Block> tag) { return a(tag); } // Yatopia - OBFHELPER
public boolean a(Tag<Block> tag) {
return this.getBlock().a(tag);
}