Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/WaterdogPE/WaterdogPE int…
Browse files Browse the repository at this point in the history
…o v1.21.0
  • Loading branch information
AkmalFairuz committed Aug 15, 2024
2 parents 1e5ab9d + 4e2b3cd commit 91e0f2c
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 11 deletions.
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<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.89.Final</netty.version>
<netty.version>4.1.101.Final</netty.version>
</properties>

<repositories>
Expand Down Expand Up @@ -196,7 +196,17 @@
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>9.10.1</version>
<version>9.37.2</version>
</dependency>
<dependency>
<groupId>org.cloudburstmc.protocol</groupId>
<artifactId>common</artifactId>
<version>3.0.0.Beta2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cloudburstmc</groupId>
<artifactId>nbt</artifactId>
<version>3.0.3.Final</version>
</dependency>
</dependencies>

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 @@ -169,7 +169,7 @@ public final BedrockPacketCodec setCodecHelper(BedrockCodec codec, BedrockCodecH
this.helper = requireNonNull(helper, "Helper can not be null");

switch (this.inboundRecipient) {
case CLIENT -> this.helper.setEncodingSettings(clientEncodingSettings);
case CLIENT -> this.helper.setEncodingSettings(EncodingSettings.UNLIMITED);
case SERVER -> this.helper.setEncodingSettings(serverEncodingSettings);
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
import org.cloudburstmc.protocol.bedrock.codec.v662.Bedrock_v662;
import org.cloudburstmc.protocol.bedrock.codec.v671.Bedrock_v671;
import org.cloudburstmc.protocol.bedrock.codec.v685.Bedrock_v685;
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 @@ -105,7 +108,8 @@ public enum ProtocolVersion {
MINECRAFT_PE_1_20_60(649, Bedrock_v649.CODEC),
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_0(685, Bedrock_v685.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 @@ -35,7 +35,6 @@ public class BlockPalette {
private static final Int2ObjectMap<BlockPalette> paletteCache = new Int2ObjectOpenHashMap<>();
private final Object2ShortMap<BlockPair> entryToId = new Object2ShortLinkedOpenHashMap<>();
private final Short2ObjectMap<BlockPair> idToEntry = new Short2ObjectLinkedOpenHashMap<>();

public BlockPalette(NbtList<NbtMap> paletteData, ProtocolVersion protocol) {
short id = 0;
for (NbtMap item : paletteData) {
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 91e0f2c

Please sign in to comment.