Skip to content

Commit

Permalink
Add support for server version 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Oct 22, 2024
1 parent c647673 commit ee18e97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public FS_ClientboundPlayerInfoUpdatePacket createPlayerInfoUpdatePacket(
ServerVersion serverVersion, EnumSet<FS_ClientboundPlayerInfoUpdatePacket.Action> actions,
List<FS_ClientboundPlayerInfoUpdatePacket.Entry> 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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -106,7 +106,7 @@ public FS_ClientboundAddEntityPacket createAddEntityPacket(
*/
public FS_ClientboundPlayerInfoRemovePacket createPlayerInfoRemovePacket(ServerVersion serverVersion, List<UUID> 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());
Expand Down Expand Up @@ -147,7 +147,7 @@ public FS_ClientboundPlayerInfoRemovePacket createPlayerInfoRemovePacket(UUID uu
*/
public FS_ClientboundRemoveEntitiesPacket createRemoveEntitiesPacket(ServerVersion serverVersion, List<Integer> 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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -249,7 +249,7 @@ public FS_ClientboundRotateHeadPacket createRotateHeadPacket(int entityId, float
public FS_ClientboundSetEntityDataPacket createSetEntityDataPacket(
ServerVersion serverVersion, int entityId, List<FS_ClientboundSetEntityDataPacket.EntityData> 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());
Expand All @@ -274,7 +274,7 @@ public FS_ClientboundSetEntityDataPacket createSetEntityDataPacket(int entityId,
*/
public FS_ClientboundSetEquipmentPacket createSetEquipmentPacket(ServerVersion serverVersion, int entityId, Map<FS_EquipmentSlot, ItemStack> 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());
Expand All @@ -300,7 +300,7 @@ public FS_ClientboundSetEquipmentPacket createSetEquipmentPacket(int entityId, M
public FS_ClientboundSetPassengersPacket createSetPassengersPacket(
ServerVersion serverVersion, int entityId, List<Integer> 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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit ee18e97

Please sign in to comment.