Mark chunks that are blocking main thread for world generation as urgent Implements a general priority system so that chunks that are sorted in the generator queues can prioritize certain chunks over another. Urgent chunks will jump to the front of the line, ensuring that a sync chunk load on an ungenerated chunk does not lag the server for a long period of time if the servers generator queues are filled with lots of chunks already. This massively reduces the lag spikes from sync chunk gens. Then we further prioritize loading order so nearby chunks have higher priority than distant chunks, reducing the pressure a high no tick view distance holds on you. Chunks in front of the player have higher priority, to help with fast traveling players keep up with their movement. This commit also improves single core cpu scenarios in that we will now automatically disable Async Chunks as well as Minecrafts thread pool. It is never recommended to use async chunks on a single CPU as context switching will be slower than just running it all on main. This also bumps the number of server worker threads by default too. Mojang does not utilize the workers in an effecient manner, resulting in them using barely any sustained CPU. So give it more workers so more chunks can be processed concurrently This change also improves urgent chunk loading, so players flying into unloaded chunks will hurt a little bit less (but still hurt) Ping #3395 #3363 (Not marking as closed, we need to make prevent moving work)
56 lines
2.7 KiB
Diff
56 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 10 May 2020 22:12:46 -0400
|
|
Subject: [PATCH] Ensure Entity AABB's are never invalid
|
|
|
|
If anything used setPositionRaw, it left potential for an AABB
|
|
to be left stale at their old location, which could cause massive
|
|
AABB boxes if movement ever then got called on the new position.
|
|
|
|
This guarantees any time we set the entities position, we also
|
|
update their AABB.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index b176dc26d15065aebc91c75e8a96745f589c0b87..c81b9d814d50a026872d2711f76649c00d65888b 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -416,10 +416,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
|
|
public void setPosition(double d0, double d1, double d2) {
|
|
this.setPositionRaw(d0, d1, d2);
|
|
- float f = this.size.width / 2.0F;
|
|
- float f1 = this.size.height;
|
|
-
|
|
- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
|
|
+ // Paper start - move into setPositionRaw
|
|
+ //float f = this.size.width / 2.0F;
|
|
+ //float f1 = this.size.height;
|
|
+ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
|
|
+ // Paper end
|
|
if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
|
|
}
|
|
|
|
@@ -2981,6 +2982,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
return new AxisAlignedBB(vec3d, vec3d1);
|
|
}
|
|
|
|
+ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER
|
|
public void a(AxisAlignedBB axisalignedbb) {
|
|
// CraftBukkit start - block invalid bounding boxes
|
|
double minX = axisalignedbb.minX,
|
|
@@ -3439,6 +3441,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
|
|
public void setPositionRaw(double d0, double d1, double d2) {
|
|
+ // Paper start - never allow AABB to become desynced from position
|
|
+ // hanging has its own special logic
|
|
+ if (!(this instanceof EntityHanging) && (locX != d0 || locY != d1 || locZ != d2)) {
|
|
+ float f = this.size.width / 2.0F;
|
|
+ float f1 = this.size.height;
|
|
+ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f));
|
|
+ }
|
|
+ // Paper end
|
|
this.locX = d0;
|
|
this.locY = d1;
|
|
this.locZ = d2;
|