Lodestone.Level
Loading...
Searching...
No Matches
Player.h
Go to the documentation of this file.
1//
2// Created by DexrnZacAttack on 11/11/25 using zPc-i2.
3//
4#ifndef LODESTONE_PLAYER_H
5#define LODESTONE_PLAYER_H
6#include <string>
7
11
13 class LODESTONE_API Player : public Entity,
15 public:
17 virtual const std::string &getId() const = 0;
18
19 std::string toString() const override {
20 return std::format("Player[id={}, health={}, pos={}]", this->getId(), this->m_health, this->position.toString());
21 };
22
23 world::World *getWorld() const;
24 bool isInWorld() const;
25
26 level::Level *getLevel() const;
27 bool isInLevel() const;
28
29 virtual void respawn(bool inDefaultLevel = true);
30 bool isOnGround() const;
31
32 std::unique_ptr<level::properties::AbstractProperty>
33 getProperty(const std::string &name) override;
34
35 protected:
41 void setLevel(level::Level *level, bool resetCoords = true);
42
48 void setWorld(world::World *world, bool resetCoords = true);
49
50 const common::registry::Identifier *getType() const override;
51
52 private:
55 // todo should we make player that has inventory
56
58 };
59} // namespace lodestone::level::entity
60
61#endif // LODESTONE_PLAYER_H
#define LODESTONE_API
A level holds Chunks.
Definition Level.h:26
int m_health
Definition Entity.h:56
Definition Player.h:14
world::World * m_world
Definition Player.h:53
level::Level * m_currentLevel
Definition Player.h:54
virtual const std::string & getId() const =0
Can return a UUID, player name, or other depending on the version.
std::string toString() const override
Definition Player.h:19
types::Vec3d position
Definition WorldSpaceObject.h:20
Definition ReflectiveProperties.h:15
Definition World.h:22
Definition Entity.cpp:8
Definition World.cpp:6
Definition Block.cpp:6