Botcraft 26.3
Loading...
Searching...
No Matches
EndCrystalEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
9 SetDataBeamTarget(std::optional<Position>());
11 }
12
17
18
19 std::string EndCrystalEntity::GetName() const
20 {
21 return "end_crystal";
22 }
23
28
29
31 {
32 return "end_crystal";
33 }
34
39
40
42 {
44
45 output["metadata"]["data_beam_target"] = GetDataBeamTarget() ? GetDataBeamTarget().value().Serialize() : ProtocolCraft::Json::Value();
46 output["metadata"]["data_show_bottom"] = GetDataShowBottom();
47
48 return output;
49 }
50
51
52 std::optional<Position> EndCrystalEntity::GetDataBeamTarget() const
53 {
54 return GetMetadata<std::optional<Position>>(BOTCRAFT_ENTITY_METADATA_INDEX("data_beam_target"));
55 }
56
58 {
59 return GetMetadata<bool>(BOTCRAFT_ENTITY_METADATA_INDEX("data_show_bottom"));
60 }
61
62
63 void EndCrystalEntity::SetDataBeamTarget(const std::optional<Position>& data_beam_target)
64 {
65 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_beam_target"), data_beam_target);
66 }
67
68 void EndCrystalEntity::SetDataShowBottom(const bool data_show_bottom)
69 {
70 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_show_bottom"), data_show_bottom);
71 }
72
73
75 {
76 return 2.0;
77 }
78
80 {
81 return 2.0;
82 }
83
84}
static std::string GetClassName()
static constexpr int hierarchy_metadata_count
virtual double GetWidthImpl() const override
virtual std::string GetName() const override
virtual double GetHeightImpl() const override
static EntityType GetClassType()
virtual ProtocolCraft::Json::Value Serialize() const override
virtual EntityType GetType() const override
std::optional< Position > GetDataBeamTarget() const
static constexpr int metadata_count
void SetDataShowBottom(const bool data_show_bottom)
void SetDataBeamTarget(const std::optional< Position > &data_beam_target)
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
virtual ProtocolCraft::Json::Value Serialize() const
Definition Entity.cpp:1246
std::vector< std::any > metadata
Definition Entity.hpp:335
Main class, basically a JsonVariant with extra utility functions it doesn't inherit JsonVariant direc...
Definition Json.hpp:45
#define BOTCRAFT_ENTITY_METADATA_INDEX(name)
Definition Entity.hpp:347