Skip to content

Commit

Permalink
login send, next step world for login
Browse files Browse the repository at this point in the history
  • Loading branch information
JblusItsMe committed Aug 21, 2024
1 parent 86bc1d2 commit da0f598
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/org/sculk/Player.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.sculk;

import org.cloudburstmc.math.vector.Vector2f;
import org.cloudburstmc.math.vector.Vector3f;
import org.cloudburstmc.math.vector.Vector3i;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
import org.cloudburstmc.protocol.bedrock.data.*;
Expand All @@ -11,6 +14,7 @@
import org.sculk.player.client.ClientChainData;
import org.sculk.player.client.LoginChainData;

import java.util.List;
import java.util.UUID;

/*
Expand Down Expand Up @@ -40,39 +44,39 @@ public Player(BedrockServerSession session, ClientChainData data) {
}

public void processLogin() {

getServer().getLogger().info("process login call");
}

public void completeLogin() {
StartGamePacket startGamePacket = new StartGamePacket();
startGamePacket.setUniqueEntityId(this.getUniqueId());
startGamePacket.setRuntimeEntityId(this.getRuntimeId());
//startGamePacket.setPlayerGameType(GameType.CREATIVE);
//startGamePacket.setPlayerPosition(pos);
//startGamePacket.setRotation(Vector2f.from(this.getYaw(), this.getPitch()));
startGamePacket.setPlayerGameType(GameType.CREATIVE);
startGamePacket.setPlayerPosition(Vector3f.from(0, 0, 0));
startGamePacket.setRotation(Vector2f.from(0, 0));
startGamePacket.setSeed(-1L);
startGamePacket.setDimensionId(0);
startGamePacket.setTrustingPlayers(false);
startGamePacket.setLevelGameType(GameType.CREATIVE);
startGamePacket.setDifficulty(0);
//startGamePacket.setDefaultSpawn(this.getSpawn().getPosition().toInt());
startGamePacket.setDefaultSpawn(Vector3i.from(0, 0, 0));
startGamePacket.setAchievementsDisabled(true);
startGamePacket.setDayCycleStopTime(0);
startGamePacket.setRainLevel(0);
startGamePacket.setLightningLevel(0);
startGamePacket.setCommandsEnabled(true);
startGamePacket.setMultiplayerGame(true);
startGamePacket.setBroadcastingToLan(true);
// NetworkUtils.gameRulesToNetwork(this.getLevel().getGameRules(), startGamePacket.getGamerules());
//NetworkUtils.gameRulesToNetwork(this.getLevel().getGameRules(), startGamePacket.getGamerules());
startGamePacket.setLevelId(""); // This is irrelevant since we have multiple levels
startGamePacket.setLevelName("World"); // We might as well use the MOTD instead of the default level name
startGamePacket.setGeneratorId(1); // 0 old, 1 infinite, 2 flat - Has no effect to my knowledge
//startGamePacket.setItemDefinitions(CloudItemRegistry.get().getItemEntries());
//startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setItemDefinitions(List.of());
startGamePacket.setXblBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setPlatformBroadcastMode(GamePublishSetting.PUBLIC);
startGamePacket.setDefaultPlayerPermission(PlayerPermission.MEMBER);
startGamePacket.setServerChunkTickRange(4);
startGamePacket.setVanillaVersion("1.17.40"); // Temporary hack that allows player to join by disabling the new chunk columns introduced in update 1.18
startGamePacket.setVanillaVersion("1.21.2"); // Temporary hack that allows player to join by disabling the new chunk columns introduced in update 1.18

This comment has been minimized.

Copy link
@AzaleeX

AzaleeX Aug 21, 2024

Member

delete commentaire

startGamePacket.setPremiumWorldTemplateId("");
startGamePacket.setMultiplayerCorrelationId("");
startGamePacket.setInventoriesServerAuthoritative(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void onCompletion(Server server) {
}
}
});
server.getLogger().info("send async task");
this.server.getScheduler().scheduleAsyncTask(loginData.getPreLoginEventTask());

PlayStatusPacket statusPacket = new PlayStatusPacket();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/sculk/player/PlayerLoginData.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public Player initializePlayer() {
return null;
}

player.processLogin();
player.completeLogin();
return player;
}
Expand Down

0 comments on commit da0f598

Please sign in to comment.