0

Merge pull request #1791 from overviewer/116-blocks

This commit is contained in:
Nicolas F
2020-08-05 19:05:57 +02:00
committed by GitHub
11 changed files with 273 additions and 175 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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,
@@ -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);

View File

@@ -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;
@@ -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

View File

@@ -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;

View File

@@ -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,
@@ -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;

View File

@@ -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>

View File

@@ -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;

View File

@@ -30,6 +30,8 @@ import functools
from . import util
BLOCKTEX = "assets/minecraft/textures/block/"
# global variables to collate information in @material decorators
blockmap_generators = {}
@@ -324,7 +326,7 @@ class Textures(object):
if verbose: logging.info("Found %s in '%s'", filename, path)
return open(path, mode)
raise TextureException("Could not find the textures while searching for '{0}'. Try specifying the 'texturepath' option in your config file.\nSet it to the path to a Minecraft Resource pack.\nAlternately, install the Minecraft client (which includes textures)\nAlso see <http://docs.overviewer.org/en/latest/running/#installing-the-textures>\n(Remember, this version of Overviewer requires a 1.15-compatible resource pack)\n(Also note that I won't automatically use snapshots; you'll have to use the texturepath option to use a snapshot jar)".format(filename))
raise TextureException("Could not find the textures while searching for '{0}'. Try specifying the 'texturepath' option in your config file.\nSet it to the path to a Minecraft Resource pack.\nAlternately, install the Minecraft client (which includes textures)\nAlso see <http://docs.overviewer.org/en/latest/running/#installing-the-textures>\n(Remember, this version of Overviewer requires a 1.16-compatible resource pack)\n(Also note that I won't automatically use snapshots; you'll have to use the texturepath option to use a snapshot jar)".format(filename))
def load_image_texture(self, filename):
# Textures may be animated or in a different resolution than 16x16.
@@ -1077,7 +1079,8 @@ block(blockid=15, top_image="assets/minecraft/textures/block/iron_ore.png")
# coal ore
block(blockid=16, top_image="assets/minecraft/textures/block/coal_ore.png")
@material(blockid=[17,162,11306,11307,11308,11309,11310,11311], data=list(range(12)), solid=True)
@material(blockid=[17, 162, 11306, 11307, 11308, 11309, 11310, 11311, 1008, 1009],
data=list(range(12)), solid=True)
def wood(self, blockid, data):
# extract orientation and wood type frorm data bits
wood_type = data & 3
@@ -1089,99 +1092,67 @@ def wood(self, blockid, data):
if wood_orientation == 4: wood_orientation = 8
elif wood_orientation == 8: wood_orientation = 4
# choose textures
if blockid == 17: # regular wood:
if wood_type == 0: # normal
top = self.load_image_texture("assets/minecraft/textures/block/oak_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/oak_log.png")
if wood_type == 1: # spruce
top = self.load_image_texture("assets/minecraft/textures/block/spruce_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/spruce_log.png")
if wood_type == 2: # birch
top = self.load_image_texture("assets/minecraft/textures/block/birch_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/birch_log.png")
if wood_type == 3: # jungle wood
top = self.load_image_texture("assets/minecraft/textures/block/jungle_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/jungle_log.png")
elif blockid == 162: # acacia/dark wood:
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log.png")
else:
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
if blockid == 11306: # stripped regular wood:
if wood_type == 0: # normal
top = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log.png")
if wood_type == 1: # spruce
top = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log.png")
if wood_type == 2: # birch
top = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log.png")
if wood_type == 3: # jungle wood
top = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log.png")
elif blockid == 11307: # stripped acacia/dark wood:
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log.png")
else:
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
if blockid == 11308: # regular bark:
if wood_type == 0: # normal
top = self.load_image_texture("assets/minecraft/textures/block/oak_log.png")
side = top
if wood_type == 1: # spruce
top = self.load_image_texture("assets/minecraft/textures/block/spruce_log.png")
side = top
if wood_type == 2: # birch
top = self.load_image_texture("assets/minecraft/textures/block/birch_log.png")
side = top
if wood_type == 3: # jungle wood
top = self.load_image_texture("assets/minecraft/textures/block/jungle_log.png")
side = top
elif blockid == 11309: # acacia/dark bark:
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
side = top
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/dark_oak_log.png")
side = top
else:
top = self.load_image_texture("assets/minecraft/textures/block/acacia_log.png")
side = top
if blockid == 11310: # stripped regular wood:
if wood_type == 0: # normal
top = self.load_image_texture("assets/minecraft/textures/block/stripped_oak_log.png")
side = top
if wood_type == 1: # spruce
top = self.load_image_texture("assets/minecraft/textures/block/stripped_spruce_log.png")
side = top
if wood_type == 2: # birch
top = self.load_image_texture("assets/minecraft/textures/block/stripped_birch_log.png")
side = top
if wood_type == 3: # jungle wood
top = self.load_image_texture("assets/minecraft/textures/block/stripped_jungle_log.png")
side = top
elif blockid == 11311: # stripped acacia/dark wood:
if wood_type == 0: # acacia
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
side = top
elif wood_type == 1: # dark oak
top = self.load_image_texture("assets/minecraft/textures/block/stripped_dark_oak_log.png")
side = top
else:
top = self.load_image_texture("assets/minecraft/textures/block/stripped_acacia_log.png")
side = top
# dictionary of blockid : { wood_type : (top, side) }
wood_tex = {
17: {
0: ("oak_log_top.png", "oak_log.png"),
1: ("spruce_log_top.png", "spruce_log.png"),
2: ("birch_log_top.png", "birch_log.png"),
3: ("jungle_log_top.png", "jungle_log.png"),
},
162: {
0: ("acacia_log_top.png", "acacia_log.png"),
1: ("dark_oak_log_top.png", "dark_oak_log.png"),
},
11306: {
0: ("stripped_oak_log_top.png", "stripped_oak_log.png"),
1: ("stripped_spruce_log_top.png", "stripped_spruce_log.png"),
2: ("stripped_birch_log_top.png", "stripped_birch_log.png"),
3: ("stripped_jungle_log_top.png", "stripped_jungle_log.png"),
},
11307: {
0: ("stripped_acacia_log_top.png", "stripped_acacia_log.png"),
1: ("stripped_dark_oak_log_top.png", "stripped_dark_oak_log.png"),
},
11308: {
0: ("oak_log.png", None),
1: ("spruce_log.png", None),
2: ("birch_log.png", None),
3: ("jungle_log.png", None),
},
11309: {
0: ("acacia_log.png", None),
1: ("dark_oak_log.png", None),
},
11310: {
0: ("stripped_oak_log.png", None),
1: ("stripped_spruce_log.png", None),
2: ("stripped_birch_log.png", None),
3: ("stripped_jungle_log.png", None),
},
11311: {
0: ("stripped_acacia_log.png", None),
1: ("stripped_dark_oak_log.png", None),
},
1008: {
0: ("warped_stem_top.png", "warped_stem.png"),
1: ("warped_stem_top.png", "stripped_warped_stem.png"),
2: ("crimson_stem_top.png", "crimson_stem.png"),
3: ("crimson_stem_top.png", "stripped_crimson_stem.png"),
},
1009: {
0: ("warped_stem.png", None),
1: ("stripped_warped_stem.png", None),
2: ("crimson_stem.png", None),
3: ("stripped_crimson_stem.png", None),
}
}
top_f, side_f = wood_tex[blockid].get(wood_type, wood_tex[blockid][0])
if not side_f:
side_f = top_f
top = self.load_image_texture(BLOCKTEX + top_f)
side = self.load_image_texture(BLOCKTEX + side_f)
# choose orientation and paste textures
if wood_orientation == 0:
@@ -1688,6 +1659,15 @@ def flower(self, blockid, data):
sprite(blockid=39, imagename="assets/minecraft/textures/block/brown_mushroom.png")
# red mushroom
sprite(blockid=40, imagename="assets/minecraft/textures/block/red_mushroom.png")
# warped fungus
sprite(blockid=1016, imagename="assets/minecraft/textures/block/warped_fungus.png")
# crimson fungus
sprite(blockid=1017, imagename="assets/minecraft/textures/block/crimson_fungus.png")
# warped roots
sprite(blockid=1018, imagename="assets/minecraft/textures/block/warped_roots.png")
# crimson roots
sprite(blockid=1019, imagename="assets/minecraft/textures/block/crimson_roots.png")
# block of gold
block(blockid=41, top_image="assets/minecraft/textures/block/gold_block.png")
# block of iron
@@ -3666,6 +3646,8 @@ block(blockid=88, top_image="assets/minecraft/textures/block/soul_sand.png")
# glowstone
block(blockid=89, top_image="assets/minecraft/textures/block/glowstone.png")
# shroomlight
block(blockid=1011, top_image="assets/minecraft/textures/block/shroomlight.png")
# portal
@material(blockid=90, data=[1, 2, 4, 5, 8, 10], transparent=True)
@@ -4225,6 +4207,12 @@ def stem(self, blockid, data):
return img
# nether vines
billboard(blockid=1012, imagename="assets/minecraft/textures/block/twisting_vines.png")
billboard(blockid=1013, imagename="assets/minecraft/textures/block/twisting_vines_plant.png")
billboard(blockid=1014, imagename="assets/minecraft/textures/block/weeping_vines.png")
billboard(blockid=1015, imagename="assets/minecraft/textures/block/weeping_vines_plant.png")
# vines
@material(blockid=106, data=list(range(32)), transparent=True, solid=False, nospawn=True)
def vines(self, blockid, data):
@@ -4359,6 +4347,13 @@ def fence_gate(self, blockid, data):
# mycelium
block(blockid=110, top_image="assets/minecraft/textures/block/mycelium_top.png", side_image="assets/minecraft/textures/block/mycelium_side.png")
# warped_nylium & crimson_nylium
block(blockid=1006, top_image="assets/minecraft/textures/block/warped_nylium.png", side_image="assets/minecraft/textures/block/warped_nylium_side.png")
block(blockid=1007, top_image="assets/minecraft/textures/block/crimson_nylium.png", side_image="assets/minecraft/textures/block/crimson_nylium_side.png")
# soul soil
block(blockid=1020, top_image="assets/minecraft/textures/block/soul_soil.png")
# nether gold ore
block(blockid=1021, top_image="assets/minecraft/textures/block/nether_gold_ore.png")
# lilypad
# At the moment of writing this lilypads has no ancil data and their
@@ -4691,24 +4686,24 @@ def beacon(self, blockid, data):
# cobblestone and mossy cobblestone walls, chorus plants, mossy stone brick walls
# one additional bit of data value added for mossy and cobblestone
@material(blockid=[199]+list(range(21000,21013+1)), data=list(range(32)), transparent=True, nospawn=True)
@material(blockid=[199]+list(range(1792, 1805 + 1)), data=list(range(32)), transparent=True, nospawn=True)
def cobblestone_wall(self, blockid, data):
walls_id_to_tex = {
199: "assets/minecraft/textures/block/chorus_plant.png", # chorus plants
21000: "assets/minecraft/textures/block/andesite.png",
21001: "assets/minecraft/textures/block/bricks.png",
21002: "assets/minecraft/textures/block/cobblestone.png",
21003: "assets/minecraft/textures/block/diorite.png",
21004: "assets/minecraft/textures/block/end_stone_bricks.png",
21005: "assets/minecraft/textures/block/granite.png",
21006: "assets/minecraft/textures/block/mossy_cobblestone.png",
21007: "assets/minecraft/textures/block/mossy_stone_bricks.png",
21008: "assets/minecraft/textures/block/nether_bricks.png",
21009: "assets/minecraft/textures/block/prismarine.png",
21010: "assets/minecraft/textures/block/red_nether_bricks.png",
21011: "assets/minecraft/textures/block/red_sandstone.png",
21012: "assets/minecraft/textures/block/sandstone.png",
21013: "assets/minecraft/textures/block/stone_bricks.png"
1792: "assets/minecraft/textures/block/andesite.png",
1793: "assets/minecraft/textures/block/bricks.png",
1794: "assets/minecraft/textures/block/cobblestone.png",
1795: "assets/minecraft/textures/block/diorite.png",
1796: "assets/minecraft/textures/block/end_stone_bricks.png",
1797: "assets/minecraft/textures/block/granite.png",
1798: "assets/minecraft/textures/block/mossy_cobblestone.png",
1799: "assets/minecraft/textures/block/mossy_stone_bricks.png",
1800: "assets/minecraft/textures/block/nether_bricks.png",
1801: "assets/minecraft/textures/block/prismarine.png",
1802: "assets/minecraft/textures/block/red_nether_bricks.png",
1803: "assets/minecraft/textures/block/red_sandstone.png",
1804: "assets/minecraft/textures/block/sandstone.png",
1805: "assets/minecraft/textures/block/stone_bricks.png"
}
t = self.load_image_texture(walls_id_to_tex[blockid]).copy()
@@ -5151,6 +5146,8 @@ block(blockid=213, top_image="assets/minecraft/textures/block/magma.png")
# nether wart block
block(blockid=214, top_image="assets/minecraft/textures/block/nether_wart_block.png")
# warped wart block
block(blockid=1010, top_image="assets/minecraft/textures/block/warped_wart_block.png")
# red nether brick
block(blockid=215, top_image="assets/minecraft/textures/block/red_nether_bricks.png")
@@ -5459,18 +5456,21 @@ def barrel(self, blockid, data):
return self.build_full_block(t_side.rotate(90), None, None, t_top, t_side.rotate(270))
# Campfire
@material(blockid=11506, data=list(range(8)), solid=True, transparent=True, nospawn=True)
# Campfire (11506) and soul campfire (1003)
@material(blockid=[11506, 1003], data=list(range(8)), solid=True, transparent=True, nospawn=True)
def campfire(self, blockid, data):
# Do rotation, mask to not clobber lit data
data = data & 0b100 | ((self.rotation + (data & 0b11)) % 4)
block_name = "campfire" if blockid == 11506 else "soul_campfire"
# Load textures
# Fire & lit log textures contain multiple tiles, since both are
# 16px wide rely on load_image_texture() to crop appropriately
fire_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_fire.png")
fire_raw_t = self.load_image_texture("assets/minecraft/textures/block/" + block_name
+ "_fire.png")
log_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_log.png")
log_lit_raw_t = self.load_image_texture("assets/minecraft/textures/block/campfire_log_lit.png")
log_lit_raw_t = self.load_image_texture("assets/minecraft/textures/block/" + block_name
+ "_log_lit.png")
def create_tile(img_src, coord_crop, coord_paste, rot):
# Takes an image, crops a region, optionally rotates the
@@ -5683,3 +5683,30 @@ def bell(self, blockid, data):
alpha_over(img, post_front_t, (0, 0), post_front_t)
return img
# Ancient Debris
block(blockid=[1000], top_image="assets/minecraft/textures/block/ancient_debris_top.png",
side_image="assets/minecraft/textures/block/ancient_debris_side.png")
# Basalt
@material(blockid=[1001, 1002], data=list(range(3)), solid=True)
def basalt(self, blockid, data):
block_name = "polished_basalt" if blockid == 1002 else "basalt"
top = self.load_image_texture("assets/minecraft/textures/block/" + block_name + "_top.png")
side = self.load_image_texture("assets/minecraft/textures/block/" + block_name + "_side.png")
if data == 0:
return self.build_block(top, side)
elif data == 1: # east-west orientation
return self.build_full_block(side.rotate(90), None, None, top, side.rotate(90))
elif data == 2: # north-south orientation
return self.build_full_block(side, None, None, side.rotate(270), top)
# Blackstone block
block(blockid=[1004], top_image="assets/minecraft/textures/block/blackstone_top.png",
side_image="assets/minecraft/textures/block/blackstone.png")
# Netherite
block(blockid=[1005], top_image="assets/minecraft/textures/block/netherite_block.png")

View File

@@ -288,7 +288,10 @@ class RegionSet(object):
for x, y, regionfile in self._iterate_regionfiles():
# regionfile is a pathname
self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile))
if os.path.getsize(regionfile) != 0:
self.regionfiles[(x,y)] = (regionfile, os.path.getmtime(regionfile))
else:
logging.debug("Skipping zero-size region file {}".format(regionfile))
self.empty_chunk = [None,None]
logging.debug("Done scanning regions")
@@ -686,6 +689,39 @@ class RegionSet(object):
'minecraft:tube_coral_fan': (8, 0),
'minecraft:tube_coral_wall_fan': (8, 0),
# Some 1.16 stuff that I'll arbitrarily shove in here due to ID bloat
'minecraft:ancient_debris': (1000, 0),
'minecraft:basalt': (1001, 0),
'minecraft:polished_basalt': (1002, 0),
'minecraft:soul_campfire': (1003, 0),
'minecraft:blackstone': (1004, 0),
'minecraft:netherite_block': (1005, 0),
'minecraft:warped_nylium': (1006, 0),
'minecraft:crimson_nylium': (1007, 0),
# Nether logs aka stem
'minecraft:warped_stem': (1008, 0),
'minecraft:stripped_warped_stem': (1008, 1),
'minecraft:crimson_stem': (1008, 2),
'minecraft:stripped_crimson_stem': (1008, 3),
# hyphae
'minecraft:warped_hyphae': (1009, 0),
'minecraft:stripped_warped_hyphae': (1009, 1),
'minecraft:crimson_hyphae': (1009, 2),
'minecraft:stripped_crimson_hyphae': (1009, 3),
# nether biomes
'minecraft:warped_wart_block': (1010, 0),
'minecraft:shroomlight': (1011, 0),
'minecraft:twisting_vines': (1012, 0),
'minecraft:twisting_vines_plant': (1013, 0),
'minecraft:weeping_vines': (1014, 0),
'minecraft:weeping_vines_plant': (1015, 0),
'minecraft:warped_fungus': (1016, 0),
'minecraft:crimson_fungus': (1017, 0),
'minecraft:warped_roots': (1018, 0),
'minecraft:crimson_roots': (1019, 0),
'minecraft:soul_soil': (1020, 0),
'minecraft:nether_gold_ore': (1021, 0),
# New blocks
'minecraft:carved_pumpkin': (11300, 0),
'minecraft:spruce_pressure_plate': (11301, 0),
@@ -803,21 +839,20 @@ class RegionSet(object):
'minecraft:campfire': (11506, 0),
'minecraft:bell': (11507, 0),
# adding a gap in the numbering of walls to keep them all
# in one numbering block starting at 21000
'minecraft:andesite_wall': (21000, 0),
'minecraft:brick_wall': (21001, 0),
'minecraft:cobblestone_wall': (21002, 0),
'minecraft:diorite_wall': (21003, 0),
'minecraft:end_stone_brick_wall': (21004, 0),
'minecraft:granite_wall': (21005, 0),
'minecraft:mossy_cobblestone_wall': (21006, 0),
'minecraft:mossy_stone_brick_wall': (21007, 0),
'minecraft:nether_brick_wall': (21008, 0),
'minecraft:prismarine_wall': (21009, 0),
'minecraft:red_nether_brick_wall': (21010, 0),
'minecraft:red_sandstone_wall': (21011, 0),
'minecraft:sandstone_wall': (21012, 0),
'minecraft:stone_brick_wall': (21013, 0),
'minecraft:andesite_wall': (1792, 0),
'minecraft:brick_wall': (1793, 0),
'minecraft:cobblestone_wall': (1794, 0),
'minecraft:diorite_wall': (1795, 0),
'minecraft:end_stone_brick_wall': (1796, 0),
'minecraft:granite_wall': (1797, 0),
'minecraft:mossy_cobblestone_wall': (1798, 0),
'minecraft:mossy_stone_brick_wall': (1799, 0),
'minecraft:nether_brick_wall': (1800, 0),
'minecraft:prismarine_wall': (1801, 0),
'minecraft:red_nether_brick_wall': (1802, 0),
'minecraft:red_sandstone_wall': (1803, 0),
'minecraft:sandstone_wall': (1804, 0),
'minecraft:stone_brick_wall': (1805, 0),
}
colors = [ 'white', 'orange', 'magenta', 'light_blue',
@@ -1017,7 +1052,8 @@ class RegionSet(object):
(key == 'minecraft:piston_head' and p.get('type', 'normal') == 'sticky') or
(key == 'minecraft:observer' and p.get('powered', 'false') == 'true')):
data |= 0x08
elif key.endswith('_log') or key.endswith('_wood') or key == 'minecraft:bone_block':
elif (key.endswith('_log') or key.endswith('_wood') or
key == 'minecraft:bone_block' or key.endswith('_stem')):
axis = palette_entry['Properties']['axis']
if axis == 'x':
data |= 4
@@ -1029,6 +1065,9 @@ class RegionSet(object):
data = 3
if axis == 'z':
data = 4
elif key == 'minecraft:basalt' or key == 'minecraft:polished_basalt':
axis = palette_entry['Properties']['axis']
data = {'y': 0, 'x': 1, 'z': 2}[axis]
elif key in ['minecraft:redstone_torch','minecraft:redstone_wall_torch','minecraft:wall_torch']:
if key.startswith('minecraft:redstone_') and palette_entry['Properties']['lit'] == 'true':
block += 1
@@ -1141,7 +1180,7 @@ class RegionSet(object):
# A moisture level of 7 has a different texture from other farmland
data = 1 if palette_entry['Properties'].get('moisture', '0') == '7' else 0
elif key in ['minecraft:grindstone', 'minecraft:lectern', 'minecraft:campfire',
'minecraft:bell']:
'minecraft:bell', 'minecraft:soul_campfire']:
p = palette_entry['Properties']
data = {'south': 0, 'west': 1, 'north': 2, 'east': 3}[p['facing']]
if key == 'minecraft:grindstone':
@@ -1149,7 +1188,7 @@ class RegionSet(object):
elif key == 'minecraft:lectern':
if p['has_book'] == 'true':
data |= 4
elif key == 'minecraft:campfire':
elif key == 'minecraft:campfire' or key == 'minecraft:soul_campfire':
if p['lit'] == 'true':
data |= 4
elif key == 'minecraft:bell':