Skip to content

Commit

Permalink
Merge pull request #1791 from overviewer/116-blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
CounterPillow committed Aug 5, 2020
2 parents 08e8c21 + 1d40ea7 commit 50b84e9
Show file tree
Hide file tree
Showing 11 changed files with 273 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python:
- "3.7"
- "3.8"
env:
- MC_VERSION=1.15
- MC_VERSION=1.16.1
before_install:
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/Imaging.h
- wget https://raw.githubusercontent.com/python-pillow/Pillow/master/src/libImaging/ImagingUtils.h
Expand Down
6 changes: 3 additions & 3 deletions docs/running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ If you want or need to provide your own textures, you have several options:

::

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

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

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

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

Expand Down
3 changes: 3 additions & 0 deletions overviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ def main():
f = tex.find_file("assets/minecraft/textures/block/grass_block_top.png", verbose=True)
f = tex.find_file("assets/minecraft/textures/block/diamond_ore.png", verbose=True)
f = tex.find_file("assets/minecraft/textures/block/acacia_planks.png", verbose=True)
# 1.16
f = tex.find_file("assets/minecraft/textures/block/ancient_debris_top.png",
verbose=True)
except IOError:
logging.error("Could not find any texture files.")
return 1
Expand Down
34 changes: 18 additions & 16 deletions overviewer_core/src/block_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ bool block_class_is_subset(
return false;
}

bool block_class_is_wall(mc_block_t block) {
mc_block_t mask = 0b11111111;
mc_block_t prefix = 0b111 << 8; // 1792 is the starting offset
// if the xor zeroes all bits, the prefix must've matched.
return (block & ~mask) ^ prefix == 0;
}

const mc_block_t block_class_stair[] = {
block_oak_stairs,
block_brick_stairs,
Expand Down Expand Up @@ -253,19 +260,14 @@ const mc_block_t block_class_alt_height[] = {
block_wooden_slab};
const size_t block_class_alt_height_len = COUNT_OF(block_class_alt_height);

const mc_block_t block_class_wall[] = {
block_andesite_wall,
block_brick_wall,
block_cobblestone_wall,
block_diorite_wall,
block_end_stone_brick_wall,
block_granite_wall,
block_mossy_cobblestone_wall,
block_mossy_stone_brick_wall,
block_nether_brick_wall,
block_prismarine_wall,
block_red_nether_brick_wall,
block_red_sandstone_wall,
block_sandstone_wall,
block_stone_brick_wall};
const size_t block_class_wall_len = COUNT_OF(block_class_wall);
const mc_block_t block_class_nether_roof[] = {
block_bedrock,
block_netherrack,
block_quartz_ore,
block_lava,
block_soul_sand,
block_basalt,
block_blackstone,
block_soul_soil,
block_nether_gold_ore};
const size_t block_class_nether_roof_len = COUNT_OF(block_class_nether_roof);
6 changes: 4 additions & 2 deletions overviewer_core/src/block_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ bool block_class_is_subset(
const mc_block_t block_class[],
size_t block_class_len);

bool block_class_is_wall(mc_block_t block);

extern const mc_block_t block_class_stair[];
extern const size_t block_class_stair_len;

Expand All @@ -46,7 +48,7 @@ extern const size_t block_class_ancil_len;
extern const mc_block_t block_class_alt_height[];
extern const size_t block_class_alt_height_len;

extern const mc_block_t block_class_wall[];
extern const size_t block_class_wall_len;
extern const mc_block_t block_class_nether_roof[];
extern const size_t block_class_nether_roof_len;

#endif
2 changes: 1 addition & 1 deletion overviewer_core/src/iterate.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ generate_pseudo_data(RenderState* state, uint16_t ancilData) {
}
}
return data;
} else if (block_class_is_subset(state->block, block_class_wall, block_class_wall_len)) {
} else if (block_class_is_wall(state->block)) {
/* check for walls and add one bit with the type of wall (mossy or cobblestone)*/
if (ancilData == 0x1) {
return check_adjacent_blocks(state, x, y, z, state->block) | 0x10;
Expand Down
59 changes: 42 additions & 17 deletions overviewer_core/src/mc_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,47 @@ enum mc_block_id {
block_structure_block = 255,
block_jigsaw = 256,
block_shulker_box = 257,
// 1.16 stuff
block_ancient_debris = 1000,
block_basalt = 1001,
block_polished_basalt = 1002,
block_soul_campfire = 1003,
block_blackstone = 1004,
block_netherite_block = 1005,
block_warped_nylium = 1006,
block_crimson_nylium = 1007,
block_warped_wart_block = 1010,
block_shroomlight = 1011,
block_twisting_vines = 1012,
block_twisting_vines_plant = 1013,
block_weeping_vines = 1014,
block_weeping_vines_plant = 1015,
block_warped_fungus = 1016,
block_crimson_fungus = 1017,
block_warped_roots = 1018,
block_crimson_roots = 1019,
block_soul_soil = 1020,
block_nether_gold_ore = 1021,
// adding a gap in the numbering of walls to keep them all
// in one numbering block starting at 1792
// all blocks between 1792 and 2047 are considered walls
// this is because our check looks for the prefix 0b11100000000
block_andesite_wall = 1792,
block_brick_wall = 1793,
block_cobblestone_wall = 1794,
block_diorite_wall = 1795,
block_end_stone_brick_wall = 1796,
block_granite_wall = 1797,
block_mossy_cobblestone_wall = 1798,
block_mossy_stone_brick_wall = 1799,
block_nether_brick_wall = 1800,
block_prismarine_wall = 1801,
block_red_nether_brick_wall = 1802,
block_red_sandstone_wall = 1803,
block_sandstone_wall = 1804,
block_stone_brick_wall = 1805,
// end of walls

block_prismarine_stairs = 11337,
block_dark_prismarine_stairs = 11338,
block_prismarine_brick_stairs = 11339,
Expand Down Expand Up @@ -336,23 +377,7 @@ enum mc_block_id {
block_honey_block = 11504,
block_sweet_berry_bush = 11505,
block_campfire = 11506,
block_bell = 11507,
// adding a gap in the numbering of walls to keep them all
// in one numbering block starting at 21000
block_andesite_wall = 21000,
block_brick_wall = 21001,
block_cobblestone_wall = 21002,
block_diorite_wall = 21003,
block_end_stone_brick_wall = 21004,
block_granite_wall = 21005,
block_mossy_cobblestone_wall = 21006,
block_mossy_stone_brick_wall = 21007,
block_nether_brick_wall = 21008,
block_prismarine_wall = 21009,
block_red_nether_brick_wall = 21010,
block_red_sandstone_wall = 21011,
block_sandstone_wall = 21012,
block_stone_brick_wall = 21013
block_bell = 11507
};

typedef uint16_t mc_block_t;
Expand Down
2 changes: 1 addition & 1 deletion overviewer_core/src/overviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

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

#include <stdbool.h>
#include <stdint.h>
Expand Down
2 changes: 1 addition & 1 deletion overviewer_core/src/primitives/nether.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ walk_chunk(RenderState* state, RenderPrimitiveNether* data) {

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

0 comments on commit 50b84e9

Please sign in to comment.