Fix wall rails and water biomes
This commit is contained in:
Binary file not shown.
@@ -69,7 +69,9 @@
|
|||||||
BLOCK_LILY_OF_THE_VALLEY = 56,
|
BLOCK_LILY_OF_THE_VALLEY = 56,
|
||||||
BLOCK_FERN = 57,
|
BLOCK_FERN = 57,
|
||||||
BLOCK_CLAY = 58,
|
BLOCK_CLAY = 58,
|
||||||
BLOCK_SEAGRASS = 59
|
BLOCK_SEAGRASS = 59,
|
||||||
|
BLOCK_IRON_BARS_NS = 60,
|
||||||
|
BLOCK_IRON_BARS_EW = 61
|
||||||
};
|
};
|
||||||
|
|
||||||
struct trail_segment;
|
struct trail_segment;
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ static const kv_pair PROPS_LADDER_N[] = {{"facing", "north"}, {"waterlogged", "f
|
|||||||
static const kv_pair PROPS_LADDER_S[] = {{"facing", "south"}, {"waterlogged", "false"}};
|
static const kv_pair PROPS_LADDER_S[] = {{"facing", "south"}, {"waterlogged", "false"}};
|
||||||
static const kv_pair PROPS_LADDER_W[] = {{"facing", "west"}, {"waterlogged", "false"}};
|
static const kv_pair PROPS_LADDER_W[] = {{"facing", "west"}, {"waterlogged", "false"}};
|
||||||
static const kv_pair PROPS_LADDER_E[] = {{"facing", "east"}, {"waterlogged", "false"}};
|
static const kv_pair PROPS_LADDER_E[] = {{"facing", "east"}, {"waterlogged", "false"}};
|
||||||
|
static const kv_pair PROPS_IRON_BARS_NS[] = {{"east", "false"}, {"north", "true"}, {"south", "true"}, {"waterlogged", "false"}, {"west", "false"}};
|
||||||
|
static const kv_pair PROPS_IRON_BARS_EW[] = {{"east", "true"}, {"north", "false"}, {"south", "false"}, {"waterlogged", "false"}, {"west", "true"}};
|
||||||
static const size_t BLOCK_STATE_CAP = 256;
|
static const size_t BLOCK_STATE_CAP = 256;
|
||||||
static const int32_t DATA_VERSION = 2730; /* Java Edition 1.17.1; includes copper ore. */
|
static const int32_t DATA_VERSION = 2730; /* Java Edition 1.17.1; includes copper ore. */
|
||||||
static const block_state BLOCK_STATE_TABLE[] = {
|
static const block_state BLOCK_STATE_TABLE[] = {
|
||||||
@@ -162,7 +164,9 @@ static const block_state BLOCK_STATE_TABLE[] = {
|
|||||||
[BLOCK_LILY_OF_THE_VALLEY] = {"minecraft:lily_of_the_valley", NULL, 0},
|
[BLOCK_LILY_OF_THE_VALLEY] = {"minecraft:lily_of_the_valley", NULL, 0},
|
||||||
[BLOCK_FERN] = {"minecraft:fern", NULL, 0},
|
[BLOCK_FERN] = {"minecraft:fern", NULL, 0},
|
||||||
[BLOCK_CLAY] = {"minecraft:clay", NULL, 0},
|
[BLOCK_CLAY] = {"minecraft:clay", NULL, 0},
|
||||||
[BLOCK_SEAGRASS] = {"minecraft:seagrass", NULL, 0}
|
[BLOCK_SEAGRASS] = {"minecraft:seagrass", NULL, 0},
|
||||||
|
[BLOCK_IRON_BARS_NS] = {"minecraft:iron_bars", PROPS_IRON_BARS_NS, 5},
|
||||||
|
[BLOCK_IRON_BARS_EW] = {"minecraft:iron_bars", PROPS_IRON_BARS_EW, 5}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const block_state *get_block_state(uint16_t id) {
|
static const block_state *get_block_state(uint16_t id) {
|
||||||
@@ -353,6 +357,13 @@ static void pack_heightmap(const chunk_data *chunk, int64_t *out_longs, size_t o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int column_contains_water(const chunk_data *chunk, int x, int z) {
|
||||||
|
for (int y = 1; y < CHUNK_HEIGHT; ++y) {
|
||||||
|
if (chunk->blocks[y][x][z] == BLOCK_WATER) return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int section_has_blocks(const chunk_data *chunk, int section_y) {
|
static int section_has_blocks(const chunk_data *chunk, int section_y) {
|
||||||
int y_base = section_y * 16;
|
int y_base = section_y * 16;
|
||||||
for (int y = 0; y < 16; ++y) {
|
for (int y = 0; y < 16; ++y) {
|
||||||
@@ -444,7 +455,11 @@ static void write_section(buf *b, const chunk_data *chunk, int section_y) {
|
|||||||
|
|
||||||
static void build_chunk_nbt(const chunk_data *chunk, buf *out) {
|
static void build_chunk_nbt(const chunk_data *chunk, buf *out) {
|
||||||
int32_t biomes[256];
|
int32_t biomes[256];
|
||||||
for (int i = 0; i < 256; ++i) biomes[i] = 1; // Plains biome
|
for (int z = 0; z < CHUNK_SIZE; ++z) {
|
||||||
|
for (int x = 0; x < CHUNK_SIZE; ++x) {
|
||||||
|
biomes[z * CHUNK_SIZE + x] = column_contains_water(chunk, x, z) ? 0 : 1; // Ocean or plains
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int64_t heightmap[37];
|
int64_t heightmap[37];
|
||||||
pack_heightmap(chunk, heightmap, 37);
|
pack_heightmap(chunk, heightmap, 37);
|
||||||
|
|||||||
@@ -3811,7 +3811,8 @@ static void generate_chunk_border_wall(worldgen_ctx *ctx, int chunk_x, int chunk
|
|||||||
}
|
}
|
||||||
if (top + 1 < CHUNK_HEIGHT) {
|
if (top + 1 < CHUNK_HEIGHT) {
|
||||||
if (!in_tower && (side_dist == wall_start || side_dist == wall_end)) {
|
if (!in_tower && (side_dist == wall_start || side_dist == wall_end)) {
|
||||||
set_block_with_height(out, dx, dz, top + 1, BLOCK_IRON_BARS);
|
uint16_t rail_block = (side < 2) ? BLOCK_IRON_BARS_NS : BLOCK_IRON_BARS_EW;
|
||||||
|
set_block_with_height(out, dx, dz, top + 1, rail_block);
|
||||||
} else if (in_tower && phase % 4 < 2) {
|
} else if (in_tower && phase % 4 < 2) {
|
||||||
set_block_with_height(out, dx, dz, top + 1, BLOCK_STONE_BRICKS);
|
set_block_with_height(out, dx, dz, top + 1, BLOCK_STONE_BRICKS);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user