-
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.
Co-Authored-By: Kaooot <[email protected]>
- Loading branch information
Showing
41 changed files
with
756 additions
and
51 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
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
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
28 changes: 28 additions & 0 deletions
28
bedrock-codec/src/main/java/org/cloudburstmc/protocol/bedrock/codec/v748/Bedrock_v748.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,28 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v748; | ||
|
||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec; | ||
import org.cloudburstmc.protocol.bedrock.codec.v729.BedrockCodecHelper_v729; | ||
import org.cloudburstmc.protocol.bedrock.codec.v729.Bedrock_v729; | ||
import org.cloudburstmc.protocol.bedrock.codec.v748.serializer.*; | ||
import org.cloudburstmc.protocol.bedrock.data.PacketRecipient; | ||
import org.cloudburstmc.protocol.bedrock.packet.*; | ||
|
||
public class Bedrock_v748 extends Bedrock_v729 { | ||
|
||
public static final BedrockCodec CODEC = Bedrock_v729.CODEC.toBuilder() | ||
.raknetProtocolVersion(11) | ||
.protocolVersion(748) | ||
.minecraftVersion("1.21.40") | ||
.helper(() -> new BedrockCodecHelper_v729(ENTITY_DATA, GAME_RULE_TYPES, ITEM_STACK_REQUEST_TYPES, CONTAINER_SLOT_TYPES, PLAYER_ABILITIES, TEXT_PROCESSING_ORIGINS)) | ||
.updateSerializer(CameraInstructionPacket.class, CameraInstructionSerializer_v748.INSTANCE) | ||
.updateSerializer(CameraPresetsPacket.class, CameraPresetsSerializer_v748.INSTANCE) | ||
.updateSerializer(CraftingDataPacket.class, CraftingDataSerializer_v748.INSTANCE) | ||
.updateSerializer(InventoryContentPacket.class, InventoryContentSerializer_v748.INSTANCE) | ||
.updateSerializer(InventorySlotPacket.class, InventorySlotSerializer_v748.INSTANCE) | ||
.updateSerializer(MobEffectPacket.class, MobEffectSerializer_v748.INSTANCE) | ||
.updateSerializer(PlayerAuthInputPacket.class, PlayerAuthInputSerializer_v748.INSTANCE) | ||
.updateSerializer(ResourcePacksInfoPacket.class, ResourcePacksInfoSerializer_v748.INSTANCE) | ||
.registerPacket(MovementEffectPacket::new, MovementEffectSerializer_v748.INSTANCE, 318, PacketRecipient.CLIENT) | ||
.registerPacket(SetMovementAuthorityPacket::new, SetMovementAuthoritySerializer_v748.INSTANCE, 319, PacketRecipient.CLIENT) | ||
.build(); | ||
} |
51 changes: 51 additions & 0 deletions
51
...cloudburstmc/protocol/bedrock/codec/v748/serializer/CameraInstructionSerializer_v748.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,51 @@ | ||
package org.cloudburstmc.protocol.bedrock.codec.v748.serializer; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import lombok.AccessLevel; | ||
import lombok.RequiredArgsConstructor; | ||
import org.cloudburstmc.math.vector.Vector2f; | ||
import org.cloudburstmc.math.vector.Vector3f; | ||
import org.cloudburstmc.protocol.bedrock.codec.BedrockCodecHelper; | ||
import org.cloudburstmc.protocol.bedrock.codec.v712.serializer.CameraInstructionSerializer_v712; | ||
import org.cloudburstmc.protocol.bedrock.data.camera.CameraSetInstruction; | ||
import org.cloudburstmc.protocol.common.NamedDefinition; | ||
import org.cloudburstmc.protocol.common.util.DefinitionUtils; | ||
import org.cloudburstmc.protocol.common.util.OptionalBoolean; | ||
import org.cloudburstmc.protocol.common.util.Preconditions; | ||
|
||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class CameraInstructionSerializer_v748 extends CameraInstructionSerializer_v712 { | ||
public static final CameraInstructionSerializer_v748 INSTANCE = new CameraInstructionSerializer_v748(); | ||
|
||
@Override | ||
protected void writeSetInstruction(BedrockCodecHelper helper, ByteBuf buf, CameraSetInstruction set) { | ||
DefinitionUtils.checkDefinition(helper.getCameraPresetDefinitions(), set.getPreset()); | ||
buf.writeIntLE(set.getPreset().getRuntimeId()); | ||
|
||
helper.writeOptionalNull(buf, set.getEase(), this::writeEase); | ||
helper.writeOptionalNull(buf, set.getPos(), helper::writeVector3f); | ||
helper.writeOptionalNull(buf, set.getRot(), helper::writeVector2f); | ||
helper.writeOptionalNull(buf, set.getFacing(), helper::writeVector3f); | ||
helper.writeOptionalNull(buf, set.getViewOffset(), helper::writeVector2f); | ||
helper.writeOptionalNull(buf, set.getEntityOffset(), helper::writeVector3f); | ||
|
||
helper.writeOptional(buf, OptionalBoolean::isPresent, set.getDefaultPreset(), | ||
(b, optional) -> b.writeBoolean(optional.getAsBoolean())); | ||
} | ||
|
||
@Override | ||
protected CameraSetInstruction readSetInstruction(ByteBuf buf, BedrockCodecHelper helper) { | ||
int runtimeId = buf.readIntLE(); | ||
NamedDefinition definition = helper.getCameraPresetDefinitions().getDefinition(runtimeId); | ||
Preconditions.checkNotNull(definition, "Unknown camera preset " + runtimeId); | ||
|
||
CameraSetInstruction.EaseData ease = helper.readOptional(buf, null, this::readEase); | ||
Vector3f pos = helper.readOptional(buf, null, helper::readVector3f); | ||
Vector2f rot = helper.readOptional(buf, null, helper::readVector2f); | ||
Vector3f facing = helper.readOptional(buf, null, helper::readVector3f); | ||
Vector2f viewOffset = helper.readOptional(buf, null, helper::readVector2f); | ||
Vector3f entityOffset = helper.readOptional(buf, null, helper::readVector3f); | ||
OptionalBoolean defaultPreset = helper.readOptional(buf, OptionalBoolean.empty(), b -> OptionalBoolean.of(b.readBoolean())); | ||
return new CameraSetInstruction(definition, ease, pos, rot, facing, viewOffset, entityOffset, defaultPreset); | ||
} | ||
} |
Oops, something went wrong.