the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 74 lines 1.6 kB view raw
1#pragma once 2#include "Entity.h" 3#include "SharedConstants.h" 4 5class Player; 6 7class ItemEntity : public Entity 8{ 9public: 10 eINSTANCEOF GetType() { return eTYPE_ITEMENTITY;} 11 static Entity *create(Level *level) { return new ItemEntity(level); } 12 13private: 14 static const int DATA_ITEM = 10; 15 16 static const int LIFETIME = 5 * 60 * SharedConstants::TICKS_PER_SECOND; // Five miniutes. 17 18 wstring thrower; 19 20 // 4J Added 21 void _init(); 22 void _init(Level *level, double x, double y, double z); 23 24public: 25 int age; 26 int throwTime; 27 28private: 29 int health; 30 31public: 32 float bobOffs; 33 34 ItemEntity(Level *level, double x, double y, double z); 35 ItemEntity(Level *level, double x, double y, double z, shared_ptr<ItemInstance> item); 36 37protected: 38 virtual bool makeStepSound(); 39 40public: 41 ItemEntity(Level *level); 42 43protected: 44 virtual void defineSynchedData(); 45 46public: 47 virtual void tick(); 48 49private: 50 void mergeWithNeighbours(); 51 52public: 53 bool merge(shared_ptr<ItemEntity> target); 54 void setShortLifeTime(); 55 virtual bool updateInWaterState(); 56 57protected: 58 virtual void burn(int dmg); 59 60public: 61 virtual bool hurt(DamageSource *source, float damage); 62 virtual void addAdditonalSaveData(CompoundTag *entityTag); 63 virtual void readAdditionalSaveData(CompoundTag *tag); 64 virtual void playerTouch(shared_ptr<Player> player); 65 66 virtual wstring getAName(); 67 virtual void changeDimension(int i); 68 shared_ptr<ItemInstance> getItem(); 69 void setItem(shared_ptr<ItemInstance> item); 70 virtual bool isAttackable(); 71 72 void setThrower(const wstring &thrower); 73 wstring getThrower(); 74};