From ee18e97b75ae70488f1c8c08269df09c5eee0036 Mon Sep 17 00:00:00 2001 From: OliverSchlueter Date: Tue, 22 Oct 2024 21:34:43 +0200 Subject: [PATCH] Add support for server version 1.21.2 --- .../fancysitula/api/utils/ServerVersion.java | 1 + .../fancysitula/factories/PacketFactory.java | 28 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/de/oliver/fancysitula/api/utils/ServerVersion.java b/api/src/main/java/de/oliver/fancysitula/api/utils/ServerVersion.java index 7b3643b..cdf26e3 100644 --- a/api/src/main/java/de/oliver/fancysitula/api/utils/ServerVersion.java +++ b/api/src/main/java/de/oliver/fancysitula/api/utils/ServerVersion.java @@ -7,6 +7,7 @@ public enum ServerVersion { + v1_21_2("1.21.2", 768), v1_21_1("1.21.1", 767), v1_21("1.21", 767), v1_20_6("1.20.6", 766), diff --git a/factories/src/main/java/de/oliver/fancysitula/factories/PacketFactory.java b/factories/src/main/java/de/oliver/fancysitula/factories/PacketFactory.java index 067fa3f..3541b65 100644 --- a/factories/src/main/java/de/oliver/fancysitula/factories/PacketFactory.java +++ b/factories/src/main/java/de/oliver/fancysitula/factories/PacketFactory.java @@ -26,7 +26,7 @@ public FS_ClientboundPlayerInfoUpdatePacket createPlayerInfoUpdatePacket( ServerVersion serverVersion, EnumSet actions, List entries) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundPlayerInfoUpdatePacketImpl(actions, entries); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -68,7 +68,7 @@ public FS_ClientboundAddEntityPacket createAddEntityPacket( int velocityZ, int data) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundAddEntityPacketImpl(entityId, entityUUID, entityType, x, y, z, yaw, pitch, headYaw, velocityX, velocityY, velocityZ, data); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -106,7 +106,7 @@ public FS_ClientboundAddEntityPacket createAddEntityPacket( */ public FS_ClientboundPlayerInfoRemovePacket createPlayerInfoRemovePacket(ServerVersion serverVersion, List uuids) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundPlayerInfoRemovePacketImpl(uuids); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -147,7 +147,7 @@ public FS_ClientboundPlayerInfoRemovePacket createPlayerInfoRemovePacket(UUID uu */ public FS_ClientboundRemoveEntitiesPacket createRemoveEntitiesPacket(ServerVersion serverVersion, List entityIds) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundRemoveEntitiesPacketImpl(entityIds); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -185,7 +185,7 @@ public FS_ClientboundTeleportEntityPacket createTeleportEntityPacket( boolean onGround ) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundTeleportEntityPacketImpl(entityId, x, y, z, yaw, pitch, onGround); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -223,7 +223,7 @@ public FS_ClientboundTeleportEntityPacket createTeleportEntityPacket( */ public FS_ClientboundRotateHeadPacket createRotateHeadPacket(ServerVersion serverVersion, int entityId, float headYaw) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundRotateHeadPacketImpl(entityId, headYaw); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -249,7 +249,7 @@ public FS_ClientboundRotateHeadPacket createRotateHeadPacket(int entityId, float public FS_ClientboundSetEntityDataPacket createSetEntityDataPacket( ServerVersion serverVersion, int entityId, List entityData) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundSetEntityDataPacketImpl(entityId, entityData); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -274,7 +274,7 @@ public FS_ClientboundSetEntityDataPacket createSetEntityDataPacket(int entityId, */ public FS_ClientboundSetEquipmentPacket createSetEquipmentPacket(ServerVersion serverVersion, int entityId, Map equipment) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundSetEquipmentPacketImpl(entityId, equipment); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -300,7 +300,7 @@ public FS_ClientboundSetEquipmentPacket createSetEquipmentPacket(int entityId, M public FS_ClientboundSetPassengersPacket createSetPassengersPacket( ServerVersion serverVersion, int entityId, List passengers) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundSetPassengersPacketImpl(entityId, passengers); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -329,7 +329,7 @@ public FS_ClientboundSetPassengersPacket createSetPassengersPacket(int entityId, */ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(ServerVersion serverVersion, String teamName, FS_ClientboundCreateOrUpdateTeamPacket.CreateTeam createTeam) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundCreateOrUpdateTeamPacketImpl(teamName, createTeam); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -358,7 +358,7 @@ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(Str */ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(ServerVersion serverVersion, String teamName, FS_ClientboundCreateOrUpdateTeamPacket.RemoveTeam removeTeam) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundCreateOrUpdateTeamPacketImpl(teamName, removeTeam); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -387,7 +387,7 @@ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(Str */ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(ServerVersion serverVersion, String teamName, FS_ClientboundCreateOrUpdateTeamPacket.UpdateTeam updateTeam) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundCreateOrUpdateTeamPacketImpl(teamName, updateTeam); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -416,7 +416,7 @@ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(Str */ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(ServerVersion serverVersion, String teamName, FS_ClientboundCreateOrUpdateTeamPacket.AddEntity addEntity) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundCreateOrUpdateTeamPacketImpl(teamName, addEntity); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion()); @@ -445,7 +445,7 @@ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(Str */ public FS_ClientboundCreateOrUpdateTeamPacket createCreateOrUpdateTeamPacket(ServerVersion serverVersion, String teamName, FS_ClientboundCreateOrUpdateTeamPacket.RemoveEntity removeEntity) { switch (serverVersion) { - case v1_20_5, v1_20_6, v1_21, v1_21_1 -> { + case v1_20_5, v1_20_6, v1_21, v1_21_1, v1_21_2 -> { return new de.oliver.fancysitula.versions.v1_20_6.packets.ClientboundCreateOrUpdateTeamPacketImpl(teamName, removeEntity); } default -> throw new IllegalArgumentException("Unsupported server version: " + serverVersion.getVersion());