Skip to content

Commit

Permalink
MCBE 1.21.20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Alemiz112 committed Aug 14, 2024
1 parent ec94c27 commit 4e2b3cd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<raklib.version>1.0.0.CR3-SNAPSHOT</raklib.version>
<protocol.version>3.0.0.Beta2-SNAPSHOT</protocol.version>
<protocol.version>3.0.0.Beta3-SNAPSHOT</protocol.version>
<log4j2.version>2.17.1</log4j2.version>
<jline.version>3.23.0</jline.version>
<netty.version>4.1.101.Final</netty.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

package dev.waterdog.waterdogpe.network.connection.codec.batch;

import org.cloudburstmc.protocol.bedrock.util.BatchFlag;
import org.cloudburstmc.protocol.bedrock.util.PacketFlag;

public enum BatchFlags implements BatchFlag {
public enum BatchFlags implements PacketFlag {
SKIP_QUEUE
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected void decode(ChannelHandlerContext ctx, BedrockBatchWrapper msg, List<O
while (buffer.isReadable()) {
int packetLength = VarInts.readUnsignedInt(buffer);

BedrockPacketWrapper wrapper = new BedrockPacketWrapper();
BedrockPacketWrapper wrapper = BedrockPacketWrapper.create();
wrapper.setPacketBuffer(buffer.readRetainedSlice(packetLength));
msg.getPackets().add(wrapper);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void onTick(ChannelHandlerContext ctx) {
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
if (msg instanceof BedrockPacket packet) {
this.packetQueue.add(new BedrockPacketWrapper(0, 0, 0, ReferenceCountUtil.retain(packet), null));
this.packetQueue.add(BedrockPacketWrapper.create(0, 0, 0, ReferenceCountUtil.retain(packet), null));
} else if (msg instanceof BedrockPacketWrapper packet) {
this.packetQueue.add(ReferenceCountUtil.retain(packet));
} else if (msg instanceof BedrockBatchWrapper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;
import org.cloudburstmc.protocol.bedrock.codec.v686.Bedrock_v686;
import org.cloudburstmc.protocol.bedrock.codec.v712.Bedrock_v712;

@ToString(exclude = {"defaultCodec", "bedrockCodec"})
public enum ProtocolVersion {
Expand Down Expand Up @@ -107,7 +108,8 @@ public enum ProtocolVersion {
MINECRAFT_PE_1_20_70(662, Bedrock_v662.CODEC),
MINECRAFT_PE_1_20_80(671, Bedrock_v671.CODEC),
MINECRAFT_PE_1_21_0(685, Bedrock_v685.CODEC),
MINECRAFT_PE_1_21_2(686, Bedrock_v686.CODEC);
MINECRAFT_PE_1_21_2(686, Bedrock_v686.CODEC),
MINECRAFT_PE_1_21_20(712, Bedrock_v712.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 @@ -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);
pack.getPackSize(), pack.getContentKey(), "", pack.getContentKey().equals("") ? "" : pack.getPackId().toString(), false, false, false);
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 4e2b3cd

Please sign in to comment.