def generate(rm: ResourceManager): # First rm.lang({ 'itemGroup.notreepunching.items': 'No Tree Punching', 'notreepunching.tooltip.small_vessel_more': '%d More...' }) # Stone for stone in ('granite', 'andesite', 'diorite'): rm.blockstate('%s_cobblestone' % stone) \ .with_block_model() \ .with_item_model() \ .with_tag('cobblestone') \ .with_block_loot('notreepunching:%s_cobblestone' % stone) \ .with_lang(lang('%s cobblestone', stone)) \ .make_stairs() \ .make_slab() \ .make_wall() for piece in ('stairs', 'slab', 'wall'): rm.block('%s_cobblestone_%s' % (stone, piece)) \ .with_lang(lang('%s cobblestone %s', stone, piece)) \ .with_tag('minecraft:' + piece + ('s' if not piece.endswith('s') else '')) # plural tag for stone in ('granite', 'andesite', 'diorite', 'stone', 'sandstone', 'red_sandstone'): rm.blockstate('%s_loose_rock' % stone) \ .with_block_model(textures='minecraft:block/%s' % stone, parent='notreepunching:block/loose_rock') \ .with_block_loot('notreepunching:%s_loose_rock' % stone) \ .with_lang(lang('%s loose rock', stone)) # flat item model for the block item rm.item_model('%s_loose_rock' % stone) \ .with_tag('loose_rocks') # item tag is needed for recipes # Pottery for pottery in ('worked', 'large_vessel', 'small_vessel', 'bucket', 'flower_pot'): block = rm.blockstate('clay_%s' % pottery) \ .with_block_model(textures='minecraft:block/clay', parent='notreepunching:block/pottery_%s' % pottery) \ .with_item_model() \ .with_block_loot('notreepunching:clay_%s' % pottery) if pottery == 'worked': block.with_lang(lang('worked clay')) else: block.with_lang(lang('clay %s', pottery)) rm.blockstate('ceramic_large_vessel') \ .with_block_model(textures='notreepunching:block/ceramic', parent='notreepunching:block/pottery_large_vessel') \ .with_item_model() \ .with_block_loot({ 'entries': { 'name': 'notreepunching:ceramic_large_vessel', 'functions': [ { 'function': 'minecraft:copy_name', 'source': 'block_entity' }, { 'function': 'minecraft:copy_nbt', 'source': 'block_entity', 'ops': [{ 'source': '', 'target': 'BlockEntityTag', 'op': 'replace' }] } ], } }) \ .with_lang(lang('ceramic large vessel')) # Tools for tool in ('iron', 'gold', 'diamond'): rm.item_model('%s_mattock' % tool) \ .with_lang(lang('%s mattock', tool)) rm.item_model('%s_saw' % tool) \ .with_lang(lang('%s saw', tool)) \ .with_tag('saws') rm.item_model('%s_knife' % tool) \ .with_lang(lang('%s knife', tool)) \ .with_tag('knives') # Flint for tool in ('axe', 'pickaxe', 'shovel', 'hoe', 'knife'): rm.item_model('flint_%s' % tool) \ .with_lang(lang('flint %s', tool)) rm.item_model('macuahuitl') \ .with_lang(lang('macuahuitl')) rm.item('flint_knife').with_tag('knives') for item in ('flint_shard', 'plant_fiber', 'plant_string', 'clay_brick', 'ceramic_small_vessel', 'clay_tool', 'fire_starter'): rm.item_model(item) \ .with_lang(lang(item)) # ceramic bucket, since it uses a very custom model rm.data( ('models', 'item', 'ceramic_bucket'), { 'parent': 'forge:item/default', 'textures': { 'base': 'notreepunching:item/ceramic_bucket', 'fluid': 'forge:item/mask/bucket_fluid_drip' }, 'loader': 'forge:bucket', 'fluid': 'empty' }, root_domain='assets') rm.item('ceramic_bucket').with_lang(lang('ceramic bucket')) # Misc Tags rm.item('plant_string').with_tag('forge:string') rm.block('minecraft:gravel').with_tag('always_breakable').with_tag( 'always_drops') for wood in ('acacia', 'oak', 'dark_oak', 'jungle', 'birch', 'spruce'): rm.block('minecraft:%s_leaves' % wood).with_tag('always_breakable').with_tag('always_drops') rm.item_tag('fire_starter_logs', '#minecraft:logs', '#minecraft:planks') rm.item_tag('fire_starter_kindling', '#forge:rods/wooden', '#minecraft:saplings', '#minecraft:leaves', '#forge:string', 'notreepunching:plant_fiber') # todo: large and small vessel blacklist tags rm.item('ceramic_small_vessel').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') rm.item('ceramic_large_vessel').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') rm.item('minecraft:shulker_box').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') for color in ('white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'): rm.item('minecraft:%s_shulker_box' % color).with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist')
def generate(rm: ResourceManager): # Rock block variants for rock in ROCKS.keys(): for block_type in ROCK_BLOCK_TYPES: if block_type == 'spike': # Spikes have special block states block = rm.blockstate( ('rock', block_type, rock), variants=dict(('part=%s' % part, { 'model': 'tfc:block/rock/%s/%s_%s' % (block_type, rock, part) }) for part in ROCK_SPIKE_PARTS)) block.with_lang(lang('%s spike', rock)) block.with_block_loot({ 'entries': 'tfc:rock/loose/%s' % rock, 'functions': [loot_tables.set_count(1, 2)] }) # Individual models rm.item_model(('rock', block_type, rock), 'tfc:block/rock/raw/%s' % rock, parent='tfc:block/rock/spike/%s_base' % rock) for part in ROCK_SPIKE_PARTS: rm.block_model( ('rock', block_type, '%s_%s' % (rock, part)), { 'texture': 'tfc:block/rock/raw/%s' % rock, 'particle': 'tfc:block/rock/raw/%s' % rock }, parent='tfc:block/rock/spike_%s' % part) elif block_type == 'loose': # One block state and multiple models for the block block = rm.blockstate( 'rock/loose/%s' % rock, variants={ 'count=1': [{ 'model': 'tfc:block/rock/pebble/%s' % rock, 'y': 90 }, { 'model': 'tfc:block/rock/pebble/%s' % rock }, { 'model': 'tfc:block/rock/pebble/%s' % rock, 'y': 180 }, { 'model': 'tfc:block/rock/pebble/%s' % rock, 'y': 270 }], 'count=2': [{ 'model': 'tfc:block/rock/rubble/%s' % rock, 'y': 90 }, { 'model': 'tfc:block/rock/rubble/%s' % rock }, { 'model': 'tfc:block/rock/rubble/%s' % rock, 'y': 180 }, { 'model': 'tfc:block/rock/rubble/%s' % rock, 'y': 270 }], 'count=3': [{ 'model': 'tfc:block/rock/boulder/%s' % rock, 'y': 90 }, { 'model': 'tfc:block/rock/boulder/%s' % rock }, { 'model': 'tfc:block/rock/boulder/%s' % rock, 'y': 180 }, { 'model': 'tfc:block/rock/boulder/%s' % rock, 'y': 270 }] }, use_default_model=False) for loose_type in ('pebble', 'rubble', 'boulder'): rm.block_model('tfc:rock/%s/%s' % (loose_type, rock), 'tfc:item/loose_rock/%s' % rock, parent='tfc:block/groundcover/%s' % loose_type) block.with_lang(lang('%s %s', rock, block_type)) block.with_tag('can_be_snow_piled') block.with_block_loot({ 'entries': [{ 'name': 'tfc:rock/loose/%s' % rock, 'functions': [{ **loot_tables.set_count(2), 'conditions': [ block_state_property( 'tfc:rock/loose/%s' % rock, {'count': '2'}) ] }, { **loot_tables.set_count(3), 'conditions': [ block_state_property( 'tfc:rock/loose/%s' % rock, {'count': '3'}) ] }, explosion_decay()] }] }) # Model for the item rm.item_model(('rock', 'loose', rock), 'tfc:item/loose_rock/%s' % rock) else: block = rm.blockstate(('rock', block_type, rock)) if block_type == 'hardened': block.with_block_model('tfc:block/rock/raw/%s' % rock) # Hardened uses the raw model else: block.with_block_model('tfc:block/rock/%s/%s' % (block_type, rock)) block.with_item_model() if block_type in CUTTABLE_ROCKS: # Stairs rm.block('tfc:rock/' + block_type + '/' + rock).make_stairs() rm.block_loot( 'tfc:rock/' + block_type + '/' + rock + '_stairs', 'tfc:rock/' + block_type + '/' + rock + '_stairs') rm.lang( 'block.tfc.rock.' + block_type + '.' + rock + '_stairs', lang('%s %s Stairs', rock, block_type)) # Slabs rm.block('tfc:rock/' + block_type + '/' + rock).make_slab() slab_namespace = 'tfc:rock/' + block_type + '/' + rock + '_slab' rm.block_loot( slab_namespace, { 'entries': [{ 'functions': [{ **loot_tables.set_count(2), 'conditions': [ block_state_property( slab_namespace, {'type': 'double'}) ] }, explosion_decay()], 'name': slab_namespace }] }) rm.lang( 'block.tfc.rock.' + block_type + '.' + rock + '_slab', lang('%s %s Slab', rock, block_type)) # Walls rm.block('tfc:rock/' + block_type + '/' + rock).make_wall() rm.block_loot( 'tfc:rock/' + block_type + '/' + rock + '_wall', 'tfc:rock/' + block_type + '/' + rock + '_wall') rm.lang( 'block.tfc.rock.' + block_type + '.' + rock + '_wall', lang('%s %s Wall', rock, block_type)) rm.block_tag( 'minecraft:walls', 'tfc:rock/' + block_type + '/' + rock + '_wall') # Loot if block_type == 'raw': block.with_block_loot( alternatives([{ 'name': 'tfc:rock/raw/%s' % rock, 'conditions': ['tfc:is_isolated'], }, { 'name': 'tfc:rock/loose/%s' % rock, 'functions': [loot_tables.set_count(1, 4)] }])) elif block_type == 'hardened': block.with_block_loot({ 'entries': 'tfc:rock/loose/%s' % rock, 'functions': [loot_tables.set_count(1, 4)] }) else: block.with_block_loot('tfc:rock/%s/%s' % (block_type, rock)) # Lang if block_type in {'smooth', 'raw', 'chiseled', 'hardened'}: block.with_lang(lang('%s %s', block_type, rock)) else: block.with_lang(lang('%s %s', rock, block_type)) # Ores for ore, ore_data in ORES.items(): if ore_data.graded: # Small Ores / Groundcover Blocks block = rm.blockstate('tfc:ore/small_%s' % ore, variants={ "": [{ 'model': 'tfc:block/groundcover/%s' % ore, 'y': 90 }, { 'model': 'tfc:block/groundcover/%s' % ore }, { 'model': 'tfc:block/groundcover/%s' % ore, 'y': 180 }, { 'model': 'tfc:block/groundcover/%s' % ore, 'y': 270 }] }, use_default_model=False) block.with_lang(lang('small %s', ore)) block.with_block_loot('tfc:ore/small_%s' % ore) block.with_tag('can_be_snow_piled') rm.item_model('tfc:ore/small_%s' % ore).with_lang( lang('small %s', ore)) for grade in ORE_GRADES.keys(): block = rm.blockstate( ('ore', grade + '_' + ore, rock), 'tfc:block/ore/%s_%s/%s' % (grade, ore, rock)) block.with_block_model( { 'all': 'tfc:block/rock/raw/%s' % rock, 'particle': 'tfc:block/rock/raw/%s' % rock, 'overlay': 'tfc:block/ore/%s_%s' % (grade, ore) }, parent='tfc:block/ore') block.with_item_model() block.with_lang(lang('%s %s %s', grade, rock, ore)) block.with_block_loot('tfc:ore/%s_%s' % (grade, ore)) else: block = rm.blockstate(('ore', ore, rock), 'tfc:block/ore/%s/%s' % (ore, rock)) block.with_block_model( { 'all': 'tfc:block/rock/raw/%s' % rock, 'particle': 'tfc:block/rock/raw/%s' % rock, 'overlay': 'tfc:block/ore/%s' % ore }, parent='tfc:block/ore') block.with_item_model() block.with_lang(lang('%s %s', rock, ore)) rm.block_loot('tfc:ore/%s/%s' % (ore, rock), 'tfc:ore/%s' % ore) # Loose Ore Items for ore, ore_data in ORES.items(): if ore_data.graded: for grade in ORE_GRADES.keys(): rm.item_model('tfc:ore/%s_%s' % (grade, ore)).with_lang( lang('%s %s', grade, ore)) rm.item_model('tfc:ore/small_%s' % ore).with_lang( lang('small %s', ore)) else: rm.item_model('tfc:ore/%s' % ore).with_lang(lang('%s', ore)) # Sand for sand in SAND_BLOCK_TYPES: block = rm.blockstate(('sand', sand)) block.with_block_model('tfc:block/sand/%s' % sand) block.with_item_model() block.with_block_loot('tfc:sand/%s' % sand) block.with_lang(lang('%s Sand', sand)) # Sandstone raw = 'tfc:block/sandstone/bottom/%s' % sand # vanilla sandstone bottom top = 'tfc:block/sandstone/top/%s' % sand # vanilla sandstone top cut = 'tfc:block/sandstone/cut/%s' % sand # vanilla sandstone side for variant in ('raw', 'cut', 'smooth'): block = rm.blockstate(('%s_sandstone' % variant, sand)) if variant == 'raw': block.with_block_model(raw) block.make_slab(bottom_texture=raw, side_texture=raw, top_texture=raw) block.make_stairs(bottom_texture=raw, side_texture=raw, top_texture=raw) block.make_wall(texture=raw) elif variant == 'smooth': block.with_block_model(top) block.make_slab(bottom_texture=top, side_texture=top, top_texture=top) block.make_stairs(bottom_texture=top, side_texture=top, top_texture=top) block.make_wall(texture=top) else: block.with_block_model({ 'end': top, 'side': cut }, parent='minecraft:block/cube_column') block.make_slab(bottom_texture=top, side_texture=cut, top_texture=top) block.make_stairs(bottom_texture=top, side_texture=cut, top_texture=top) block.make_wall(texture=cut) block.with_item_model() rm.block_tag('minecraft:walls', 'tfc:%s_sandstone/%s_wall' % (variant, sand)) for extra in ('', ' slab', ' stairs', ' wall'): rm.block(('%s_sandstone' % variant, sand + extra)).with_lang( lang('%s %s sandstone' + extra, variant, sand)) # Groundcover for misc in MISC_GROUNDCOVER: block = rm.blockstate( ('groundcover', misc), variants={ "": [{ 'model': 'tfc:block/groundcover/%s' % misc, 'y': 90 }, { 'model': 'tfc:block/groundcover/%s' % misc }, { 'model': 'tfc:block/groundcover/%s' % misc, 'y': 180 }, { 'model': 'tfc:block/groundcover/%s' % misc, 'y': 270 }] }, use_default_model=False) block.with_lang(lang(misc)) block.with_tag('can_be_snow_piled') if misc in {'stick', 'flint', 'feather', 'rotten_flesh', 'bone'}: # Vanilla ground cover block.with_block_loot('minecraft:%s' % misc) else: block.with_block_loot('tfc:groundcover/%s' % misc) rm.item_model(('groundcover', misc), 'tfc:item/groundcover/%s' % misc) # Peat block = rm.blockstate('peat') block.with_block_model('tfc:block/peat') block.with_item_model() block.with_block_loot('tfc:peat') block.with_lang(lang('Peat')) rm.blockstate('thatch').with_block_model().with_item_model( ).with_block_loot('tfc:thatch').with_lang(lang('Thatch')) block = rm.block_model('thatch_bed').with_item_model().with_lang( lang('Thatch Bed')) block.with_block_loot({ 'entries': [{ 'type': 'minecraft:item', 'name': 'tfc:thatch_bed' }], 'conditions': [ 'minecraft:survives_explosion', block_state_property('tfc:thatch_bed', {'part': 'head'}) ] }) # Dirt for soil in SOIL_BLOCK_VARIANTS: # Regular Dirt block = rm.blockstate( ('dirt', soil), variants={ '': [{ 'model': 'tfc:block/dirt/%s' % soil, 'y': i } for i in range(0, 360, 90)] }, use_default_model=False) block.with_block_model() block.with_item_model() block.with_block_loot('tfc:dirt/%s' % soil) block.with_lang(lang('%s Dirt', soil)) # Clay Dirt block = rm.blockstate( ('clay', soil), variants={ '': [{ 'model': 'tfc:block/clay/%s' % soil, 'y': i } for i in range(0, 360, 90)] }, use_default_model=False) block.with_block_model() block.with_block_loot({ 'entries': [{ 'name': 'minecraft:clay_ball', 'functions': [loot_tables.set_count(1, 3)] }] }) block.with_lang(lang('%s Clay Dirt', soil)) block.with_item_model() # Grass north_face = { 'from': [0, 0, 0], 'to': [16, 16, 0], 'faces': { 'north': { 'texture': '#texture', 'cullface': 'north' } } } north_face_overlay = { 'from': [0, 0, 0], 'to': [16, 16, 0], 'faces': { 'north': { 'texture': '#overlay', 'cullface': 'north' } } } north_face_overlay_tint0 = { 'from': [0, 0, 0], 'to': [16, 16, 0], 'faces': { 'north': { 'texture': '#overlay', 'cullface': 'north', 'tintindex': 0 } } } rm.block_model('grass_top', textures={ 'overlay': 'tfc:block/grass_top', 'particle': '#texture' }, parent='block/block', elements=[north_face_overlay_tint0]) rm.block_model('grass_snowy_top', textures={ 'overlay': 'minecraft:block/snow', 'particle': '#texture' }, parent='block/block', elements=[north_face_overlay]) rm.block_model('grass_side', textures={ 'overlay': 'tfc:block/grass_side', 'particle': '#texture' }, parent='block/block', elements=[north_face, north_face_overlay_tint0]) rm.block_model('grass_snowy_side', textures={ 'overlay': 'tfc:block/grass_snowy_side', 'particle': '#texture' }, parent='block/block', elements=[north_face, north_face_overlay]) rm.block_model('grass_bottom', textures={ 'texture': '#texture', 'particle': '#texture' }, parent='block/block', elements=[north_face]) # Grass (Peat, Normal + Clay) - Helper Functions def grass_multipart(model: str): return [{ 'model': model + '/bottom', 'x': 90 }, ({ 'snowy': False }, { 'model': model + '/top', 'x': 270 }), ({ 'snowy': True }, { 'model': model + '/snowy_top', 'x': 270 }), ({ 'north': True, 'snowy': False }, { 'model': model + '/top' }), ({ 'east': True, 'snowy': False }, { 'model': model + '/top', 'y': 90 }), ({ 'south': True, 'snowy': False }, { 'model': model + '/top', 'y': 180 }), ({ 'west': True, 'snowy': False }, { 'model': model + '/top', 'y': 270 }), ({ 'north': True, 'snowy': True }, { 'model': model + '/snowy_top' }), ({ 'east': True, 'snowy': True }, { 'model': model + '/snowy_top', 'y': 90 }), ({ 'south': True, 'snowy': True }, { 'model': model + '/snowy_top', 'y': 180 }), ({ 'west': True, 'snowy': True }, { 'model': model + '/snowy_top', 'y': 270 }), ({ 'north': False, 'snowy': False }, { 'model': model + '/side' }), ({ 'east': False, 'snowy': False }, { 'model': model + '/side', 'y': 90 }), ({ 'south': False, 'snowy': False }, { 'model': model + '/side', 'y': 180 }), ({ 'west': False, 'snowy': False }, { 'model': model + '/side', 'y': 270 }), ({ 'north': False, 'snowy': True }, { 'model': model + '/snowy_side' }), ({ 'east': False, 'snowy': True }, { 'model': model + '/snowy_side', 'y': 90 }), ({ 'south': False, 'snowy': True }, { 'model': model + '/snowy_side', 'y': 180 }), ({ 'west': False, 'snowy': True }, { 'model': model + '/snowy_side', 'y': 270 })] def grass_models(name: utils.ResourceIdentifier, texture: str): rm.block_model((name, 'top'), {'texture': texture}, parent='tfc:block/grass_top') rm.block_model((name, 'snowy_top'), {'texture': texture}, parent='tfc:block/grass_snowy_top') rm.block_model((name, 'side'), {'texture': texture}, parent='tfc:block/grass_side') rm.block_model((name, 'snowy_side'), {'texture': texture}, parent='tfc:block/grass_snowy_side') rm.block_model((name, 'bottom'), {'texture': texture}, parent='tfc:block/grass_bottom') # Peat Grass block = rm.blockstate_multipart('peat_grass', grass_multipart('tfc:block/peat_grass')) block.with_block_loot('tfc:peat') block.with_tag('grass') block.with_lang(lang('Peat Grass')) grass_models('peat_grass', 'tfc:block/peat') # Grass Blocks for soil in SOIL_BLOCK_VARIANTS: for grass_var, dirt in (('grass', 'tfc:block/dirt/%s' % soil), ('clay_grass', 'tfc:block/clay/%s' % soil)): block = rm.blockstate_multipart( (grass_var, soil), grass_multipart('tfc:block/%s/%s' % (grass_var, soil))) block.with_block_loot('tfc:dirt/%s' % soil) block.with_tag('grass') block.with_lang(lang('%s %s', soil, grass_var)) grass_models((grass_var, soil), dirt) # Farmland block = rm.blockstate(('farmland', soil)) block.with_block_model( { 'dirt': 'tfc:block/dirt/%s' % soil, 'top': 'tfc:block/farmland/%s' % soil }, parent='block/template_farmland') block.with_item_model() block.with_block_loot('tfc:dirt/%s' % soil) block.with_tag('farmland') block.with_lang(lang('%s farmland', soil)) # Snow Piles block = rm.blockstate( 'snow_pile', variants=dict((('layers=%d' % i), { 'model': 'minecraft:block/snow_height%d' % (i * 2) if i != 8 else 'minecraft:block/snow_block' }) for i in range(1, 1 + 8))) block.with_lang(lang('Snow Pile')) rm.item_model('snow_pile', parent='minecraft:block/snow_height2', no_textures=True) # Loot table for snow blocks and snow piles - override the vanilla one to only return one snowball per layer def snow_block_loot_table(block: str): rm.block_loot( block, { 'entries': [{ 'type': 'minecraft:alternatives', 'children': utils.loot_entry_list([{ 'conditions': [silk_touch()], 'name': 'minecraft:snow' }, 'minecraft:snowball']) }], 'conditions': [{ 'condition': 'minecraft:entity_properties', 'predicate': {}, 'entity': 'this' }] }) snow_block_loot_table('snow_pile') snow_block_loot_table('minecraft:snow') # Sea Ice block = rm.blockstate( 'sea_ice').with_block_model().with_item_model().with_lang( lang('sea ice')) block.with_block_loot({ 'entries': 'minecraft:ice', 'conditions': [silk_touch()] }) # Hides for size in ('small', 'medium', 'large'): for hide in ('prepared', 'raw', 'scraped', 'sheepskin', 'soaked'): item = rm.item_model('%s_%s_hide' % (size, hide), 'tfc:item/hide/%s/%s' % (size, hide)) if item != 'sheepskin': item.with_lang(lang('%s %s hide', size, hide)) else: item.with_lang(lang('%s %s', size, hide)) # Rock Tools for rock in ROCK_CATEGORIES: for rock_item in ROCK_ITEMS: item = rm.item_model(('stone', rock_item, rock), 'tfc:item/stone/%s' % rock_item, parent='item/handheld') item.with_lang(lang('stone %s', rock_item)) # Rock Items for rock in ROCKS.keys(): rm.item_model( ('brick', rock), 'tfc:item/brick/%s' % rock).with_lang(lang('%s brick', rock)) for metal, metal_data in METALS.items(): # Metal Items for metal_item, metal_item_data in METAL_ITEMS.items(): if metal_item_data.type in metal_data.types or metal_item_data.type == 'all': item = rm.item_model( ('metal', '%s' % metal_item, '%s' % metal), 'tfc:item/metal/%s/%s' % (metal_item, metal), parent=metal_item_data.parent_model) item.with_lang(lang('%s %s' % (metal, metal_item))) # Metal Blocks for metal_block, metal_block_data in METAL_BLOCKS.items(): if metal_block_data.type in metal_data.types or metal_block_data.type == 'all': block = rm.blockstate(('metal', '%s' % metal_block, metal)) block.with_block_model( { 'all': 'tfc:block/metal/%s' % metal, 'particle': 'tfc:block/metal/%s' % metal }, parent=metal_block_data.parent_model) block.with_block_loot('tfc:metal/%s/%s' % (metal_block, metal)) block.with_lang(lang('%s %s' % (metal, metal_block))) block.with_item_model() # Gems for gem in GEMS: rm.item_model(('gem', gem)).with_lang(lang('cut %s', gem)) rm.item_model(('powder', gem)).with_lang(lang('%s powder', gem)) # Plants for plant, plant_data in PLANTS.items(): rm.lang('block.tfc.plant.%s' % plant, lang(plant)) for plant in MISC_PLANT_FEATURES: rm.lang('block.tfc.plant.%s' % plant, lang(plant)) for plant in ('tree_fern', 'arundo', 'winged_kelp', 'leafy_kelp', 'giant_kelp_flower'): rm.lang('block.tfc.plant.%s' % plant, lang(plant)) rm.lang('block.tfc.sea_pickle', lang('sea_pickle')) # Wood Blocks for wood in WOODS: # Logs for variant in ('log', 'stripped_log', 'wood', 'stripped_wood'): block = rm.blockstate( ('wood', variant, wood), variants={ 'axis=y': { 'model': 'tfc:block/wood/%s/%s' % (variant, wood) }, 'axis=z': { 'model': 'tfc:block/wood/%s/%s' % (variant, wood), 'x': 90 }, 'axis=x': { 'model': 'tfc:block/wood/%s/%s' % (variant, wood), 'x': 90, 'y': 90 } }, use_default_model=False) block.with_item_model() end = 'tfc:block/wood/%s/%s' % (variant.replace( 'log', 'log_top').replace('wood', 'log'), wood) side = 'tfc:block/wood/%s/%s' % (variant.replace('wood', 'log'), wood) block.with_block_model({ 'end': end, 'side': side }, parent='block/cube_column') if 'stripped' in variant: block.with_lang(lang(variant.replace('_', ' ' + wood + ' '))) else: block.with_lang(lang('%s %s', wood, variant)) if variant == 'log': block.with_tag('minecraft:logs') # Groundcover for variant in ('twig', 'fallen_leaves'): block = rm.blockstate( 'wood/%s/%s' % (variant, wood), variants={ "": [{ 'model': 'tfc:block/wood/%s/%s' % (variant, wood), 'y': 90 }, { 'model': 'tfc:block/wood/%s/%s' % (variant, wood) }, { 'model': 'tfc:block/wood/%s/%s' % (variant, wood), 'y': 180 }, { 'model': 'tfc:block/wood/%s/%s' % (variant, wood), 'y': 270 }] }, use_default_model=False) block.with_item_model() block.with_lang(lang('%s %s', wood, variant)) if variant == 'twig': block.with_block_model( { 'side': 'tfc:block/wood/log/%s' % wood, 'top': 'tfc:block/wood/log_top/%s' % wood }, parent='tfc:block/groundcover/%s' % variant) block.with_block_loot('tfc:wood/twig/%s' % wood) elif variant == 'fallen_leaves': block.with_block_model('tfc:block/wood/leaves/%s' % wood, parent='tfc:block/groundcover/%s' % variant) block.with_block_loot('tfc:wood/%s/%s' % (variant, wood)) block.with_tag('can_be_snow_piled') # Leaves block = rm.blockstate(('wood', 'leaves', wood), model='tfc:block/wood/leaves/%s' % wood) block.with_block_model('tfc:block/wood/leaves/%s' % wood, parent='block/leaves') block.with_item_model() block.with_tag('minecraft:leaves') # Sapling block = rm.blockstate(('wood', 'sapling', wood), 'tfc:block/wood/sapling/%s' % wood) block.with_block_model({'cross': 'tfc:block/wood/sapling/%s' % wood}, 'block/cross') rm.item_model(('wood', 'sapling', wood), 'tfc:block/wood/sapling/%s' % wood) # Planks and variant blocks block = rm.block(('wood', 'planks', wood)) block.with_blockstate() block.with_block_model() block.with_item_model() block.with_block_loot('tfc:wood/planks/%s' % wood) block.with_lang(lang('%s planks', wood)) block.make_slab() block.make_stairs() block.make_button() block.make_door() block.make_pressure_plate() block.make_trapdoor() block.make_fence() block.make_fence_gate() # Tool Rack rack_namespace = 'tfc:wood/planks/%s_tool_rack' % wood rm.blockstate(rack_namespace, model='tfc:block/wood/planks/%s_tool_rack' % wood, variants={ 'facing=east': { 'model': 'tfc:block/wood/planks/%s_tool_rack' % wood, 'y': 270 }, 'facing=north': { 'model': 'tfc:block/wood/planks/%s_tool_rack' % wood, 'y': 180 }, 'facing=south': { 'model': 'tfc:block/wood/planks/%s_tool_rack' % wood }, 'facing=west': { 'model': 'tfc:block/wood/planks/%s_tool_rack' % wood, 'y': 90 } }) rm.block_model(rack_namespace, textures={'texture': 'tfc:block/wood/planks/%s' % wood}, parent='tfc:block/tool_rack') rm.item_model(rack_namespace, parent='tfc:block/wood/planks/%s_tool_rack' % wood, no_textures=True) rm.lang('block.tfc.wood.planks.%s_tool_rack' % wood, lang('%s Tool Rack', wood)) rm.block_loot(rack_namespace, rack_namespace) # Bookshelf block = rm.blockstate('tfc:wood/planks/%s_bookshelf' % wood) block.with_block_model( { 'end': 'tfc:block/wood/planks/%s' % wood, 'side': 'tfc:block/wood/planks/%s_bookshelf' % wood }, parent='minecraft:block/bookshelf') block.with_item_model() block.with_lang(lang('%s Bookshelf', wood)) # Workbench rm.blockstate( ('wood', 'planks', '%s_workbench' % wood)).with_block_model( parent='minecraft:block/cube', textures={ 'particle': 'tfc:block/wood/planks/%s_workbench_front' % wood, 'north': 'tfc:block/wood/planks/%s_workbench_front' % wood, 'south': 'tfc:block/wood/planks/%s_workbench_side' % wood, 'east': 'tfc:block/wood/planks/%s_workbench_side' % wood, 'west': 'tfc:block/wood/planks/%s_workbench_front' % wood, 'up': 'tfc:block/wood/planks/%s_workbench_top' % wood, 'down': 'tfc:block/wood/planks/%s' % wood }).with_item_model().with_lang(lang( '%s Workbench', wood)).with_tag('tfc:workbench') # Doors rm.item_model('tfc:wood/planks/%s_door' % wood, 'tfc:item/wood/planks/%s_door' % wood) # Log Fences log_fence_namespace = 'tfc:wood/planks/' + wood + '_log_fence' rm.blockstate_multipart( log_fence_namespace, parts=block_states.fence_multipart( 'tfc:block/wood/planks/' + wood + '_log_fence_post', 'tfc:block/wood/planks/' + wood + '_log_fence_side')) rm.block_model(log_fence_namespace + '_post', textures={'texture': 'tfc:block/wood/log/' + wood}, parent='block/fence_post') rm.block_model(log_fence_namespace + '_side', textures={'texture': 'tfc:block/wood/planks/' + wood}, parent='block/fence_side') rm.block_model(log_fence_namespace + '_inventory', textures={ 'log': 'tfc:block/wood/log/' + wood, 'planks': 'tfc:block/wood/planks/' + wood }, parent='tfc:block/log_fence_inventory') rm.item_model('tfc:wood/planks/' + wood + '_log_fence', parent='tfc:block/wood/planks/' + wood + '_log_fence_inventory', no_textures=True) rm.block_loot(log_fence_namespace, log_fence_namespace) texture = 'tfc:block/wood/sheet/%s' % wood connection = 'tfc:block/wood/support/%s_connection' % wood rm.blockstate_multipart(('wood', 'vertical_support', wood), [ { 'model': 'tfc:block/wood/support/%s_vertical' % wood }, ({ 'north': True }, { 'model': connection, 'y': 270 }), ({ 'east': True }, { 'model': connection }), ({ 'south': True }, { 'model': connection, 'y': 90 }), ({ 'west': True }, { 'model': connection, 'y': 180 }), ]).with_tag('tfc:support_beam').with_lang(lang( '%s Support', wood)).with_block_loot('tfc:wood/support/' + wood) rm.blockstate_multipart(('wood', 'horizontal_support', wood), [ { 'model': 'tfc:block/wood/support/%s_horizontal' % wood }, ({ 'north': True }, { 'model': connection, 'y': 270 }), ({ 'east': True }, { 'model': connection }), ({ 'south': True }, { 'model': connection, 'y': 90 }), ({ 'west': True }, { 'model': connection, 'y': 180 }), ]).with_tag('tfc:support_beam').with_lang(lang( '%s Support', wood)).with_block_loot('tfc:wood/support/' + wood) rm.block_model('tfc:wood/support/%s_inventory' % wood, textures={'texture': texture}, parent='tfc:block/wood/support/inventory') rm.block_model('tfc:wood/support/%s_vertical' % wood, textures={ 'texture': texture, 'particle': texture }, parent='tfc:block/wood/support/vertical') rm.block_model('tfc:wood/support/%s_connection' % wood, textures={ 'texture': texture, 'particle': texture }, parent='tfc:block/wood/support/connection') rm.block_model('tfc:wood/support/%s_horizontal' % wood, textures={ 'texture': texture, 'particle': texture }, parent='tfc:block/wood/support/horizontal') rm.item_model( ('wood', 'support', wood), no_textures=True, parent='tfc:block/wood/support/%s_inventory' % wood).with_lang( lang('%s Support', wood)) # Tags for fence_namespace in ('tfc:wood/planks/' + wood + '_fence', log_fence_namespace): rm.block_tag('minecraft:wooden_fences', fence_namespace) rm.block_tag('minecraft:fences', fence_namespace) rm.block_tag('forge:fences', fence_namespace) rm.block_tag('forge:fences/wooden', fence_namespace) fence_gate_namespace = 'tfc:wood/planks/' + wood + '_fence_gate' rm.block_tag('forge:fence_gates/wooden', fence_gate_namespace) rm.block_tag('forge:fence_gates', fence_gate_namespace) rm.block_tag('minecraft:doors', 'tfc:wood/planks/' + wood + '_door') rm.block_tag('minecraft:buttons', 'tfc:wood/planks/' + wood + '_button') rm.block_tag('minecraft:wooden_buttons', 'tfc:wood/planks/' + wood + '_button') rm.block_tag('minecraft:wooden_pressure_plates', 'tfc:wood/planks/' + wood + '_pressure_plate') rm.block_tag('minecraft:wooden_slabs', 'tfc:wood/planks/' + wood + '_slab') rm.block_tag('minecraft:wooden_stairs', 'tfc:wood/planks/' + wood + '_stairs') for variant in ('log', 'stripped_log', 'wood', 'stripped_wood'): if variant != 'log': rm.block_tag('minecraft:logs', 'tfc:wood/' + variant + '/' + wood) rm.block_tag('tfc:' + wood + '_logs', 'tfc:wood/' + variant + '/' + wood) rm.block_tag('tfc:creeping_plantable_on', 'tfc:wood/' + variant + '/' + wood) # Lang for variant in ('door', 'trapdoor', 'fence', 'log_fence', 'fence_gate', 'button', 'pressure_plate', 'slab', 'stairs'): rm.lang('block.tfc.wood.planks.' + wood + '_' + variant, lang('%s %s', wood, variant)) for variant in ('sapling', 'leaves'): rm.lang('block.tfc.wood.' + variant + '.' + wood, lang('%s %s', wood, variant)) def bucket_item_model(name_parts, fluid): res = utils.resource_location(rm.domain, name_parts) rm.write( (*rm.resource_dir, 'assets', res.domain, 'models', 'item', res.path), { 'parent': 'forge:item/bucket', 'loader': 'forge:bucket', 'fluid': fluid }) return rm.item(name_parts) # Fluids def water_based_fluid(name: str): rm.blockstate(('fluid', name)).with_block_model( {'particle': 'minecraft:block/water_still'}, parent=None) rm.fluid_tag(name, 'tfc:%s' % name, 'tfc:flowing_%s' % name) rm.fluid_tag('minecraft:water', 'tfc:%s' % name, 'tfc:flowing_%s' % name) # Need to use water fluid tag for behavior rm.fluid_tag('mixable', 'tfc:%s' % name, 'tfc:flowing_%s' % name) item = bucket_item_model(('bucket', name), 'tfc:%s' % name) item.with_lang(lang('%s bucket', name)) def molten_fluid(name: str): rm.blockstate( ('fluid', 'metal', metal)).with_block_model({'particle': 'block/lava_still'}, parent=None) rm.fluid_tag(metal, 'tfc:metal/%s' % metal, 'tfc:metal/flowing_%s' % metal) item = bucket_item_model(('bucket', 'metal', name), 'tfc:%s' % name) item.with_lang(lang('molten %s bucket', name)) water_based_fluid('salt_water') water_based_fluid('spring_water') # Mixable tags for vanilla water rm.fluid_tag('mixable', '#minecraft:water') for metal in METALS.keys(): molten_fluid(metal) # Thin Spikes: Calcite + Icicles for variant, texture in (('calcite', 'tfc:block/calcite'), ('icicle', 'minecraft:block/ice')): block = rm.blockstate(variant, variants={ 'tip=true': { 'model': 'tfc:block/%s_tip' % variant }, 'tip=false': { 'model': 'tfc:block/%s' % variant } }) block.with_item_model() block.with_lang(lang(variant)) rm.block_model(variant, textures={ '0': texture, 'particle': texture }, parent='tfc:block/thin_spike') rm.block_model(variant + '_tip', textures={ '0': texture, 'particle': texture }, parent='tfc:block/thin_spike_tip') # Misc Items rm.item_model('mortar').with_lang(lang('mortar')).with_tag('tfc:mortar') def corals(color: str, dead: bool): # vanilla and tfc have a different convention for dead/color order left = 'dead_' + color if dead else color right = color + '_dead' if dead else color rm.blockstate('coral/%s_coral' % right, 'minecraft:block/%s_coral' % left) rm.blockstate('coral/%s_coral_fan' % right, 'minecraft:block/%s_coral_fan' % left) rm.blockstate( 'coral/%s_coral_wall_fan' % right, variants=dict(('facing=%s' % d, { 'model': 'minecraft:block/%s_coral_wall_fan' % left, 'y': r }) for d, r in (('north', None), ('east', 90), ('south', 180), ('west', 270)))) for variant in ('coral', 'coral_fan', 'coral_wall_fan'): rm.item_model('coral/%s_%s' % (right, variant), 'minecraft:block/%s_%s' % (left, variant)) rm.lang('block.tfc.coral.%s_%s' % (right, variant), lang('%s %s', left, variant)) if not dead: # Tag contents are used for selecting a random coral to place by features rm.block_tag('wall_corals', 'coral/%s_coral_wall_fan' % color) rm.block_tag('corals', 'coral/%s_coral' % color, 'coral/%s_coral_fan' % color) for color in ('tube', 'brain', 'bubble', 'fire', 'horn'): corals(color, False) corals(color, True)
def generate(rm: ResourceManager): # First rm.lang({ 'itemGroup.notreepunching.items': 'No Tree Punching', 'notreepunching.tooltip.small_vessel_more': '%d More...', 'notreepunching.tile_entity.large_vessel': 'Large Vessel' }) # Stone for stone in ('granite', 'andesite', 'diorite'): block = rm.blockstate('%s_cobblestone' % stone) block.with_block_model() block.with_item_model() block.with_tag('cobblestone') rm.item_tag('cobblestone', '%s_cobblestone' % stone) # both block and item tag block.with_block_loot('notreepunching:%s_cobblestone' % stone) block.with_lang(lang('%s cobblestone', stone)) block.make_stairs() block.make_slab() block.make_wall() for piece in ('stairs', 'slab', 'wall'): block = rm.block('%s_cobblestone_%s' % (stone, piece)) block.with_lang(lang('%s cobblestone %s', stone, piece)) block.with_tag( 'minecraft:' + piece + ('s' if not piece.endswith('s') else '')) # plural tag for stone in ('granite', 'andesite', 'diorite', 'stone', 'sandstone', 'red_sandstone'): block = rm.blockstate('%s_loose_rock' % stone) block.with_block_model(textures='minecraft:block/%s' % stone, parent='notreepunching:block/loose_rock') block.with_block_loot('notreepunching:%s_loose_rock' % stone) block.with_lang(lang('%s loose rock', stone)) # flat item model for the block item item = rm.item_model('%s_loose_rock' % stone) item.with_tag('loose_rocks') # item tag is needed for recipes # Pottery for pottery in ('worked', 'large_vessel', 'small_vessel', 'bucket', 'flower_pot'): block = rm.blockstate('clay_%s' % pottery) block.with_block_model(textures='minecraft:block/clay', parent='notreepunching:block/pottery_%s' % pottery) block.with_item_model() block.with_block_loot('notreepunching:clay_%s' % pottery) if pottery == 'worked': block.with_lang(lang('worked clay')) else: block.with_lang(lang('clay %s', pottery)) block = rm.blockstate('ceramic_large_vessel') block.with_block_model(textures='notreepunching:block/ceramic', parent='notreepunching:block/pottery_large_vessel') block.with_item_model() block.with_block_loot({ 'entries': { 'name': 'notreepunching:ceramic_large_vessel', 'functions': [{ 'function': 'minecraft:copy_name', 'source': 'block_entity' }, { 'function': 'minecraft:copy_nbt', 'source': 'block_entity', 'ops': [{ 'source': '', 'target': 'BlockEntityTag', 'op': 'replace' }] }], } }) block.with_lang(lang('ceramic large vessel')) # Tools for tool in ('iron', 'gold', 'diamond', 'netherite'): item = rm.item_model('%s_mattock' % tool, parent='item/handheld') item.with_lang(lang('%s mattock', tool)) item.with_tag('mattocks') item.with_tag('forge:tools/mattocks') item = rm.item_model('%s_saw' % tool, parent='item/handheld') item.with_lang(lang('%s saw', tool)) item.with_tag('saws') item.with_tag('forge:tools/saws') item = rm.item_model('%s_knife' % tool, parent='item/handheld') item.with_lang(lang('%s knife', tool)) item.with_tag('knives') item.with_tag('forge:tools/knives') # Flint for tool in ('axe', 'pickaxe', 'shovel', 'hoe', 'knife'): item = rm.item_model('flint_%s' % tool, parent='item/handheld') item.with_lang(lang('flint %s', tool)) item = rm.item_model('macuahuitl', parent='item/handheld') item.with_lang(lang('macuahuitl')) rm.item('flint_knife').with_tag('knives') rm.item('flint_axe').with_tag('weak_saws') for item_name in ('flint_shard', 'plant_fiber', 'plant_string', 'clay_brick', 'ceramic_small_vessel', 'clay_tool', 'fire_starter'): item = rm.item_model(item_name) item.with_lang(lang(item_name)) # ceramic bucket, since it uses a very custom model rm.item('ceramic_bucket').with_lang(lang('ceramic bucket')) rm.data( ('models', 'item', 'ceramic_bucket'), { 'parent': 'forge:item/default', 'textures': { 'base': 'notreepunching:item/ceramic_bucket', 'fluid': 'forge:item/mask/bucket_fluid_drip' }, 'loader': 'forge:bucket', 'fluid': 'empty' }, root_domain='assets') # Misc Tags rm.item('plant_string').with_tag('forge:string') rm.block('minecraft:gravel').with_tag('always_breakable').with_tag( 'always_drops') rm.item_tag('weak_saws', 'minecraft:iron_axe', 'minecraft:golden_axe', 'minecraft:diamond_axe', 'minecraft:netherite_axe') rm.block_tag('always_breakable', '#minecraft:leaves', 'minecraft:gravel', '#forge:dirt', 'minecraft:grass', 'minecraft:podzol', 'minecraft:coarse_dirt', '#minecraft:sand') rm.block_tag('always_drops', '#minecraft:leaves', 'minecraft:gravel', '#forge:dirt', 'minecraft:grass', 'minecraft:podzol', 'minecraft:coarse_dirt', '#minecraft:sand') rm.item_tag('fire_starter_logs', '#minecraft:logs', '#minecraft:planks') rm.item_tag('fire_starter_kindling', '#forge:rods/wooden', '#minecraft:saplings', '#minecraft:leaves', '#forge:string', 'notreepunching:plant_fiber') rm.item_tag('fire_starter_soul_fire_catalyst', 'minecraft:soul_sand', 'minecraft:soul_soil') ceramics = [ 'notreepunching:ceramic_large_vessel', 'notreepunching:ceramic_small_vessel', 'notreepunching:ceramic_bucket', 'minecraft:flower_pot' ] pottery = [ 'minecraft:clay', 'notreepunching:clay_worked', 'notreepunching:clay_large_vessel', 'notreepunching:clay_small_vessel', 'notreepunching:clay_bucket', 'notreepunching:clay_flower_pot' ] rm.item_tag('ceramics', *ceramics) rm.item_tag('pottery', *pottery) rm.block_tag('pottery', *pottery) # Add cobblestone to existing similar tags rm.item_tag('minecraft:stone_tool_materials', '#notreepunching:cobblestone') rm.item_tag('minecraft:stone_crafting_materials', '#notreepunching:cobblestone') rm.block_tag('forge:cobblestone', '#notreepunching:cobblestone') rm.item_tag('forge:cobblestone', '#notreepunching:cobblestone') rm.item('ceramic_small_vessel').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') rm.item('ceramic_large_vessel').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') rm.item('minecraft:shulker_box').with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') for color in ('white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', 'brown', 'green', 'red', 'black'): rm.item('minecraft:%s_shulker_box' % color).with_tag( 'large_vessel_blacklist').with_tag('small_vessel_blacklist') # Advancements story = AdvancementBuilder( rm, 'story', 'minecraft:textures/gui/advancements/backgrounds/stone.png') story.advancement( 'root', 'notreepunching:flint_pickaxe', 'No Tree Punching', 'I tried to punch tree. It didn\'t work and now my fingers are covered in splinters...', None, { 'has_loose_rock': inventory_changed('tag!notreepunching:loose_rocks'), 'has_gravel': inventory_changed('minecraft:gravel'), 'has_sticks': inventory_changed('minecraft:stick'), }, requirements=[['has_loose_rock', 'has_gravel', 'has_sticks']], toast=False, chat=False) story.advancement('find_loose_rock', 'notreepunching:stone_loose_rock', 'Dull Rocks', 'Pick up a loose rock.', 'root', { 'has_loose_rock': inventory_changed('tag!notreepunching:loose_rocks') }) story.advancement('find_gravel', 'minecraft:gravel', 'Discount Cobblestone', 'Find some gravel, it may come in handy.', 'root', { 'has_gravel': inventory_changed('minecraft:gravel'), 'has_flint': inventory_changed('minecraft:flint') }, requirements=[['has_gravel', 'has_flint']]) story.advancement('find_sticks', 'minecraft:stick', 'A Big Stick', 'Obtain sticks by breaking leaves.', 'root', {'has_stick': inventory_changed('minecraft:stick')}) story.advancement('find_flint', 'minecraft:flint', 'Shiny Rocks!', 'Obtain some flint by digging through gravel.', 'find_gravel', {'has_flint': inventory_changed('minecraft:flint')}) story.advancement( 'knapping', 'notreepunching:flint_shard', 'Knapit!', 'Use a piece of flint on some exposed stone, to break it into small flint shards.', 'find_flint', {'has_flint_shard': inventory_changed('notreepunching:flint_shard')}) story.advancement( 'plant_fiber', 'notreepunching:plant_fiber', 'Plant Based Tool Bindings', 'With a primitive flint knife, obtain plant fiber by cutting down tall grasses.', 'knapping', {'has_plant_fiber': inventory_changed('notreepunching:plant_fiber')}) story.advancement( 'flint_axe', 'notreepunching:flint_axe', 'And My Axe!', 'Build your first tool capable of harvesting wood!', 'plant_fiber', {'has_flint_axe': inventory_changed('notreepunching:flint_axe')}) story.advancement( 'macuahuitl', 'notreepunching:macuahuitl', 'Macaroniwhatnow?', 'Craft a macuahuitl', 'flint_axe', {'has_macuahuitl': inventory_changed('notreepunching:macuahuitl')}) story.advancement( 'flint_pickaxe', 'notreepunching:flint_pickaxe', 'My First Pickaxe', 'Craft your first pickaxe from flint, plant fiber, and sticks!', 'flint_axe', { 'has_flint_pickaxe': inventory_changed('notreepunching:flint_pickaxe') }) story.advancement( 'use_clay_tool', 'notreepunching:clay_large_vessel', 'You\'re a Potter, Harry', 'Use a clay tool on a block of clay to create pottery of various kinds.', 'find_sticks', { 'damage_clay_tool': use_item_on_block('notreepunching:clay_tool', 'notreepunching:pottery') }) story.advancement( 'fire_pottery', 'notreepunching:ceramic_large_vessel', 'Ceramics', 'Fire some pottery into useful devices!', 'use_clay_tool', {'has_ceramics': inventory_changed('tag!notreepunching:ceramics')}) story.advancement( 'mattock', 'notreepunching:iron_mattock', 'Getting a Better Upgrade', 'Craft a mattock, a hoe-axe-shovel-all-in-one multitool!', 'flint_pickaxe', {'has_mattock': inventory_changed('tag!notreepunching:mattocks')})
def generate(rm: ResourceManager): main_data_dir = CORE_PATHS['main'].sub for core_path in CORE_PATHS.keys(): full_path = '' if core_path == 'main': full_path = CORE_PATHS[core_path].sub else: full_path = main_data_dir + CORE_PATHS[core_path].sub try: os.mkdir(full_path, 0o777) except OSError: print("Creation of the directory %s failed or already exists" % full_path) else: print("Successfully created the directory %s" % full_path) for sub_path in VEG_PATHS.keys(): full_path = main_data_dir + VEG_PATHS[sub_path].sub try: os.mkdir(full_path, 0o777) except OSError: print("Creation of the directory %s failed or already exists" % full_path) else: print("Successfully created the directory %s" % full_path) for veg in VEG.keys(): # Initialize data file data = {} if VEG[veg].category == 'herb': block = rm.blockstate( ('survivalism:veg/herb/%s' % veg), variants={ '': [{ 'model': 'survivalism:veg/herb/%s%d' % (veg, i + 1) } for i in range(VEG[veg].variants)] }, use_default_model=False) item = rm.item_model(('herb', veg)) block.with_lang(lang('%s', veg)) item.with_lang(lang('%s', veg)) block.with_block_loot({ 'entries': 'survivalism/veg/herb/%s' % veg, 'functions': [loot_tables.set_count(1, 2)] }) for var in range(VEG[veg].variants): rm.block_model( ('herb', veg + str(var + 1)), textures={ 'texture': 'survivalism:block/veg/herb/%s%d' % (veg, var + 1) }, parent='minecraft:block/cross') idx = 0 for field in VEG[veg]._fields: data[field] = VEG[veg][idx] idx += 1 with open( '%s%s%s.json' % (main_data_dir, VEG_PATHS[VEG[veg].category].sub, veg), 'w') as output: json.dump(data, output)