Skip to content

Commit

Permalink
24w33a
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrygames committed Aug 19, 2024
1 parent 00ed228 commit 5321faa
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 53 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, 205, "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 @@ -486,12 +498,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(0x48, 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(0x46, MINECRAFT_1_21_2, false));
clientbound.register(
ResourcePackRequestPacket.class,
ResourcePackRequestPacket::new,
Expand All @@ -511,7 +525,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(0x47, MINECRAFT_1_21_2, false));
clientbound.register(
HeaderAndFooterPacket.class,
HeaderAndFooterPacket::new,
Expand All @@ -532,7 +547,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(0x70, MINECRAFT_1_21_2, true));
clientbound.register(
LegacyTitlePacket.class,
LegacyTitlePacket::new,
Expand All @@ -552,7 +568,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(0x66, MINECRAFT_1_21_2, true));
clientbound.register(
TitleTextPacket.class,
TitleTextPacket::new,
Expand All @@ -563,7 +580,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(0x68, MINECRAFT_1_21_2, true));
clientbound.register(
TitleActionbarPacket.class,
TitleActionbarPacket::new,
Expand All @@ -574,7 +592,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(0x4D, MINECRAFT_1_21_2, true));
clientbound.register(
TitleTimesPacket.class,
TitleTimesPacket::new,
Expand All @@ -585,7 +604,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(0x69, MINECRAFT_1_21_2, true));
clientbound.register(
TitleClearPacket.class,
TitleClearPacket::new,
Expand All @@ -612,17 +632,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(0x3E, 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(0x3F, 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(0x6E, MINECRAFT_1_21_2, false));
clientbound.register(
SystemChatPacket.class,
SystemChatPacket::new,
Expand All @@ -632,7 +655,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(0x6F, MINECRAFT_1_21_2, true));
clientbound.register(
PlayerChatCompletionPacket.class,
PlayerChatCompletionPacket::new,
Expand All @@ -650,26 +674,30 @@ 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(0x4C, 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(0x6C, 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)
);
map(0x73, MINECRAFT_1_20_5, false),
map(0x76, MINECRAFT_1_21_2, false));
clientbound.register(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new,
map(0x7A, MINECRAFT_1_21, false));
map(0x7A, MINECRAFT_1_21, false),
map(0x7D, MINECRAFT_1_21_2, false));
clientbound.register(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new,
map(0x7B, MINECRAFT_1_21, false));
map(0x7B, MINECRAFT_1_21, false),
map(0x7E, MINECRAFT_1_21_2, false));
}
},
LOGIN {
Expand Down
Loading

0 comments on commit 5321faa

Please sign in to comment.