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

#include "LevelSource.h"
#include "Mob.h"
#include "WeighedRandom.h"

class Feature;
class MobCategory;
class BiomeDecorator;
class TreeFeature;
class BasicTree;
class BirchFeature;
class SwampTreeFeature;
class ChunkRebuildData;

class Biome
{
	friend class ChunkRebuildData;
public:
	// 4J JEV, replaces the static blocks.
	static void staticCtor();

	static Biome *biomes[256];

	static Biome *ocean;
	static Biome *plains;
	static Biome *desert;
	static Biome *extremeHills;
	static Biome *forest;
	static Biome *taiga;
	static Biome *swampland;
	static Biome *river;
	static Biome *hell;
	static Biome *sky;
	static Biome *frozenOcean;
	static Biome *frozenRiver;
	static Biome *iceFlats;
	static Biome *iceMountains;
	static Biome *mushroomIsland;
	static Biome *mushroomIslandShore ;
	static Biome *beaches;
	static Biome *desertHills;
	static Biome *forestHills;
	static Biome *taigaHills;
	static Biome *smallerExtremeHills;
	static Biome *jungle;
	static Biome *jungleHills;

	static const int BIOME_COUNT = 23; // 4J Stu added

public:
	wstring m_name;
	int color;
	byte topMaterial;
	byte material;
	int leafColor;
	float depth;
	float scale;
	float temperature;
	float downfall;
	//int waterColor; // 4J Stu removed

	BiomeDecorator *decorator;

	const int id;

	class MobSpawnerData : public WeighedRandomItem
	{
	public:
		eINSTANCEOF mobClass;
		int minCount;
		int maxCount;

		MobSpawnerData(eINSTANCEOF mobClass, int probabilityWeight, int minCount, int maxCount) : WeighedRandomItem(probabilityWeight)
		{
			this->mobClass = mobClass;
			this->minCount = minCount;
			this->maxCount = maxCount;
		}
	};

protected:
	vector<MobSpawnerData *> enemies;
	vector<MobSpawnerData *> friendlies;
	vector<MobSpawnerData *> waterFriendlies;
	vector<MobSpawnerData *> friendlies_chicken;
	vector<MobSpawnerData *> friendlies_wolf;
	vector<MobSpawnerData *> friendlies_mushroomcow;
	vector<MobSpawnerData *> ambientFriendlies;

	Biome(int id);
	~Biome();

	BiomeDecorator *createDecorator();

private:
	Biome *setTemperatureAndDownfall(float temp, float downfall);
	Biome *setDepthAndScale(float depth, float scale);

	bool snowCovered;
	bool _hasRain;

	// 4J Added
	eMinecraftColour m_grassColor;
	eMinecraftColour m_foliageColor;
	eMinecraftColour m_waterColor;
	eMinecraftColour m_skyColor;

	Biome *setNoRain();

protected:
	/* removing these so that we can consistently return newly created trees via getTreeFeature, and let the calling function be resposible for deleting the returned tree
	TreeFeature *normalTree;
	BasicTree *fancyTree;
	BirchFeature *birchTree;
	SwampTreeFeature *swampTree;
	*/

public:
	virtual Feature *getTreeFeature(Random *random);
	virtual Feature *getGrassFeature(Random *random);

protected:
	Biome *setSnowCovered();
	Biome *setName(const wstring &name);
	Biome *setLeafColor(int leafColor);
	Biome *setColor(int color);

	// 4J Added
	Biome *setLeafFoliageWaterSkyColor(eMinecraftColour grassColor, eMinecraftColour foliageColor, eMinecraftColour waterColour, eMinecraftColour skyColour);

public:
	virtual int getSkyColor(float temp);

	vector<MobSpawnerData *> *getMobs(MobCategory *category);

	virtual bool hasSnow();
	virtual bool hasRain();
	virtual bool isHumid();

	virtual float getCreatureProbability();
	virtual int getDownfallInt();
	virtual int getTemperatureInt();
	virtual float getDownfall();			// 4J - brought forward from 1.2.3
	virtual float getTemperature();			// 4J - brought forward from 1.2.3

	virtual void decorate(Level *level, Random *random, int xo, int zo);

	virtual int getGrassColor();
	virtual int getFolageColor();
	virtual int getWaterColor(); // 4J Added
};