mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
Ensure shulker bounding box is updated (#6010)
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
parent
d8ad276b7d
commit
79d7dfbbe5
@ -5,28 +5,42 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 912723108af2ffe660f0c2e528e4e028f7f74bcb..b208f561ab8bb0ea9ad06fb2a30becef4583c2e6 100644
|
index 581f1ba9a24f5c5267dea29c892c6dfe03468f0c..8278d38d6d61bff836c49ae5651f2be195389d1b 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -560,7 +560,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -559,8 +559,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
|
}
|
||||||
|
|
||||||
public void setPos(double x, double y, double z) {
|
public void setPos(double x, double y, double z) {
|
||||||
this.setPosRaw(x, y, z);
|
- this.setPosRaw(x, y, z);
|
||||||
- this.setBoundingBox(this.makeBoundingBox());
|
- this.setBoundingBox(this.makeBoundingBox());
|
||||||
|
+ this.setPosRaw(x, y, z, true); // Paper - force bounding box update
|
||||||
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
|
+ // this.setBoundingBox(this.makeBoundingBox()); // Paper - move into setPositionRaw
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AABB makeBoundingBox() {
|
protected AABB makeBoundingBox() {
|
||||||
@@ -3740,6 +3740,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -3740,6 +3740,11 @@ 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) {
|
||||||
+ // Paper start - never allow AABB to become desynced from position
|
+ // Paper start
|
||||||
+ // hanging has its own special logic
|
+ this.setPosRaw(x, y, z, false);
|
||||||
+ 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));
|
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
||||||
+ }
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
if (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);
|
this.position = new Vec3(x, y, z);
|
||||||
int i = Mth.floor(x);
|
int i = Mth.floor(x);
|
||||||
|
@@ -3758,6 +3763,12 @@ 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() {}
|
||||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 6fe23851c3ab105c8ebc4fd7ded47da205d5036c..487b22171521de0cae30e57ca7f62cf05aeb3b0c 100644
|
index c9ea809bcfd394f5a9483351ee0d4619c541f481..14edbf6b2dc7697f9b703aa83d8529dd8ffe73a8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3927,4 +3927,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -3932,4 +3932,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
|
|
||||||
void accept(Entity entity, double x, double y, double z);
|
void accept(Entity entity, double x, double y, double z);
|
||||||
}
|
}
|
||||||
@ -21,7 +21,7 @@ index 6fe23851c3ab105c8ebc4fd7ded47da205d5036c..487b22171521de0cae30e57ca7f62cf0
|
|||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
index 736cbdc118b7a19b724a3afd433927e8e8316d23..a6250143baced61e87900181f8b37cfd89c717ff 100644
|
index 135749c789d44f0af1ad11ccd1b208f1e28853eb..8c1ac43cf5510a14d1d41ec45d189ad9711024da 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -443,6 +443,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -443,6 +443,10 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Entity#isTicking
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 487b22171521de0cae30e57ca7f62cf05aeb3b0c..a8d000717a52e3896c0c81e8cf754d8cfbeadf52 100644
|
index 14edbf6b2dc7697f9b703aa83d8529dd8ffe73a8..477b6102361f0ae03541402578e1d053572e52d3 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey;
|
@@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey;
|
||||||
@ -16,7 +16,7 @@ index 487b22171521de0cae30e57ca7f62cf05aeb3b0c..a8d000717a52e3896c0c81e8cf754d8c
|
|||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.server.level.TicketType;
|
import net.minecraft.server.level.TicketType;
|
||||||
@@ -3932,5 +3933,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -3937,5 +3938,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
public static int nextEntityId() {
|
public static int nextEntityId() {
|
||||||
return ENTITY_COUNTER.incrementAndGet();
|
return ENTITY_COUNTER.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ loss, which forces the server to lose the same precision as the client
|
|||||||
keeping them in sync.
|
keeping them in sync.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
index 652d87fc5d566dba8018c81676329f0e0bca471b..c56e7fb18f9a56c8025eb70a524f028b5942da37 100644
|
index e62bb33852b0dca346aeb3cb2747d1a5686dea2d..ea4fa458113d68dc2ed3187e19b11d72fc05d36c 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||||
@@ -474,4 +474,9 @@ public class PaperConfig {
|
@@ -474,4 +474,9 @@ public class PaperConfig {
|
||||||
@ -41,13 +41,13 @@ index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f9
|
|||||||
|
|
||||||
public Vec3 updateEntityPosition(Vec3 orig) {
|
public Vec3 updateEntityPosition(Vec3 orig) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 9c37264884d1353de9b1ef388773d1991f5db2b4..bf8e02e23fce3c48fc07c0bdb4ac137c8ba13e03 100644
|
index db2ca58064000ac73c054d51590ccbcb9151d596..f744bf2d19291991ffa9c7b13fc62a479702d201 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -3754,6 +3754,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
@@ -3759,6 +3759,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
}
|
}
|
||||||
|
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
|
||||||
public final void setPosRaw(double x, double y, double z) {
|
// Paper end
|
||||||
+ // Paper start - fix MC-4
|
+ // Paper start - fix MC-4
|
||||||
+ if (this instanceof ItemEntity) {
|
+ if (this instanceof ItemEntity) {
|
||||||
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
|
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
|
||||||
@ -58,6 +58,6 @@ index 9c37264884d1353de9b1ef388773d1991f5db2b4..bf8e02e23fce3c48fc07c0bdb4ac137c
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - fix MC-4
|
+ // Paper end - fix MC-4
|
||||||
// Paper start - never allow AABB to become desynced from position
|
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||||
// hanging has its own special logic
|
this.position = new Vec3(x, y, z);
|
||||||
if (!(this instanceof net.minecraft.world.entity.decoration.HangingEntity) && (this.position.x != x || this.position.y != y || this.position.z != z)) {
|
int i = Mth.floor(x);
|
||||||
|
Loading…
Reference in New Issue
Block a user