blob: 1f42bc216373c6fb1ad4dc37dd9eb7b856688cdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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();
};
|