diff --git a/src/main/java/net/minestom/server/entity/EntityManager.java b/src/main/java/net/minestom/server/entity/EntityManager.java index 9f461d06b..c261abf22 100644 --- a/src/main/java/net/minestom/server/entity/EntityManager.java +++ b/src/main/java/net/minestom/server/entity/EntityManager.java @@ -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); diff --git a/src/main/java/net/minestom/server/entity/Player.java b/src/main/java/net/minestom/server/entity/Player.java index 4e36e0fd0..52654567c 100644 --- a/src/main/java/net/minestom/server/entity/Player.java +++ b/src/main/java/net/minestom/server/entity/Player.java @@ -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. *
* 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;