Skip to content

Commit

Permalink
Merge pull request #1527 from FlorianMichael/fix/update-entity-hitbox…
Browse files Browse the repository at this point in the history
…-registry

Add slime/magma_cube dimension change in 1.20.3->.5
  • Loading branch information
AoElite authored Jun 11, 2024
2 parents 6f85ff9 + dd852fe commit a5dbed6
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/main/java/ac/grim/grimac/utils/nmsutil/BoundingBoxSize.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a5dbed6

Please sign in to comment.