Yatopia/patches/server/0039-Nuke-streams-off-BlockPosition.patch
Ivan Pekov 0a19056af0
Drop akarin's stream replacements
Fixes bad performance out of the box for production. 
Apparently there's another issue which is thinkering our minds up, it is that after certain amount of time the gc just can't keep up. We're investigating into this, but until it is fixed - this is gonna be a stable build 

Co-authored-by: Mykyta Komarn <nkomarn@hotmail.com>
2020-10-08 14:04:22 +03: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 fb083996c10f553d7eff629a815b11eb7f0bf42c..17c8e5fe9e3e18244bbcf479267289dce01f9615 100644
--- a/src/main/java/net/minecraft/server/BlockBase.java
+++ b/src/main/java/net/minecraft/server/BlockBase.java
@@ -637,6 +637,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);
}
@@ -645,6 +646,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 dbe6f7d555e8c851faba5cafee8831c516256c09..3bd6d37a93b741043851c6a24ffe61f517774546 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) {