diff options
| author | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
|---|---|---|
| committer | daoge_cmd <3523206925@qq.com> | 2026-03-01 12:16:08 +0800 |
| commit | b691c43c44ff180d10e7d4a9afc83b98551ff586 (patch) | |
| tree | 3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.World/ItemEntity.h | |
| parent | def8cb415354ac390b7e89052a50605285f1aca9 (diff) | |
Initial commit
Diffstat (limited to 'Minecraft.World/ItemEntity.h')
| -rw-r--r-- | Minecraft.World/ItemEntity.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Minecraft.World/ItemEntity.h b/Minecraft.World/ItemEntity.h new file mode 100644 index 00000000..1f42bc21 --- /dev/null +++ b/Minecraft.World/ItemEntity.h @@ -0,0 +1,74 @@ +#pragma once +#include "Entity.h" +#include "SharedConstants.h" + +class Player; + +class ItemEntity : public Entity +{ +public: + eINSTANCEOF GetType() { return eTYPE_ITEMENTITY;} + static Entity *create(Level *level) { return new ItemEntity(level); } + +private: + static const int DATA_ITEM = 10; + + static const int LIFETIME = 5 * 60 * SharedConstants::TICKS_PER_SECOND; // Five miniutes. + + wstring thrower; + + // 4J Added + void _init(); + void _init(Level *level, double x, double y, double z); + +public: + int age; + int throwTime; + +private: + int health; + +public: + float bobOffs; + + ItemEntity(Level *level, double x, double y, double z); + ItemEntity(Level *level, double x, double y, double z, shared_ptr<ItemInstance> item); + +protected: + virtual bool makeStepSound(); + +public: + ItemEntity(Level *level); + +protected: + virtual void defineSynchedData(); + +public: + virtual void tick(); + +private: + void mergeWithNeighbours(); + +public: + bool merge(shared_ptr<ItemEntity> target); + void setShortLifeTime(); + virtual bool updateInWaterState(); + +protected: + virtual void burn(int dmg); + +public: + virtual bool hurt(DamageSource *source, int damage); + virtual void addAdditonalSaveData(CompoundTag *entityTag); + virtual void readAdditionalSaveData(CompoundTag *tag); + virtual void playerTouch(shared_ptr<Player> player); + + virtual wstring getAName(); + + shared_ptr<ItemInstance> getItem(); + void setItem(shared_ptr<ItemInstance> item); + virtual bool isAttackable(); + + void setThrower(const wstring &thrower); + wstring getThrower(); +}; |
