Yatopia/patches/server/0032-Nuke-streams-off-BlockPosition.patch
Ivan Pekov 2b78178637
Updated Upstream and Sidestream(s) (Tuinity/Purpur)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
69e6a4c Updated Upstream (Paper)

Purpur Changes:
391f9ad Updated Upstream (Paper)
2020-12-17 09:48:17 +02:00

48 lines
2.2 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/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
index fdfd955aad65b758696b72a71521ec74e9aa122a..7c3e792b53329c869fbd21e298961b3f254c6ef5 100644
--- a/src/main/java/net/minecraft/server/BlockBase.java
+++ b/src/main/java/net/minecraft/server/BlockBase.java
@@ -639,6 +639,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);
}
@@ -647,6 +648,7 @@ public abstract class BlockBase {
return this.getBlock().a(tag) && predicate.test(this);
}
+ public final boolean isBlock(Block block) { return a(block); } // Yatopia - OBFHELPER
public boolean a(Block block) {
return this.getBlock().a(block);
}
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index aac055489291cd742bbbfd0aeb0b8face4040e17..34d0240903deb43ff486daa35a04a4b33788e474 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -318,7 +318,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) {