geforkt von Mirrors/Paper
6a7fef0e4a
* Allow entity effect modification off the main thread for worldgen * squash all async catcher patches
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 e052694ca221508f28cbfbb93a6ec974d9ca65d8..b26fc1a1f30bd9736ac0cf09d381dc02c0bc34d6 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4326,11 +4326,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 - rewrite chunk system
|
|
if (this.updatingSectionStatus) {
|