Ensure shulker bounding box is updated (#6010)

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Bjarne Koll 2021-07-09 03:18:32 +02:00
parent 08e9f148f9
commit fc1a197de2
2 changed files with 25 additions and 11 deletions

View file

@ -9,10 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public void setPos(double x, double y, double z) {
this.setPosRaw(x, y, z);
- this.setPosRaw(x, y, z);
- this.setBoundingBox(this.makeBoundingBox());
+ this.setPosRaw(x, y, z, true); // Paper - force bounding box update
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
}
@ -21,12 +23,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
public final void setPosRaw(double x, double y, double z) {
+ // Paper start - never allow AABB to become desynced from position
+ // hanging has its own special logic
+ if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (this.position.x != x || this.position.y != y || this.position.z != z)) {
+ this.setBoundingBox(this.dimensions.makeBoundingBox(x, y, z));
+ }
+ // Paper start
+ this.setPosRaw(x, y, z, false);
+ }
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
+ // Paper end
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
}
+ // Paper start - never allow AABB to become desynced from position
+ // hanging has its own special logic
+ if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (forceBoundingBoxUpdate || this.position.x != x || this.position.y != y || this.position.z != z)) {
+ this.setBoundingBox(this.makeBoundingBox());
+ }
+ // Paper end
}
public void checkDespawn() {}

View file

@ -46,8 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
public final void setPosRaw(double x, double y, double z) {
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
// Paper end
+ // Paper start - fix MC-4
+ if (this instanceof ItemEntity) {
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
@ -58,6 +58,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+ // Paper end - fix MC-4
// Paper start - never allow AABB to become desynced from position
// hanging has its own special logic
if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (this.position.x != x || this.position.y != y || this.position.z != z)) {
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);