the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 84 lines 1.9 kB view raw
1#pragma once 2using namespace std; 3 4#include "Entity.h" 5#include "Projectile.h" 6 7class Level; 8class CompoundTag; 9 10class Arrow : public Entity, public Projectile 11{ 12public: 13 eINSTANCEOF GetType() { return eTYPE_ARROW; } 14 static Entity *create(Level *level) { return new Arrow(level); } 15 16private: 17 // base damage, multiplied with velocity 18 static const double ARROW_BASE_DAMAGE; 19 20public: 21 static const int PICKUP_DISALLOWED = 0; 22 static const int PICKUP_ALLOWED = 1; 23 static const int PICKUP_CREATIVE_ONLY = 2; 24 25private: 26 static const int ID_FLAGS = 16; 27 static const int FLAG_CRIT = 1; 28 29private: 30 int xTile; 31 int yTile; 32 int zTile; 33 int lastTile; 34 int lastData; 35 bool inGround; 36 37public: 38 int pickup; 39 int shakeTime; 40 shared_ptr<Entity> owner; 41 42private: 43 double baseDamage; 44 45 int knockback; 46 47private: 48 int life; 49 int flightTime; 50 51 // 4J - added common ctor code. 52 void _init(); 53 54public: 55 Arrow(Level *level); 56 Arrow(Level *level, shared_ptr<LivingEntity> mob, shared_ptr<LivingEntity> target, float power, float uncertainty); 57 Arrow(Level *level, double x, double y, double z); 58 Arrow(Level *level, shared_ptr<LivingEntity> mob, float power); 59 60protected: 61 virtual void defineSynchedData(); 62 63public: 64 void shoot(double xd, double yd, double zd, float pow, float uncertainty); 65 virtual void lerpTo(double x, double y, double z, float yRot, float xRot, int steps); 66 virtual void lerpMotion(double xd, double yd, double zd); 67 virtual void tick(); 68 virtual void addAdditonalSaveData(CompoundTag *tag); 69 virtual void readAdditionalSaveData(CompoundTag *tag); 70 virtual void playerTouch(shared_ptr<Player> player); 71 72protected: 73 virtual bool makeStepSound(); 74 75public: 76 virtual float getShadowHeightOffs(); 77 78 void setBaseDamage(double baseDamage); 79 double getBaseDamage(); 80 void setKnockback(int knockback); 81 virtual bool isAttackable(); 82 void setCritArrow(bool critArrow); 83 bool isCritArrow(); 84};