blob: f788ea634b8e46bace2f2814fff2f963e1b35997 (
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
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
|
#pragma once
using namespace std;
#include "Monster.h"
#include "SharedConstants.h"
#include "MobGroupData.h"
class Zombie : public Monster
{
private:
static const int VILLAGER_CONVERSION_WAIT_MIN = SharedConstants::TICKS_PER_SECOND * 60 * 3;
static const int VILLAGER_CONVERSION_WAIT_MAX = SharedConstants::TICKS_PER_SECOND * 60 * 5;
protected:
static Attribute *SPAWN_REINFORCEMENTS_CHANCE;
private:
static AttributeModifier *SPEED_MODIFIER_BABY;
static const int DATA_BABY_ID = 12;
static const int DATA_VILLAGER_ID = 13;
static const int DATA_CONVERTING_ID = 14;
public:
static const float ZOMBIE_LEADER_CHANCE;
static const int REINFORCEMENT_ATTEMPTS = 50;
static const int REINFORCEMENT_RANGE_MAX = 40;
static const int REINFORCEMENT_RANGE_MIN = 7;
private:
int villagerConversionTime;
public:
static const int MAX_SPECIAL_BLOCKS_COUNT = 14;
static const int SPECIAL_BLOCK_RADIUS = 4;
public:
eINSTANCEOF GetType() { return eTYPE_ZOMBIE; }
static Entity *create(Level *level) { return new Zombie(level); }
Zombie(Level *level);
protected:
virtual void registerAttributes();
virtual void defineSynchedData();
public:
virtual int getArmorValue();
protected:
virtual bool useNewAi();
public:
virtual bool isBaby();
virtual void setBaby(bool baby);
virtual bool isVillager();
virtual void setVillager(bool villager);
virtual void aiStep();
virtual bool hurt(DamageSource *source, float dmg);
virtual void tick();
virtual bool doHurtTarget(shared_ptr<Entity> target);
virtual void updateSize(bool isBaby);
protected:
virtual int getAmbientSound();
virtual int getHurtSound();
virtual int getDeathSound();
virtual int getDeathLoot();
virtual void playStepSound(int xt, int yt, int zt, int t);
public:
virtual MobType getMobType();
protected:
virtual void dropRareDeathLoot(int rareLootLevel);
virtual void populateDefaultEquipmentSlots();
public:
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual void killed(shared_ptr<LivingEntity> mob);
virtual MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param
virtual bool mobInteract(shared_ptr<Player> player);
protected:
virtual void startConverting(int time);
public:
virtual void handleEntityEvent(byte id);
protected:
virtual bool removeWhenFarAway();
public:
virtual bool isConverting();
protected:
virtual void finishConversion();
virtual int getConversionProgress();
private:
class ZombieGroupData : public MobGroupData
{
public:
bool isBaby;
bool isVillager;
ZombieGroupData(bool baby, bool villager);
};
};
|