Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion biomenoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "tables/btree19.h"
#include "tables/btree20.h"
#include "tables/btree21wd.h"
#include "tables/btree21_11.h"

#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -1453,11 +1454,20 @@ int climateToBiome(int mc, const uint64_t np[6], uint64_t *dat)
btree21wd_steps, &btree21wd_param[0][0], btree21wd_nodes, btree21wd_order,
sizeof(btree21wd_nodes) / sizeof(uint64_t)
};
static const BiomeTree btree21_11 = {
btree21_11_steps, &btree21_11_param[0][0], btree21_11_nodes, btree21_11_order,
sizeof(btree21_11_nodes) / sizeof(uint64_t)
};

const BiomeTree *bt;
int idx;

if (mc >= MC_1_21_WD)
// THAT IS A LECTURE:
// When you patch a newer version, do not forget to put an 'else'
// here after you add the new biome tree.
if (mc >= MC_1_21_5)
bt = &btree21_11;
else if (mc >= MC_1_21_WD)
bt = &btree21wd;
else if (mc >= MC_1_20_6)
bt = &btree20;
Expand Down
6 changes: 3 additions & 3 deletions biomenoise.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ STRUCT(Range)
{
// Defines an area or volume for the biome generation. It is given by a
// position, size and scaling in the horizontal axes, and an optional
// vertical range. The vertical scaling is equal to 1:1 iff scale == 1,
// vertical range. The vertical scaling is equal to 1:1 if scale == 1,
// and 1:4 (default biome scale) in all other cases!
//
// @scale: Horizontal scale factor, should be one of 1, 4, 16, 64, or 256
// additionally a value of zero bypasses scaling and expects a
// manual generation entry layer.
// @x,z: Horizontal position, i.e. coordinates of north-west corner.
// @sx,sz: Horizontal size (width and height for 2D), should be positive.
// @y Vertical position, 1:1 iff scale==1, 1:4 otherwise.
// @y Vertical position, 1:1 if scale==1, 1:4 otherwise.
// @sy Vertical size. Values <= 0 are treated equivalent to 1.
//
// Volumes generated with a range are generally indexed as:
// out [ i_y*sx*sz + i_z*sx + i_x ]
// where i_x, i_y, i_z are indecies in their respective directions.
// where i_x, i_y, i_z are indices in their respective directions.
//
// EXAMPLES
// Area at normal biome scale (1:4):
Expand Down
6 changes: 4 additions & 2 deletions biomes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ enum MCVersion
MC_1_20_6, MC_1_20 = MC_1_20_6,
MC_1_21_1,
MC_1_21_3,
MC_1_21_WD, // Winter Drop, version TBA
MC_1_21 = MC_1_21_WD,
MC_1_21_WD,
MC_1_21_5,
MC_1_21_11 = MC_1_21_5,
MC_1_21 = MC_1_21_5,
MC_NEWEST = MC_1_21,
};

Expand Down
4 changes: 3 additions & 1 deletion generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ int genArea(const Layer *layer, int *out, int areaX, int areaZ, int areaWidth, i
/**
* Map an approximation of the Overworld surface height.
* The horizontal scaling is 1:4. If non-null, the ids are filled with the
* biomes of the area. The height (written to y) is in blocks.
* biomes of the area. The height (written to y[w*h]) is in blocks.
* If the Generator's dimension is Overworld and version before Beta 1.8
* or after 1.18, SurfaceNoise is not needed.
*/
int mapApproxHeight(float *y, int *ids, const Generator *g,
const SurfaceNoise *sn, int x, int z, int w, int h);
Expand Down
Loading