Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tunikakeks/WaterdogPE int…
Browse files Browse the repository at this point in the history
…o 1.21.50
  • Loading branch information
AkmalFairuz committed Dec 4, 2024
2 parents 688824c + 7959641 commit 05d9dca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
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;
import org.cloudburstmc.protocol.bedrock.codec.v766.Bedrock_v766;

@ToString(exclude = {"defaultCodec", "bedrockCodec"})
public enum ProtocolVersion {
Expand Down Expand Up @@ -113,7 +114,8 @@ public enum ProtocolVersion {
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_40(748, Bedrock_v748.CODEC);
MINECRAFT_PE_1_21_40(748, Bedrock_v748.CODEC),
MINECRAFT_PE_1_21_50(766, Bedrock_v766.CODEC);

private static final ProtocolVersion[] VALUES = values();
private static final Int2ObjectMap<ProtocolVersion> VERSIONS = new Int2ObjectOpenHashMap<>();
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/dev/waterdog/waterdogpe/packs/PackManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class PackManager {
private final ResourcePacksInfoPacket packsInfoPacket = new ResourcePacksInfoPacket();
private final ResourcePackStackPacket stackPacket = new ResourcePackStackPacket();

private static final UUID ZERO_UUID = new UUID(0, 0);

public PackManager(ProxyServer proxy) {
this.proxy = proxy;
}
Expand Down Expand Up @@ -148,6 +150,9 @@ public boolean unregisterPack(UUID packId) {
}

public void rebuildPackets() {
this.packsInfoPacket.setWorldTemplateId(ZERO_UUID);
this.packsInfoPacket.setWorldTemplateVersion("0.0.0");

this.packsInfoPacket.setForcedToAccept(this.proxy.getConfiguration().isForceServerPacks());
this.stackPacket.setForcedToAccept(this.proxy.getConfiguration().isOverwriteClientPacks());

Expand All @@ -157,10 +162,10 @@ public void rebuildPackets() {
this.stackPacket.getBehaviorPacks().clear();
this.stackPacket.getResourcePacks().clear();

this.stackPacket.setGameVersion("");
this.stackPacket.setGameVersion("*");

for (ResourcePack pack : this.packs.values()) {
ResourcePacksInfoPacket.Entry infoEntry = new ResourcePacksInfoPacket.Entry(pack.getPackId().toString(), pack.getVersion().toString(),
ResourcePacksInfoPacket.Entry infoEntry = new ResourcePacksInfoPacket.Entry(pack.getPackId(), pack.getVersion().toString(),
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)) {
Expand Down

0 comments on commit 05d9dca

Please sign in to comment.