Java源码示例:com.nukkitx.nbt.tag.ListTag

示例1
public PaletteManager() {
    InputStream stream = BedrockConnect.class.getClassLoader().getResourceAsStream("tables/runtime_block_states.dat");
    if (stream == null) {
        throw new AssertionError("Unable to locate block state nbt");
    }

    Map<String, Integer> blockIdToIdentifier = new HashMap<>();
    ListTag<CompoundTag> tag;

    NBTInputStream nbtInputStream = NbtUtils.createNetworkReader(stream);

    ListTag<CompoundTag> blocksTag;
    try {
        tag = (ListTag<CompoundTag>) nbtInputStream.readTag();
        nbtInputStream.close();
    } catch (Exception ex) {
        System.out.println("Failed to receive blocks palette");
        throw new AssertionError(ex);
    }

    CACHED_PALLETE = tag;
}
 
示例2
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setPlatformLockedContentConfirmed(buffer.readBoolean());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setServerChunkTickRange(buffer.readIntLE());
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例3
@SuppressWarnings("unchecked")
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(VarInts.readInt(buffer));
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setPlatformLockedContentConfirmed(buffer.readBoolean());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setServerChunkTickRange(buffer.readIntLE());
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    packet.setOnlySpawningV1Villagers(buffer.readBoolean());
    packet.setVanillaVersion(BedrockUtils.readString(buffer));
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setMovementServerAuthoritative(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    try (NBTInputStream stream = NbtUtils.createNetworkReader(new ByteBufInputStream(buffer))) {
        packet.setBlockPalette((ListTag<CompoundTag>) stream.readTag());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    BedrockUtils.readArray(buffer, packet.getItemEntries(), buf -> {
        String identifier = BedrockUtils.readString(buf);
        short id = buf.readShortLE();
        return new StartGamePacket.ItemEntry(identifier, id);
    });

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例4
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setPlatformLockedContentConfirmed(buffer.readBoolean());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setServerChunkTickRange(buffer.readIntLE());
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例5
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    buffer.readBoolean(); // broadcasting to XBL
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setTrustingPlayers(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setServerChunkTickRange(buffer.readIntLE());
    buffer.readBoolean(); // broadcasting to Platform
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    buffer.readBoolean(); // Intent to broadcast XBL
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例6
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setPlatformLockedContentConfirmed(buffer.readBoolean());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setServerChunkTickRange(buffer.readIntLE());
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    packet.setOnlySpawningV1Villagers(buffer.readBoolean());
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .shortTag("id", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    BedrockUtils.readArray(buffer, packet.getItemEntries(), buf -> {
        String identifier = BedrockUtils.readString(buf);
        short id = buf.readShortLE();
        return new StartGamePacket.ItemEntry(identifier, id);
    });

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例7
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));

    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setPlatformLockedContentConfirmed(buffer.readBoolean());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setServerChunkTickRange(buffer.readIntLE());
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    packet.setFromWorldTemplate(buffer.readBoolean());
    packet.setWorldTemplateOptionLocked(buffer.readBoolean());
    // Level settings end

    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}
 
示例8
@Override
public void deserialize(ByteBuf buffer, StartGamePacket packet) {
    packet.setUniqueEntityId(VarInts.readLong(buffer));
    packet.setRuntimeEntityId(VarInts.readUnsignedLong(buffer));
    packet.setPlayerGamemode(VarInts.readInt(buffer));
    packet.setPlayerPosition(BedrockUtils.readVector3f(buffer));
    packet.setRotation(BedrockUtils.readVector2f(buffer));
    // Level settings start
    packet.setSeed(VarInts.readInt(buffer));
    packet.setDimensionId(VarInts.readInt(buffer));
    packet.setGeneratorId(VarInts.readInt(buffer));
    packet.setLevelGamemode(VarInts.readInt(buffer));
    packet.setDifficulty(VarInts.readInt(buffer));
    packet.setDefaultSpawn(BedrockUtils.readBlockPosition(buffer));
    packet.setAchievementsDisabled(buffer.readBoolean());
    packet.setTime(VarInts.readInt(buffer));
    packet.setEduEditionOffers(buffer.readBoolean() ? 1 : 0);
    packet.setEduFeaturesEnabled(buffer.readBoolean());
    packet.setRainLevel(buffer.readFloatLE());
    packet.setLightningLevel(buffer.readFloatLE());
    packet.setMultiplayerGame(buffer.readBoolean());
    packet.setBroadcastingToLan(buffer.readBoolean());
    buffer.readBoolean(); // broadcasting to XBL
    packet.setCommandsEnabled(buffer.readBoolean());
    packet.setTexturePacksRequired(buffer.readBoolean());
    BedrockUtils.readArray(buffer, packet.getGamerules(), BedrockUtils::readGameRule);
    packet.setBonusChestEnabled(buffer.readBoolean());
    packet.setStartingWithMap(buffer.readBoolean());
    packet.setTrustingPlayers(buffer.readBoolean());
    packet.setDefaultPlayerPermission(PLAYER_PERMISSIONS[VarInts.readInt(buffer)]);
    packet.setXblBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    packet.setServerChunkTickRange(buffer.readIntLE());
    buffer.readBoolean(); // Broadcasting to Platform
    packet.setPlatformBroadcastMode(GamePublishSetting.byId(VarInts.readInt(buffer)));
    buffer.readBoolean(); // Intent on XBL broadcast
    packet.setBehaviorPackLocked(buffer.readBoolean());
    packet.setResourcePackLocked(buffer.readBoolean());
    packet.setFromLockedWorldTemplate(buffer.readBoolean());
    packet.setUsingMsaGamertagsOnly(buffer.readBoolean());
    // Level settings end
    packet.setLevelId(BedrockUtils.readString(buffer));
    packet.setWorldName(BedrockUtils.readString(buffer));
    packet.setPremiumWorldTemplateId(BedrockUtils.readString(buffer));
    packet.setTrial(buffer.readBoolean());
    packet.setCurrentTick(buffer.readLongLE());
    packet.setEnchantmentSeed(VarInts.readInt(buffer));

    int paletteLength = VarInts.readUnsignedInt(buffer);
    List<CompoundTag> palette = new ObjectArrayList<>(paletteLength);
    for (int i = 0; i < paletteLength; i++) {
        palette.add(CompoundTagBuilder.builder()
                .tag(CompoundTagBuilder.builder()
                        .stringTag("name", BedrockUtils.readString(buffer))
                        .build("block"))
                .shortTag("meta", buffer.readShortLE())
                .buildRootTag());
    }
    packet.setBlockPalette(new ListTag<>("", CompoundTag.class, palette));

    packet.setMultiplayerCorrelationId(BedrockUtils.readString(buffer));
}