Lodestone.Level
Loading...
Searching...
No Matches
projects
Libraries
Level
include
Lodestone.Level
entity
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
8
#include "
Lodestone.Level/Level.h
"
9
#include "
Lodestone.Level/entity/Entity.h
"
10
#include "
Lodestone.Level/properties/ReflectiveProperties.h
"
11
12
namespace
lodestone::level::entity
{
13
class
LODESTONE_API
Player
:
public
Entity
,
14
public
properties::ReflectiveProperties
{
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
:
53
world::World
*
m_world
=
nullptr
;
54
level::Level
*
m_currentLevel
=
nullptr
;
55
// todo should we make player that has inventory
56
57
friend
class
lodestone::level::world::World
;
58
};
59
}
// namespace lodestone::level::entity
60
61
#endif
// LODESTONE_PLAYER_H
LODESTONE_API
#define LODESTONE_API
Entity.h
Level.h
ReflectiveProperties.h
lodestone::common::registry::Identifier
lodestone::level::Level
A level holds Chunks.
Definition
Level.h:26
lodestone::level::entity::Entity::Entity
Entity()=default
lodestone::level::entity::Entity::m_health
int m_health
Definition
Entity.h:56
lodestone::level::entity::Player
Definition
Player.h:14
lodestone::level::entity::Player::m_world
world::World * m_world
Definition
Player.h:53
lodestone::level::entity::Player::m_currentLevel
level::Level * m_currentLevel
Definition
Player.h:54
lodestone::level::entity::Player::getId
virtual const std::string & getId() const =0
Can return a UUID, player name, or other depending on the version.
lodestone::level::entity::Player::toString
std::string toString() const override
Definition
Player.h:19
lodestone::level::entity::WorldSpaceObject::position
types::Vec3d position
Definition
WorldSpaceObject.h:20
lodestone::level::properties::ReflectiveProperties
Definition
ReflectiveProperties.h:15
lodestone::level::world::World
Definition
World.h:22
lodestone::level::entity
Definition
Entity.cpp:8
lodestone::level::world
Definition
World.cpp:6
lodestone::level
Definition
Block.cpp:6
Generated by
1.15.0