From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Ivan Pekov 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 bb520b56d797cabec86fce42dd4afff018e66fdd..9c508cc41575175d442cd51d75706830351a24f2 100644 --- a/src/main/java/net/minecraft/core/BlockPosition.java +++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -325,7 +325,15 @@ public class BlockPosition extends BaseBlockPosition { } public static Optional a(BlockPosition blockposition, int i, int j, Predicate 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 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 e41615d7583d5485e31fbc0012925a24638101b8..e6c37db1a8b51dda1e9d493d8fbfecd4ddf1aeb3 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 @@ -734,6 +734,7 @@ public abstract class BlockBase { return this.getBlock().getInventory(this.p(), world, blockposition); } + public final boolean hasTag(Tag tag) { return a(tag); } // Yatopia - OBFHELPER public boolean a(Tag tag) { return this.getBlock().a(tag); }