From dd852fefb7488e5a8da4f1f02175f42869c1af6e Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Mon, 10 Jun 2024 23:02:30 +0200 Subject: [PATCH] Add slime/magma_cube dimension change in 1.20.3->.5 --- .../grimac/utils/nmsutil/BoundingBoxSize.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/ac/grim/grimac/utils/nmsutil/BoundingBoxSize.java b/src/main/java/ac/grim/grimac/utils/nmsutil/BoundingBoxSize.java index ed422392de..1a514e0e20 100644 --- a/src/main/java/ac/grim/grimac/utils/nmsutil/BoundingBoxSize.java +++ b/src/main/java/ac/grim/grimac/utils/nmsutil/BoundingBoxSize.java @@ -74,9 +74,11 @@ private static float getWidthMinusBaby(GrimPlayer player, PacketEntity packetEnt return 1.4f; } else if (EntityTypes.MAGMA_CUBE.equals(type)) { if (packetEntity instanceof PacketEntitySizeable) { - return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) - ? 2.04f * (0.255f * (float) ((PacketEntitySizeable) packetEntity).size) - : 0.51000005f * ((PacketEntitySizeable) packetEntity).size; + float size = ((PacketEntitySizeable) packetEntity).size; + return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5) + ? 0.52f * size : player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) + ? 2.04f * (0.255f * size) + : 0.51000005f * size; } return 0.98f; @@ -92,9 +94,10 @@ private static float getWidthMinusBaby(GrimPlayer player, PacketEntity packetEnt return 1.0f; } else if (EntityTypes.SLIME.equals(type)) { if (packetEntity instanceof PacketEntitySizeable) { - return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) - ? 2.04f * (0.255f * (float) ((PacketEntitySizeable) packetEntity).size) - : 0.51000005f * ((PacketEntitySizeable) packetEntity).size; + float size = ((PacketEntitySizeable) packetEntity).size; + return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5) + ? 0.52f * size : player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) + ? 2.04f * (0.255f * size) : 0.51000005f * size; } return 0.3125f; @@ -292,9 +295,11 @@ private static float getHeightMinusBaby(GrimPlayer player, PacketEntity packetEn return 0.4f; } else if (EntityTypes.MAGMA_CUBE.equals(type)) { if (packetEntity instanceof PacketEntitySizeable) { - return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) - ? 2.04f * (0.255f * (float) ((PacketEntitySizeable) packetEntity).size) - : 0.51000005f * ((PacketEntitySizeable) packetEntity).size; + float size = ((PacketEntitySizeable) packetEntity).size; + return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5) + ? 0.52f * size : player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) + ? 2.04f * (0.255f * size) + : 0.51000005f * size; } return 0.7f; @@ -338,9 +343,11 @@ private static float getHeightMinusBaby(GrimPlayer player, PacketEntity packetEn return 1.6f; } else if (EntityTypes.SLIME.equals(type)) { if (packetEntity instanceof PacketEntitySizeable) { - return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) - ? 2.04f * (0.255f * (float) ((PacketEntitySizeable) packetEntity).size) - : 0.51000005f * ((PacketEntitySizeable) packetEntity).size; + float size = ((PacketEntitySizeable) packetEntity).size; + return player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_5) + ? 0.52f * size : player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) + ? 2.04f * (0.255f * size) + : 0.51000005f * size; } return 0.3125f;