diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/AbstractClientPlayer.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/AbstractClientPlayer.java index cbd63b20..2567e5b7 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/AbstractClientPlayer.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/AbstractClientPlayer.java @@ -30,7 +30,7 @@ public abstract class AbstractClientPlayer extends Player { private final BotConnection connection; public AbstractClientPlayer(BotConnection connection, Level level, GameProfile gameProfile) { - super(level, gameProfile); + super(level, level.levelData().spawnPos(), level.levelData().spawnAngle(), gameProfile); this.connection = connection; } diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Entity.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Entity.java index 2608912f..60a67311 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Entity.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Entity.java @@ -153,6 +153,7 @@ public Entity(EntityType entityType, Level level) { metadataState.setMetadata(metadata); } + this.setPos(0.0, 0.0, 0.0); this.eyeHeight = entityType.dimensions().eyeHeight(); } diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/FoodData.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/FoodData.java index cf41fbf1..d1a69983 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/FoodData.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/FoodData.java @@ -17,11 +17,9 @@ */ package com.soulfiremc.server.protocol.bot.state.entity; - public class FoodData { private int foodLevel = 20; private float saturationLevel = 5.0F; - private float exhaustionLevel; public int getFoodLevel() { return this.foodLevel; diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/LivingEntity.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/LivingEntity.java index a1d80eff..9bf0b05d 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/LivingEntity.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/LivingEntity.java @@ -76,6 +76,9 @@ public abstract class LivingEntity extends Entity { public LivingEntity(EntityType entityType, Level level) { super(entityType, level); + this.setHealth(this.getMaxHealth()); + this.reapplyPosition(); + this.setYRot((float) (Math.random() * (float) (Math.PI * 2))); } @Override diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Player.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Player.java index 0c1fb900..15a8b1e5 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Player.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/entity/Player.java @@ -72,10 +72,11 @@ public abstract class Player extends LivingEntity { private boolean clientLoaded = false; private Optional lastDeathLocation = Optional.empty(); - public Player(Level level, GameProfile gameProfile) { + public Player(Level level, Vector3i spawnBlockPos, float spawnYRot, GameProfile gameProfile) { super(EntityType.PLAYER, level); - this.gameProfile = gameProfile; uuid(gameProfile.getId()); + this.gameProfile = gameProfile; + this.moveTo((double) spawnBlockPos.getX() + 0.5, spawnBlockPos.getY() + 1, (double) spawnBlockPos.getZ() + 0.5, spawnYRot, 0.0F); } @Override