Skip to content

Commit 50b84e9

Browse files
Merge pull request #1791 from overviewer/116-blocks
2 parents 08e8c21 + 1d40ea7 commit 50b84e9

File tree

11 files changed

+273
-175
lines changed

11 files changed

+273
-175
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ python:
66
- "3.7"
77
- "3.8"
88
env:
9-
- MC_VERSION=1.15
9+
- MC_VERSION=1.16.1
1010
before_install:
1111
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/Imaging.h
1212
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/ImagingUtils.h

docs/running.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ If you want or need to provide your own textures, you have several options:
273273

274274
::
275275

276-
VERSION=1.15
276+
VERSION=1.16.1
277277
mkdir -p ~/.minecraft/versions/${VERSION}/
278278
wget https://overviewer.org/textures/${VERSION} -O ~/.minecraft/versions/${VERSION}/${VERSION}.jar
279279

280280
If that's too confusing for you, then just take this single line and paste it into
281-
a terminal to get 1.15 textures::
281+
a terminal to get 1.16 textures::
282282

283-
wget https://overviewer.org/textures/1.15 -O ~/.minecraft/versions/1.15/1.15.jar
283+
wget https://overviewer.org/textures/1.16.1 -O ~/.minecraft/versions/1.16.1/1.16.1.jar
284284

285285
* You can also just run the launcher to install the client.
286286

overviewer.py

+3
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ def main():
239239
f = tex.find_file("assets/minecraft/textures/block/grass_block_top.png", verbose=True)
240240
f = tex.find_file("assets/minecraft/textures/block/diamond_ore.png", verbose=True)
241241
f = tex.find_file("assets/minecraft/textures/block/acacia_planks.png", verbose=True)
242+
# 1.16
243+
f = tex.find_file("assets/minecraft/textures/block/ancient_debris_top.png",
244+
verbose=True)
242245
except IOError:
243246
logging.error("Could not find any texture files.")
244247
return 1

overviewer_core/src/block_class.c

+18-16
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ bool block_class_is_subset(
5858
return false;
5959
}
6060

61+
bool block_class_is_wall(mc_block_t block) {
62+
mc_block_t mask = 0b11111111;
63+
mc_block_t prefix = 0b111 << 8; // 1792 is the starting offset
64+
// if the xor zeroes all bits, the prefix must've matched.
65+
return (block & ~mask) ^ prefix == 0;
66+
}
67+
6168
const mc_block_t block_class_stair[] = {
6269
block_oak_stairs,
6370
block_brick_stairs,
@@ -253,19 +260,14 @@ const mc_block_t block_class_alt_height[] = {
253260
block_wooden_slab};
254261
const size_t block_class_alt_height_len = COUNT_OF(block_class_alt_height);
255262

256-
const mc_block_t block_class_wall[] = {
257-
block_andesite_wall,
258-
block_brick_wall,
259-
block_cobblestone_wall,
260-
block_diorite_wall,
261-
block_end_stone_brick_wall,
262-
block_granite_wall,
263-
block_mossy_cobblestone_wall,
264-
block_mossy_stone_brick_wall,
265-
block_nether_brick_wall,
266-
block_prismarine_wall,
267-
block_red_nether_brick_wall,
268-
block_red_sandstone_wall,
269-
block_sandstone_wall,
270-
block_stone_brick_wall};
271-
const size_t block_class_wall_len = COUNT_OF(block_class_wall);
263+
const mc_block_t block_class_nether_roof[] = {
264+
block_bedrock,
265+
block_netherrack,
266+
block_quartz_ore,
267+
block_lava,
268+
block_soul_sand,
269+
block_basalt,
270+
block_blackstone,
271+
block_soul_soil,
272+
block_nether_gold_ore};
273+
const size_t block_class_nether_roof_len = COUNT_OF(block_class_nether_roof);

overviewer_core/src/block_class.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ bool block_class_is_subset(
2828
const mc_block_t block_class[],
2929
size_t block_class_len);
3030

31+
bool block_class_is_wall(mc_block_t block);
32+
3133
extern const mc_block_t block_class_stair[];
3234
extern const size_t block_class_stair_len;
3335

@@ -46,7 +48,7 @@ extern const size_t block_class_ancil_len;
4648
extern const mc_block_t block_class_alt_height[];
4749
extern const size_t block_class_alt_height_len;
4850

49-
extern const mc_block_t block_class_wall[];
50-
extern const size_t block_class_wall_len;
51+
extern const mc_block_t block_class_nether_roof[];
52+
extern const size_t block_class_nether_roof_len;
5153

5254
#endif

overviewer_core/src/iterate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ generate_pseudo_data(RenderState* state, uint16_t ancilData) {
354354
}
355355
}
356356
return data;
357-
} else if (block_class_is_subset(state->block, block_class_wall, block_class_wall_len)) {
357+
} else if (block_class_is_wall(state->block)) {
358358
/* check for walls and add one bit with the type of wall (mossy or cobblestone)*/
359359
if (ancilData == 0x1) {
360360
return check_adjacent_blocks(state, x, y, z, state->block) | 0x10;

overviewer_core/src/mc_id.h

+42-17
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,47 @@ enum mc_block_id {
260260
block_structure_block = 255,
261261
block_jigsaw = 256,
262262
block_shulker_box = 257,
263+
// 1.16 stuff
264+
block_ancient_debris = 1000,
265+
block_basalt = 1001,
266+
block_polished_basalt = 1002,
267+
block_soul_campfire = 1003,
268+
block_blackstone = 1004,
269+
block_netherite_block = 1005,
270+
block_warped_nylium = 1006,
271+
block_crimson_nylium = 1007,
272+
block_warped_wart_block = 1010,
273+
block_shroomlight = 1011,
274+
block_twisting_vines = 1012,
275+
block_twisting_vines_plant = 1013,
276+
block_weeping_vines = 1014,
277+
block_weeping_vines_plant = 1015,
278+
block_warped_fungus = 1016,
279+
block_crimson_fungus = 1017,
280+
block_warped_roots = 1018,
281+
block_crimson_roots = 1019,
282+
block_soul_soil = 1020,
283+
block_nether_gold_ore = 1021,
284+
// adding a gap in the numbering of walls to keep them all
285+
// in one numbering block starting at 1792
286+
// all blocks between 1792 and 2047 are considered walls
287+
// this is because our check looks for the prefix 0b11100000000
288+
block_andesite_wall = 1792,
289+
block_brick_wall = 1793,
290+
block_cobblestone_wall = 1794,
291+
block_diorite_wall = 1795,
292+
block_end_stone_brick_wall = 1796,
293+
block_granite_wall = 1797,
294+
block_mossy_cobblestone_wall = 1798,
295+
block_mossy_stone_brick_wall = 1799,
296+
block_nether_brick_wall = 1800,
297+
block_prismarine_wall = 1801,
298+
block_red_nether_brick_wall = 1802,
299+
block_red_sandstone_wall = 1803,
300+
block_sandstone_wall = 1804,
301+
block_stone_brick_wall = 1805,
302+
// end of walls
303+
263304
block_prismarine_stairs = 11337,
264305
block_dark_prismarine_stairs = 11338,
265306
block_prismarine_brick_stairs = 11339,
@@ -336,23 +377,7 @@ enum mc_block_id {
336377
block_honey_block = 11504,
337378
block_sweet_berry_bush = 11505,
338379
block_campfire = 11506,
339-
block_bell = 11507,
340-
// adding a gap in the numbering of walls to keep them all
341-
// in one numbering block starting at 21000
342-
block_andesite_wall = 21000,
343-
block_brick_wall = 21001,
344-
block_cobblestone_wall = 21002,
345-
block_diorite_wall = 21003,
346-
block_end_stone_brick_wall = 21004,
347-
block_granite_wall = 21005,
348-
block_mossy_cobblestone_wall = 21006,
349-
block_mossy_stone_brick_wall = 21007,
350-
block_nether_brick_wall = 21008,
351-
block_prismarine_wall = 21009,
352-
block_red_nether_brick_wall = 21010,
353-
block_red_sandstone_wall = 21011,
354-
block_sandstone_wall = 21012,
355-
block_stone_brick_wall = 21013
380+
block_bell = 11507
356381
};
357382

358383
typedef uint16_t mc_block_t;

overviewer_core/src/overviewer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
// increment this value if you've made a change to the c extension
3333
// and want to force users to rebuild
34-
#define OVERVIEWER_EXTENSION_VERSION 86
34+
#define OVERVIEWER_EXTENSION_VERSION 90
3535

3636
#include <stdbool.h>
3737
#include <stdint.h>

overviewer_core/src/primitives/nether.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ walk_chunk(RenderState* state, RenderPrimitiveNether* data) {
3737

3838
for (y = NETHER_ROOF - 1; y >= 0; y--) {
3939
blockid = get_data(state, BLOCKS, x, y - (state->chunky * 16), z);
40-
if (block_class_is_subset(blockid, (mc_block_t[]){block_bedrock, block_netherrack, block_quartz_ore, block_lava}, 4))
40+
if (block_class_is_subset(blockid, block_class_nether_roof, block_class_nether_roof_len))
4141
data->remove_block[x + 1][y][z + 1] = true;
4242
else
4343
break;

0 commit comments

Comments
 (0)