3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 14:40:21 +02:00
Dieser Commit ist enthalten in:
Gero 2024-08-19 11:47:13 +02:00
Ursprung 00ed2284ec
Commit 5321faa909
9 geänderte Dateien mit 195 neuen und 53 gelöschten Zeilen

Datei anzeigen

@ -87,7 +87,8 @@ public enum ProtocolVersion implements Ordered<ProtocolVersion> {
MINECRAFT_1_20_2(764, "1.20.2"), MINECRAFT_1_20_2(764, "1.20.2"),
MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"), MINECRAFT_1_20_3(765, "1.20.3", "1.20.4"),
MINECRAFT_1_20_5(766, "1.20.5", "1.20.6"), 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; private static final int SNAPSHOT_BIT = 30;

Datei anzeigen

@ -68,6 +68,20 @@ public interface PlayerSettings {
*/ */
boolean isClientListingAllowed(); 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. * The client's current chat display mode.
*/ */
@ -84,4 +98,13 @@ public interface PlayerSettings {
LEFT, LEFT,
RIGHT RIGHT
} }
/**
* The client's current "Particles" option state.
*/
enum ParticleStatus {
ALL,
DECREASED,
MINIMAL
}
} }

Datei anzeigen

@ -30,7 +30,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ClientSettingsWrapper implements PlayerSettings { public class ClientSettingsWrapper implements PlayerSettings {
static final PlayerSettings DEFAULT = new ClientSettingsWrapper( 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 ClientSettingsPacket settings;
private final SkinParts parts; private final SkinParts parts;
@ -56,11 +56,11 @@ public class ClientSettingsWrapper implements PlayerSettings {
@Override @Override
public ChatMode getChatMode() { public ChatMode getChatMode() {
int chat = settings.getChatVisibility(); return switch (settings.getChatVisibility()) {
if (chat < 0 || chat > 2) { case 1 -> ChatMode.COMMANDS_ONLY;
return ChatMode.SHOWN; case 2 -> ChatMode.HIDDEN;
} default -> ChatMode.SHOWN;
return ChatMode.values()[chat]; };
} }
@Override @Override
@ -83,6 +83,20 @@ public class ClientSettingsWrapper implements PlayerSettings {
return settings.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 @Override
public boolean equals(@Nullable final Object o) { public boolean equals(@Nullable final Object o) {
if (this == o) { if (this == o) {

Datei anzeigen

@ -37,6 +37,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_2;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_20_3; 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_20_5;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_21; 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_7_2;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9; import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
@ -252,7 +253,8 @@ public enum StateRegistry {
map(0x08, MINECRAFT_1_19_3, false), map(0x08, MINECRAFT_1_19_3, false),
map(0x09, MINECRAFT_1_19_4, false), map(0x09, MINECRAFT_1_19_4, false),
map(0x0A, MINECRAFT_1_20_2, 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( serverbound.register(
LegacyChatPacket.class, LegacyChatPacket.class,
LegacyChatPacket::new, LegacyChatPacket::new,
@ -264,7 +266,8 @@ public enum StateRegistry {
serverbound.register( serverbound.register(
ChatAcknowledgementPacket.class, ChatAcknowledgementPacket.class,
ChatAcknowledgementPacket::new, 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, serverbound.register(KeyedPlayerCommandPacket.class, KeyedPlayerCommandPacket::new,
map(0x03, MINECRAFT_1_19, false), map(0x03, MINECRAFT_1_19, false),
map(0x04, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false)); map(0x04, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false));
@ -273,14 +276,17 @@ public enum StateRegistry {
map(0x05, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false)); map(0x05, MINECRAFT_1_19_1, MINECRAFT_1_19_1, false));
serverbound.register(SessionPlayerCommandPacket.class, SessionPlayerCommandPacket::new, serverbound.register(SessionPlayerCommandPacket.class, SessionPlayerCommandPacket::new,
map(0x04, MINECRAFT_1_19_3, false), 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, 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( serverbound.register(
SessionPlayerChatPacket.class, SessionPlayerChatPacket.class,
SessionPlayerChatPacket::new, SessionPlayerChatPacket::new,
map(0x05, MINECRAFT_1_19_3, false), 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( serverbound.register(
ClientSettingsPacket.class, ClientSettingsPacket.class,
ClientSettingsPacket::new, ClientSettingsPacket::new,
@ -294,10 +300,12 @@ public enum StateRegistry {
map(0x07, MINECRAFT_1_19_3, false), map(0x07, MINECRAFT_1_19_3, false),
map(0x08, MINECRAFT_1_19_4, false), map(0x08, MINECRAFT_1_19_4, false),
map(0x09, MINECRAFT_1_20_2, 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( serverbound.register(
ServerboundCookieResponsePacket.class, ServerboundCookieResponsePacket::new, 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( serverbound.register(
PluginMessagePacket.class, PluginMessagePacket.class,
PluginMessagePacket::new, PluginMessagePacket::new,
@ -314,7 +322,8 @@ public enum StateRegistry {
map(0x0D, MINECRAFT_1_19_4, false), map(0x0D, MINECRAFT_1_19_4, false),
map(0x0F, MINECRAFT_1_20_2, false), map(0x0F, MINECRAFT_1_20_2, false),
map(0x10, MINECRAFT_1_20_3, 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( serverbound.register(
KeepAlivePacket.class, KeepAlivePacket.class,
KeepAlivePacket::new, KeepAlivePacket::new,
@ -332,7 +341,8 @@ public enum StateRegistry {
map(0x12, MINECRAFT_1_19_4, false), map(0x12, MINECRAFT_1_19_4, false),
map(0x14, MINECRAFT_1_20_2, false), map(0x14, MINECRAFT_1_20_2, false),
map(0x15, MINECRAFT_1_20_3, 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( serverbound.register(
ResourcePackResponsePacket.class, ResourcePackResponsePacket.class,
ResourcePackResponsePacket::new, ResourcePackResponsePacket::new,
@ -347,11 +357,13 @@ public enum StateRegistry {
map(0x24, MINECRAFT_1_19_1, false), map(0x24, MINECRAFT_1_19_1, false),
map(0x27, MINECRAFT_1_20_2, false), map(0x27, MINECRAFT_1_20_2, false),
map(0x28, MINECRAFT_1_20_3, 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( serverbound.register(
FinishedUpdatePacket.class, () -> FinishedUpdatePacket.INSTANCE, FinishedUpdatePacket.class, () -> FinishedUpdatePacket.INSTANCE,
map(0x0B, MINECRAFT_1_20_2, false), 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( clientbound.register(
BossBarPacket.class, BossBarPacket.class,
@ -486,12 +498,14 @@ public enum StateRegistry {
map(0x41, MINECRAFT_1_19_4, true), map(0x41, MINECRAFT_1_19_4, true),
map(0x43, MINECRAFT_1_20_2, true), map(0x43, MINECRAFT_1_20_2, true),
map(0x45, MINECRAFT_1_20_3, 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( clientbound.register(
RemoveResourcePackPacket.class, RemoveResourcePackPacket.class,
RemoveResourcePackPacket::new, RemoveResourcePackPacket::new,
map(0x43, MINECRAFT_1_20_3, false), 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( clientbound.register(
ResourcePackRequestPacket.class, ResourcePackRequestPacket.class,
ResourcePackRequestPacket::new, ResourcePackRequestPacket::new,
@ -511,7 +525,8 @@ public enum StateRegistry {
map(0x40, MINECRAFT_1_19_4, false), map(0x40, MINECRAFT_1_19_4, false),
map(0x42, MINECRAFT_1_20_2, false), map(0x42, MINECRAFT_1_20_2, false),
map(0x44, MINECRAFT_1_20_3, 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( clientbound.register(
HeaderAndFooterPacket.class, HeaderAndFooterPacket.class,
HeaderAndFooterPacket::new, HeaderAndFooterPacket::new,
@ -532,7 +547,8 @@ public enum StateRegistry {
map(0x65, MINECRAFT_1_19_4, true), map(0x65, MINECRAFT_1_19_4, true),
map(0x68, MINECRAFT_1_20_2, true), map(0x68, MINECRAFT_1_20_2, true),
map(0x6A, MINECRAFT_1_20_3, 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( clientbound.register(
LegacyTitlePacket.class, LegacyTitlePacket.class,
LegacyTitlePacket::new, LegacyTitlePacket::new,
@ -552,7 +568,8 @@ public enum StateRegistry {
map(0x5D, MINECRAFT_1_19_4, true), map(0x5D, MINECRAFT_1_19_4, true),
map(0x5F, MINECRAFT_1_20_2, true), map(0x5F, MINECRAFT_1_20_2, true),
map(0x61, MINECRAFT_1_20_3, 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( clientbound.register(
TitleTextPacket.class, TitleTextPacket.class,
TitleTextPacket::new, TitleTextPacket::new,
@ -563,7 +580,8 @@ public enum StateRegistry {
map(0x5F, MINECRAFT_1_19_4, true), map(0x5F, MINECRAFT_1_19_4, true),
map(0x61, MINECRAFT_1_20_2, true), map(0x61, MINECRAFT_1_20_2, true),
map(0x63, MINECRAFT_1_20_3, 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( clientbound.register(
TitleActionbarPacket.class, TitleActionbarPacket.class,
TitleActionbarPacket::new, TitleActionbarPacket::new,
@ -574,7 +592,8 @@ public enum StateRegistry {
map(0x46, MINECRAFT_1_19_4, true), map(0x46, MINECRAFT_1_19_4, true),
map(0x48, MINECRAFT_1_20_2, true), map(0x48, MINECRAFT_1_20_2, true),
map(0x4A, MINECRAFT_1_20_3, 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( clientbound.register(
TitleTimesPacket.class, TitleTimesPacket.class,
TitleTimesPacket::new, TitleTimesPacket::new,
@ -585,7 +604,8 @@ public enum StateRegistry {
map(0x60, MINECRAFT_1_19_4, true), map(0x60, MINECRAFT_1_19_4, true),
map(0x62, MINECRAFT_1_20_2, true), map(0x62, MINECRAFT_1_20_2, true),
map(0x64, MINECRAFT_1_20_3, 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( clientbound.register(
TitleClearPacket.class, TitleClearPacket.class,
TitleClearPacket::new, TitleClearPacket::new,
@ -612,17 +632,20 @@ public enum StateRegistry {
map(0x35, MINECRAFT_1_19_3, false), map(0x35, MINECRAFT_1_19_3, false),
map(0x39, MINECRAFT_1_19_4, false), map(0x39, MINECRAFT_1_19_4, false),
map(0x3B, MINECRAFT_1_20_2, 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( clientbound.register(
UpsertPlayerInfoPacket.class, UpsertPlayerInfoPacket.class,
UpsertPlayerInfoPacket::new, UpsertPlayerInfoPacket::new,
map(0x36, MINECRAFT_1_19_3, false), map(0x36, MINECRAFT_1_19_3, false),
map(0x3A, MINECRAFT_1_19_4, false), map(0x3A, MINECRAFT_1_19_4, false),
map(0x3C, MINECRAFT_1_20_2, 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( clientbound.register(
ClientboundStoreCookiePacket.class, ClientboundStoreCookiePacket::new, 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( clientbound.register(
SystemChatPacket.class, SystemChatPacket.class,
SystemChatPacket::new, SystemChatPacket::new,
@ -632,7 +655,8 @@ public enum StateRegistry {
map(0x64, MINECRAFT_1_19_4, true), map(0x64, MINECRAFT_1_19_4, true),
map(0x67, MINECRAFT_1_20_2, true), map(0x67, MINECRAFT_1_20_2, true),
map(0x69, MINECRAFT_1_20_3, 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( clientbound.register(
PlayerChatCompletionPacket.class, PlayerChatCompletionPacket.class,
PlayerChatCompletionPacket::new, PlayerChatCompletionPacket::new,
@ -650,13 +674,15 @@ public enum StateRegistry {
map(0x45, MINECRAFT_1_19_4, false), map(0x45, MINECRAFT_1_19_4, false),
map(0x47, MINECRAFT_1_20_2, false), map(0x47, MINECRAFT_1_20_2, false),
map(0x49, MINECRAFT_1_20_3, 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( clientbound.register(
StartUpdatePacket.class, StartUpdatePacket.class,
() -> StartUpdatePacket.INSTANCE, () -> StartUpdatePacket.INSTANCE,
map(0x65, MINECRAFT_1_20_2, false), map(0x65, MINECRAFT_1_20_2, false),
map(0x67, MINECRAFT_1_20_3, 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( clientbound.register(
BundleDelimiterPacket.class, BundleDelimiterPacket.class,
() -> BundleDelimiterPacket.INSTANCE, () -> BundleDelimiterPacket.INSTANCE,
@ -664,12 +690,14 @@ public enum StateRegistry {
clientbound.register( clientbound.register(
TransferPacket.class, TransferPacket.class,
TransferPacket::new, 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, 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, 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 { LOGIN {

Datei anzeigen

@ -34,21 +34,25 @@ public class ClientSettingsPacket implements MinecraftPacket {
private byte difficulty; // 1.7 Protocol private byte difficulty; // 1.7 Protocol
private short skinParts; private short skinParts;
private int mainHand; private int mainHand;
private boolean chatFilteringEnabled; // Added in 1.17 private boolean textFilteringEnabled; // Added in 1.17
private boolean clientListingAllowed; // Added in 1.18, overwrites server-list "anonymous" mode private boolean clientListingAllowed; // Added in 1.18, overwrites server-list "anonymous" mode
private int particleStatus; // Added in 1.20.2
public ClientSettingsPacket() { public ClientSettingsPacket() {
} }
public ClientSettingsPacket(String locale, byte viewDistance, int chatVisibility, boolean chatColors, public ClientSettingsPacket(String locale, byte viewDistance, int chatVisibility, boolean chatColors,
short skinParts, int mainHand, boolean chatFilteringEnabled, boolean clientListingAllowed) { short skinParts, int mainHand, boolean textFilteringEnabled, boolean clientListingAllowed,
int particleStatus) {
this.locale = locale; this.locale = locale;
this.viewDistance = viewDistance; this.viewDistance = viewDistance;
this.chatVisibility = chatVisibility; this.chatVisibility = chatVisibility;
this.chatColors = chatColors; this.chatColors = chatColors;
this.skinParts = skinParts; this.skinParts = skinParts;
this.mainHand = mainHand; this.mainHand = mainHand;
this.textFilteringEnabled = textFilteringEnabled;
this.clientListingAllowed = clientListingAllowed; this.clientListingAllowed = clientListingAllowed;
this.particleStatus = particleStatus;
} }
public String getLocale() { public String getLocale() {
@ -102,12 +106,12 @@ public class ClientSettingsPacket implements MinecraftPacket {
this.mainHand = mainHand; this.mainHand = mainHand;
} }
public boolean isChatFilteringEnabled() { public boolean isTextFilteringEnabled() {
return chatFilteringEnabled; return textFilteringEnabled;
} }
public void setChatFilteringEnabled(boolean chatFilteringEnabled) { public void setTextFilteringEnabled(boolean textFilteringEnabled) {
this.chatFilteringEnabled = chatFilteringEnabled; this.textFilteringEnabled = textFilteringEnabled;
} }
public boolean isClientListingAllowed() { public boolean isClientListingAllowed() {
@ -118,12 +122,20 @@ public class ClientSettingsPacket implements MinecraftPacket {
this.clientListingAllowed = clientListingAllowed; this.clientListingAllowed = clientListingAllowed;
} }
public int getParticleStatus() {
return particleStatus;
}
public void setParticleStatus(int particleStatus) {
this.particleStatus = particleStatus;
}
@Override @Override
public String toString() { public String toString() {
return "ClientSettings{" + "locale='" + locale + '\'' + ", viewDistance=" + viewDistance + return "ClientSettings{" + "locale='" + locale + '\'' + ", viewDistance=" + viewDistance +
", chatVisibility=" + chatVisibility + ", chatColors=" + chatColors + ", skinParts=" + ", chatVisibility=" + chatVisibility + ", chatColors=" + chatColors + ", skinParts=" +
skinParts + ", mainHand=" + mainHand + ", chatFilteringEnabled=" + chatFilteringEnabled + skinParts + ", mainHand=" + mainHand + ", chatFilteringEnabled=" + textFilteringEnabled +
", clientListingAllowed=" + clientListingAllowed + '}'; ", clientListingAllowed=" + clientListingAllowed + ", particleStatus=" + particleStatus + '}';
} }
@Override @Override
@ -143,10 +155,14 @@ public class ClientSettingsPacket implements MinecraftPacket {
this.mainHand = ProtocolUtils.readVarInt(buf); this.mainHand = ProtocolUtils.readVarInt(buf);
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) {
this.chatFilteringEnabled = buf.readBoolean(); this.textFilteringEnabled = buf.readBoolean();
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_18)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_18)) {
this.clientListingAllowed = buf.readBoolean(); this.clientListingAllowed = buf.readBoolean();
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
this.particleStatus = ProtocolUtils.readVarInt(buf);
}
} }
} }
} }
@ -172,11 +188,15 @@ public class ClientSettingsPacket implements MinecraftPacket {
ProtocolUtils.writeVarInt(buf, mainHand); ProtocolUtils.writeVarInt(buf, mainHand);
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_17)) {
buf.writeBoolean(chatFilteringEnabled); buf.writeBoolean(textFilteringEnabled);
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_18)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_18)) {
buf.writeBoolean(clientListingAllowed); buf.writeBoolean(clientListingAllowed);
} }
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
ProtocolUtils.writeVarInt(buf, particleStatus);
}
} }
} }
} }
@ -201,8 +221,9 @@ public class ClientSettingsPacket implements MinecraftPacket {
&& difficulty == that.difficulty && difficulty == that.difficulty
&& skinParts == that.skinParts && skinParts == that.skinParts
&& mainHand == that.mainHand && mainHand == that.mainHand
&& chatFilteringEnabled == that.chatFilteringEnabled && textFilteringEnabled == that.textFilteringEnabled
&& clientListingAllowed == that.clientListingAllowed && clientListingAllowed == that.clientListingAllowed
&& particleStatus == that.particleStatus
&& Objects.equals(locale, that.locale); && Objects.equals(locale, that.locale);
} }
@ -216,7 +237,8 @@ public class ClientSettingsPacket implements MinecraftPacket {
difficulty, difficulty,
skinParts, skinParts,
mainHand, mainHand,
chatFilteringEnabled, textFilteringEnabled,
clientListingAllowed); clientListingAllowed,
particleStatus);
} }
} }

Datei anzeigen

@ -51,6 +51,7 @@ public class JoinGamePacket implements MinecraftPacket {
private int simulationDistance; // 1.18+ private int simulationDistance; // 1.18+
private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+ private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+
private int portalCooldown; // 1.20+ private int portalCooldown; // 1.20+
private int seaLevel; // 1.21.2+
private boolean enforcesSecureChat; // 1.20.5+ private boolean enforcesSecureChat; // 1.20.5+
public int getEntityId() { public int getEntityId() {
@ -181,6 +182,14 @@ public class JoinGamePacket implements MinecraftPacket {
this.portalCooldown = portalCooldown; this.portalCooldown = portalCooldown;
} }
public int getSeaLevel() {
return seaLevel;
}
public void setSeaLevel(int seaLevel) {
this.seaLevel = seaLevel;
}
public boolean getEnforcesSecureChat() { public boolean getEnforcesSecureChat() {
return this.enforcesSecureChat; return this.enforcesSecureChat;
} }
@ -204,6 +213,7 @@ public class JoinGamePacket implements MinecraftPacket {
dimensionInfo + '\'' + ", currentDimensionData='" + currentDimensionData + '\'' + dimensionInfo + '\'' + ", currentDimensionData='" + currentDimensionData + '\'' +
", previousGamemode=" + previousGamemode + ", simulationDistance=" + simulationDistance + ", previousGamemode=" + previousGamemode + ", simulationDistance=" + simulationDistance +
", lastDeathPosition='" + lastDeathPosition + '\'' + ", portalCooldown=" + portalCooldown + ", lastDeathPosition='" + lastDeathPosition + '\'' + ", portalCooldown=" + portalCooldown +
", seaLevel=" + seaLevel +
'}'; '}';
} }
@ -343,6 +353,11 @@ public class JoinGamePacket implements MinecraftPacket {
} }
this.portalCooldown = ProtocolUtils.readVarInt(buf); this.portalCooldown = ProtocolUtils.readVarInt(buf);
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
this.seaLevel = ProtocolUtils.readVarInt(buf);
}
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {
this.enforcesSecureChat = buf.readBoolean(); this.enforcesSecureChat = buf.readBoolean();
} }
@ -491,6 +506,10 @@ public class JoinGamePacket implements MinecraftPacket {
ProtocolUtils.writeVarInt(buf, portalCooldown); ProtocolUtils.writeVarInt(buf, portalCooldown);
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
ProtocolUtils.writeVarInt(buf, seaLevel);
}
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {
buf.writeBoolean(this.enforcesSecureChat); buf.writeBoolean(this.enforcesSecureChat);
} }

Datei anzeigen

@ -41,6 +41,7 @@ public class RespawnPacket implements MinecraftPacket {
private CompoundBinaryTag currentDimensionData; // 1.16.2+ private CompoundBinaryTag currentDimensionData; // 1.16.2+
private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+ private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+
private int portalCooldown; // 1.20+ private int portalCooldown; // 1.20+
private int seaLevel; // 1.21.2+
public RespawnPacket() { public RespawnPacket() {
} }
@ -48,7 +49,8 @@ public class RespawnPacket implements MinecraftPacket {
public RespawnPacket(int dimension, long partialHashedSeed, short difficulty, short gamemode, public RespawnPacket(int dimension, long partialHashedSeed, short difficulty, short gamemode,
String levelType, byte dataToKeep, DimensionInfo dimensionInfo, String levelType, byte dataToKeep, DimensionInfo dimensionInfo,
short previousGamemode, CompoundBinaryTag currentDimensionData, short previousGamemode, CompoundBinaryTag currentDimensionData,
@Nullable Pair<String, Long> lastDeathPosition, int portalCooldown) { @Nullable Pair<String, Long> lastDeathPosition, int portalCooldown,
int seaLevel) {
this.dimension = dimension; this.dimension = dimension;
this.partialHashedSeed = partialHashedSeed; this.partialHashedSeed = partialHashedSeed;
this.difficulty = difficulty; this.difficulty = difficulty;
@ -60,13 +62,15 @@ public class RespawnPacket implements MinecraftPacket {
this.currentDimensionData = currentDimensionData; this.currentDimensionData = currentDimensionData;
this.lastDeathPosition = lastDeathPosition; this.lastDeathPosition = lastDeathPosition;
this.portalCooldown = portalCooldown; this.portalCooldown = portalCooldown;
this.seaLevel = seaLevel;
} }
public static RespawnPacket fromJoinGame(JoinGamePacket joinGame) { public static RespawnPacket fromJoinGame(JoinGamePacket joinGame) {
return new RespawnPacket(joinGame.getDimension(), joinGame.getPartialHashedSeed(), return new RespawnPacket(joinGame.getDimension(), joinGame.getPartialHashedSeed(),
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
(byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(), (byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition(), joinGame.getPortalCooldown()); joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition(),
joinGame.getPortalCooldown(), joinGame.getSeaLevel());
} }
public int getDimension() { public int getDimension() {
@ -141,6 +145,14 @@ public class RespawnPacket implements MinecraftPacket {
this.portalCooldown = portalCooldown; this.portalCooldown = portalCooldown;
} }
public int getSeaLevel() {
return seaLevel;
}
public void setSeaLevel(int seaLevel) {
this.seaLevel = seaLevel;
}
@Override @Override
public String toString() { public String toString() {
return "Respawn{" return "Respawn{"
@ -155,6 +167,7 @@ public class RespawnPacket implements MinecraftPacket {
+ ", previousGamemode=" + previousGamemode + ", previousGamemode=" + previousGamemode
+ ", dimensionData=" + currentDimensionData + ", dimensionData=" + currentDimensionData
+ ", portalCooldown=" + portalCooldown + ", portalCooldown=" + portalCooldown
+ ", seaLevel=" + seaLevel
+ '}'; + '}';
} }
@ -204,6 +217,9 @@ public class RespawnPacket implements MinecraftPacket {
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20)) {
this.portalCooldown = ProtocolUtils.readVarInt(buf); this.portalCooldown = ProtocolUtils.readVarInt(buf);
} }
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_21_2)) {
this.seaLevel = ProtocolUtils.readVarInt(buf);
}
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_2)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_2)) {
this.dataToKeep = buf.readByte(); this.dataToKeep = buf.readByte();
} }
@ -262,6 +278,10 @@ public class RespawnPacket implements MinecraftPacket {
ProtocolUtils.writeVarInt(buf, portalCooldown); ProtocolUtils.writeVarInt(buf, portalCooldown);
} }
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_12_1)) {
ProtocolUtils.writeVarInt(buf, seaLevel);
}
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_2)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_2)) {
buf.writeByte(dataToKeep); buf.writeByte(dataToKeep);
} }

Datei anzeigen

@ -92,7 +92,7 @@ public class ServerLoginSuccessPacket implements MinecraftPacket {
if (version.noLessThan(ProtocolVersion.MINECRAFT_1_19)) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_19)) {
properties = ProtocolUtils.readProperties(buf); properties = ProtocolUtils.readProperties(buf);
} }
if (version == ProtocolVersion.MINECRAFT_1_20_5 || version == ProtocolVersion.MINECRAFT_1_21) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {
buf.readBoolean(); buf.readBoolean();
} }
} }
@ -123,7 +123,7 @@ public class ServerLoginSuccessPacket implements MinecraftPacket {
ProtocolUtils.writeProperties(buf, properties); ProtocolUtils.writeProperties(buf, properties);
} }
} }
if (version == ProtocolVersion.MINECRAFT_1_20_5 || version == ProtocolVersion.MINECRAFT_1_21) { if (version.noLessThan(ProtocolVersion.MINECRAFT_1_20_5)) {
buf.writeBoolean(strictErrorHandling); buf.writeBoolean(strictErrorHandling);
} }
} }

Datei anzeigen

@ -188,6 +188,11 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket {
if (info.displayName != null) { if (info.displayName != null) {
info.displayName.write(buf); info.displayName.write(buf);
} }
}),
UPDATE_LIST_ORDER((version, buf, info) -> { // red
info.listOrder = ProtocolUtils.readVarInt(buf);
}, (version, buf, info) -> { // write
ProtocolUtils.writeVarInt(buf, info.listOrder);
}); });
private final Read read; private final Read read;
@ -218,6 +223,7 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket {
private int gameMode; private int gameMode;
@Nullable @Nullable
private ComponentHolder displayName; private ComponentHolder displayName;
private int listOrder;
@Nullable @Nullable
private RemoteChatSession chatSession; private RemoteChatSession chatSession;
@ -250,6 +256,10 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket {
return displayName; return displayName;
} }
public int getListOrder() {
return listOrder;
}
@Nullable @Nullable
public RemoteChatSession getChatSession() { public RemoteChatSession getChatSession() {
return chatSession; return chatSession;
@ -275,6 +285,10 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket {
this.displayName = displayName; this.displayName = displayName;
} }
public void setListOrder(int listOrder) {
this.listOrder = listOrder;
}
public void setChatSession(@Nullable RemoteChatSession chatSession) { public void setChatSession(@Nullable RemoteChatSession chatSession) {
this.chatSession = chatSession; this.chatSession = chatSession;
} }
@ -288,6 +302,7 @@ public class UpsertPlayerInfoPacket implements MinecraftPacket {
", latency=" + latency + ", latency=" + latency +
", gameMode=" + gameMode + ", gameMode=" + gameMode +
", displayName=" + displayName + ", displayName=" + displayName +
", listOrder=" + listOrder +
", chatSession=" + chatSession + ", chatSession=" + chatSession +
'}'; '}';
} }