parent
0e9c24e595
commit
6009ba8f44
|
@ -1,67 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Fri, 22 May 2020 00:29:52 -0400
|
|
||||||
Subject: [PATCH] Use saner Entity bounding box limits
|
|
||||||
|
|
||||||
CB only protected from > 64 but there's no reason an entity should ever
|
|
||||||
be more than 2x its width or 1x height as the BB is supposed to represent
|
|
||||||
the entity size.
|
|
||||||
|
|
||||||
BB is / 2 to calculate position.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
||||||
index e0ab058bf947ea10b37eadf6122292e708bd3809..609f02a70ffc2e997f47a8ae5c07c0f1ced971fa 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
||||||
@@ -2991,18 +2991,45 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
||||||
maxX = axisalignedbb.maxX,
|
|
||||||
maxY = axisalignedbb.maxY,
|
|
||||||
maxZ = axisalignedbb.maxZ;
|
|
||||||
+ // Paper start - use saner max's for bounding box
|
|
||||||
+ boolean illegal = false;
|
|
||||||
+ double maxW = Math.max(1, this.getWidth() * 2);
|
|
||||||
+ double maxH = Math.max(1, this.getHeight());
|
|
||||||
double len = axisalignedbb.maxX - axisalignedbb.minX;
|
|
||||||
- if (len < 0) maxX = minX;
|
|
||||||
- if (len > 64) maxX = minX + 64.0;
|
|
||||||
+ if (len < 0) {
|
|
||||||
+ maxX = minX;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
+ if (len > maxW+1.0E-7D) {
|
|
||||||
+ maxX = minX + maxW;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
len = axisalignedbb.maxY - axisalignedbb.minY;
|
|
||||||
- if (len < 0) maxY = minY;
|
|
||||||
- if (len > 64) maxY = minY + 64.0;
|
|
||||||
+ if (len < 0) {
|
|
||||||
+ maxY = minY;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
+ if (len > maxH+1.0E-7D) {
|
|
||||||
+ maxY = minY + maxH;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
len = axisalignedbb.maxZ - axisalignedbb.minZ;
|
|
||||||
- if (len < 0) maxZ = minZ;
|
|
||||||
- if (len > 64) maxZ = minZ + 64.0;
|
|
||||||
+ if (len < 0) {
|
|
||||||
+ maxZ = minZ;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
+ if (len > maxW+1.0E-7D) {
|
|
||||||
+ maxZ = minZ + maxW;
|
|
||||||
+ illegal = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
this.boundingBox = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
|
||||||
+ if (illegal) {
|
|
||||||
+ new Throwable("Illegal Entity bounding box attempt on (" + this + ") - tried: " + axisalignedbb + " - using: " + boundingBox).printStackTrace();
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
// CraftBukkit end
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue