aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Zombie.h
blob: 237db15be2c1317969171992decdbbc6d87c52a2 (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
#pragma once
using namespace std;

#include "Monster.h"
#include "SharedConstants.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;

	static const int DATA_BABY_ID = 12;
	static const int DATA_VILLAGER_ID = 13;
	static const int DATA_CONVERTING_ID = 14;

	int villagerConversionTime;

	float registeredBBWidth;
	float registeredBBHeight;

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);
	virtual float getWalkingSpeedModifier();

protected:
	virtual void defineSynchedData();

public:
	virtual int getTexture();
	virtual int getMaxHealth();
	int getArmorValue();

protected:
	virtual bool useNewAi();

public:
	bool isBaby();
	void setBaby(bool baby);
	bool isVillager();
	void setVillager(bool villager);
    virtual void aiStep();
    virtual void tick();
	
protected:
	virtual int getAmbientSound();
    virtual int getHurtSound();
    virtual int getDeathSound();
    virtual int getDeathLoot();

public:
	MobType getMobType();

protected:
	virtual void dropRareDeathLoot(int rareLootLevel);

public:
	virtual void addAdditonalSaveData(CompoundTag *tag);
	virtual void readAdditionalSaveData(CompoundTag *tag);
	void killed(shared_ptr<Mob> mob);
	virtual void finalizeMobSpawn();
	bool interact(shared_ptr<Player> player);

protected:
	void startConverting(int time);

public:
	void handleEntityEvent(byte id);
	bool isConverting();

protected:
	void finishConversion();
	int getConversionProgress();

public:
	virtual void updateSize(bool isBaby);

protected:
	virtual void setSize(float w, float h);
	void internalSetSize(float scale);
};