the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 92 lines 2.4 kB view raw
1#pragma once 2 3using namespace std; 4 5#include "TamableAnimal.h" 6class DamageSource; 7 8class Wolf : public TamableAnimal 9{ 10public: 11 eINSTANCEOF GetType() { return eTYPE_WOLF; } 12 static Entity *create(Level *level) { return new Wolf(level); } 13private: 14 // synch health in a separate field to show tame wolves' health 15 static const int DATA_HEALTH_ID = 18; 16 static const int DATA_INTERESTED_ID = 19; 17 static const int DATA_COLLAR_COLOR = 20; 18 19 static const int START_HEALTH = 8; 20 static const int MAX_HEALTH = 20; 21 static const int TAME_HEALTH = 20; 22 23 float interestedAngle, interestedAngleO; 24 bool m_isWet, isShaking; 25 float shakeAnim, shakeAnimO; 26 27public: 28 Wolf(Level *level); 29 30protected: 31 virtual void registerAttributes(); 32 33public: 34 virtual bool useNewAi(); 35 virtual void setTarget(shared_ptr<LivingEntity> target); 36 37protected: 38 virtual void serverAiMobStep(); 39 virtual void defineSynchedData(); 40 virtual void playStepSound(int xt, int yt, int zt, int t); 41 42public: 43 virtual void addAdditonalSaveData(CompoundTag *tag); 44 virtual void readAdditionalSaveData(CompoundTag *tag); 45 46protected: 47 virtual int getAmbientSound(); 48 virtual int getHurtSound(); 49 virtual int getDeathSound(); 50 virtual float getSoundVolume(); 51 virtual int getDeathLoot(); 52 53public: 54 virtual void aiStep(); 55 virtual void tick(); 56 bool isWet(); 57 float getWetShade(float a); 58 float getBodyRollAngle(float a, float offset); 59 float getHeadRollAngle(float a); 60 float getHeadHeight(); 61 int getMaxHeadXRot(); 62 virtual bool hurt(DamageSource *source, float dmg); 63 virtual bool doHurtTarget(shared_ptr<Entity> target); 64 virtual void setTame(bool value); 65 virtual bool mobInteract(shared_ptr<Player> player); 66 virtual void handleEntityEvent(byte id); 67 float getTailAngle(); 68 virtual bool isFood(shared_ptr<ItemInstance> item); 69 virtual int getMaxSpawnClusterSize(); 70 bool isAngry(); 71 void setAngry(bool value); 72 int getCollarColor(); 73 void setCollarColor(int color); 74 void tame(const wstring &wsOwnerUUID, bool bDisplayTamingParticles, bool bSetSitting); 75 76 // For tooltips 77 int GetSynchedHealth(); 78 79protected: 80 virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target); 81 82public: 83 virtual void setIsInterested(bool isInterested); 84 virtual bool canMate(shared_ptr<Animal> animal); 85 bool isInterested(); 86 87protected: 88 virtual bool removeWhenFarAway(); 89 90public: 91 virtual bool wantsToAttack(shared_ptr<LivingEntity> target, shared_ptr<LivingEntity> owner); 92};