Skip to content

Commit

Permalink
Add 1:1 spawn position code
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Dec 13, 2024
1 parent 9c22d81 commit fead56b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public abstract class Player extends LivingEntity {
private boolean clientLoaded = false;
private Optional<GlobalPos> 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
Expand Down

0 comments on commit fead56b

Please sign in to comment.