-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
228 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v622/Bedrock_v622.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v622; | ||
|
||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; | ||
import org.cloudburstmc.protocol.bedrock.codec.EntityDataTypeMap; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelSoundEvent1Serializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.codec.v313.serializer.LevelSoundEvent2Serializer_v313; | ||
import org.cloudburstmc.protocol.bedrock.codec.v332.serializer.LevelSoundEventSerializer_v332; | ||
import org.cloudburstmc.protocol.bedrock.codec.v575.BedrockCodecHelper_v575; | ||
import org.cloudburstmc.protocol.bedrock.codec.v618.Bedrock_v618; | ||
import org.cloudburstmc.protocol.bedrock.codec.v622.serializer.DisconnectSerializer_v622; | ||
import org.cloudburstmc.protocol.bedrock.data.SoundEvent; | ||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; | ||
import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; | ||
import org.cloudburstmc.protocol.bedrock.packet.DisconnectPacket; | ||
import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEvent1Packet; | ||
import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEvent2Packet; | ||
import org.cloudburstmc.protocol.bedrock.packet.LevelSoundEventPacket; | ||
import org.cloudburstmc.protocol.bedrock.transformer.FlagTransformer; | ||
import org.cloudburstmc.protocol.common.util.TypeMap; | ||
|
||
public class Bedrock_v622 extends Bedrock_v618 { | ||
|
||
protected static final TypeMap<EntityFlag> ENTITY_FLAGS = Bedrock_v618.ENTITY_FLAGS | ||
.toBuilder() | ||
.insert(115, EntityFlag.TIMER_FLAG_1) | ||
.insert(116, EntityFlag.TIMER_FLAG_2) | ||
.insert(117, EntityFlag.TIMER_FLAG_3) | ||
.build(); | ||
|
||
protected static final EntityDataTypeMap ENTITY_DATA = Bedrock_v618.ENTITY_DATA | ||
.toBuilder() | ||
.update(EntityDataTypes.FLAGS, new FlagTransformer(ENTITY_FLAGS, 0)) | ||
.update(EntityDataTypes.FLAGS_2, new FlagTransformer(ENTITY_FLAGS, 1)) | ||
.build(); | ||
|
||
protected static final TypeMap<SoundEvent> SOUND_EVENTS = Bedrock_v618.SOUND_EVENTS | ||
.toBuilder() | ||
.replace(477, SoundEvent.BOTTLE_FILL) | ||
.insert(478, SoundEvent.BOTTLE_EMPTY) | ||
.insert(479, SoundEvent.UNDEFINED) | ||
.build(); | ||
|
||
public static final BedrockCodec CODEC = Bedrock_v618.CODEC.toBuilder() | ||
.raknetProtocolVersion(11) | ||
.protocolVersion(622) | ||
.minecraftVersion("1.20.40") | ||
.helper(() -> new BedrockCodecHelper_v575(ENTITY_DATA, GAME_RULE_TYPES, ITEM_STACK_REQUEST_TYPES, CONTAINER_SLOT_TYPES, PLAYER_ABILITIES, TEXT_PROCESSING_ORIGINS)) | ||
.updateSerializer(DisconnectPacket.class, DisconnectSerializer_v622.INSTANCE) | ||
.updateSerializer(LevelSoundEvent1Packet.class, new LevelSoundEvent1Serializer_v291(SOUND_EVENTS)) | ||
.updateSerializer(LevelSoundEvent2Packet.class, new LevelSoundEvent2Serializer_v313(SOUND_EVENTS)) | ||
.updateSerializer(LevelSoundEventPacket.class, new LevelSoundEventSerializer_v332(SOUND_EVENTS)) | ||
.build(); | ||
} |
27 changes: 27 additions & 0 deletions
27
...va/org/cloudburstmc/protocol/bedrock/codec/v622/serializer/DisconnectSerializer_v622.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v622.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.DisconnectSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.data.DisconnectFailReason; | ||
import org.cloudburstmc.protocol.bedrock.packet.DisconnectPacket; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class DisconnectSerializer_v622 extends DisconnectSerializer_v291 { | ||
public static final DisconnectSerializer_v622 INSTANCE = new DisconnectSerializer_v622(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, DisconnectPacket packet) { | ||
VarInts.writeInt(buffer, packet.getReason().ordinal()); | ||
super.serialize(buffer, helper, packet); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, DisconnectPacket packet) { | ||
packet.setReason(DisconnectFailReason.values()[VarInts.readInt(buffer)]); | ||
super.deserialize(buffer, helper, packet); | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/data/DisconnectFailReason.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.cloudburstmc.protocol.bedrock.data; | ||
|
||
public enum DisconnectFailReason { | ||
UNKNOWN, | ||
CANT_CONNECT_NO_INTERNET, | ||
NO_PERMISSIONS, | ||
UNRECOVERABLE_ERROR, | ||
THIRD_PARTY_BLOCKED, | ||
THIRD_PARTY_NO_INTERNET, | ||
THIRD_PARTY_BAD_IP, | ||
THIRD_PARTY_NO_SERVER_OR_SERVER_LOCKED, | ||
VERSION_MISMATCH, | ||
SKIN_ISSUE, | ||
INVITE_SESSION_NOT_FOUND, | ||
EDU_LEVEL_SETTINGS_MISSING, | ||
LOCAL_SERVER_NOT_FOUND, | ||
LEGACY_DISCONNECT, | ||
USER_LEAVE_GAME_ATTEMPTED, | ||
PLATFORM_LOCKED_SKINS_ERROR, | ||
REALMS_WORLD_UNASSIGNED, | ||
REALMS_SERVER_CANT_CONNECT, | ||
REALMS_SERVER_HIDDEN, | ||
REALMS_SERVER_DISABLED_BETA, | ||
REALMS_SERVER_DISABLED, | ||
CROSS_PLATFORM_DISALLOWED, | ||
CANT_CONNECT, | ||
SESSION_NOT_FOUND, | ||
CLIENT_SETTINGS_INCOMPATIBLE_WITH_SERVER, | ||
SERVER_FULL, | ||
INVALID_PLATFORM_SKIN, | ||
EDITION_VERSION_MISMATCH, | ||
EDITION_MISMATCH, | ||
LEVEL_NEWER_THAN_EXE_VERSION, | ||
NO_FAIL_OCCURRED, | ||
BANNED_SKIN, | ||
TIMEOUT, | ||
SERVER_NOT_FOUND, | ||
OUTDATED_SERVER, | ||
OUTDATED_CLIENT, | ||
NO_PREMIUM_PLATFORM, | ||
MULTIPLAYER_DISABLED, | ||
NO_WIFI, | ||
WORLD_CORRUPTION, | ||
NO_REASON, | ||
DISCONNECTED, | ||
INVALID_PLAYER, | ||
LOGGED_IN_OTHER_LOCATION, | ||
SERVER_ID_CONFLICT, | ||
NOT_ALLOWED, | ||
NOT_AUTHENTICATED, | ||
INVALID_TENANT, | ||
UNKNOWN_PACKET, | ||
UNEXPECTED_PACKET, | ||
INVALID_COMMAND_REQUEST_PACKET, | ||
HOST_SUSPENDED, | ||
LOGIN_PACKET_NO_REQUEST, | ||
LOGIN_PACKET_NO_CERT, | ||
MISSING_CLIENT, | ||
KICKED, | ||
KICKED_FOR_EXPLOIT, | ||
KICKED_FOR_IDLE, | ||
RESOURCE_PACK_PROBLEM, | ||
INCOMPATIBLE_PACK, | ||
OUT_OF_STORAGE, | ||
INVALID_LEVEL, | ||
DISCONNECT_PACKET_DEPRECATED, | ||
BLOCK_MISMATCH, | ||
INVALID_HEIGHTS, | ||
INVALID_WIDTHS, | ||
CONNECTION_LOST, | ||
ZOMBIE_CONNECTION, | ||
SHUTDOWN, | ||
REASON_NOT_SET, | ||
LOADING_STATE_TIMEOUT, | ||
RESOURCE_PACK_LOADING_FAILED, | ||
SEARCHING_FOR_SESSION_LOADING_SCREEN_FAILED, | ||
CONN_PROTOCOL_VERSION, | ||
SUBSYSTEM_STATUS_ERROR, | ||
EMPTY_AUTH_FROM_DISCOVERY, | ||
EMPTY_URL_FROM_DISCOVERY, | ||
EXPIRED_AUTH_FROM_DISCOVERY, | ||
UNKNOWN_SIGNAL_SERVICE_SIGN_IN_FAILURE, | ||
XBL_JOIN_LOBBY_FAILURE, | ||
UNSPECIFIED_CLIENT_INSTANCE_DISCONNECTION, | ||
CONN_SESSION_NOT_FOUND, | ||
CONN_CREATE_PEER_CONNECTION, | ||
CONN_ICE, | ||
CONN_CONNECT_REQUEST, | ||
CONN_CONNECT_RESPONSE, | ||
CONN_NEGOTIATION_TIMEOUT, | ||
CONN_INACTIVITY_TIMEOUT, | ||
STALE_CONNECTION_BEING_REPLACED, | ||
REALMS_SESSION_NOT_FOUND, | ||
BAD_PACKET | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters