Skip to content

Commit

Permalink
Implement sleeping state
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Nov 21, 2024
1 parent d28df50 commit 57621b7
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
import lombok.Getter;
import lombok.Setter;
import net.kyori.adventure.key.Key;
import org.cloudburstmc.math.vector.Vector3i;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.MetadataType;
import org.geysermc.mcprotocollib.protocol.data.game.entity.metadata.Pose;

import java.util.Optional;

@Getter
@Setter
public abstract class LivingEntity extends Entity {
Expand Down Expand Up @@ -75,12 +78,16 @@ public void baseTick() {
this.effectState.tick();
}

public Optional<Vector3i> getSleepingPos() {
return this.metadataState.getMetadata(NamedEntityData.LIVING_ENTITY__SLEEPING_POS, MetadataType.OPTIONAL_POSITION);
}

public boolean isSpectator() {
return false; // TODO
return false;
}

public boolean isSleeping() {
return false; // TODO
return this.getSleepingPos().isPresent();
}

public abstract boolean isUnderWater();
Expand Down

0 comments on commit 57621b7

Please sign in to comment.