Java Code Examples for com.nukkitx.protocol.bedrock.packet.StartGamePacket#setPlatformLockedContentConfirmed()

The following examples show how to use com.nukkitx.protocol.bedrock.packet.StartGamePacket#setPlatformLockedContentConfirmed() . 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: 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 2
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 3
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 4
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 5
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));
}