Skip to content

Commit

Permalink
Fix Entity#isInWall for non-single AABB collisions
Browse files Browse the repository at this point in the history
Need to use the offseted bounding box to check for collisions
  • Loading branch information
Spottedleaf committed Sep 13, 2023
1 parent 3b16d8f commit ab06dbb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,7 @@ index d0a8092bf57a29ab7c00ec0ddf52a9fdb2a33267..392406722b0a040c1d41fdc1154d75d3
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) {
this.data3d = id;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..a3f9048d4f6c976c097a60833bd5edb239ef6d4a 100644
index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..91d96f89f33668a38c158c1bc1f76577d71514db 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1450,8 +1450,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Expand Down Expand Up @@ -2744,7 +2744,7 @@ index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..a3f9048d4f6c976c097a60833bd5edb2
+ final int newChunkX = fx >> 4;
+ final int newChunkZ = fz >> 4;
+ final net.minecraft.world.level.chunk.LevelChunk chunk = lastChunkKey == (lastChunkKey = io.papermc.paper.util.CoordinateUtils.getChunkKey(newChunkX, newChunkZ)) ?
+ lastChunk : (lastChunk = chunkProvider.getChunkAtIfLoadedImmediately(fx >> 4, fz >> 4));
+ lastChunk : (lastChunk = chunkProvider.getChunkAtIfLoadedImmediately(newChunkX, newChunkZ));
+ tempPos.setX(fx);
+ if (chunk == null) {
+ continue;
Expand Down Expand Up @@ -2780,7 +2780,7 @@ index fa35d2c1c8de225acd68e08f15976c92f7ab82aa..a3f9048d4f6c976c097a60833bd5edb2
- BlockState iblockdata = chunk.getBlockStateFinal(fx, fy, fz);
- blockposition.set(fx, fy, fz);
- if (!iblockdata.isAir() && iblockdata.isSuffocating(this.level, blockposition) && Shapes.joinIsNotEmpty(iblockdata.getCollisionShape(this.level, blockposition).move((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()), Shapes.create(axisalignedbb), BooleanOp.AND)) {
+ if (io.papermc.paper.util.CollisionUtil.voxelShapeIntersectNoEmpty(collisionShape, axisalignedbb)) {
+ if (io.papermc.paper.util.CollisionUtil.voxelShapeIntersectNoEmpty(collisionShape, toCollide)) {
return true;
}
+ continue;
Expand Down

0 comments on commit ab06dbb

Please sign in to comment.