mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-01-25 09:32:01 +01:00
0a19056af0
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>
68 lines
3.0 KiB
Diff
68 lines
3.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
Date: Tue, 1 Sep 2020 19:21:52 +0300
|
|
Subject: [PATCH] Nuke streams off SectionPosition
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BehaviorUtil.java b/src/main/java/net/minecraft/server/BehaviorUtil.java
|
|
index d0e7c6b4c0b1e5993f0019e7a448423e048a8af5..b788685331bc28e0d339e6600b5805a2bed4cf27 100644
|
|
--- a/src/main/java/net/minecraft/server/BehaviorUtil.java
|
|
+++ b/src/main/java/net/minecraft/server/BehaviorUtil.java
|
|
@@ -84,12 +84,25 @@ public class BehaviorUtil {
|
|
|
|
public static SectionPosition a(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
|
int j = worldserver.b(sectionposition);
|
|
+ // Yatopia start - replace stream
|
|
+ SectionPosition best = null;
|
|
+ for (SectionPosition pos : SectionPosition.getPosList(sectionposition, i)) {
|
|
+ if (worldserver.b(pos) < j) {
|
|
+ if (best == null || worldserver.b(pos) < worldserver.b(best)) {
|
|
+ best = pos;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if (best == null) best = sectionposition;
|
|
+ return best;
|
|
+ /*
|
|
Stream<SectionPosition> stream = SectionPosition.a(sectionposition, i).filter((sectionposition1) -> { // CraftBukkit - decompile error
|
|
return worldserver.b(sectionposition1) < j;
|
|
});
|
|
|
|
worldserver.getClass();
|
|
return (SectionPosition) stream.min(Comparator.comparingInt(worldserver::b)).orElse(sectionposition);
|
|
+ */ // Yatopia end
|
|
}
|
|
|
|
public static boolean a(EntityInsentient entityinsentient, EntityLiving entityliving, int i) {
|
|
diff --git a/src/main/java/net/minecraft/server/Raid.java b/src/main/java/net/minecraft/server/Raid.java
|
|
index 5dd5249caf55945607d5ac7830e54eedf9ca2c0d..89464cc770b4875ad65c5e84315e462689cea57b 100644
|
|
--- a/src/main/java/net/minecraft/server/Raid.java
|
|
+++ b/src/main/java/net/minecraft/server/Raid.java
|
|
@@ -355,6 +355,18 @@ public class Raid {
|
|
}
|
|
|
|
private void z() {
|
|
+ // Yatopia start - replace impl
|
|
+ BlockPosition best = null;
|
|
+ for (SectionPosition pos : SectionPosition.getPosList(SectionPosition.a(center), 2)) {
|
|
+ if (world.a(pos)) {
|
|
+ BlockPosition asBlockPos = pos.q();
|
|
+ if (best == null || asBlockPos.distanceSquared(center) < best.distanceSquared(center)) {
|
|
+ best = asBlockPos;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ if (best != null) this.c(best);
|
|
+ /*
|
|
Stream<SectionPosition> stream = SectionPosition.a(SectionPosition.a(this.center), 2);
|
|
WorldServer worldserver = this.world;
|
|
|
|
@@ -362,6 +374,7 @@ public class Raid {
|
|
stream.filter(worldserver::a).map(SectionPosition::q).min(Comparator.comparingDouble((blockposition) -> {
|
|
return blockposition.j(this.center);
|
|
})).ifPresent(this::c);
|
|
+ */ // Yatopia end
|
|
}
|
|
|
|
private Optional<BlockPosition> d(int i) {
|