diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionFence.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionFence.java index dc4aa58c3e..2da9a7d239 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionFence.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionFence.java @@ -18,7 +18,7 @@ import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes; public class DynamicCollisionFence extends DynamicConnecting implements CollisionFactory { - private static final CollisionBox[] COLLISION_BOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true); + private static final CollisionBox[] COLLISION_BOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true, 1); @Override public CollisionBox fetch(GrimPlayer player, ClientVersion version, WrappedBlockState block, int x, int y, int z) { diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionPane.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionPane.java index 10d7494e0f..fd49dbc570 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionPane.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionPane.java @@ -21,7 +21,7 @@ public class DynamicCollisionPane extends DynamicConnecting implements CollisionFactory { - private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true); + private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true, 1); @Override public CollisionBox fetch(GrimPlayer player, ClientVersion version, WrappedBlockState block, int x, int y, int z) { diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionWall.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionWall.java index 4c84d41b99..ab533afb68 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionWall.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicCollisionWall.java @@ -16,10 +16,9 @@ import com.github.retrooper.packetevents.protocol.world.states.type.StateType; public class DynamicCollisionWall extends DynamicConnecting implements CollisionFactory { - public static final CollisionBox[] BOXES = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 16.0F, false); // https://bugs.mojang.com/browse/MC-9565 // https://bugs.mojang.com/browse/MC-94016 - private static final CollisionBox[] COLLISION_BOXES = makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, false); + private static final CollisionBox[] COLLISION_BOXES = makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, false, 1); /** * @deprecated use DynamicHitboxWall diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicConnecting.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicConnecting.java index 79c18c9556..ed339eceda 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicConnecting.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicConnecting.java @@ -18,7 +18,7 @@ public class DynamicConnecting { - public static CollisionBox[] makeShapes(float p_196408_1_, float p_196408_2_, float p_196408_3_, float p_196408_4_, float p_196408_5_, boolean includeCenter) { + public static CollisionBox[] makeShapes(float p_196408_1_, float p_196408_2_, float p_196408_3_, float p_196408_4_, float p_196408_5_, boolean includeCenter, int additionalMaxIndex) { float middleMin = 8.0F - p_196408_1_; float middleMax = 8.0F + p_196408_1_; float f2 = 8.0F - p_196408_2_; @@ -29,19 +29,17 @@ public static CollisionBox[] makeShapes(float p_196408_1_, float p_196408_2_, fl SimpleCollisionBox voxelshape3 = new HexCollisionBox(0.0D, p_196408_4_, f2, f3, p_196408_5_, f3); SimpleCollisionBox voxelshape4 = new HexCollisionBox(f2, p_196408_4_, f2, 16.0D, p_196408_5_, f3); - int extraShapeOffset = includeCenter ? 1 : 0; - - ComplexCollisionBox voxelshape5 = new ComplexCollisionBox(2 + extraShapeOffset, voxelshape1, voxelshape4); - ComplexCollisionBox voxelshape6 = new ComplexCollisionBox(2 + extraShapeOffset, voxelshape2, voxelshape3); + ComplexCollisionBox voxelshape5 = new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape1, voxelshape4); + ComplexCollisionBox voxelshape6 = new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape2, voxelshape3); CollisionBox[] avoxelshape = new CollisionBox[]{ NoCollisionBox.INSTANCE, voxelshape2, voxelshape3, voxelshape6, voxelshape1, - new ComplexCollisionBox(2 + extraShapeOffset, voxelshape2, voxelshape1), new ComplexCollisionBox(2 + extraShapeOffset, voxelshape3, voxelshape1), - new ComplexCollisionBox(3 + extraShapeOffset, voxelshape2, voxelshape3, voxelshape1), voxelshape4, - new ComplexCollisionBox(2 + extraShapeOffset, voxelshape2, voxelshape4), new ComplexCollisionBox(2 + extraShapeOffset, voxelshape3, voxelshape4), - new ComplexCollisionBox(3 + extraShapeOffset, voxelshape2, voxelshape3, voxelshape4), voxelshape5, - new ComplexCollisionBox(3 + extraShapeOffset, voxelshape2, voxelshape1, voxelshape4), new ComplexCollisionBox(3 + extraShapeOffset, voxelshape3, voxelshape1, voxelshape4), - new ComplexCollisionBox(4 + extraShapeOffset, voxelshape1, voxelshape2, voxelshape3, voxelshape4)}; + new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape2, voxelshape1), new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape3, voxelshape1), + new ComplexCollisionBox(3 + additionalMaxIndex, voxelshape2, voxelshape3, voxelshape1), voxelshape4, + new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape2, voxelshape4), new ComplexCollisionBox(2 + additionalMaxIndex, voxelshape3, voxelshape4), + new ComplexCollisionBox(3 + additionalMaxIndex, voxelshape2, voxelshape3, voxelshape4), voxelshape5, + new ComplexCollisionBox(3 + additionalMaxIndex, voxelshape2, voxelshape1, voxelshape4), new ComplexCollisionBox(3 + additionalMaxIndex, voxelshape3, voxelshape1, voxelshape4), + new ComplexCollisionBox(4 + additionalMaxIndex, voxelshape1, voxelshape2, voxelshape3, voxelshape4)}; if (includeCenter) { for (int i = 0; i < 16; ++i) { diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxFence.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxFence.java index d0bde13a9b..0a543ae06b 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxFence.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxFence.java @@ -18,7 +18,7 @@ public class DynamicHitboxFence extends DynamicConnecting implements HitBoxFactory { - private static final CollisionBox[] MODERN_HITBOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true); + private static final CollisionBox[] MODERN_HITBOXES = makeShapes(2.0F, 2.0F, 24.0F, 0.0F, 24.0F, true, 1); public static SimpleCollisionBox[] LEGACY_HITBOXES = new SimpleCollisionBox[] {new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.375D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.625D), new SimpleCollisionBox(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxPane.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxPane.java index 39226ed407..b8c98a1d93 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxPane.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxPane.java @@ -15,7 +15,7 @@ public class DynamicHitboxPane extends DynamicConnecting implements HitBoxFactory { - private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true); + private static final CollisionBox[] COLLISION_BOXES = makeShapes(1.0F, 1.0F, 16.0F, 0.0F, 16.0F, true, 1); @Override public CollisionBox fetch(GrimPlayer player, StateType item, ClientVersion version, WrappedBlockState block, int x, int y, int z) { diff --git a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxWall.java b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxWall.java index 2e3f4ce6e1..4c3f1fc3d9 100644 --- a/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxWall.java +++ b/src/main/java/ac/grim/grimac/utils/collisions/blocks/connecting/DynamicHitboxWall.java @@ -13,8 +13,6 @@ import com.github.retrooper.packetevents.protocol.world.states.type.StateType; public class DynamicHitboxWall extends DynamicConnecting implements HitBoxFactory { - private static final CollisionBox[] HIT_BOXES = makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 16.0F, false); - @Override public CollisionBox fetch(GrimPlayer player, StateType heldItem, ClientVersion version, WrappedBlockState state, int x, int y, int z) { int[] connections = getConnections(player, version, state, x, y, z);