Skip to content

Commit bef7ba2

Browse files
committed
refactor: remove redundant type fields from config and deduce block scaling from path
1 parent 6ce9c96 commit bef7ba2

2 files changed

Lines changed: 4 additions & 32 deletions

File tree

.github/scripts/generate_showcase.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def download_image(url):
2828
# Return a transparent dummy image
2929
return Image.new("RGBA", (256, 256), (0, 0, 0, 0))
3030

31-
def get_texture(path, is_block):
31+
def get_texture(path):
32+
is_block = path.startswith("block/")
3233
# Try local first
3334
local_path = os.path.join(CUSTOM_ASSETS_DIR, f"{path}.png")
3435
if os.path.exists(local_path):
@@ -131,14 +132,12 @@ def main():
131132
x = c * SLOT_SIZE + (SLOT_SIZE - ITEM_SIZE) // 2
132133
y = r * SLOT_SIZE + (SLOT_SIZE - ITEM_SIZE) // 2
133134

134-
is_block = (item.get("type") == "block")
135-
136135
if "off_texture" in item:
137-
off_img = get_texture(item["off_texture"], is_block)
136+
off_img = get_texture(item["off_texture"])
138137
off_grid.paste(off_img, (x, y), off_img)
139138

140139
if "on_texture" in item:
141-
on_img = get_texture(item["on_texture"], is_block)
140+
on_img = get_texture(item["on_texture"])
142141
on_grid.paste(on_img, (x, y), on_img)
143142

144143
# Paste grids to bg directly

.github/scripts/showcase_config.json

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,163 +7,136 @@
77
"items": [
88
{
99
"slot": 0,
10-
"type": "item",
1110
"off_texture": "item/dandelion",
1211
"on_texture": "item/golden_dandelion"
1312
},
1413
{
1514
"slot": 1,
16-
"type": "item",
1715
"off_texture": "item/pink_petals",
1816
"on_texture": "item/wildflowers"
1917
},
2018
{
2119
"slot": 2,
22-
"type": "item",
2320
"off_texture": "item/pink_petals",
2421
"on_texture": "item/leaf_litter"
2522
},
2623
{
2724
"slot": 3,
28-
"type": "item",
2925
"off_texture": "item/brain_coral_fan",
3026
"on_texture": "item/cactus_flower"
3127
},
3228
{
3329
"slot": 4,
34-
"type": "item",
3530
"off_texture": "item/short_grass",
3631
"on_texture": "item/firefly_bush"
3732
},
3833
{
3934
"slot": 5,
40-
"type": "item",
4135
"off_texture": "item/egg",
4236
"on_texture": "item/brown_egg"
4337
},
4438
{
4539
"slot": 6,
46-
"type": "block",
4740
"off_texture": "item/skeleton_skull",
4841
"on_texture": "block/dried_ghast"
4942
},
5043
{
5144
"slot": 7,
52-
"type": "block",
5345
"off_texture": "block/oak_planks",
5446
"on_texture": "block/oak_shelf"
5547
},
5648
{
5749
"slot": 8,
58-
"type": "block",
5950
"off_texture": "block/oak_planks",
6051
"on_texture": "block/pale_oak_shelf"
6152
},
6253
{
6354
"slot": 9,
64-
"type": "item",
6555
"off_texture": "item/iron_sword",
6656
"on_texture": "item/copper_sword"
6757
},
6858
{
6959
"slot": 10,
70-
"type": "item",
7160
"off_texture": "item/diamond_sword",
7261
"on_texture": "item/diamond_spear"
7362
},
7463
{
7564
"slot": 11,
76-
"type": "item",
7765
"off_texture": "item/iron_horse_armor",
7866
"on_texture": "item/copper_nautilus_armor"
7967
},
8068
{
8169
"slot": 12,
82-
"type": "item",
8370
"off_texture": "item/diamond_horse_armor",
8471
"on_texture": "item/diamond_nautilus_armor"
8572
},
8673
{
8774
"slot": 13,
88-
"type": "item",
8975
"off_texture": "item/leather_horse_armor",
9076
"on_texture": "item/netherite_horse_armor"
9177
},
9278
{
9379
"slot": 14,
94-
"type": "item",
9580
"off_texture": "item/iron_golem_spawn_egg",
9681
"on_texture": "item/copper_golem_spawn_egg"
9782
},
9883
{
9984
"slot": 15,
100-
"type": "item",
10185
"off_texture": "item/camel_spawn_egg",
10286
"on_texture": "item/camel_husk_spawn_egg"
10387
},
10488
{
10589
"slot": 16,
106-
"type": "block",
10790
"off_texture": "block/weathered_cut_copper",
10891
"on_texture": "block/weathered_copper_golem_statue"
10992
},
11093
{
11194
"slot": 17,
112-
"type": "block",
11395
"off_texture": "block/chest",
11496
"on_texture": "block/exposed_copper_chest"
11597
},
11698
{
11799
"slot": 18,
118-
"type": "item",
119100
"off_texture": "item/soul_lantern",
120101
"on_texture": "item/oxidized_copper_lantern"
121102
},
122103
{
123104
"slot": 19,
124-
"type": "block",
125105
"off_texture": "block/lightning_rod",
126106
"on_texture": "block/oxidized_lightning_rod"
127107
},
128108
{
129109
"slot": 20,
130-
"type": "item",
131110
"off_texture": "item/powder_snow_bucket",
132111
"on_texture": "item/sulfur_cube_bucket"
133112
},
134113
{
135114
"slot": 21,
136-
"type": "item",
137115
"off_texture": "item/pointed_dripstone",
138116
"on_texture": "item/sulfur_spike"
139117
},
140118
{
141119
"slot": 22,
142-
"type": "block",
143120
"off_texture": "block/end_stone",
144121
"on_texture": "block/potent_sulfur"
145122
},
146123
{
147124
"slot": 23,
148-
"type": "block",
149125
"off_texture": "block/bricks",
150126
"on_texture": "block/cinnabar_bricks"
151127
},
152128
{
153129
"slot": 24,
154-
"type": "block",
155130
"off_texture": "item/wolf_armor",
156131
"on_texture": "item/purple_harness"
157132
},
158133
{
159134
"slot": 25,
160-
"type": "item",
161135
"off_texture": "item/music_disc_pigstep",
162136
"on_texture": "item/music_disc_lava_chicken"
163137
},
164138
{
165139
"slot": 26,
166-
"type": "item",
167140
"off_texture": "item/music_disc_13",
168141
"on_texture": "item/music_disc_bounce"
169142
}

0 commit comments

Comments
 (0)