Skip to content

Commit

Permalink
Add support for 1.20.40
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Oct 22, 2024
1 parent d445d50 commit 06b6fa0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public class ProtocolCodecs {
HANDLED_PACKETS.add(LevelChunkPacket.class);
HANDLED_PACKETS.add(ClientCheatAbilityPacket.class);
HANDLED_PACKETS.add(ToastRequestPacket.class);
HANDLED_PACKETS.add(MovementEffectPacket.class);
}

private static final List<ProtocolCodecUpdater> UPDATERS = new ObjectArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v686.Bedrock_v686;
import org.cloudburstmc.protocol.bedrock.codec.v712.Bedrock_v712;
import org.cloudburstmc.protocol.bedrock.codec.v729.Bedrock_v729;
import org.cloudburstmc.protocol.bedrock.codec.v748.Bedrock_v748;

@ToString(exclude = {"defaultCodec", "bedrockCodec"})
public enum ProtocolVersion {
Expand Down Expand Up @@ -111,7 +112,8 @@ public enum ProtocolVersion {
MINECRAFT_PE_1_21_0(685, Bedrock_v685.CODEC),
MINECRAFT_PE_1_21_2(686, Bedrock_v686.CODEC),
MINECRAFT_PE_1_21_20(712, Bedrock_v712.CODEC),
MINECRAFT_PE_1_21_30(729, Bedrock_v729.CODEC);
MINECRAFT_PE_1_21_30(729, Bedrock_v729.CODEC),
MINECRAFT_PE_1_21_40(748, Bedrock_v748.CODEC);

private static final ProtocolVersion[] VALUES = values();
private static final Int2ObjectMap<ProtocolVersion> VERSIONS = new Int2ObjectOpenHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ public PacketSignal handle(AnimateEntityPacket packet) {
return signal;
}

@Override
public PacketSignal handle(MovementEffectPacket packet) {
return rewriteId(packet.getEntityRuntimeId(), packet::setEntityRuntimeId);
}

private PacketSignal rewriteMetadata(EntityDataMap metadata) {
PacketSignal signal = PacketSignal.UNHANDLED;
for (EntityDataType<Long> data : ENTITY_DATA_FIELDS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public void rebuildPackets() {

for (ResourcePack pack : this.packs.values()) {
ResourcePacksInfoPacket.Entry infoEntry = new ResourcePacksInfoPacket.Entry(pack.getPackId().toString(), pack.getVersion().toString(),
pack.getPackSize(), pack.getContentKey(), "", pack.getContentKey().equals("") ? "" : pack.getPackId().toString(), false, false, false);
pack.getPackSize(), pack.getContentKey(), "", pack.getContentKey().equals("") ? "" : pack.getPackId().toString(), false, false, false, null);
ResourcePackStackPacket.Entry stackEntry = new ResourcePackStackPacket.Entry(pack.getPackId().toString(), pack.getVersion().toString(), "");
if (pack.getType().equals(ResourcePack.TYPE_RESOURCES)) {
this.packsInfoPacket.getResourcePackInfos().add(infoEntry);
Expand Down

0 comments on commit 06b6fa0

Please sign in to comment.