Provide the proper dimensiontype in the JoinGamePacket

This commit is contained in:
themode 2021-01-07 04:21:34 +01:00
parent 0fa82aff1f
commit 349364e15d
2 changed files with 7 additions and 3 deletions

View File

@ -62,7 +62,7 @@ public final class EntityManager {
Check.notNull(spawningInstance, "You need to specify a spawning instance in the PlayerLoginEvent");
waitingPlayer.init();
waitingPlayer.init(spawningInstance);
// Spawn the player at Player#getRespawnPoint during the next instance tick
spawningInstance.scheduleNextTick(waitingPlayer::setInstance);

View File

@ -215,7 +215,7 @@ public class Player extends LivingEntity implements CommandSender {
refreshAnswerKeepAlive(true);
this.gameMode = GameMode.SURVIVAL;
this.dimensionType = DimensionType.OVERWORLD;
this.dimensionType = DimensionType.OVERWORLD; // Default dimension
this.levelFlat = true;
getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.1f);
@ -228,8 +228,12 @@ public class Player extends LivingEntity implements CommandSender {
* Init the player and spawn him.
* <p>
* WARNING: executed in the main update thread
*
* @param spawnInstance the player spawn instance (defined in {@link PlayerLoginEvent})
*/
protected void init() {
protected void init(@NotNull Instance spawnInstance) {
this.dimensionType = spawnInstance.getDimensionType();
JoinGamePacket joinGamePacket = new JoinGamePacket();
joinGamePacket.entityId = getEntityId();
joinGamePacket.gameMode = gameMode;