-
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
18 changed files
with
274 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
56 changes: 56 additions & 0 deletions
56
bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v662/Bedrock_v662.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,56 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v662; | ||
|
||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.LevelEventSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.codec.v361.serializer.LevelEventGenericSerializer_v361; | ||
import org.cloudburstmc.protocol.bedrock.codec.v575.BedrockCodecHelper_v575; | ||
import org.cloudburstmc.protocol.bedrock.codec.v649.Bedrock_v649; | ||
import org.cloudburstmc.protocol.bedrock.codec.v662.serializer.*; | ||
import org.cloudburstmc.protocol.bedrock.data.LevelEvent; | ||
import org.cloudburstmc.protocol.bedrock.data.LevelEventType; | ||
import org.cloudburstmc.protocol.bedrock.data.ParticleType; | ||
import org.cloudburstmc.protocol.bedrock.data.inventory.itemstack.request.TextProcessingEventOrigin; | ||
import org.cloudburstmc.protocol.bedrock.packet.*; | ||
import org.cloudburstmc.protocol.common.util.TypeMap; | ||
|
||
public class Bedrock_v662 extends Bedrock_v649 { | ||
|
||
protected static final TypeMap<ParticleType> PARTICLE_TYPES = Bedrock_v649.PARTICLE_TYPES | ||
.toBuilder() | ||
.replace(18, ParticleType.BREEZE_WIND_EXPLOSION) | ||
.insert(90, ParticleType.VAULT_CONNECTION) | ||
.insert(91, ParticleType.WIND_EXPLOSION) | ||
.build(); | ||
|
||
protected static final TypeMap<LevelEventType> LEVEL_EVENTS = Bedrock_v649.LEVEL_EVENTS.toBuilder() | ||
.replace(LEVEL_EVENT_BLOCK + 110, LevelEvent.PARTICLE_BREEZE_WIND_EXPLOSION) | ||
.replace(LEVEL_EVENT_BLOCK + 114, LevelEvent.PARTICLE_WIND_EXPLOSION) | ||
.insert(LEVEL_EVENT_BLOCK + 115, LevelEvent.ALL_PLAYERS_SLEEPING) | ||
.insert(9811, LevelEvent.ANIMATION_VAULT_ACTIVATE) | ||
.insert(9812, LevelEvent.ANIMATION_VAULT_DEACTIVATE) | ||
.insert(9813, LevelEvent.ANIMATION_VAULT_EJECT_ITEM) | ||
.insert(LEVEL_EVENT_PARTICLE_TYPE, PARTICLE_TYPES) | ||
.build(); | ||
|
||
protected static final TypeMap<TextProcessingEventOrigin> TEXT_PROCESSING_ORIGINS = Bedrock_v649.TEXT_PROCESSING_ORIGINS | ||
.toBuilder() | ||
.replace(14, TextProcessingEventOrigin.SERVER_FORM) // replaces PASS_THROUGH_WITHOUT_SIFT | ||
.build(); | ||
|
||
// TODO: check for command params | ||
|
||
public static final BedrockCodec CODEC = Bedrock_v649.CODEC.toBuilder() | ||
.raknetProtocolVersion(11) | ||
.protocolVersion(662) | ||
.minecraftVersion("1.20.70") | ||
.helper(() -> new BedrockCodecHelper_v575(ENTITY_DATA, GAME_RULE_TYPES, ITEM_STACK_REQUEST_TYPES, CONTAINER_SLOT_TYPES, PLAYER_ABILITIES, TEXT_PROCESSING_ORIGINS)) | ||
.updateSerializer(LevelEventPacket.class, new LevelEventSerializer_v291(LEVEL_EVENTS)) | ||
.updateSerializer(LevelEventGenericPacket.class, new LevelEventGenericSerializer_v361(LEVEL_EVENTS)) | ||
.updateSerializer(LecternUpdatePacket.class, LecternUpdateSerializer_v662.INSTANCE) | ||
.updateSerializer(MobEffectPacket.class, MobEffectSerializer_v662.INSTANCE) | ||
.updateSerializer(PlayerAuthInputPacket.class, new PlayerAuthInputSerializer_v662()) | ||
.updateSerializer(ResourcePacksInfoPacket.class, ResourcePacksInfoSerializer_v622.INSTANCE) | ||
.updateSerializer(SetEntityMotionPacket.class, SetEntityMotionSerializer_v662.INSTANCE) | ||
.deregisterPacket(ItemFrameDropItemPacket.class) // this packet is now deprecated | ||
.build(); | ||
} |
27 changes: 27 additions & 0 deletions
27
...org/cloudburstmc/protocol/bedrock/codec/v662/serializer/LecternUpdateSerializer_v662.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.v662.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.v354.serializer.LecternUpdateSerializer_v354; | ||
import org.cloudburstmc.protocol.bedrock.packet.LecternUpdatePacket; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class LecternUpdateSerializer_v662 extends LecternUpdateSerializer_v354 { | ||
public static final LecternUpdateSerializer_v662 INSTANCE = new LecternUpdateSerializer_v662(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, LecternUpdatePacket packet) { | ||
buffer.writeByte(packet.getPage()); | ||
buffer.writeByte(packet.getTotalPages()); | ||
helper.writeBlockPosition(buffer, packet.getBlockPosition()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, LecternUpdatePacket packet) { | ||
packet.setPage(buffer.readUnsignedByte()); | ||
packet.setTotalPages(buffer.readUnsignedByte()); | ||
packet.setBlockPosition(helper.readBlockPosition(buffer)); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ava/org/cloudburstmc/protocol/bedrock/codec/v662/serializer/MobEffectSerializer_v662.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,23 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v662.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v291.serializer.MobEffectSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.packet.MobEffectPacket; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
public class MobEffectSerializer_v662 extends MobEffectSerializer_v291 { | ||
public static final MobEffectSerializer_v662 INSTANCE = new MobEffectSerializer_v662(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, MobEffectPacket packet) { | ||
super.serialize(buffer, helper, packet); | ||
VarInts.writeUnsignedLong(buffer, packet.getTick()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, MobEffectPacket packet) { | ||
super.deserialize(buffer, helper, packet); | ||
packet.setTick(VarInts.readUnsignedLong(buffer)); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...g/cloudburstmc/protocol/bedrock/codec/v662/serializer/PlayerAuthInputSerializer_v662.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,36 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v662.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import lombok.NoArgsConstructor; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v527.serializer.PlayerAuthInputSerializer_v527; | ||
import org.cloudburstmc.protocol.bedrock.data.PlayerAuthInputData; | ||
import org.cloudburstmc.protocol.bedrock.packet.PlayerAuthInputPacket; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
/** | ||
* Use PlayerAuthInputSerializer_v527 here because predictedVehicle was added before analogMoveVector | ||
*/ | ||
@NoArgsConstructor | ||
public class PlayerAuthInputSerializer_v662 extends PlayerAuthInputSerializer_v527 { | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerAuthInputPacket packet) { | ||
super.serialize(buffer, helper, packet); | ||
if (packet.getInputData().contains(PlayerAuthInputData.IN_CLIENT_PREDICTED_IN_VEHICLE)) { | ||
helper.writeVector2f(buffer, packet.getVehicleRotation()); | ||
VarInts.writeLong(buffer, packet.getPredictedVehicle()); | ||
} | ||
helper.writeVector2f(buffer, packet.getAnalogMoveVector()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, PlayerAuthInputPacket packet) { | ||
super.deserialize(buffer, helper, packet); | ||
if (packet.getInputData().contains(PlayerAuthInputData.IN_CLIENT_PREDICTED_IN_VEHICLE)) { | ||
packet.setVehicleRotation(helper.readVector2f(buffer)); | ||
packet.setPredictedVehicle(VarInts.readLong(buffer)); | ||
} | ||
packet.setAnalogMoveVector(helper.readVector2f(buffer)); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...cloudburstmc/protocol/bedrock/codec/v662/serializer/ResourcePacksInfoSerializer_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,35 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v662.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import lombok.AccessLevel; | ||
import lombok.RequiredArgsConstructor; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v618.serializer.ResourcePacksInfoSerializer_v618; | ||
import org.cloudburstmc.protocol.bedrock.packet.ResourcePacksInfoPacket; | ||
|
||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ResourcePacksInfoSerializer_v622 extends ResourcePacksInfoSerializer_v618 { | ||
public static final ResourcePacksInfoSerializer_v622 INSTANCE = new ResourcePacksInfoSerializer_v622(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, ResourcePacksInfoPacket packet) { | ||
buffer.writeBoolean(packet.isForcedToAccept()); | ||
buffer.writeBoolean(packet.isHasAddonPacks()); | ||
buffer.writeBoolean(packet.isScriptingEnabled()); | ||
buffer.writeBoolean(packet.isForcingServerPacksEnabled()); | ||
writePacks(buffer, packet.getBehaviorPackInfos(), helper, false); | ||
writePacks(buffer, packet.getResourcePackInfos(), helper, true); | ||
this.writeCDNEntries(buffer, packet, helper); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, ResourcePacksInfoPacket packet) { | ||
packet.setForcedToAccept(buffer.readBoolean()); | ||
packet.setHasAddonPacks(buffer.readBoolean()); | ||
packet.setScriptingEnabled(buffer.readBoolean()); | ||
packet.setForcingServerPacksEnabled(buffer.readBoolean()); | ||
readPacks(buffer, packet.getBehaviorPackInfos(), helper, false); | ||
readPacks(buffer, packet.getResourcePackInfos(), helper, true); | ||
this.readCDNEntries(buffer, packet, helper); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...g/cloudburstmc/protocol/bedrock/codec/v662/serializer/SetEntityMotionSerializer_v662.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,26 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v662.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.SetEntityMotionSerializer_v291; | ||
import org.cloudburstmc.protocol.bedrock.packet.SetEntityMotionPacket; | ||
import org.cloudburstmc.protocol.common.util.VarInts; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class SetEntityMotionSerializer_v662 extends SetEntityMotionSerializer_v291 { | ||
public static final SetEntityMotionSerializer_v662 INSTANCE = new SetEntityMotionSerializer_v662(); | ||
|
||
@Override | ||
public void serialize(ByteBuf buffer, BedrockCodecHelper helper, SetEntityMotionPacket packet) { | ||
super.serialize(buffer, helper, packet); | ||
VarInts.writeUnsignedLong(buffer, packet.getTick()); | ||
} | ||
|
||
@Override | ||
public void deserialize(ByteBuf buffer, BedrockCodecHelper helper, SetEntityMotionPacket packet) { | ||
super.deserialize(buffer, helper, packet); | ||
packet.setTick(VarInts.readUnsignedLong(buffer)); | ||
} | ||
} |
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
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