Skip to content

Commit

Permalink
1.21.2 (#1447)
Browse files Browse the repository at this point in the history
* 24w33a

* 24w34a

* 24w38a

* 24w40a

* 1.21.2
  • Loading branch information
Gerrygames authored Oct 22, 2024
1 parent 2c8ce21 commit 05235da
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public boolean isSupported() {
MINECRAFT_1_20_2(764, "1.20.2"),
MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"),
MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"),
MINECRAFT_1_21(767, "1.21", "1.21.1");
MINECRAFT_1_21(767, "1.21", "1.21.1"),
MINECRAFT_1_21_2(768, "1.21.2");

private static final int SNAPSHOT_BIT = 30;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ public interface PlayerSettings {
*/
boolean isClientListingAllowed();

/**
* Returns if the client has text filtering enabled.
*
* @return if text filtering is enabled
*/
boolean isTextFilteringEnabled();

/**
* Returns the selected "Particles" option state.
*
* @return the particle option
*/
ParticleStatus getParticleStatus();

/**
* The client's current chat display mode.
*/
Expand All @@ -84,4 +98,13 @@ enum MainHand {
LEFT,
RIGHT
}

/**
* The client's current "Particles" option state.
*/
enum ParticleStatus {
ALL,
DECREASED,
MINIMAL
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class ClientSettingsWrapper implements PlayerSettings {

static final PlayerSettings DEFAULT = new ClientSettingsWrapper(
new ClientSettingsPacket("en_US", (byte) 10, 0, true, (short) 127, 1, true, false));
new ClientSettingsPacket("en_us", (byte) 2, 0, true, (short) 0, 1, false, false, 0));

private final ClientSettingsPacket settings;
private final SkinParts parts;
Expand All @@ -56,11 +56,11 @@ public byte getViewDistance() {

@Override
public ChatMode getChatMode() {
int chat = settings.getChatVisibility();
if (chat < 0 || chat > 2) {
return ChatMode.SHOWN;
}
return ChatMode.values()[chat];
return switch (settings.getChatVisibility()) {
case 1 -> ChatMode.COMMANDS_ONLY;
case 2 -> ChatMode.HIDDEN;
default -> ChatMode.SHOWN;
};
}

@Override
Expand All @@ -83,6 +83,20 @@ public boolean isClientListingAllowed() {
return settings.isClientListingAllowed();
}

@Override
public boolean isTextFilteringEnabled() {
return settings.isTextFilteringEnabled();
}

@Override
public ParticleStatus getParticleStatus() {
return switch (settings.getParticleStatus()) {
case 1 -> ParticleStatus.DECREASED;
case 2 -> ParticleStatus.MINIMAL;
default -> ParticleStatus.ALL;
};
}

@Override
public boolean equals(@Nullable final Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_5;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21_2;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_7_2;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
Expand Down Expand Up @@ -252,7 +253,8 @@ public enum StateRegistry {
map(0x08, MINECRAFT_1_19_3, false),
map(0x09, MINECRAFT_1_19_4, false),
map(0x0A, MINECRAFT_1_20_2, false),
map(0x0B, MINECRAFT_1_20_5, false));
map(0x0B, MINECRAFT_1_20_5, false),
map(0x0D, MINECRAFT_1_21_2, false));
serverbound.register(
LegacyChatPacket.class,
LegacyChatPacket::new,
Expand All @@ -264,7 +266,8 @@ public enum StateRegistry {
serverbound.register(
ChatAcknowledgementPacket.class,
ChatAcknowledgementPacket::new,
map(0x03, MINECRAFT_1_19_3, false));
map(0x03, MINECRAFT_1_19_3, false),
map(0x04, MINECRAFT_1_21_2, false));
serverbound.register(KeyedPlayerCommandPacket.class, KeyedPlayerCommandPacket::new,
map(0x03, MINECRAFT_1_19, false),
map(0x04, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false));
Expand All @@ -273,14 +276,17 @@ public enum StateRegistry {
map(0x05, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false));
serverbound.register(SessionPlayerCommandPacket.class, SessionPlayerCommandPacket::new,
map(0x04, MINECRAFT_1_19_3, false),
map(0x05, MINECRAFT_1_20_5, false));
map(0x05, MINECRAFT_1_20_5, false),
map(0x06, MINECRAFT_1_21_2, false));
serverbound.register(UnsignedPlayerCommandPacket.class, UnsignedPlayerCommandPacket::new,
map(0x04, MINECRAFT_1_20_5, false));
map(0x04, MINECRAFT_1_20_5, false),
map(0x05, MINECRAFT_1_21_2, false));
serverbound.register(
SessionPlayerChatPacket.class,
SessionPlayerChatPacket::new,
map(0x05, MINECRAFT_1_19_3, false),
map(0x06, MINECRAFT_1_20_5, false));
map(0x06, MINECRAFT_1_20_5, false),
map(0x07, MINECRAFT_1_21_2, false));
serverbound.register(
ClientSettingsPacket.class,
ClientSettingsPacket::new,
Expand All @@ -294,10 +300,12 @@ public enum StateRegistry {
map(0x07, MINECRAFT_1_19_3, false),
map(0x08, MINECRAFT_1_19_4, false),
map(0x09, MINECRAFT_1_20_2, false),
map(0x0A, MINECRAFT_1_20_5, false));
map(0x0A, MINECRAFT_1_20_5, false),
map(0x0C, MINECRAFT_1_21_2, false));
serverbound.register(
ServerboundCookieResponsePacket.class, ServerboundCookieResponsePacket::new,
map(0x11, MINECRAFT_1_20_5, false));
map(0x11, MINECRAFT_1_20_5, false),
map(0x13, MINECRAFT_1_21_2, false));
serverbound.register(
PluginMessagePacket.class,
PluginMessagePacket::new,
Expand All @@ -314,7 +322,8 @@ public enum StateRegistry {
map(0x0D, MINECRAFT_1_19_4, false),
map(0x0F, MINECRAFT_1_20_2, false),
map(0x10, MINECRAFT_1_20_3, false),
map(0x12, MINECRAFT_1_20_5, false));
map(0x12, MINECRAFT_1_20_5, false),
map(0x14, MINECRAFT_1_21_2, false));
serverbound.register(
KeepAlivePacket.class,
KeepAlivePacket::new,
Expand All @@ -332,7 +341,8 @@ public enum StateRegistry {
map(0x12, MINECRAFT_1_19_4, false),
map(0x14, MINECRAFT_1_20_2, false),
map(0x15, MINECRAFT_1_20_3, false),
map(0x18, MINECRAFT_1_20_5, false));
map(0x18, MINECRAFT_1_20_5, false),
map(0x1A, MINECRAFT_1_21_2, false));
serverbound.register(
ResourcePackResponsePacket.class,
ResourcePackResponsePacket::new,
Expand All @@ -347,11 +357,13 @@ public enum StateRegistry {
map(0x24, MINECRAFT_1_19_1, false),
map(0x27, MINECRAFT_1_20_2, false),
map(0x28, MINECRAFT_1_20_3, false),
map(0x2B, MINECRAFT_1_20_5, false));
map(0x2B, MINECRAFT_1_20_5, false),
map(0x2D, MINECRAFT_1_21_2, false));
serverbound.register(
FinishedUpdatePacket.class, () -> FinishedUpdatePacket.INSTANCE,
map(0x0B, MINECRAFT_1_20_2, false),
map(0x0C, MINECRAFT_1_20_5, false));
map(0x0C, MINECRAFT_1_20_5, false),
map(0x0E, MINECRAFT_1_21_2, false));

clientbound.register(
BossBarPacket.class,
Expand Down Expand Up @@ -449,7 +461,8 @@ public enum StateRegistry {
map(0x1F, MINECRAFT_1_19_3, false),
map(0x23, MINECRAFT_1_19_4, false),
map(0x24, MINECRAFT_1_20_2, false),
map(0x26, MINECRAFT_1_20_5, false));
map(0x26, MINECRAFT_1_20_5, false),
map(0x27, MINECRAFT_1_21_2, false));
clientbound.register(
JoinGamePacket.class,
JoinGamePacket::new,
Expand All @@ -466,7 +479,8 @@ public enum StateRegistry {
map(0x24, MINECRAFT_1_19_3, false),
map(0x28, MINECRAFT_1_19_4, false),
map(0x29, MINECRAFT_1_20_2, false),
map(0x2B, MINECRAFT_1_20_5, false));
map(0x2B, MINECRAFT_1_20_5, false),
map(0x2C, MINECRAFT_1_21_2, false));
clientbound.register(
RespawnPacket.class,
RespawnPacket::new,
Expand All @@ -486,12 +500,14 @@ public enum StateRegistry {
map(0x41, MINECRAFT_1_19_4, true),
map(0x43, MINECRAFT_1_20_2, true),
map(0x45, MINECRAFT_1_20_3, true),
map(0x47, MINECRAFT_1_20_5, true));
map(0x47, MINECRAFT_1_20_5, true),
map(0x4C, MINECRAFT_1_21_2, true));
clientbound.register(
RemoveResourcePackPacket.class,
RemoveResourcePackPacket::new,
map(0x43, MINECRAFT_1_20_3, false),
map(0x45, MINECRAFT_1_20_5, false));
map(0x45, MINECRAFT_1_20_5, false),
map(0x4A, MINECRAFT_1_21_2, false));
clientbound.register(
ResourcePackRequestPacket.class,
ResourcePackRequestPacket::new,
Expand All @@ -511,7 +527,8 @@ public enum StateRegistry {
map(0x40, MINECRAFT_1_19_4, false),
map(0x42, MINECRAFT_1_20_2, false),
map(0x44, MINECRAFT_1_20_3, false),
map(0x46, MINECRAFT_1_20_5, false));
map(0x46, MINECRAFT_1_20_5, false),
map(0x4B, MINECRAFT_1_21_2, false));
clientbound.register(
HeaderAndFooterPacket.class,
HeaderAndFooterPacket::new,
Expand All @@ -532,7 +549,8 @@ public enum StateRegistry {
map(0x65, MINECRAFT_1_19_4, true),
map(0x68, MINECRAFT_1_20_2, true),
map(0x6A, MINECRAFT_1_20_3, true),
map(0x6D, MINECRAFT_1_20_5, true));
map(0x6D, MINECRAFT_1_20_5, true),
map(0x74, MINECRAFT_1_21_2, true));
clientbound.register(
LegacyTitlePacket.class,
LegacyTitlePacket::new,
Expand All @@ -552,7 +570,8 @@ public enum StateRegistry {
map(0x5D, MINECRAFT_1_19_4, true),
map(0x5F, MINECRAFT_1_20_2, true),
map(0x61, MINECRAFT_1_20_3, true),
map(0x63, MINECRAFT_1_20_5, true));
map(0x63, MINECRAFT_1_20_5, true),
map(0x6A, MINECRAFT_1_21_2, true));
clientbound.register(
TitleTextPacket.class,
TitleTextPacket::new,
Expand All @@ -563,7 +582,8 @@ public enum StateRegistry {
map(0x5F, MINECRAFT_1_19_4, true),
map(0x61, MINECRAFT_1_20_2, true),
map(0x63, MINECRAFT_1_20_3, true),
map(0x65, MINECRAFT_1_20_5, true));
map(0x65, MINECRAFT_1_20_5, true),
map(0x6C, MINECRAFT_1_21_2, true));
clientbound.register(
TitleActionbarPacket.class,
TitleActionbarPacket::new,
Expand All @@ -574,7 +594,8 @@ public enum StateRegistry {
map(0x46, MINECRAFT_1_19_4, true),
map(0x48, MINECRAFT_1_20_2, true),
map(0x4A, MINECRAFT_1_20_3, true),
map(0x4C, MINECRAFT_1_20_5, true));
map(0x4C, MINECRAFT_1_20_5, true),
map(0x51, MINECRAFT_1_21_2, true));
clientbound.register(
TitleTimesPacket.class,
TitleTimesPacket::new,
Expand All @@ -585,7 +606,8 @@ public enum StateRegistry {
map(0x60, MINECRAFT_1_19_4, true),
map(0x62, MINECRAFT_1_20_2, true),
map(0x64, MINECRAFT_1_20_3, true),
map(0x66, MINECRAFT_1_20_5, true));
map(0x66, MINECRAFT_1_20_5, true),
map(0x6D, MINECRAFT_1_21_2, true));
clientbound.register(
TitleClearPacket.class,
TitleClearPacket::new,
Expand All @@ -612,17 +634,20 @@ public enum StateRegistry {
map(0x35, MINECRAFT_1_19_3, false),
map(0x39, MINECRAFT_1_19_4, false),
map(0x3B, MINECRAFT_1_20_2, false),
map(0x3D, MINECRAFT_1_20_5, false));
map(0x3D, MINECRAFT_1_20_5, false),
map(0x3F, MINECRAFT_1_21_2, false));
clientbound.register(
UpsertPlayerInfoPacket.class,
UpsertPlayerInfoPacket::new,
map(0x36, MINECRAFT_1_19_3, false),
map(0x3A, MINECRAFT_1_19_4, false),
map(0x3C, MINECRAFT_1_20_2, false),
map(0x3E, MINECRAFT_1_20_5, false));
map(0x3E, MINECRAFT_1_20_5, false),
map(0x40, MINECRAFT_1_21_2, false));
clientbound.register(
ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new,
map(0x6B, MINECRAFT_1_20_5, false));
map(0x6B, MINECRAFT_1_20_5, false),
map(0x72, MINECRAFT_1_21_2, false));
clientbound.register(
SystemChatPacket.class,
SystemChatPacket::new,
Expand All @@ -632,7 +657,8 @@ public enum StateRegistry {
map(0x64, MINECRAFT_1_19_4, true),
map(0x67, MINECRAFT_1_20_2, true),
map(0x69, MINECRAFT_1_20_3, true),
map(0x6C, MINECRAFT_1_20_5, true));
map(0x6C, MINECRAFT_1_20_5, true),
map(0x73, MINECRAFT_1_21_2, true));
clientbound.register(
PlayerChatCompletionPacket.class,
PlayerChatCompletionPacket::new,
Expand All @@ -650,26 +676,34 @@ public enum StateRegistry {
map(0x45, MINECRAFT_1_19_4, false),
map(0x47, MINECRAFT_1_20_2, false),
map(0x49, MINECRAFT_1_20_3, false),
map(0x4B, MINECRAFT_1_20_5, false));
map(0x4B, MINECRAFT_1_20_5, false),
map(0x50, MINECRAFT_1_21_2, false));
clientbound.register(
StartUpdatePacket.class,
() -> StartUpdatePacket.INSTANCE,
map(0x65, MINECRAFT_1_20_2, false),
map(0x67, MINECRAFT_1_20_3, false),
map(0x69, MINECRAFT_1_20_5, false));
map(0x69, MINECRAFT_1_20_5, false),
map(0x70, MINECRAFT_1_21_2, false));
clientbound.register(
BundleDelimiterPacket.class,
() -> BundleDelimiterPacket.INSTANCE,
map(0x00, MINECRAFT_1_19_4, false));
clientbound.register(
TransferPacket.class,
TransferPacket::new,
map(0x73, MINECRAFT_1_20_5, false)
);
clientbound.register(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new,
map(0x7A, MINECRAFT_1_21, false));
clientbound.register(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new,
map(0x7B, MINECRAFT_1_21, false));
map(0x73, MINECRAFT_1_20_5, false),
map(0x7A, MINECRAFT_1_21_2, false));
clientbound.register(
ClientboundCustomReportDetailsPacket.class,
ClientboundCustomReportDetailsPacket::new,
map(0x7A, MINECRAFT_1_21, false),
map(0x81, MINECRAFT_1_21_2, false));
clientbound.register(
ClientboundServerLinksPacket.class,
ClientboundServerLinksPacket::new,
map(0x7B, MINECRAFT_1_21, false),
map(0x82, MINECRAFT_1_21_2, false));
}
},
LOGIN {
Expand Down
Loading

0 comments on commit 05235da

Please sign in to comment.