com.nukkitx.nbt.tag.ListTag Java Examples

The following examples show how to use com.nukkitx.nbt.tag.ListTag. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PaletteManager.java    From BedrockConnect with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: StartGameSerializer_v354.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #3
Source File: StartGameSerializer_v388.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #4
Source File: StartGameSerializer_v340.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #5
Source File: StartGameSerializer_v313.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #6
Source File: StartGameSerializer_v361.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #7
Source File: StartGameSerializer_v332.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}
 
Example #8
Source File: StartGameSerializer_v291.java    From Protocol with Apache License 2.0 4 votes vote down vote up
@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));
}