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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
|
#pragma once
#include "Animal.h"
#include "net.minecraft.world.ContainerListener.h"
#include "MobGroupData.h"
#include "EntitySelector.h"
class Attribute;
class AnimalChest;
class HorseEntitySelector : public EntitySelector
{
public:
bool matches(shared_ptr<Entity> entity) const;
};
class EntityHorse : public Animal, public net_minecraft_world::ContainerListener
{
public:
eINSTANCEOF GetType() { return eTYPE_HORSE; }
static Entity *create(Level *level) { return new EntityHorse(level); }
private:
static const wstring TEX_FOLDER;
static const EntitySelector *PARENT_HORSE_SELECTOR;
static Attribute *JUMP_STRENGTH;
static const int DATA_ID_HORSE_FLAGS = 16;
static const int DATA_ID_TYPE = 19;
static const int DATA_ID_TYPE_VARIANT = 20;
static const int DATA_ID_OWNER_NAME = 21;
static const int DATA_ID_ARMOR = 22;
static const int FLAG_TAME = 1 << 1;
static const int FLAG_SADDLE = 1 << 2;
static const int FLAG_CHESTED = 1 << 3;
static const int FLAG_BRED = 1 << 4;
static const int FLAG_EATING = 1 << 5;
static const int FLAG_STANDING = 1 << 6;
static const int FLAG_OPEN_MOUTH = 1 << 7;
public:
static const int INV_SLOT_SADDLE = 0;
static const int INV_SLOT_ARMOR = 1;
static const int INV_BASE_COUNT = 2;
static const int INV_DONKEY_CHEST_COUNT = 15;
// TODO: USE ENUMS! // Original comment
static const int ARMOR_NONE = 0;
static const int ARMOR_IRON = 1;
static const int ARMOR_GOLD = 2;
static const int ARMOR_DIAMOND = 3;
private:
static const int ARMORS = 4;
static wstring ARMOR_TEXTURES[ARMORS];
static int ARMOR_TEXTURES_ID[ARMORS];
static wstring ARMOR_HASHES[ARMORS];
static int ARMOR_PROTECTION[ARMORS];
public:
static const int TYPE_HORSE = 0;
static const int TYPE_DONKEY = 1;
static const int TYPE_MULE = 2;
static const int TYPE_UNDEAD = 3;
static const int TYPE_SKELETON = 4;
static const int VARIANT_WHITE = 0;
static const int VARIANT_CREAMY = 1;
static const int VARIANT_CHESTNUT = 2;
static const int VARIANT_BROWN = 3;
static const int VARIANT_BLACK = 4;
static const int VARIANT_GRAY = 5;
static const int VARIANT_DARKBROWN = 6;
private:
static const int VARIANTS = 7;
static wstring VARIANT_TEXTURES[VARIANTS];
static int VARIANT_TEXTURES_ID[VARIANTS];
static wstring VARIANT_HASHES[VARIANTS];
public:
static const int MARKING_NONE = 0;
static const int MARKING_WHITE_DETAILS = 1;
static const int MARKING_WHITE_FIELDS = 2;
static const int MARKING_WHITE_DOTS = 3;
static const int MARKING_BLACK_DOTS = 4;
private:
static const int MARKINGS = 5;
static wstring MARKING_TEXTURES[MARKINGS];
static int MARKING_TEXTURES_ID[MARKINGS];
static wstring MARKING_HASHES[MARKINGS];
private:
int countEating; // eating timer
int mouthCounter;
int standCounter;
public:
int tailCounter;
int sprintCounter;
protected:
bool isEntityJumping;
private:
shared_ptr<AnimalChest> inventory;
bool hasReproduced;
protected:
int temper;
float playerJumpPendingScale;
private:
bool allowStandSliding;
// animation data
float eatAnim, eatAnimO;
float standAnim, standAnimO;
float mouthAnim, mouthAnimO;
public:
EntityHorse(Level *world);
~EntityHorse();
protected:
virtual void defineSynchedData();
public:
virtual void setType(int i);
virtual int getType();
virtual void setVariant(int i);
virtual int getVariant();
virtual wstring getAName();
private:
virtual bool getHorseFlag(int flag);
virtual void setHorseFlag(int flag, bool value);
public:
virtual bool isAdult();
virtual bool isTamed();
virtual bool isRidable();
virtual wstring getOwnerName();
virtual void setOwner(const wstring &par1Str);
virtual float getFoalScale();
virtual void updateSize(bool isBaby);
virtual bool getIsJumping();
virtual void setTamed(bool flag);
virtual void setIsJumping(bool flag);
virtual bool canBeLeashed();
protected:
virtual void onLeashDistance(float distanceToLeashHolder);
public:
virtual bool isChestedHorse();
virtual int getArmorType();
virtual int getArmorTypeForItem(shared_ptr<ItemInstance> armorItem);
virtual bool isEating();
virtual bool isStanding();
virtual bool isBred();
virtual bool getHasReproduced();
virtual void setArmorType(int i);
virtual void setBred(bool flag);
virtual void setChestedHorse(bool flag);
virtual void setReproduced(bool flag);
virtual void setSaddled(bool flag);
virtual int getTemper();
virtual void setTemper(int temper);
virtual int modifyTemper(int amount);
virtual bool hurt(DamageSource *damagesource, float dmg);
virtual int getArmorValue();
virtual bool isPushable();
virtual bool checkSpawningBiome();
virtual void dropBags();
private:
virtual void eatingHorse();
protected:
virtual void causeFallDamage(float fallDistance);
private:
virtual int getInventorySize();
virtual void createInventory();
virtual void updateEquipment();
public:
virtual void containerChanged();
virtual bool canSpawn();
protected:
virtual shared_ptr<EntityHorse> getClosestMommy(shared_ptr<Entity> baby, double searchRadius);
public:
virtual double getCustomJump();
protected:
virtual int getDeathSound();
virtual int getDeathLoot();
virtual int getHurtSound();
public:
virtual bool isSaddled();
protected:
virtual int getAmbientSound();
virtual int getMadSound();
private:
int gallopSoundCounter;
protected:
virtual void playStepSound(int xt, int yt, int zt, int t);
virtual void registerAttributes();
public:
virtual int getMaxSpawnClusterSize();
virtual int getMaxTemper();
protected:
virtual float getSoundVolume();
public:
virtual int getAmbientSoundInterval();
virtual bool hasLayeredTextures();
private:
wstring layerTextureHashName;
intArray layerTextureLayers;
private:
virtual void clearLayeredTextureInfo();
virtual void rebuildLayeredTextureInfo();
public:
virtual wstring getLayeredTextureHashName();
virtual intArray getLayeredTextureLayers();
virtual void openInventory(shared_ptr<Player> player);
virtual bool mobInteract(shared_ptr<Player> player);
private:
virtual void doPlayerRide(shared_ptr<Player> player);
public:
virtual bool isAmuletHorse();
virtual bool canWearArmor();
virtual bool canWearBags();
protected:
virtual bool isImmobile();
public:
virtual bool isPureBreed();
virtual bool isUndead();
virtual bool isSterile();
virtual bool isFood(shared_ptr<ItemInstance> itemInstance);
private:
virtual void moveTail();
public:
virtual int nameYOffset();
virtual void die(DamageSource *damagesource);
virtual void aiStep();
virtual void tick();
private:
virtual void openMouth();
public:
// 4J-JEV: Made public for tooltip code, doesn't change state anyway.
virtual bool isReadyForParenting();
public:
virtual bool renderName();
virtual bool rideableEntity();
virtual void setUsingItemFlag(bool flag);
virtual void setEating(bool state);
virtual void setStanding(bool state);
private:
virtual void stand();
public:
virtual void makeMad();
virtual void dropMyStuff();
private:
virtual void dropInventory(shared_ptr<Entity> entity, shared_ptr<AnimalChest> animalchest);
public:
virtual bool tameWithName(shared_ptr<Player> player);
virtual void travel(float xa, float ya);
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual bool canMate(shared_ptr<Animal> partner);
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> partner);
virtual MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param
virtual float getEatAnim(float a);
virtual float getStandAnim(float a);
virtual float getMouthAnim(float a);
protected:
virtual bool useNewAi();
public:
virtual void onPlayerJump(int jumpAmount);
protected:
virtual void spawnTamingParticles(bool success);
public:
virtual void handleEntityEvent(byte id);
virtual void positionRider();
private:
virtual float generateRandomMaxHealth();
virtual double generateRandomJumpStrength();
virtual double generateRandomSpeed();
shared_ptr<Player> getOwner();
public:
class HorseGroupData : public MobGroupData
{
public:
int horseType;
int horseVariant;
HorseGroupData(int type, int variant);
};
static bool isHorseArmor(int itemId);
virtual bool onLadder();
};
|