Skip to content
Merged
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
5 changes: 3 additions & 2 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ Simple Solid 6-Sided Block
Most blocks are simple full height solid blocks. These blocks are automatically
picked up by the ``unbound_models()`` method from the minecraft assets.
Sometimes these blocks have special properties that can not be picked up
from the assets, like transparency. These blocks can be added like this::
from the assets, like nospawn, or because you want to include them in an overview.
These blocks can be added like this::

transparentmodelblock(blockid=1125, name="mangrove_roots")
solidmodelblock(blockid=1125, name="mangrove_roots")

Block with Variable Colors
~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 0 additions & 4 deletions overviewer_core/src/mc_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ enum mc_block_id {
block_cauldron = 118,
block_end_portal = 119,
block_end_portal_frame = 120,
block_dragon_egg = 122,
block_redstone_lamp = 123,
block_double_wooden_slab = 125,
block_wooden_slab = 126,
Expand Down Expand Up @@ -143,7 +142,6 @@ enum mc_block_id {
block_dark_oak_stairs = 164,
block_crimson_stairs = 509,
block_warped_stairs = 510,
block_slime = 165,
block_barrier = 166,
block_iron_trapdoor = 167,
block_hay_block = 170,
Expand Down Expand Up @@ -328,7 +326,6 @@ enum mc_block_id {
block_spore_blossom = 1120,

block_mud_brick_slab = 1124,
block_mangrove_roots = 1125,
block_mangrove_log = 1126,
block_mangrove_slab = 1789,

Expand Down Expand Up @@ -435,7 +432,6 @@ enum mc_block_id {
// 1.15 blocks below
block_beehive = 11501,
block_bee_nest = 11502,
block_honey_block = 11504,
block_sweet_berry_bush = 11505,
block_campfire = 11506,
block_bell = 11507,
Expand Down
62 changes: 14 additions & 48 deletions overviewer_core/textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,13 @@ def build_block_from_model(self, modelname, blockstate={}):
if 'elements' not in colmodel:
return None

elements = colmodel['elements']
elements.sort(key=lambda x: (x['to'][1], 16 - (x['from'][0]+x['to'][0]),16 - (x['from'][2]+x['to'][2])))

img = Image.new("RGBA", (24, 24), self.bgcolor)

# for each elements
for elem in colmodel['elements']:
for elem in elements:
try:
if 'west' in elem['faces']:
self.draw_blockface(img, elem, colmodel, blockstate, modelname, 'west')
Expand Down Expand Up @@ -1159,15 +1162,15 @@ def crop_to_transparancy(self, img, area):

# cut from bottom
if area[1] != 0:
ImageDraw.Draw(img).rectangle((0, 16 - (area[1]-1), 16, 16), outline=(0, 0, 0, 0), fill=(0, 0, 0, 0))
ImageDraw.Draw(img).rectangle((0, 16 - (area[1]-2), 16, 16), outline=(0, 0, 0, 0), fill=(0, 0, 0, 0))

# cut from right
if area[2] != 16:
ImageDraw.Draw(img).rectangle((area[2]-1, 0, 16, 16), outline=(0, 0, 0, 0), fill=(0, 0, 0, 0))

# cut from left
if area[0] != 0:
ImageDraw.Draw(img).rectangle((0, 0, area[0]-1, 16), outline=(0, 0, 0, 0), fill=(0, 0, 0, 0))
ImageDraw.Draw(img).rectangle((0, 0, area[0]-2, 16), outline=(0, 0, 0, 0), fill=(0, 0, 0, 0))

return img

Expand Down Expand Up @@ -1285,12 +1288,6 @@ def func_wrapper(texobj, blockid, data):
return inner_material


def transparentmodelblock(blockid=[], name=None, **kwargs):
new_kwargs = {'transparent': True}
new_kwargs.update(kwargs)
return modelblock(blockid=blockid, name=name, **new_kwargs)


def solidmodelblock(blockid=[], name=None, **kwargs):
new_kwargs = {'solid': True}
new_kwargs.update(kwargs)
Expand Down Expand Up @@ -1622,8 +1619,6 @@ def dropper(self, blockid, data):
return self.build_block_from_model('dispenser', {'facing': facing})

# furnace, blast furnace, and smoker


@material(blockid=[61, 11362, 11364], data=list(range(14)), solid=True)
def furnaces(self, blockid, data):
lit = data & 0b1000 == 8
Expand Down Expand Up @@ -2397,7 +2392,7 @@ def fire(self, blockid, data):
return self.build_block_from_model('soul_fire_floor0')

# monster spawner
transparentmodelblock(blockid=52, name="spawner")
modelblock(blockid=52, name="spawner", solid=True, transparent=True)

# wooden, cobblestone, red brick, stone brick, netherbrick, sandstone, spruce, birch,
# jungle, quartz, red sandstone, purpur_stairs, crimson_stairs, warped_stairs, (dark) prismarine,
Expand Down Expand Up @@ -3144,17 +3139,7 @@ def create_tile(img_src, coord_crop, coord_paste, scale):
# crops with 8 data values (like wheat)
@material(blockid=59, data=list(range(8)), transparent=True, nospawn=True)
def crops8(self, blockid, data):
raw_crop = self.load_image_texture("assets/minecraft/textures/block/wheat_stage%d.png" % data)
crop1 = self.transform_image_top(raw_crop)
crop2 = self.transform_image_side(raw_crop)
crop3 = crop2.transpose(Image.FLIP_LEFT_RIGHT)

img = Image.new("RGBA", (24,24), self.bgcolor)
alpha_over(img, crop1, (0,12), crop1)
alpha_over(img, crop2, (6,3), crop2)
alpha_over(img, crop3, (6,3), crop3)
return img

return self.build_block_from_model("wheat_stage%d" % data)

# farmland and grass path (15/16 blocks)
@material(blockid=[60, 208], data=list(range(2)), solid=True, transparent=True, nospawn=True)
Expand Down Expand Up @@ -4938,11 +4923,6 @@ def end_portal_frame(self, blockid, data):
return self.build_block_from_model('end_portal_frame_filled', {'facing': facing})
return self.build_block_from_model('end_portal_frame', {'facing': facing})


# dragon egg
transparentmodelblock(blockid=122, name="dragon_egg")


@material(blockid=[123], data=list(range(2)), solid=True)
def redstone_lamp(self, blockid, data):
if data == 0: # off
Expand Down Expand Up @@ -5298,9 +5278,6 @@ def hopper(self, blockid, data):

return img

# slime block
transparentmodelblock(blockid=165, name="slime_block")

# hay block
@material(blockid=170, data=list(range(3)), solid=True)
def hayblock(self, blockid, data):
Expand Down Expand Up @@ -5332,11 +5309,9 @@ def flower(self, blockid, data):
def chorus_flower(self, blockid, data):
# aged 5, dead
if data == 5:
texture = self.load_image_texture("assets/minecraft/textures/block/chorus_flower_dead.png")
return self.build_block_from_model("chorus_flower_dead")
else:
texture = self.load_image_texture("assets/minecraft/textures/block/chorus_flower.png")

return self.build_block(texture,texture)
return self.build_block_from_model("chorus_flower")

# purpur pillar
@material(blockid=202, data=list(range(3)), solid=True)
Expand Down Expand Up @@ -5431,13 +5406,10 @@ def jigsaw_block(self, blockid, data):
# beetroots(207), berry bushes (11505)
@material(blockid=[207, 11505], data=list(range(4)), transparent=True, nospawn=True)
def crops(self, blockid, data):

crops_id_to_tex = {
207: "assets/minecraft/textures/block/beetroots_stage%d.png",
11505: "assets/minecraft/textures/block/sweet_berry_bush_stage%d.png",
}

raw_crop = self.load_image_texture(crops_id_to_tex[blockid] % data)
if blockid == 207:
return self.build_block_from_model("beetroots_stage%d" % data)
else:
raw_crop = self.load_image_texture("assets/minecraft/textures/block/sweet_berry_bush_stage%d.png" % data)
crop1 = self.transform_image_top(raw_crop)
crop2 = self.transform_image_side(raw_crop)
crop3 = crop2.transpose(Image.FLIP_LEFT_RIGHT)
Expand Down Expand Up @@ -5475,10 +5447,6 @@ def beehivenest(self, blockid, data):
return self.build_block_from_model('bee_nest_honey', {'facing': facing})
return self.build_block_from_model('bee_nest', {'facing': facing})


# honey_block
transparentmodelblock(blockid=11504, name="honey_block")

# Barrel
@material(blockid=11418, data=list(range(12)), solid=True)
def barrel(self, blockid, data):
Expand Down Expand Up @@ -6114,8 +6082,6 @@ def spore_blossom(self, blockid, data):
alpha_over(img, base_top, (0, 0), base_top)
return img

transparentmodelblock(blockid=1125, name="mangrove_roots")

# Render all blocks not explicitly declared before
# Must run last to prevent being hidden by blocks with fixed IDs
unbound_models()
4 changes: 0 additions & 4 deletions overviewer_core/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ def __init__(self, regiondir, rel):
'minecraft:powder_snow_cauldron': (118, 3 << 2),
'minecraft:end_portal': (119, 0),
'minecraft:end_portal_frame': (120, 0),
'minecraft:dragon_egg': (122, 0),
'minecraft:redstone_lamp': (123, 0),
'minecraft:oak_slab': (126, 0),
'minecraft:spruce_slab': (126, 1),
Expand Down Expand Up @@ -526,7 +525,6 @@ def __init__(self, regiondir, rel):
'minecraft:dark_oak_log': (162, 1),
'minecraft:acacia_stairs': (163, 0),
'minecraft:dark_oak_stairs': (164, 0),
'minecraft:slime_block': (165,0),
'minecraft:iron_trapdoor': (167, 0),
'minecraft:hay_block': (170, 0),
'minecraft:sunflower': (175, 0),
Expand Down Expand Up @@ -715,7 +713,6 @@ def __init__(self, regiondir, rel):

# 1.19 blocks
'minecraft:mud_brick_slab': (1124, 0),
'minecraft:mangrove_roots': (1125, 0),
'minecraft:mangrove_log': (1126, 0),
'minecraft:stripped_mangrove_log': (1126, 1),

Expand Down Expand Up @@ -822,7 +819,6 @@ def __init__(self, regiondir, rel):
# 1.15 blocks below
'minecraft:beehive': (11501, 0),
'minecraft:bee_nest': (11502, 0),
'minecraft:honey_block': (11504, 0),
'minecraft:sweet_berry_bush': (11505, 0),
'minecraft:campfire': (11506, 0),
'minecraft:bell': (11507, 0),
Expand Down