Botcraft 26.3
Loading...
Searching...
No Matches
MushroomCowEntity.cpp
Go to the documentation of this file.
2
3namespace Botcraft
4{
6 {
7 // Initialize all metadata with default values
9#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
10#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
11 SetDataType("red");
12#else
13 SetDataType(0);
14#endif
15#endif
16 }
17
22
23
24 std::string MushroomCowEntity::GetName() const
25 {
26 return "mooshroom";
27 }
28
33
34
36 {
37 return "mooshroom";
38 }
39
44
45
46#if PROTOCOL_VERSION > 404 /* > 1.13.2 */
48 {
49#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
51#else
53#endif
54
55 output["metadata"]["data_type"] = GetDataType();
56
57 return output;
58 }
59
60
61#if PROTOCOL_VERSION < 770 /* < 1.21.5 */
62 std::string MushroomCowEntity::GetDataType() const
63 {
64 return GetMetadata<std::string>(BOTCRAFT_ENTITY_METADATA_INDEX("data_type"));
65 }
66
67
68 void MushroomCowEntity::SetDataType(const std::string& data_type)
69 {
70 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_type"), data_type);
71 }
72#else
74 {
75 return GetMetadata<int>(BOTCRAFT_ENTITY_METADATA_INDEX("data_type"));
76 }
77
78
79 void MushroomCowEntity::SetDataType(const int data_type)
80 {
81 SetMetadata(BOTCRAFT_ENTITY_METADATA_INDEX("data_type"), data_type);
82 }
83#endif
84#endif
85
86
88 {
89 return 0.9;
90 }
91
93 {
94 return 1.4;
95 }
96
97}
virtual ProtocolCraft::Json::Value Serialize() const override
virtual ProtocolCraft::Json::Value Serialize() const override
Definition CowEntity.cpp:50
void SetMetadata(const int index, const std::any &value)
Definition Entity.cpp:366
std::vector< std::any > metadata
Definition Entity.hpp:335
virtual double GetWidthImpl() const override
virtual EntityType GetType() const override
void SetDataType(const int data_type)
virtual double GetHeightImpl() const override
virtual std::string GetName() const override
static constexpr int hierarchy_metadata_count
static std::string GetClassName()
static constexpr int metadata_count
virtual ProtocolCraft::Json::Value Serialize() const override
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