Skip to content

Commit

Permalink
Add slime/magma_cube dimension change in 1.20.3->.5
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Jun 10, 2024
1 parent 21c119d commit dd852fe
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 dd852fe

Please sign in to comment.