aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Sheep.h
blob: 16ecfb4cf2a95e520f9bb1a06b352a8d9aad72e5 (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;

class Random;
class EatTileGoal;
class CraftingContainer;

#include "Animal.h"
#include "SharedConstants.h"
#include "AbstractContainerMenu.h"

class Sheep : public Animal
{
private:
	class SheepContainer : public AbstractContainerMenu
	{
		bool stillValid(shared_ptr<Player> player) { return false; }
	};

	shared_ptr<CraftingContainer> container;
public:
	eINSTANCEOF GetType() { return eTYPE_SHEEP; }
	static Entity *create(Level *level) { return new Sheep(level); }

private:
	static const int EAT_ANIMATION_TICKS = SharedConstants::TICKS_PER_SECOND * 2;
	static const int DATA_WOOL_ID = 16;

	int eatAnimationTick;
	EatTileGoal *eatTileGoal;

public:
	static const int COLOR_LENGTH = 16;
	static const float COLOR[COLOR_LENGTH][3];

public:
	Sheep(Level *level);

protected:
	virtual bool useNewAi();
	virtual void newServerAiStep();

public:
	void aiStep();

protected:
	virtual void registerAttributes();
	virtual void defineSynchedData();

public:
	virtual void dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel);
	virtual int getDeathLoot();

public:
	virtual void handleEntityEvent(byte id);

public:
	float getHeadEatPositionScale(float a);
	float getHeadEatAngleScale(float a);

	virtual bool mobInteract(shared_ptr<Player> player);
	virtual void addAdditonalSaveData(CompoundTag *tag);
	virtual void readAdditionalSaveData(CompoundTag *tag);

protected:
	virtual int getAmbientSound();
	virtual int getHurtSound();
	virtual int getDeathSound();
	virtual void playStepSound(int xt, int yt, int zt, int t);

public:
	int getColor();
	void setColor(int color);
	bool isSheared();
	void setSheared(bool value);

	static int getSheepColor(Random *random);
	virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);

	virtual void ate();

	MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param

private:
	int getOffspringColor(shared_ptr<Animal> animal, shared_ptr<Animal> partner);
	int getDyeColor(shared_ptr<Animal> animal);
};