Skip to content

Commit

Permalink
Fixed resource pack handling inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Nov 21, 2023
1 parent d81ff07 commit 54ac7a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void register(ViaProviders providers) {
public void init(UserConnection user) {
user.put(new ClientSettingsStorage("en_us", 12, 0, true, (short) 127, 1, false, true));
user.put(new SpawnPositionStorage());
user.put(new ResourcePacksStorage());
user.put(new BlobCache(user));
user.put(new PlayerListStorage());
user.put(new PacketSyncStorage(user));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import net.raphimc.viabedrock.protocol.types.JavaTypes;

import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import java.util.stream.Collectors;

Expand All @@ -66,9 +67,10 @@ public static void register(final BedrockProtocol protocol) {
return; // Mojang client silently ignores multiple start game packets
}

if (resourcePacksStorage == null || !resourcePacksStorage.hasCompletedTransfer()) {
BedrockProtocol.kickForIllegalState(wrapper.user(), "Pack negotiation not completed");
return;
if (!resourcePacksStorage.hasFinishedLoading()) {
ViaBedrock.getPlatform().getLogger().log(Level.WARNING, "Pack negotiation not completed before joining game. Skipping resource pack loading");
resourcePacksStorage.setCompletedTransfer();
resourcePacksStorage.setPackStack(new UUID[0], new UUID[0]);
}

final long uniqueEntityId = wrapper.read(BedrockTypes.VAR_LONG); // unique entity id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ private Chunk remapChunk(final Chunk chunk) throws Exception {
} else {
remappedBlockPalette.setIdAt(x, y, z, remappedBlockState);
}
} else {
ViaBedrock.getPlatform().getLogger().log(Level.WARNING, "Invalid layer 2 block state. L1: " + prevBlockState + ", L2: " + blockState);
}
}
}
Expand Down

0 comments on commit 54ac7a2

Please sign in to comment.