com.nukkitx.protocol.bedrock.data.GameRuleData Java Examples

The following examples show how to use com.nukkitx.protocol.bedrock.data.GameRuleData. 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: PipePlayer.java    From BedrockConnect with GNU General Public License v3.0 4 votes vote down vote up
public void joinGame() {

        MovePlayerPacket mp = new MovePlayerPacket();
        mp.setRuntimeEntityId(1);
        mp.setOnGround(false);
        mp.setMode(MovePlayerPacket.Mode.NORMAL);
        mp.setRotation(Vector3f.from(0,0,0));
        mp.setPosition(Vector3f.from(0,0,0));
        session.sendPacket(mp);

        StartGamePacket startGamePacket = new StartGamePacket();
        startGamePacket.setUniqueEntityId(1);
        startGamePacket.setRuntimeEntityId(1);
        startGamePacket.setPlayerGamemode(1);
        startGamePacket.setPlayerPosition(Vector3f.from(0, 0, 0));
        startGamePacket.setRotation(Vector2f.from(1, 1));

        startGamePacket.setSeed(-1);
        startGamePacket.setDimensionId(0);
        startGamePacket.setGeneratorId(1);
        startGamePacket.setLevelGamemode(1);
        startGamePacket.setDifficulty(1);
        startGamePacket.setDefaultSpawn(Vector3i.from(0, 0, 0));
        startGamePacket.setAchievementsDisabled(false);
        startGamePacket.setTime(-1);
        startGamePacket.setEduFeaturesEnabled(false);
        startGamePacket.setEduFeaturesEnabled(false);
        startGamePacket.setRainLevel(0);
        startGamePacket.setLightningLevel(0);
        startGamePacket.setPlatformLockedContentConfirmed(false);
        startGamePacket.setMultiplayerGame(true);
        startGamePacket.setBroadcastingToLan(true);
        startGamePacket.getGamerules().add((new GameRuleData<>("showcoordinates", true)));
        startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC);
        startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC);
        startGamePacket.setCommandsEnabled(true);
        startGamePacket.setTexturePacksRequired(false);
        startGamePacket.setBonusChestEnabled(false);
        startGamePacket.setStartingWithMap(false);
        startGamePacket.setTrustingPlayers(false);
        startGamePacket.setDefaultPlayerPermission(PlayerPermission.MEMBER);
        startGamePacket.setServerChunkTickRange(4);
        startGamePacket.setBehaviorPackLocked(false);
        startGamePacket.setResourcePackLocked(false);
        startGamePacket.setFromLockedWorldTemplate(false);
        startGamePacket.setUsingMsaGamertagsOnly(false);
        startGamePacket.setFromWorldTemplate(false);
        startGamePacket.setWorldTemplateOptionLocked(false);
        startGamePacket.setOnlySpawningV1Villagers(false);
        startGamePacket.setMovementServerAuthoritative(false);
        startGamePacket.setTrial(false);
        startGamePacket.setVanillaVersion(Server.codec.getMinecraftVersion());

        startGamePacket.setLevelId("");
        startGamePacket.setWorldName("world");
        startGamePacket.setPremiumWorldTemplateId("");
        startGamePacket.setCurrentTick(0);
        startGamePacket.setEnchantmentSeed(0);
        startGamePacket.setMultiplayerCorrelationId("");

        startGamePacket.setBlockPalette(BedrockConnect.paletteManager.CACHED_PALLETE);

        session.sendPacket(startGamePacket);

        spawn();
    }
 
Example #2
Source File: JavaUpdateTimeTranslator.java    From Geyser with MIT License 4 votes vote down vote up
private void setDoDaylightCycleGamerule(GeyserSession session, boolean doCycle) {
    GameRulesChangedPacket gameRulesChangedPacket = new GameRulesChangedPacket();
    gameRulesChangedPacket.getGameRules().add(new GameRuleData<>("dodaylightcycle", doCycle));
    session.sendUpstreamPacket(gameRulesChangedPacket);
}