From ad6b24345bf9eca342ccd1091518ee8909e672dc Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Fri, 20 Sep 2024 03:43:41 -0400 Subject: [PATCH] Minor Dynamic Fence cleanup --- .../blocks/connecting/DynamicCollisionFence.java | 2 -- .../blocks/connecting/DynamicHitboxFence.java | 15 +-------------- 2 files changed, 1 insertion(+), 16 deletions(-) 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 865e1a0dad..bb531178d5 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 @@ -21,8 +21,6 @@ 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); - public static SimpleCollisionBox[] LEGACY_BOUNDING_BOXES = 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)}; - @Override public CollisionBox fetch(GrimPlayer player, ClientVersion version, WrappedBlockState block, int x, int y, int z) { boolean east; 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 5865d24f92..4d4ed8a51f 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 @@ -69,20 +69,7 @@ public CollisionBox fetch(GrimPlayer player, StateType heldItem, ClientVersion v } private CollisionBox getLegacyCollisionBox(boolean north, boolean east, boolean south, boolean west) { - int i = 0; - if (south) { - i |= 0b1; - } - if (west) { - i |= 0b10; - } - if (north) { - i |= 0b100; - } - if (east) { - i |= 0b1000; - } - return LEGACY_HITBOXES[i].copy(); + return LEGACY_HITBOXES[getAABBIndex(north, east, south, west)].copy(); } private CollisionBox getModernCollisionBox(boolean north, boolean east, boolean south, boolean west) {