geforkt von Mirrors/Paper
7bf9446d9e
Configurable under "settings.chunk-loading.player-max-chunk-load-rate", defaults to -1. This commit also changes the chunk loading to be distributed equally for all players, rather than distance based. This is to ensure players flying around do not take priority over everyone else. The exception to this new rule is the min-load-radius, which still has priority over everything else.
46 Zeilen
2.1 KiB
Diff
46 Zeilen
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 31 Mar 2022 05:18:28 -0700
|
|
Subject: [PATCH] Guard against invalid entity positions
|
|
|
|
Anything not finite should be blocked and logged
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 26911884384d5e8afd1b43360494b793374f505f..49cf3601df7b145d49b1fe9a71ba0bc60c5394b3 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4090,11 +4090,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
|
}
|
|
|
|
+ // Paper start - block invalid positions
|
|
+ public static boolean checkPosition(Entity entity, double newX, double newY, double newZ) {
|
|
+ if (Double.isFinite(newX) && Double.isFinite(newY) && Double.isFinite(newZ)) {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ String entityInfo = null;
|
|
+ try {
|
|
+ entityInfo = entity.toString();
|
|
+ } catch (Exception ex) {
|
|
+ entityInfo = "[Entity info unavailable] ";
|
|
+ }
|
|
+ LOGGER.error("New entity position is invalid! Tried to set invalid position (" + newX + "," + newY + "," + newZ + ") for entity " + entity.getClass().getName() + " located at " + entity.position + ", entity info: " + entityInfo, new Throwable());
|
|
+ return false;
|
|
+ }
|
|
+ // Paper end - block invalid positions
|
|
+
|
|
public final void setPosRaw(double x, double y, double z) {
|
|
// Paper start
|
|
this.setPosRaw(x, y, z, false);
|
|
}
|
|
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
|
+ // Paper start - block invalid positions
|
|
+ if (!checkPosition(this, x, y, z)) {
|
|
+ return;
|
|
+ }
|
|
+ // Paper end - block invalid positions
|
|
// Paper end
|
|
// Paper start - fix MC-4
|
|
if (this instanceof ItemEntity) {
|