Esempio n. 1
0
def casting_recipe(rm: ResourceManager, name_parts: utils.ResourceIdentifier, mold: str, metal: str, amount: int, break_chance: float):
    rm.recipe(('casting', name_parts), 'tfc:casting', {
        'mold': {'item': 'tfc:ceramic/%s_mold' % mold},
        'fluid': fluid_stack_ingredient('tfc:metal/%s' % metal, amount),
        'result': utils.item_stack('tfc:metal/%s/%s' % (mold, metal)),
        'break_chance': break_chance
    })
Esempio n. 2
0
def food_item(rm: ResourceManager,
              name_parts: utils.ResourceIdentifier,
              ingredient: utils.Json,
              category: Category,
              hunger: int,
              saturation: float,
              water: int,
              decay: float,
              fruit: Optional[float] = None,
              veg: Optional[float] = None,
              protein: Optional[float] = None,
              grain: Optional[float] = None,
              dairy: Optional[float] = None):
    rm.data(
        ('tfc', 'food_items', name_parts), {
            'ingredient': utils.ingredient(ingredient),
            'category': category.name,
            'hunger': hunger,
            'saturation': saturation,
            'water': water if water != 0 else None,
            'decay': decay,
            'fruit': fruit,
            'vegetables': veg,
            'protein': protein,
            'grain': grain,
            'dairy': dairy
        })
Esempio n. 3
0
def collapse_recipe(rm: ResourceManager, name_parts: utils.ResourceIdentifier, ingredient, result: Optional[utils.Json] = None, copy_input: Optional[bool] = None):
    assert result is not None or copy_input
    rm.recipe(('collapse', name_parts), 'tfc:collapse', {
        'ingredient': ingredient,
        'result': result,
        'copy_input': copy_input
    })
Esempio n. 4
0
def generate_vanilla(rm: ResourceManager):
    # Vanilla Tags
    rm.item('flint').with_tag('notreepunching:flint_knappable')
    for block in ('grass_block', 'dirt', 'coarse_dirt', 'gravel', 'sand',
                  'red_sand', 'terracotta', 'stone', 'andesite', 'diorite',
                  'granite', 'sandstone', 'red_sandstone', 'podzol'):
        rm.block(block).with_tag('notreepunching:loose_rock_placeable_on')
Esempio n. 5
0
def drinkable(rm: ResourceManager, name_parts: utils.ResourceIdentifier, fluid: str, thirst: Optional[int] = None, intoxication: Optional[int] = None):
    rm.data(('tfc', 'drinkables', name_parts), {
        'ingredient': {'fluid': fluid},
        'thirst': thirst,
        'intoxication': intoxication
        # todo: effects
        # todo: milk effects
    })
Esempio n. 6
0
def item_size(rm: ResourceManager, name_parts: utils.ResourceIdentifier,
              ingredient: utils.Json, size: Size, weight: Weight):
    rm.data(
        ('tfc', 'item_sizes', name_parts), {
            'ingredient': utils.ingredient(ingredient),
            'size': size.name,
            'weight': weight.name
        })
Esempio n. 7
0
def fuel_item(rm: ResourceManager, name_parts: utils.ResourceIdentifier,
              ingredient: utils.Json, duration: int, temperature: float):
    rm.data(
        ('tfc', 'fuels', name_parts), {
            'ingredient': utils.ingredient(ingredient),
            'duration': duration,
            'temperature': temperature
        })
Esempio n. 8
0
def alloy_recipe(rm: ResourceManager, name_parts: utils.ResourceIdentifier, metal: str, *parts: Tuple[str, float, float]):
    rm.recipe(('alloy', name_parts), 'tfc:alloy', {
        'result': 'tfc:%s' % metal,
        'contents': [{
            'metal': 'tfc:%s' % p[0],
            'min': p[1],
            'max': p[2]
        } for p in parts]
    })
Esempio n. 9
0
def generate_all(rm: ResourceManager):

    # generic lang first, dynamic lang included in assets.py
    rm.lang(STANDARD_LANG)

    # assets/data
    assets.generate(rm)

    rm.flush()
def generate_all(rm: ResourceManager):
    # do simple lang keys first, because it's ordered intentionally
    rm.lang(DEFAULT_LANG)

    # generic assets / data
    assets.generate(rm)
    data.generate(rm)
    world_gen.generate(rm)
    recipes.generate(rm)

    rm.flush()
Esempio n. 11
0
def item_heat(rm: ResourceManager, name_parts: utils.ResourceIdentifier, ingredient: utils.Json, heat_capacity: float, melt_temperature: Optional[int] = None):
    if melt_temperature is not None:
        forging_temperature = melt_temperature * 0.6
        welding_temperature = melt_temperature * 0.8
    else:
        forging_temperature = welding_temperature = None
    rm.data(('tfc', 'item_heats', name_parts), {
        'ingredient': utils.ingredient(ingredient),
        'heat_capacity': heat_capacity,
        'forging_temperature': forging_temperature,
        'welding_temperature': welding_temperature
    })
Esempio n. 12
0
def damage_shapeless(rm: ResourceManager, name_parts: utils.ResourceIdentifier, ingredients: utils.Json, result: utils.Json, group: str = None, conditions: utils.Json = None) -> RecipeContext:
    res = utils.resource_location(rm.domain, name_parts)
    rm.write((*rm.resource_dir, 'data', res.domain, 'recipes', res.path), {
        'type': 'tfc:damage_inputs_shapeless_crafting',
        'recipe': {
            'type': 'minecraft:crafting_shapeless',
            'group': group,
            'ingredients': utils.item_stack_list(ingredients),
            'result': utils.item_stack(result),
            'conditions': utils.recipe_condition(conditions)
        }
    })
    return RecipeContext(rm, res)
def main():
    rm = ResourceManager('betterfoliage', resource_dir='../src/main/resources')

    generate_all(rm)
    print(
        'New = %d, Modified = %d, Unchanged = %d, Errors = %d' %
        (rm.new_files, rm.modified_files, rm.unchanged_files, rm.error_files))
Esempio n. 14
0
def rock_knapping(rm: ResourceManager, name, pattern: List[str], result: utils.ResourceIdentifier, ingredient: str = None, outside_slot_required: bool = False):
    ingredient = None if ingredient is None else utils.ingredient(ingredient)
    return rm.recipe(('rock_knapping', name), 'tfc:rock_knapping', {
        'outside_slot_required': outside_slot_required,
        'pattern': pattern,
        'result': utils.item_stack(result),
        'ingredient': ingredient
    })
Esempio n. 15
0
def climate_range(rm: ResourceManager,
                  name_parts: utils.ResourceIdentifier,
                  hydration: Tuple[int, int, int] = None,
                  temperature: Tuple[float, float, float] = None):
    data = {}
    if hydration is not None:
        data.update({
            'min_hydration': hydration[0],
            'max_hydration': hydration[1],
            'hydration_wiggle_range': hydration[2]
        })
    if temperature is not None:
        data.update({
            'min_temperature': temperature[0],
            'max_temperature': temperature[1],
            'temperature_wiggle_range': temperature[2]
        })
    rm.data(('tfc', 'climate_ranges', name_parts), data)
Esempio n. 16
0
def heat_recipe(rm: ResourceManager, name_parts: utils.ResourceIdentifier, ingredient: utils.Json, temperature: float, result_item: Optional[utils.Json] = None, result_fluid: Optional[str] = None, amount: int = 1000) -> RecipeContext:
    result_item = None if result_item is None else utils.item_stack(result_item)
    result_fluid = None if result_fluid is None else fluid_stack(result_fluid, amount)
    return rm.recipe(('heating', name_parts), 'tfc:heating', {
        'ingredient': utils.ingredient(ingredient),
        'result_item': result_item,
        'result_fluid': result_fluid,
        'temperature': temperature
    })
Esempio n. 17
0
def main():
    rm = ResourceManager('notreepunching', resource_dir='../src/main/resources')
    rm_vanilla = ResourceManager(resource_dir='../src/main/resources')
    clean_generated_resources('../src/main/resources')

    assets.generate(rm)
    assets.generate_vanilla(rm_vanilla)
    recipes.generate(rm)
    recipes.generate_vanilla(rm_vanilla)

    rm.flush()
    rm_vanilla.flush()
def main():
    parser = argparse.ArgumentParser(description='Generate resources for TFC')
    parser.add_argument('--clean',
                        action='store_true',
                        dest='clean',
                        help='Clean all auto generated resources')
    parser.add_argument(
        '--hotswap',
        type=str,
        default=None,
        help=
        'A secondary target directory to write resources to, creates a resource hotswap.'
    )
    args = parser.parse_args()

    rm = ResourceManager('tfc', resource_dir='../src/main/resources')

    if args.clean:
        # Stupid windows file locking errors.
        for tries in range(1, 1 + 3):
            try:
                utils.clean_generated_resources('/'.join(rm.resource_dir))
                print('Clean Success')
                return
            except:
                print('Failed, retrying (%d / 3)' % tries)
        print('Clean Aborted')
        return

    generate_all(rm)
    print(
        'New = %d, Modified = %d, Unchanged = %d, Errors = %d' %
        (rm.new_files, rm.modified_files, rm.unchanged_files, rm.error_files))

    if args.hotswap is not None:
        # Optionally generate all resources into a second directory (the build dir, either gradle or IDEA's, for resource hot swapping
        rm = ResourceManager('tfc', resource_dir=args.hotswap)
        generate_all(rm)
        print('Hotswap Finished')
Esempio n. 19
0
def main():
    parser = argparse.ArgumentParser(
        description='Generate resources for Survivalism')
    parser.add_argument('--clean',
                        action='store_true',
                        dest='clean',
                        help='Clean all auto generated resources')
    parser.add_argument(
        '--hotswap',
        action='store_true',
        dest='hotswap',
        help=
        'Also generate resources into the /out/production/resources directory, creates an asset hotswap'
    )
    args = parser.parse_args()

    rm = ResourceManager('survivalism', resource_dir='../src/main/resources')
    if args.clean:
        # Stupid windows file locking errors.
        for tries in range(1, 1 + 3):
            try:
                clean_generated_resources('/'.join(rm.resource_dir))
                print('Clean Success')
                return
            except Exception:
                print('Failed, retrying (%d / 3)' % tries)
        print('Clean Aborted')
        return

    generate_all(rm)
    print(
        'New = %d, Modified = %d, Unchanged = %d, Errors = %d' %
        (rm.new_files, rm.modified_files, rm.unchanged_files, rm.error_files))

    if args.hotswap:
        # Generate into the /out/production/resources folder, which is used when build + run with Intellij
        rm = ResourceManager('tfc', resource_dir='../out/production/resources')
        generate_all(rm)
        print('Hotswap Finished')
Esempio n. 20
0
def tool_damaging_shaped(rm: ResourceManager,
                         name_parts: utils.ResourceIdentifier,
                         pattern: Sequence[str],
                         ingredients: utils.Json,
                         result: utils.Json,
                         group: str = None,
                         conditions: utils.Json = None):
    return rm.recipe(
        name_parts,
        'notreepunching:tool_damaging', {
            'recipe': {
                'type': 'minecraft:crafting_shaped',
                'group': group,
                'pattern': pattern,
                'key': utils.item_stack_dict(ingredients, ''.join(pattern)[0]),
                'result': utils.item_stack(result),
            }
        },
        conditions=conditions)
Esempio n. 21
0
def generate(rm: ResourceManager):
    # Loose rocks
    rm.crafting_shaped('cobblestone_from_rocks', ('XX', 'XX'), {
        'X': 'notreepunching:stone_loose_rock'
    }, 'minecraft:cobblestone').with_advancement(
        'notreepunching:stone_loose_rock')
    for stone in ('andesite', 'diorite', 'granite'):
        rm.crafting_shaped('%s_cobblestone_from_rocks' % stone, ('XX', 'XX'), {
            'X': 'notreepunching:%s_loose_rock' % stone
        }, 'notreepunching:%s_cobblestone' % stone).with_advancement(
            'notreepunching:%s_loose_rock' % stone)
    for stone in ('sandstone', 'red_sandstone'):
        rm.crafting_shaped('%s_from_rocks' % stone, ('XX', 'XX'), {
            'X': 'notreepunching:%s_loose_rock' % stone
        }, 'minecraft:%s' % stone).with_advancement(
            'notreepunching:%s_loose_rock' % stone)

    # Stairs, Slabs, Walls
    for stone in ('andesite', 'diorite', 'granite'):
        cobble = 'notreepunching:%s_cobblestone' % stone

        # crafting recipes
        rm.crafting_shaped('%s_cobblestone_stairs' % stone,
                           ('X  ', 'XX ', 'XXX'), {
                               'X': cobble
                           }, (4, cobble + '_stairs')).with_advancement(cobble)
        rm.crafting_shaped('%s_cobblestone_slab' % stone, ('XXX', ), {
            'X': cobble
        }, (6, cobble + '_slab')).with_advancement(cobble)
        rm.crafting_shaped('%s_cobblestone_wall' % stone, ('XXX', 'XXX'), {
            'X': cobble
        }, (6, cobble + '_wall')).with_advancement(cobble)

        # stone cutting
        rm.recipe(
            ('stonecutting', '%s_cobblestone_stairs' % stone),
            'minecraft:stonecutting', {
                'ingredient': utils.ingredient(cobble),
                'result': cobble + '_stairs',
                'count': 1
            }).with_advancement(cobble)
        rm.recipe(
            ('stonecutting', '%s_cobblestone_slab' % stone),
            'minecraft:stonecutting', {
                'ingredient': utils.ingredient(cobble),
                'result': cobble + '_slab',
                'count': 2
            })
        rm.recipe(
            ('stonecutting', '%s_cobblestone_wall' % stone),
            'minecraft:stonecutting', {
                'ingredient': utils.ingredient(cobble),
                'result': cobble + '_wall',
                'count': 1
            })

        # smelting
        rm.recipe(
            ('smelting', '%s_from_cobblestone' % stone), 'minecraft:smelting',
            {
                'ingredient': utils.ingredient(cobble),
                'result': 'minecraft:%s' % stone,
                'experience': 0.1,
                'cookingtime': 200
            })

    # Clay tool
    rm.crafting_shapeless(
        'clay_brick_from_balls',
        ('notreepunching:clay_tool', 'minecraft:clay_ball'),
        'notreepunching:clay_brick').with_advancement('minecraft:clay_ball')
    rm.crafting_shapeless(
        'clay_brick_from_blocks',
        ('notreepunching:clay_tool', 'minecraft:clay'),
        (4, 'notreepunching:clay_brick')).with_advancement('minecraft:clay')

    # Misc
    rm.crafting_shapeless('plant_string', ['notreepunching:plant_fiber'] * 3,
                          'notreepunching:plant_string').with_advancement(
                              'notreepunching:plant_fiber')
    rm.recipe(
        ('smelting', 'string_from_plant_string'), 'minecraft:smelting', {
            'ingredient': utils.ingredient('notreepunching:plant_string'),
            'result': 'minecraft:string',
            'experience': 0.1,
            'cookingtime': 200
        })
    rm.crafting_shapeless(
        'flint_from_gravel', ['minecraft:gravel'] * 3,
        (2, 'minecraft:flint')).with_advancement('minecraft:gravel')

    # Wood
    for wood in ('acacia', 'oak', 'dark_oak', 'jungle', 'birch', 'spruce'):
        # Planks
        rm.crafting_shaped('%s_planks_with_saw' % wood, ('S', 'W'), {
            'S': 'tag!notreepunching:saws',
            'W': 'tag!minecraft:%s_logs' % wood
        }, (4, 'minecraft:%s_planks' % wood)).with_advancement(
            'minecraft:%s_log' % wood)
        rm.crafting_shaped('%s_planks_with_flint_axe' % wood, ('S', 'W'), {
            'S': 'notreepunching:flint_axe',
            'W': 'tag!minecraft:%s_logs' % wood
        }, (2, 'minecraft:%s_planks' % wood)).with_advancement(
            'minecraft:%s_log' % wood)

    # Sticks
    rm.crafting_shaped('sticks_from_logs_with_saw', ('SW', ), {
        'S': 'tag!notreepunching:saws',
        'W': 'tag!minecraft:logs'
    }, (8, 'minecraft:stick')).with_advancement('tag!minecraft:logs')
    rm.crafting_shaped('sticks_from_planks_with_saw', ('SW', ), {
        'S': 'tag!notreepunching:saws',
        'W': 'tag!minecraft:planks'
    }, (2, 'minecraft:stick')).with_advancement('tag!minecraft:planks')

    rm.crafting_shaped('sticks_from_logs_with_flint_axe', ('SW', ), {
        'S': 'notreepunching:flint_axe',
        'W': 'tag!minecraft:logs'
    }, (6, 'minecraft:stick')).with_advancement('tag!minecraft:logs')
    rm.crafting_shaped('sticks_from_planks_with_flint_axe', ('SW', ), {
        'S': 'notreepunching:flint_axe',
        'W': 'tag!minecraft:planks'
    }, (1, 'minecraft:stick')).with_advancement('tag!minecraft:planks')

    # Tools
    for tool in ('iron', 'gold', 'diamond'):
        ingot = 'tag!forge:ingots/%s' % tool if tool != 'diamond' else 'tag!forge:gems/diamond'
        rm.crafting_shaped('%s_knife' % tool, ('I', 'S'), {
            'S': 'tag!forge:rods/wooden',
            'I': ingot
        }, 'notreepunching:%s_knife' % tool).with_advancement(ingot)
        rm.crafting_shaped('%s_mattock' % tool, ('III', ' SI', ' S '), {
            'S': 'tag!forge:rods/wooden',
            'I': ingot
        }, 'notreepunching:%s_mattock' % tool).with_advancement(ingot)
        rm.crafting_shaped('%s_saw' % tool, ('  S', ' SI', 'SI '), {
            'S': 'tag!forge:rods/wooden',
            'I': ingot
        }, 'notreepunching:%s_saw' % tool).with_advancement(ingot)

    # Flint Tools
    rm.crafting_shaped(
        'flint_axe', ('PI', 'S '), {
            'S': 'tag!forge:rods/wooden',
            'I': 'notreepunching:flint_shard',
            'P': 'tag!forge:string'
        }, 'notreepunching:flint_axe').with_advancement(
            'notreepunching:flint_shard')
    rm.crafting_shaped(
        'flint_hoe', ('PII', 'S  ', 'S  '), {
            'S': 'tag!forge:rods/wooden',
            'I': 'notreepunching:flint_shard',
            'P': 'tag!forge:string'
        }, 'notreepunching:flint_hoe').with_advancement(
            'notreepunching:flint_shard')
    rm.crafting_shaped('flint_knife', ('I', 'S'), {
        'S': 'tag!forge:rods/wooden',
        'I': 'notreepunching:flint_shard'
    }, 'notreepunching:flint_knife').with_advancement(
        'notreepunching:flint_shard')
    rm.crafting_shaped(
        'flint_pickaxe', ('IPI', 'ISI', ' S '), {
            'S': 'tag!forge:rods/wooden',
            'I': 'notreepunching:flint_shard',
            'P': 'tag!forge:string'
        }, 'notreepunching:flint_pickaxe').with_advancement(
            'notreepunching:flint_shard')
    rm.crafting_shaped(
        'flint_shovel', (' II', ' PI', 'S  '), {
            'S': 'tag!forge:rods/wooden',
            'I': 'notreepunching:flint_shard',
            'P': 'tag!forge:string'
        }, 'notreepunching:flint_shovel').with_advancement(
            'notreepunching:flint_shard')
    rm.crafting_shaped('macuahuitl', (' IS', 'ISI', 'SI '), {
        'S': 'tag!forge:rods/wooden',
        'I': 'notreepunching:flint_shard'
    }, 'notreepunching:macuahuitl').with_advancement(
        'notreepunching:flint_shard')

    # Misc Tools
    rm.crafting_shaped('clay_tool', ('  I', ' II', 'I  '), {
        'I': 'tag!forge:rods/wooden'
    }, 'notreepunching:clay_tool').with_advancement('tag!forge:rods/wooden')
    rm.crafting_shaped(
        'fire_starter', ('SP', 'FS'), {
            'S': 'tag!forge:rods/wooden',
            'P': 'tag!forge:string',
            'F': 'notreepunching:flint_shard'
        }, 'notreepunching:fire_starter').with_advancement(
            'notreepunching:flint_shard')

    # Pottery firing
    for pottery in ('large_vessel', 'small_vessel', 'bucket', 'flower_pot',
                    'brick'):
        clay = 'notreepunching:clay_' + pottery
        if pottery == 'flower_pot':
            fired = 'minecraft:flower_pot'
        elif pottery == 'brick':
            fired = 'minecraft:brick'
        else:
            fired = 'notreepunching:ceramic_' + pottery
        rm.recipe(
            ('smelting', pottery), 'minecraft:smelting', {
                'ingredient': utils.ingredient(clay),
                'result': fired,
                'experience': 0.1,
                'cookingtime': 200
            })
        rm.recipe(
            ('campfire', pottery), 'minecraft:campfire_cooking', {
                'ingredient': utils.ingredient(clay),
                'result': fired,
                'experience': 0.1,
                'cookingtime': 600
            })

    # Knife crafting
    knife = 'tag!notreepunching:knives'
    rm.crafting_shapeless(
        'string_from_wool_with_knife', ('tag!minecraft:wool', knife),
        (4, 'minecraft:string')).with_advancement('tag!minecraft:wool')
    rm.crafting_shapeless(
        'string_from_web_with_knife', ('minecraft:cobweb', knife),
        (8, 'minecraft:string')).with_advancement('minecraft:cobweb')
    rm.crafting_shapeless('plant_fiber_from_sugarcane_with_knife',
                          ('minecraft:sugar_cane', knife),
                          (3, 'notreepunching:plant_fiber'
                           )).with_advancement('minecraft:sugar_cane')
    rm.crafting_shapeless(
        'plant_fiber_from_wheat_with_knife', ('minecraft:wheat', knife),
        (2, 'notreepunching:plant_fiber')).with_advancement('minecraft:wheat')
    rm.crafting_shapeless(
        'plant_fiber_from_vines_with_knife', ('minecraft:vine', knife),
        (5, 'notreepunching:plant_fiber')).with_advancement('minecraft:vine')
    rm.crafting_shapeless(
        'plant_fiber_from_cactus_with_knife', ('minecraft:cactus', knife),
        (3, 'notreepunching:plant_fiber')).with_advancement('minecraft:cactus')
    rm.crafting_shapeless(
        'plant_fiber_from_leaves_with_knife', ('tag!minecraft:leaves', knife),
        'notreepunching:plant_fiber').with_advancement('tag!minecraft:leaves')
    rm.crafting_shapeless('plant_fiber_from_saplings_with_knife',
                          ('tag!minecraft:saplings', knife),
                          (2, 'notreepunching:plant_fiber'
                           )).with_advancement('tag!minecraft:saplings')
    rm.crafting_shapeless('plant_fiber_from_small_flowers_with_knife',
                          ('tag!minecraft:small_flowers', knife),
                          'notreepunching:plant_fiber').with_advancement(
                              'tag!minecraft:small_flowers')
    rm.crafting_shapeless('plant_fiber_from_tall_flowers_with_knife',
                          ('tag!minecraft:tall_flowers', knife),
                          (2, 'notreepunching:plant_fiber'
                           )).with_advancement('tag!minecraft:tall_flowers')

    rm.crafting_shapeless(
        'leather_from_boots_with_knife', ('minecraft:leather_boots', knife),
        (3, 'minecraft:leather')).with_advancement('minecraft:leather_boots')
    rm.crafting_shapeless(
        'leather_from_leggings_with_knife',
        ('minecraft:leather_leggings', knife),
        (6,
         'minecraft:leather')).with_advancement('minecraft:leather_leggings')
    rm.crafting_shapeless(
        'leather_from_chestplate_with_knife',
        ('minecraft:leather_chestplate', knife),
        (7,
         'minecraft:leather')).with_advancement('minecraft:leather_chestplate')
    rm.crafting_shapeless(
        'leather_from_helmet_with_knife', ('minecraft:leather_helmet', knife),
        (4, 'minecraft:leather')).with_advancement('minecraft:leather_helmet')

    rm.crafting_shapeless(
        'melon_slices_with_knife', ('minecraft:melon', knife),
        (9, 'minecraft:melon_slice')).with_advancement('minecraft:melon')
Esempio n. 22
0
def generate_vanilla(rm: ResourceManager):
    empty = {'type': 'forge:conditional', 'recipes': []}

    # Remove wood crafting recipes
    for wood in ('acacia', 'oak', 'dark_oak', 'jungle', 'birch', 'spruce'):
        rm.data(('recipes', '%s_planks' % wood), empty)

    rm.data(('recipes', 'stick'), empty)

    # Remove wood and stone tools
    for tool in ('pickaxe', 'shovel', 'hoe', 'sword', 'axe'):
        rm.data(('recipes', 'wooden_%s' % tool), empty)
        rm.data(('recipes', 'stone_%s' % tool), empty)

    rm.data(('recipes', 'campfire'), empty)
    rm.data(('recipes', 'flower_pot'), empty)
    rm.data(('recipes', 'brick'), empty)

    # Add optional plant fiber to loot tables
    rm.block_loot('grass', [{
        'entries': {
            'type':
            'minecraft:alternatives',
            'children':
            utils.loot_entry_list([{
                'name':
                'minecraft:grass',
                'conditions':
                loot_tables.match_tool('minecraft:shears')
            }, {
                'name':
                'notreepunching:plant_fiber',
                'conditions': [
                    loot_tables.match_tool('tag!notreepunching:knives'),
                    loot_tables.random_chance(0.25)
                ]
            }, {
                'conditions':
                loot_tables.random_chance(0.125),
                'functions':
                [loot_tables.fortune_bonus(2), 'minecraft:explosion_decay'],
                'name':
                'minecraft:wheat_seeds'
            }])
        },
        'conditions': None
    }])
    rm.block_loot('tall_grass', [{
        'entries': {
            'type':
            'minecraft:alternatives',
            'children':
            utils.loot_entry_list(
                [{
                    'name': 'minecraft:grass',
                    'conditions': loot_tables.match_tool('minecraft:shears')
                }, {
                    'name':
                    'minecraft:wheat_seeds',
                    'conditions': [
                        'minecraft:survives_explosion', {
                            'condition': 'minecraft:block_state_property',
                            'block': 'minecraft:tall_grass',
                            'properties': {
                                'half': 'lower'
                            }
                        },
                        loot_tables.random_chance(0.125)
                    ]
                }])
        }
    }])
Esempio n. 23
0
def generate(rm: ResourceManager):
    # Metal Items

    for metal, metal_data in METALS.items():

        # Metal
        rm.data(
            ('tfc', 'metals', metal), {
                'tier': metal_data.tier,
                'fluid': 'tfc:metal/%s' % metal,
                'melt_temperature': metal_data.melt_temperature,
                'heat_capacity': metal_data.heat_capacity
            })

        # Metal Items and Blocks
        for item, item_data in METAL_ITEMS_AND_BLOCKS.items():
            if item_data.type in metal_data.types or item_data.type == 'all':
                if item_data.tag is not None:
                    rm.item_tag(item_data.tag + '/' + metal,
                                'tfc:metal/%s/%s' % (item, metal))
                    ingredient = utils.item_stack('#%s/%s' %
                                                  (item_data.tag, metal))
                else:
                    ingredient = utils.item_stack('tfc:metal/%s/%s' %
                                                  (item, metal))

                item_heat(rm, ('metal', metal + '_' + item), ingredient,
                          metal_data.heat_capacity,
                          metal_data.melt_temperature)
                if 'tool' in metal_data.types and item == 'fishing_rod':
                    rm.item_tag('forge:fishing_rods',
                                'tfc:metal/%s/%s' % (item, metal))

    for ore, ore_data in ORES.items():
        if ore_data.metal and ore_data.graded:
            metal_data = METALS[ore_data.metal]
            item_heat(rm, ('ore', ore), [
                'tfc:ore/small_%s' % ore,
                'tfc:ore/normal_%s' % ore,
                'tfc:ore/poor_%s' % ore,
                'tfc:ore/rich_%s' % ore
            ], metal_data.heat_capacity, int(metal_data.melt_temperature))

    # Item Heats

    item_heat(rm, 'wrought_iron_grill', 'tfc:wrought_iron_grill', 0.35, 1535)
    item_heat(rm, 'stick', '#forge:rods/wooden', 0.3)
    item_heat(rm, 'stick_bunch', 'tfc:stick_bunch', 0.05)
    item_heat(rm, 'glass_shard', 'tfc:glass_shard', 1)
    item_heat(rm, 'sand', '#forge:sand', 0.8)
    item_heat(rm, 'ceramic_unfired_brick', 'tfc:ceramic/unfired_brick',
              POTTERY_HC)
    item_heat(rm, 'ceramic_unfired_flower_pot',
              'tfc:ceramic/unfired_flower_pot', POTTERY_HC)
    item_heat(rm, 'ceramic_unfired_jug', 'tfc:ceramic/unfired_jug', POTTERY_HC)
    item_heat(rm, 'terracotta', [
        'minecraft:terracotta',
        *['minecraft:%s_terracotta' % color for color in COLORS]
    ], 0.8)
    item_heat(rm, 'dough', ['tfc:food/%s_dough' % grain for grain in GRAINS],
              1)
    item_heat(rm, 'meat', ['tfc:food/%s' % meat for meat in MEATS], 1)
    item_heat(rm, 'edible_plants',
              ['tfc:plant/%s' % plant
               for plant in SEAWEED] + ['tfc:plant/giant_kelp_flower'], 1)

    for pottery in SIMPLE_POTTERY:
        item_heat(rm, 'unfired_' + pottery, 'tfc:ceramic/unfired_' + pottery,
                  POTTERY_HC)

    for item, item_data in METAL_ITEMS.items():
        if item_data.mold:
            item_heat(rm, 'unfired_%s_mold' % item,
                      'tfc:ceramic/unfired_%s_mold' % item, POTTERY_HC)
            # No need to do fired molds, as they have their own capability implementation

    # Supports

    for wood in WOODS:
        rm.data(
            ('tfc', 'supports', wood), {
                'ingredient': 'tfc:wood/horizontal_support/%s' % wood,
                'support_up': 1,
                'support_down': 1,
                'support_horizontal': 4
            })

    # Fuels

    for wood, wood_data in WOODS.items():
        fuel_item(rm, wood + '_log',
                  ['tfc:wood/log/' + wood, 'tfc:wood/wood/' + wood],
                  wood_data.duration, wood_data.temp)

    fuel_item(rm, 'coal', ['minecraft:coal', 'tfc:ore/bituminous_coal'], 2200,
              1415)
    fuel_item(rm, 'lignite', 'tfc:ore/lignite', 2200, 1350)
    fuel_item(rm, 'charcoal', 'minecraft:charcoal', 1800, 1350)
    fuel_item(rm, 'peat', 'tfc:peat', 2500, 600)
    fuel_item(rm, 'stick_bundle', 'tfc:stick_bundle', 600, 900)

    # =========
    # ITEM TAGS
    # =========

    rm.item_tag('forge:ingots/cast_iron', 'minecraft:iron_ingot')
    rm.item_tag('firepit_sticks', '#forge:rods/wooden')
    rm.item_tag('firepit_kindling', 'tfc:straw', 'minecraft:paper',
                'minecraft:book', 'tfc:groundcover/pinecone')
    rm.item_tag('starts_fires_with_durability', 'minecraft:flint_and_steel')
    rm.item_tag('starts_fires_with_items', 'minecraft:fire_charge')
    rm.item_tag('handstone', 'tfc:handstone')
    rm.item_tag('high_quality_cloth', 'tfc:silk_cloth', 'tfc:wool_cloth')
    rm.item_tag('minecraft:stone_pressure_plates',
                'minecraft:stone_pressure_plate',
                'minecraft:polished_blackstone_pressure_plate')
    rm.item_tag('axes_that_log', '#tfc:axes')
    rm.item_tag('extinguisher', '#tfc:shovels')
    rm.item_tag('forge:shears', '#tfc:shears')  # forge tag includes TFC shears
    rm.item_tag('minecraft:coals', 'tfc:ore/bituminous_coal',
                'tfc:ore/lignite')
    rm.item_tag('forge_fuel', '#minecraft:coals')
    rm.item_tag('firepit_fuel', '#minecraft:logs', 'tfc:peat',
                'tfc:peat_grass', 'tfc:stick_bundle')
    rm.item_tag('bloomery_fuel', 'minecraft:charcoal')
    rm.item_tag('log_pile_logs', 'tfc:stick_bundle')
    rm.item_tag('pit_kiln_straw', 'tfc:straw')
    rm.item_tag('firepit_logs', '#minecraft:logs')
    rm.item_tag('log_pile_logs', '#minecraft:logs')
    rm.item_tag('pit_kiln_logs', '#minecraft:logs')
    rm.item_tag('can_be_lit_on_torch', '#forge:rods/wooden')
    rm.item_tag('mortar', 'tfc:mortar')
    rm.item_tag('thatch_bed_hides', 'tfc:large_raw_hide',
                'tfc:large_sheepskin_hide')
    rm.item_tag('scrapable', 'tfc:large_soaked_hide', 'tfc:medium_soaked_hide',
                'tfc:small_soaked_hide')
    rm.item_tag('clay_knapping', 'minecraft:clay_ball')
    rm.item_tag('fire_clay_knapping', 'tfc:fire_clay')
    rm.item_tag('leather_knapping', 'minecraft:leather')
    rm.item_tag('knapping_any', '#tfc:clay_knapping',
                '#tfc:fire_clay_knapping', '#tfc:leather_knapping',
                '#tfc:rock_knapping')
    rm.item_tag('forge:gems/diamond', 'tfc:gem/diamond')
    rm.item_tag('forge:gems/lapis', 'tfc:gem/lapis_lazuli')
    rm.item_tag('forge:gems/emerald', 'tfc:gem/emerald')
    rm.item_tag('bush_cutting_tools', '#forge:shears', '#tfc:knives')
    rm.item_tag('minecraft:fishes', 'tfc:food/cod', 'tfc:food/cooked_cod',
                'tfc:food/salmon', 'tfc:food/cooked_salmon',
                'tfc:food/tropical_fish', 'tfc:food/cooked_tropical_fish',
                'tfc:food/bluegill', 'tfc:food/cooked_bluegill')

    for gem in GEMS:
        rm.item_tag('forge:gems', 'tfc:gem/' + gem)

    for wood in WOODS.keys():
        rm.item_tag('minecraft:logs', 'tfc:wood/log/%s' % wood,
                    'tfc:wood/wood/%s' % wood,
                    'tfc:wood/stripped_log/%s' % wood,
                    'tfc:wood/stripped_wood/%s' % wood)
        rm.item_tag('twigs', 'tfc:wood/twig/%s' % wood)
        rm.item_tag('lumber', 'tfc:wood/lumber/%s' % wood)

    for category in ROCK_CATEGORIES:  # Rock (Category) Tools
        for tool in ROCK_CATEGORY_ITEMS:
            rm.item_tag(TOOL_TAGS[tool], 'tfc:stone/%s/%s' % (tool, category))

    for metal, metal_data in METALS.items():  # Metal Tools
        if 'tool' in metal_data.types:
            for tool_type, tool_tag in TOOL_TAGS.items():
                rm.item_tag(tool_tag, 'tfc:metal/%s/%s' % (tool_type, metal))

    # Blocks and Items
    block_and_item_tag(
        rm, 'forge:sand', '#minecraft:sand'
    )  # Forge doesn't reference the vanilla tag for some reason

    # Sand
    for color in SAND_BLOCK_TYPES:
        block_and_item_tag(rm, 'minecraft:sand', 'tfc:sand/%s' % color)

    # ==========
    # BLOCK TAGS
    # ==========

    rm.block_tag('tree_grows_on', 'minecraft:grass_block', '#forge:dirt',
                 '#tfc:grass')
    rm.block_tag('supports_landslide', 'minecraft:dirt_path')
    rm.block_tag('bush_plantable_on', 'minecraft:grass_block', '#forge:dirt',
                 '#tfc:grass')
    rm.block_tag('small_spike', 'tfc:calcite')
    rm.block_tag('sea_bush_plantable_on', '#forge:dirt', '#minecraft:sand',
                 '#forge:gravel')
    rm.block_tag('creeping_plantable_on', 'minecraft:grass_block',
                 '#tfc:grass', '#minecraft:base_stone_overworld',
                 '#minecraft:logs')
    rm.block_tag('minecraft:bamboo_plantable_on', '#tfc:grass')
    rm.block_tag('minecraft:climbable', 'tfc:plant/hanging_vines',
                 'tfc:plant/hanging_vines_plant', 'tfc:plant/liana',
                 'tfc:plant/liana_plant')
    rm.block_tag('kelp_tree', 'tfc:plant/giant_kelp_flower',
                 'tfc:plant/giant_kelp_plant')
    rm.block_tag('kelp_flower', 'tfc:plant/giant_kelp_flower')
    rm.block_tag('kelp_branch', 'tfc:plant/giant_kelp_plant')
    rm.block_tag('lit_by_dropped_torch', 'tfc:log_pile', 'tfc:thatch',
                 'tfc:pit_kiln')
    rm.block_tag('charcoal_cover_whitelist', 'tfc:log_pile',
                 'tfc:charcoal_pile', 'tfc:burning_log_pile')
    rm.block_tag('forge_invisible_whitelist', 'tfc:crucible')
    rm.block_tag('any_spreading_bush', '#tfc:spreading_bush')
    rm.block_tag('thorny_bushes', 'tfc:plant/blackberry_bush',
                 'tfc:plant/raspberry_bush')
    rm.block_tag('logs_that_log', '#minecraft:logs')
    rm.block_tag('scraping_surface', '#minecraft:logs')
    rm.block_tag('forge:sand',
                 '#minecraft:sand')  # Forge doesn't reference the vanilla tag
    rm.block_tag('thatch_bed_thatch', 'tfc:thatch')
    rm.block_tag('snow', 'minecraft:snow', 'minecraft:snow_block',
                 'tfc:snow_pile')
    rm.block_tag('tfc:forge_insulation', '#forge:stone', '#forge:cobblestone',
                 '#forge:stone_bricks', '#forge:smooth_stone')
    rm.block_tag('minecraft:valid_spawn',
                 *['tfc:grass/%s' % v for v in SOIL_BLOCK_VARIANTS],
                 *['tfc:sand/%s' % c for c in SAND_BLOCK_TYPES],
                 *['tfc:rock/raw/%s' % r for r in ROCKS.keys()
                   ])  # Valid spawn tag - grass, sand, or raw rock
    rm.block_tag('forge:dirt',
                 *['tfc:dirt/%s' % v for v in SOIL_BLOCK_VARIANTS])
    rm.block_tag('prospectable', '#forge:ores')

    for wood in WOODS.keys():
        rm.block_tag('lit_by_dropped_torch', 'tfc:wood/fallen_leaves/' + wood)

    for plant, plant_data in PLANTS.items():  # Plants
        rm.block_tag('plant', 'tfc:plant/%s' % plant)
        if plant_data.type in {'standard', 'short_grass', 'creeping'}:
            rm.block_tag('can_be_snow_piled', 'tfc:plant/%s' % plant)

    # Rocks
    for rock, rock_data in ROCKS.items():

        def block(block_type: str):
            return 'tfc:rock/%s/%s' % (block_type, rock)

        block_and_item_tag(rm, 'forge:gravel', 'tfc:rock/gravel/%s' % rock)
        rm.block_tag('forge:stone', block('raw'), block('hardened'))
        rm.block_tag('forge:cobblestone', block('cobble'),
                     block('mossy_cobble'))
        rm.block_tag('minecraft:base_stone_overworld', block('raw'),
                     block('hardened'))
        rm.block_tag('forge:stone_bricks', block('bricks'),
                     block('mossy_bricks'), block('cracked_bricks'))
        rm.block_tag('forge:smooth_stone', block('smooth'))
        rm.block_tag('tfc:breaks_when_isolated', block('raw'))
        rm.block_tag('minecraft:stone_pressure_plates',
                     block('pressure_plate'))

        rm.item_tag('forge:smooth_stone', block('smooth'))
        rm.item_tag('forge:smooth_stone_slab',
                    'tfc:rock/smooth/%s_slab' % rock)
        rm.item_tag('tfc:rock_knapping', block('loose'))
        rm.item_tag('tfc:%s_rock' % rock_data.category, block('loose'))
        rm.item_tag('minecraft:stone_pressure_plates', block('pressure_plate'))

        if rock in ['chalk', 'dolomite', 'limestone', 'marble']:
            rm.item_tag('tfc:fluxstone', block('loose'))

    for plant in PLANTS.keys():
        rm.block_tag('can_be_snow_piled', 'tfc:plant/%s' % plant)

    # Ore tags
    for ore, data in ORES.items():
        if data.tag not in DEFAULT_FORGE_ORE_TAGS:
            rm.block_tag('forge:ores', '#forge:ores/%s' % data.tag)
        if data.graded:  # graded ores -> each grade is declared as a TFC tag, then added to the forge tag
            rm.block_tag('forge:ores/%s' % data.tag,
                         '#tfc:ores/%s/poor' % data.tag,
                         '#tfc:ores/%s/normal' % data.tag,
                         '#tfc:ores/%s/rich' % data.tag)
        for rock in ROCKS.keys():
            if data.graded:
                rm.block_tag('ores/%s/poor' % data.tag,
                             'tfc:ore/poor_%s/%s' % (ore, rock))
                rm.block_tag('ores/%s/normal' % data.tag,
                             'tfc:ore/normal_%s/%s' % (ore, rock))
                rm.block_tag('ores/%s/rich' % data.tag,
                             'tfc:ore/rich_%s/%s' % (ore, rock))
            else:
                rm.block_tag('forge:ores/%s' % data.tag,
                             'tfc:ore/%s/%s' % (ore, rock))

    # can_carve Tag
    for rock in ROCKS.keys():
        for variant in ('raw', 'hardened', 'gravel', 'cobble'):
            rm.block_tag('can_carve', 'tfc:rock/%s/%s' % (variant, rock))
    for sand in SAND_BLOCK_TYPES:
        rm.block_tag('can_carve', 'tfc:sand/%s' % sand,
                     'tfc:raw_sandstone/%s' % sand)
    for soil in SOIL_BLOCK_VARIANTS:
        rm.block_tag('can_carve', 'tfc:dirt/%s' % soil, 'tfc:grass/%s' % soil)

    # Harvest Tool + Level Tags

    rm.block_tag('needs_stone_tool', '#forge:needs_wood_tool')
    rm.block_tag('needs_copper_tool', '#minecraft:needs_stone_tool')
    rm.block_tag('needs_wrought_iron_tool', '#minecraft:needs_iron_tool')
    rm.block_tag('needs_steel_tool', '#minecraft:needs_diamond_tool')
    rm.block_tag('needs_colored_steel_tool', '#forge:needs_netherite_tool')

    rm.block_tag('minecraft:mineable/hoe', '#tfc:mineable_with_sharp_tool')
    rm.block_tag('tfc:mineable_with_knife', '#tfc:mineable_with_sharp_tool')
    rm.block_tag('tfc:mineable_with_scythe', '#tfc:mineable_with_sharp_tool')

    rm.block_tag('forge:needs_wood_tool')
    rm.block_tag('forge:needs_netherite_tool')

    for ore, data in ORES.items():
        for rock in ROCKS.keys():
            if data.graded:
                rm.block_tag('needs_%s_tool' % data.required_tool,
                             'tfc:ore/poor_%s/%s' % (ore, rock),
                             'tfc:ore/normal_%s/%s' % (ore, rock),
                             'tfc:ore/rich_%s/%s' % (ore, rock))
            else:
                rm.block_tag('needs_%s_tool' % data.required_tool,
                             'tfc:ore/%s/%s' % (ore, rock))

    rm.block_tag(
        'minecraft:mineable/shovel', *[
            *[
                'tfc:%s/%s' % (soil, variant) for soil in SOIL_BLOCK_TYPES
                for variant in SOIL_BLOCK_VARIANTS
            ], 'tfc:peat', 'tfc:peat_grass',
            *['tfc:sand/%s' % sand
              for sand in SAND_BLOCK_TYPES], 'tfc:snow_pile',
            *['tfc:rock/gravel/%s' % rock
              for rock in ROCKS.keys()], 'tfc:aggregate',
            'tfc:fire_clay_block', 'tfc:charcoal_pile', 'tfc:charcoal_forge'
        ])
    rm.block_tag(
        'minecraft:mineable/pickaxe', *[
            *[
                'tfc:%s_sandstone/%s' % (variant, sand)
                for variant in SANDSTONE_BLOCK_TYPES
                for sand in SAND_BLOCK_TYPES
            ], *[
                'tfc:%s_sandstone/%s_%s' % (variant, sand, suffix)
                for variant in SANDSTONE_BLOCK_TYPES
                for sand in SAND_BLOCK_TYPES
                for suffix in ('slab', 'stairs', 'wall')
            ], 'tfc:icicle', 'tfc:calcite', *[
                'tfc:ore/%s/%s' % (ore, rock)
                for ore, ore_data in ORES.items()
                for rock in ROCKS.keys() if not ore_data.graded
            ], *[
                'tfc:ore/%s_%s/%s' % (grade, ore, rock)
                for ore, ore_data in ORES.items() for rock in ROCKS.keys()
                for grade in ORE_GRADES.keys() if ore_data.graded
            ], *[
                'tfc:ore/small_%s' % ore
                for ore, ore_data in ORES.items() if ore_data.graded
            ], *[
                'tfc:rock/%s/%s' % (variant, rock)
                for variant in ('raw', 'hardened', 'smooth', 'cobble',
                                'bricks', 'spike', 'cracked_bricks',
                                'mossy_bricks', 'mossy_cobble', 'chiseled',
                                'loose', 'pressure_plate', 'button')
                for rock in ROCKS.keys()
            ], *[
                'tfc:rock/%s/%s_%s' % (variant, rock, suffix)
                for variant in ('raw', 'smooth', 'cobble', 'bricks',
                                'cracked_bricks', 'mossy_bricks',
                                'mossy_cobble') for rock in ROCKS.keys()
                for suffix in ('slab', 'stairs', 'wall')
            ], *[
                'tfc:rock/anvil/%s' % rock
                for rock, rock_data in ROCKS.items()
                if rock_data.category == 'igneous_intrusive'
                or rock_data.category == 'igneous_extrusive'
            ], *[
                'tfc:metal/%s/%s' % (variant, metal)
                for variant, variant_data in METAL_BLOCKS.items()
                for metal, metal_data in METALS.items()
                if variant_data.type in metal_data.types
            ], *[
                'tfc:coral/%s_%s' % (color, variant) for color in CORALS
                for variant in CORAL_BLOCKS
            ], 'tfc:alabaster/raw/alabaster',
            'tfc:alabaster/raw/alabaster_bricks',
            'tfc:alabaster/raw/polished_alabaster', *[
                'tfc:alabaster/stained/%s%s' % (color, variant)
                for color in COLORS for variant in
                ('_raw_alabaster', '_alabaster_bricks', '_polished_alabaster',
                 '_alabaster_bricks_slab', '_alabaster_bricks_stairs',
                 '_alabaster_bricks_wall', '_polished_alabaster_slab',
                 '_polished_alabaster_stairs', '_polished_alabaster_wall')
            ], 'tfc:fire_bricks', 'tfc:quern'
        ])
    rm.block_tag(
        'minecraft:mineable/axe', *[
            *[
                'tfc:wood/%s/%s' % (variant, wood)
                for variant in ('log', 'stripped_log', 'wood', 'stripped_wood',
                                'planks', 'twig', 'vertical_support',
                                'horizontal_support') for wood in WOODS.keys()
            ], *[
                'tfc:wood/planks/%s_%s' % (wood, variant)
                for variant in ('bookshelf', 'door', 'trapdoor', 'fence',
                                'log_fence', 'fence_gate', 'button',
                                'pressure_plate', 'slab', 'stairs',
                                'tool_rack', 'workbench')
                for wood in WOODS.keys()
            ], *['tfc:plant/%s_branch' % tree for tree in NORMAL_FRUIT_TREES],
            *[
                'tfc:plant/%s_growing_branch' % tree
                for tree in NORMAL_FRUIT_TREES
            ], 'tfc:plant/banana_plant', 'tfc:log_pile', 'tfc:burning_log_pile'
        ])
    rm.block_tag(
        'tfc:mineable_with_sharp_tool', *[
            *[
                'tfc:wood/%s/%s' % (variant, wood)
                for variant in ('leaves', 'sapling', 'fallen_leaves')
                for wood in WOODS.keys()
            ], *['tfc:plant/%s' % plant for plant in PLANTS.keys()],
            *['tfc:plant/%s' % plant
              for plant in UNIQUE_PLANTS], 'tfc:sea_pickle', *[
                  'tfc:plant/%s_bush' % bush
                  for bush in ('snowberry', 'bunchberry', 'gooseberry',
                               'cloudberry', 'strawberry', 'wintergreen_berry')
              ], *[
                  'tfc:plant/%s_bush%s' % (bush, suffix)
                  for bush in ('blackberry', 'raspberry', 'blueberry',
                               'elderberry') for suffix in ('', '_cane')
              ], 'tfc:plant/cranberry_bush', 'tfc:plant/dead_berry_bush',
            'tfc:plant/dead_cane',
            *['tfc:plant/%s_leaves' % tree for tree in NORMAL_FRUIT_TREES],
            *['tfc:plant/%s_sapling' % tree for tree in NORMAL_FRUIT_TREES],
            'tfc:plant/banana_sapling', 'tfc:thatch', 'tfc:thatch_bed'
        ])

    # ==========
    # FLUID TAGS
    # ==========

    rm.fluid_tag('fluid_ingredients', 'minecraft:water', 'tfc:salt_water',
                 'tfc:spring_water')
    rm.fluid_tag('drinkables', 'minecraft:water', 'tfc:salt_water',
                 'tfc:river_water')
    rm.fluid_tag('hydrating', 'minecraft:water', 'tfc:river_water')

    rm.fluid_tag('usable_in_pot', '#tfc:fluid_ingredients')
    rm.fluid_tag('usable_in_jug', '#tfc:drinkables')

    # Item Sizes

    # todo: specific item size definitions for a whole bunch of items that aren't naturally assigned
    item_size(rm, 'logs', '#minecraft:logs', Size.very_large, Weight.medium)

    # Food

    food_item(rm,
              'banana',
              'tfc:food/banana',
              Category.fruit,
              4,
              0.2,
              0,
              2,
              fruit=1)
    food_item(rm,
              'blackberry',
              'tfc:food/blackberry',
              Category.fruit,
              4,
              0.2,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'blueberry',
              'tfc:food/blueberry',
              Category.fruit,
              4,
              0.2,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'bunchberry',
              'tfc:food/bunchberry',
              Category.fruit,
              4,
              0.5,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'cherry',
              'tfc:food/cherry',
              Category.fruit,
              4,
              0.2,
              5,
              4,
              fruit=1)
    food_item(rm,
              'cloudberry',
              'tfc:food/cloudberry',
              Category.fruit,
              4,
              0.5,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'cranberry',
              'tfc:food/cranberry',
              Category.fruit,
              4,
              0.2,
              5,
              1.8,
              fruit=1)
    food_item(rm,
              'elderberry',
              'tfc:food/elderberry',
              Category.fruit,
              4,
              0.2,
              5,
              4.9,
              fruit=1)
    food_item(rm,
              'gooseberry',
              'tfc:food/gooseberry',
              Category.fruit,
              4,
              0.5,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'green_apple',
              'tfc:food/green_apple',
              Category.fruit,
              4,
              0.5,
              0,
              2.5,
              fruit=1)
    food_item(rm,
              'lemon',
              'tfc:food/lemon',
              Category.fruit,
              4,
              0.2,
              5,
              2,
              fruit=0.75)
    food_item(rm,
              'olive',
              'tfc:food/olive',
              Category.fruit,
              4,
              0.2,
              0,
              1.6,
              fruit=1)
    food_item(rm,
              'orange',
              'tfc:food/orange',
              Category.fruit,
              4,
              0.5,
              10,
              2.2,
              fruit=0.5)
    food_item(rm,
              'peach',
              'tfc:food/peach',
              Category.fruit,
              4,
              0.5,
              10,
              2.8,
              fruit=0.5)
    food_item(rm,
              'plum',
              'tfc:food/plum',
              Category.fruit,
              4,
              0.5,
              5,
              2.8,
              fruit=0.75)
    food_item(rm,
              'raspberry',
              'tfc:food/raspberry',
              Category.fruit,
              4,
              0.5,
              5,
              4.9,
              fruit=0.75)
    food_item(rm,
              'red_apple',
              'tfc:food/red_apple',
              Category.fruit,
              4,
              0.5,
              0,
              1.7,
              fruit=1)
    food_item(rm,
              'snowberry',
              'tfc:food/snowberry',
              Category.fruit,
              4,
              0.2,
              5,
              4.9,
              fruit=1)
    food_item(rm,
              'strawberry',
              'tfc:food/strawberry',
              Category.fruit,
              4,
              0.5,
              10,
              4.9,
              fruit=0.5)
    food_item(rm,
              'wintergreen_berry',
              'tfc:food/wintergreen_berry',
              Category.fruit,
              4,
              0.2,
              5,
              4.9,
              fruit=1)
    food_item(rm, 'barley', 'tfc:food/barley', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'barley_grain', 'tfc:food/barley_grain', Category.grain, 4,
              0, 0, 0.25)
    food_item(rm, 'barley_flour', 'tfc:food/barley_flour', Category.grain, 4,
              0, 0, 0.5)
    food_item(rm, 'barley_dough', 'tfc:food/barley_dough', Category.grain, 4,
              0, 0, 3)
    food_item(rm,
              'barley_bread',
              'tfc:food/barley_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1.5)
    food_item(rm, 'maize', 'tfc:food/maize', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'maize_grain', 'tfc:food/maize_grain', Category.grain, 4,
              0.5, 0, 0.25)
    food_item(rm, 'maize_flour', 'tfc:food/maize_flour', Category.grain, 4, 0,
              0, 0.5)
    food_item(rm, 'maize_dough', 'tfc:food/maize_dough', Category.grain, 4, 0,
              0, 3)
    food_item(rm,
              'maize_bread',
              'tfc:food/maize_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1)
    food_item(rm, 'oat', 'tfc:food/oat', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'oat_grain', 'tfc:food/oat_grain', Category.grain, 4, 0.5, 0,
              0.25)
    food_item(rm, 'oat_flour', 'tfc:food/oat_flour', Category.grain, 4, 0, 0,
              0.5)
    food_item(rm, 'oat_dough', 'tfc:food/oat_dough', Category.grain, 4, 0, 0,
              3)
    food_item(rm,
              'oat_bread',
              'tfc:food/oat_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1)
    # todo: figure out what to do with rice. thinking rice -> grain -> cooked rice in a pot recipe? so remove flour/dough/bread for this one
    food_item(rm, 'rice', 'tfc:food/rice', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'rice_grain', 'tfc:food/rice_grain', Category.grain, 4, 0.5,
              0, 0.25)
    food_item(rm, 'rice_flour', 'tfc:food/rice_flour', Category.grain, 4, 0, 0,
              0.5)
    food_item(rm, 'rice_dough', 'tfc:food/rice_dough', Category.grain, 4, 0, 0,
              3)
    food_item(rm,
              'rice_bread',
              'tfc:food/rice_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1.5)
    food_item(rm, 'rye', 'tfc:food/rye', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'rye_grain', 'tfc:food/rye_grain', Category.grain, 4, 0.5, 0,
              0.25)
    food_item(rm, 'rye_flour', 'tfc:food/rye_flour', Category.grain, 4, 0, 0,
              0.5)
    food_item(rm, 'rye_dough', 'tfc:food/rye_dough', Category.grain, 4, 0, 0,
              3)
    food_item(rm,
              'rye_bread',
              'tfc:food/rye_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1.5)
    food_item(rm, 'wheat', 'tfc:food/wheat', Category.grain, 4, 0, 0, 2)
    food_item(rm, 'wheat_grain', 'tfc:food/wheat_grain', Category.grain, 4,
              0.5, 0, 0.25)
    food_item(rm, 'wheat_flour', 'tfc:food/wheat_flour', Category.grain, 4, 0,
              0, 0.5)
    food_item(rm, 'wheat_dough', 'tfc:food/wheat_dough', Category.grain, 4, 0,
              0, 3)
    food_item(rm,
              'wheat_bread',
              'tfc:food/wheat_bread',
              Category.bread,
              4,
              1,
              0,
              1,
              grain=1)
    food_item(rm,
              'beet',
              'tfc:food/beet',
              Category.vegetable,
              4,
              2,
              0,
              0.7,
              veg=1)
    food_item(rm,
              'cabbage',
              'tfc:food/cabbage',
              Category.vegetable,
              4,
              0.5,
              0,
              1.2,
              veg=1)
    food_item(rm,
              'carrot',
              'tfc:food/carrot',
              Category.vegetable,
              4,
              2,
              0,
              0.7,
              veg=1)
    food_item(rm,
              'garlic',
              'tfc:food/garlic',
              Category.vegetable,
              4,
              0.5,
              0,
              0.4,
              veg=2)
    food_item(rm,
              'green_bean',
              'tfc:food/green_bean',
              Category.vegetable,
              4,
              0.5,
              0,
              3.5,
              veg=1)
    food_item(rm,
              'green_bell_pepper',
              'tfc:food/green_bell_pepper',
              Category.vegetable,
              4,
              0.5,
              0,
              2.7,
              veg=1)
    food_item(rm,
              'onion',
              'tfc:food/onion',
              Category.vegetable,
              4,
              0.5,
              0,
              0.5,
              veg=1)
    food_item(rm,
              'potato',
              'tfc:food/potato',
              Category.vegetable,
              4,
              2,
              0,
              0.666,
              veg=1.5)
    food_item(rm,
              'red_bell_pepper',
              'tfc:food/red_bell_pepper',
              Category.vegetable,
              4,
              1,
              0,
              2.5,
              veg=1)
    food_item(rm,
              'dried_seaweed',
              'tfc:food/dried_seaweed',
              Category.vegetable,
              2,
              1,
              0,
              2.5,
              veg=0.5)
    food_item(rm,
              'dried_kelp',
              'tfc:food/dried_kelp',
              Category.vegetable,
              2,
              1,
              0,
              2.5,
              veg=0.5)
    food_item(rm,
              'cattail_root',
              'tfc:food/cattail_root',
              Category.vegetable,
              2,
              1,
              0,
              2.5,
              grain=0.5)
    food_item(rm,
              'soybean',
              'tfc:food/soybean',
              Category.vegetable,
              4,
              2,
              0,
              2.5,
              veg=0.5,
              protein=1)
    food_item(rm,
              'squash',
              'tfc:food/squash',
              Category.vegetable,
              4,
              1,
              0,
              1.67,
              veg=1.5)
    food_item(rm,
              'tomato',
              'tfc:food/tomato',
              Category.vegetable,
              4,
              0.5,
              5,
              3.5,
              veg=1.5)
    food_item(rm,
              'yellow_bell_pepper',
              'tfc:food/yellow_bell_pepper',
              Category.vegetable,
              4,
              1,
              0,
              2.5,
              veg=1)
    food_item(rm,
              'cheese',
              'tfc:food/cheese',
              Category.dairy,
              4,
              2,
              0,
              0.3,
              dairy=3)
    food_item(rm,
              'cooked_egg',
              'tfc:food/cooked_egg',
              Category.other,
              4,
              0.5,
              0,
              4,
              protein=0.75,
              dairy=0.25)
    # todo: figure out what to do with sugarcane, do we need a different plant? or item or something? or modify the vanilla one
    # food_item(rm, 'sugarcane', 'tfc:food/sugarcane', Category.grain, 4, 0, 0, 1.6, grain=0.5)
    food_item(rm,
              'beef',
              'tfc:food/beef',
              Category.meat,
              4,
              0,
              0,
              2,
              protein=2)
    food_item(rm,
              'pork',
              'tfc:food/pork',
              Category.meat,
              4,
              0,
              0,
              2,
              protein=1.5)
    food_item(rm,
              'chicken',
              'tfc:food/chicken',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1.5)
    food_item(rm,
              'mutton',
              'tfc:food/mutton',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1.5)
    food_item(rm,
              'bluegill',
              'tfc:food/bluegill',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1)
    food_item(rm, 'cod', 'tfc:food/cod', Category.meat, 4, 0, 0, 3, protein=1)
    food_item(rm,
              'salmon',
              'tfc:food/salmon',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1)
    food_item(rm,
              'tropical_fish',
              'tfc:food/tropical_fish',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1)
    food_item(rm,
              'bear',
              'tfc:food/bear',
              Category.meat,
              4,
              0,
              0,
              2,
              protein=1.5)
    # food_item(rm, 'calamari', 'tfc:food/calamari', Category.meat, 4, 0, 0, 3, protein=0.5)
    food_item(rm,
              'horse_meat',
              'tfc:food/horse_meat',
              Category.meat,
              4,
              0,
              0,
              2,
              protein=1.5)
    food_item(rm,
              'pheasant',
              'tfc:food/pheasant',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=1.5)
    food_item(rm,
              'venison',
              'tfc:food/venison',
              Category.meat,
              4,
              0,
              0,
              2,
              protein=1)
    food_item(rm,
              'wolf',
              'tfc:food/wolf',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'rabbit',
              'tfc:food/rabbit',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'hyena',
              'tfc:food/hyena',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'duck',
              'tfc:food/duck',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'chevon',
              'tfc:food/chevon',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'gran_feline',
              'tfc:food/gran_feline',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'camelidae',
              'tfc:food/camelidae',
              Category.meat,
              4,
              0,
              0,
              3,
              protein=0.5)
    food_item(rm,
              'cooked_beef',
              'tfc:food/cooked_beef',
              Category.cooked_meat,
              4,
              2,
              0,
              1.5,
              protein=2.5)
    food_item(rm,
              'cooked_pork',
              'tfc:food/cooked_pork',
              Category.cooked_meat,
              4,
              2,
              0,
              1.5,
              protein=2.5)
    food_item(rm,
              'cooked_chicken',
              'tfc:food/cooked_chicken',
              Category.cooked_meat,
              4,
              2,
              0,
              2.25,
              protein=2.5)
    food_item(rm,
              'cooked_mutton',
              'tfc:food/cooked_mutton',
              Category.cooked_meat,
              4,
              2,
              0,
              2.25,
              protein=2.5)
    food_item(rm,
              'cooked_cod',
              'tfc:food/cooked_cod',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=2)
    food_item(rm,
              'cooked_tropical_fish',
              'tfc:food/cooked_tropical_fish',
              Category.cooked_meat,
              4,
              1,
              0,
              1.5,
              protein=2)
    food_item(rm,
              'cooked_salmon',
              'tfc:food/cooked_salmon',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=2)
    food_item(rm,
              'cooked_bluegill',
              'tfc:food/cooked_bluegill',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=2)
    food_item(rm,
              'cooked_bear',
              'tfc:food/cooked_bear',
              Category.cooked_meat,
              4,
              1,
              0,
              1.5,
              protein=2.5)
    # food_item(rm, 'cooked_calamari', 'tfc:food/cooked_calamari', Category.cooked_meat, 4, 1, 0, 2.25, protein=1.5)
    food_item(rm,
              'cooked_horse_meat',
              'tfc:food/cooked_horse_meat',
              Category.cooked_meat,
              4,
              2,
              0,
              1.5,
              protein=2.5)
    food_item(rm,
              'cooked_pheasant',
              'tfc:food/cooked_pheasant',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=2.5)
    food_item(rm,
              'cooked_venison',
              'tfc:food/cooked_venison',
              Category.cooked_meat,
              4,
              1,
              0,
              1.5,
              protein=2)
    food_item(rm,
              'cooked_wolf',
              'tfc:food/cooked_wolf',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=1.5)
    food_item(rm,
              'cooked_rabbit',
              'tfc:food/cooked_rabbit',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=1.5)
    food_item(rm,
              'cooked_hyena',
              'tfc:food/cooked_hyena',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=1.5)
    food_item(rm,
              'cooked_duck',
              'tfc:food/cooked_duck',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=1.5)
    food_item(rm,
              'cooked_chevon',
              'tfc:food/cooked_chevon',
              Category.cooked_meat,
              4,
              1,
              0,
              2.25,
              protein=2)
    food_item(rm,
              'cooked_gran_feline',
              'tfc:food/cooked_gran_feline',
              Category.cooked_meat,
              4,
              2,
              0,
              2.25,
              protein=2.5)
    food_item(rm,
              'cooked_camelidae',
              'tfc:food/cooked_camelidae',
              Category.cooked_meat,
              4,
              2,
              0,
              2.25,
              protein=2.5)

    # Drinkables

    drinkable(rm,
              'fresh_water', ['minecraft:water', 'tfc:river_water'],
              thirst=10)
    drinkable(rm, 'salt_water', 'tfc:salt_water', thirst=-1)

    # Climate Ranges

    for berry, data in BERRIES.items():
        climate_range(rm,
                      'plant/%s_bush' % berry,
                      hydration=(hydration_from_rainfall(data.min_rain), 100,
                                 0),
                      temperature=(data.min_temp, data.max_temp, 0))

    # Entities
    rm.data(('tfc', 'fauna', 'isopod'),
            fauna(distance_below_sea_level=20,
                  climate=climate_config(max_temp=14)))
    rm.data(('tfc', 'fauna', 'lobster'),
            fauna(distance_below_sea_level=20,
                  climate=climate_config(max_temp=21)))
    rm.data(('tfc', 'fauna', 'horseshoe_crab'),
            fauna(distance_below_sea_level=10,
                  climate=climate_config(min_temp=10,
                                         max_temp=21,
                                         max_rain=400)))
    rm.data(('tfc', 'fauna', 'cod'),
            fauna(climate=climate_config(max_temp=18),
                  distance_below_sea_level=5))
    rm.data(('tfc', 'fauna', 'pufferfish'),
            fauna(climate=climate_config(min_temp=10),
                  distance_below_sea_level=3))
    rm.data(('tfc', 'fauna', 'tropical_fish'),
            fauna(climate=climate_config(min_temp=18),
                  distance_below_sea_level=3))
    rm.data(('tfc', 'fauna', 'jellyfish'),
            fauna(climate=climate_config(min_temp=18),
                  distance_below_sea_level=3))
    # rm.data(('tfc', 'fauna', 'orca'), fauna(distance_below_sea_level=35, climate=climate_config(max_temp=19, min_rain=100), chance=10))
    # rm.data(('tfc', 'fauna', 'dolphin'), fauna(distance_below_sea_level=20, climate=climate_config(min_temp=10, min_rain=200), chance=10))
    # rm.data(('tfc', 'fauna', 'manatee'), fauna(distance_below_sea_level=3, climate=climate_config(min_temp=20, min_rain=300), chance=10))
    rm.data(('tfc', 'fauna', 'salmon'),
            fauna(climate=climate_config(min_temp=-5)))
    rm.data(('tfc', 'fauna', 'bluegill'),
            fauna(climate=climate_config(min_temp=-10, max_temp=26)))
    # rm.data(('tfc', 'fauna', 'penguin'), fauna(climate=climate_config(max_temp=-14, min_rain=75)))
    # rm.data(('tfc', 'fauna', 'turtle'), fauna(climate=climate_config(min_temp=21, min_rain=250)))

    rm.entity_loot('cod', 'tfc:food/cod')
    rm.entity_loot('bluegill', 'tfc:food/bluegill')
    rm.entity_loot('tropical_fish', 'tfc:food/tropical_fish')
    rm.entity_loot('salmon', 'tfc:food/salmon')
    rm.entity_loot('pufferfish', 'minecraft:pufferfish')
Esempio n. 24
0
def block_and_item_tag(rm: ResourceManager,
                       name_parts: utils.ResourceIdentifier,
                       *values: utils.ResourceIdentifier,
                       replace: bool = False):
    rm.block_tag(name_parts, *values, replace=replace)
    rm.item_tag(name_parts, *values, replace=replace)
Esempio n. 25
0
def generate(rm: ResourceManager):
    vanilla_woods = ('oak', 'acacia', 'dark_oak', 'birch', 'jungle', 'spruce')

    for wood in vanilla_woods:
        direct_block_model(
            rm, 'betterfoliage:%s_leaves' % wood, {
                'loader': 'betterfoliage:leaves',
                'leaves': 'minecraft:block/%s_leaves' % wood,
                'fluff': 'betterfoliage:block/%s_fluff' % wood
            })

        rm.blockstate('minecraft:%s_leaves' % wood,
                      model='betterfoliage:block/%s_leaves' % wood)

    pad = 0
    for flower in range(0, 1 + 1):
        for root in range(0, 2 + 1):
            rm.block_model('betterfoliage:lily_pad%d' % pad,
                           parent='betterfoliage:block/lily_pad',
                           textures={
                               'flower':
                               'betterfoliage:block/lilypad_flower%d' % flower,
                               'roots':
                               'betterfoliage:block/lilypad_roots%d' % root
                           })
            pad += 1

    cactus_variants = [{
        'model': 'minecraft:block/cactus',
        'weight': 3,
        'y': i
    } for i in (0, 90, 180, 270)]
    cactus_variants.extend([{
        'model': 'betterfoliage:block/cactus1',
        'weight': 2,
        'y': i
    } for i in (0, 90, 180, 270)])
    cactus_variants.extend([{
        'model': 'betterfoliage:block/cactus2',
        'weight': 4,
        'y': i
    } for i in (0, 90, 180, 270)])
    cactus_variants.extend([{
        'model': 'betterfoliage:block/cactus3',
        'y': i
    } for i in (0, 90, 180, 270)])
    cactus_variants.extend([{
        'model': 'betterfoliage:block/cactus4',
        'y': i
    } for i in (0, 90, 180, 270)])
    cactus_variants.extend([{
        'model': 'betterfoliage:block/cactus5',
        'y': i
    } for i in (0, 90, 180, 270)])

    rm.blockstate('minecraft:cactus',
                  variants={"": cactus_variants},
                  use_default_model=False)

    rm.blockstate('minecraft:grass_block',
                  variants={
                      'snowy=false': {
                          'model': 'betterfoliage:block/grass_block'
                      },
                      'snowy=true': {
                          'model': 'betterfoliage:block/snowy_grass_block'
                      }
                  })

    rm.blockstate('minecraft:mycelium',
                  variants={
                      'snowy=false': {
                          'model': 'betterfoliage:block/mycelium'
                      },
                      'snowy=true': {
                          'model': 'betterfoliage:block/snowy_grass_block'
                      }
                  })

    rm.blockstate('minecraft:podzol',
                  variants={
                      'snowy=false': {
                          'model': 'betterfoliage:block/podzol'
                      },
                      'snowy=true': {
                          'model': 'betterfoliage:block/snowy_grass_block'
                      }
                  })

    direct_block_model(
        rm, 'betterfoliage:grass_block', {
            'loader': 'betterfoliage:grass',
            'dirt': 'minecraft:block/dirt',
            'top': 'minecraft:block/grass_block_top',
            'overlay': 'minecraft:block/grass_block_side_overlay',
            'tint': True
        })

    direct_block_model(
        rm, 'betterfoliage:snowy_grass_block', {
            'loader': 'betterfoliage:grass',
            'dirt': 'minecraft:block/dirt',
            'top': 'minecraft:block/snow',
            'overlay': 'minecraft:block/grass_block_snow',
            'tint': False
        })

    direct_block_model(
        rm, 'betterfoliage:mycelium', {
            'loader': 'betterfoliage:grass',
            'dirt': 'minecraft:block/dirt',
            'top': 'minecraft:block/mycelium_top',
            'overlay': 'minecraft:block/mycelium_side',
            'tint': False
        })

    direct_block_model(
        rm, 'betterfoliage:podzol', {
            'loader': 'betterfoliage:grass',
            'dirt': 'minecraft:block/dirt',
            'top': 'minecraft:block/podzol_top',
            'overlay': 'minecraft:block/podzol_side',
            'tint': False
        })
Esempio n. 26
0
def generate(rm: ResourceManager):
    # Metals
    for metal, metal_data in METALS.items():
        # The metal itself
        rm.data(('tfc', 'metals', metal), {
            'tier': metal_data.tier,
            'fluid': 'tfc:metal/%s' % metal
        })

        # for each registered metal item
        for item, item_data in {**METAL_ITEMS, **METAL_BLOCKS}.items():
            if item_data.type in metal_data.types or item_data.type == 'all':
                if item_data.tag is not None:
                    rm.item_tag(item_data.tag + '/' + metal,
                                'tfc:metal/%s/%s' % (item, metal))
                    ingredient = item_stack('tag!%s/%s' %
                                            (item_data.tag, metal))
                else:
                    ingredient = item_stack('tfc:metal/%s/%s' % (item, metal))

                # The IMetal capability
                rm.data(
                    ('tfc', 'metal_items', metal, item), {
                        'ingredient': ingredient,
                        'metal': 'tfc:%s' % metal,
                        'amount': item_data.smelt_amount
                    })

                # And the IHeat capability
                rm.data(
                    ('tfc', 'item_heats', metal, item), {
                        'ingredient': ingredient,
                        'heat_capacity': metal_data.heat_capacity,
                        'forging_temperature':
                        metal_data.melt_temperature * 0.6,
                        'welding_temperature':
                        metal_data.melt_temperature * 0.8
                    })

        # Common metal crafting tools
        if 'tool' in metal_data.types:
            for tool in ('hammer', 'chisel', 'axe', 'pickaxe', 'shovel'):
                rm.item_tag('tfc:%ss' % tool,
                            'tfc:metal/%s/%s' % (tool, metal))

    # Rocks
    for rock, rock_data in ROCKS.items():
        rm.data(
            ('tfc', 'rocks', rock), {
                'blocks':
                dict((block_type, 'tfc:rock/%s/%s' % (block_type, rock))
                     for block_type in ROCK_BLOCK_TYPES),
                'category':
                rock_data.category,
                'desert_sand_color':
                rock_data.desert_sand_color,
                'beach_sand_color':
                rock_data.beach_sand_color
            })

        def block(block_type: str):
            return 'tfc:rock/%s/%s' % (block_type, rock)

        rm.block_tag('forge:gravel', block('gravel'))
        rm.block_tag('forge:stone', block('raw'), block('hardened'))
        rm.block_tag('forge:cobblestone', block('cobble'),
                     block('mossy_cobble'))
        rm.block_tag('minecraft:base_stone_overworld', block('raw'),
                     block('hardened'))
        rm.block_tag('tfc:breaks_when_isolated', block('raw'))  # only raw rock

    # Plants
    for plant, plant_data in PLANTS.items():
        rm.block_tag('plant', 'tfc:plant/%s' % plant)
        if plant_data.type in {'standard', 'short_grass', 'creeping'}:
            rm.block_tag('can_be_snow_piled', 'tfc:plant/%s' % plant)

    # Sand
    for color in SAND_BLOCK_TYPES:
        rm.block_tag('minecraft:sand', 'tfc:sand/%s' % color)

    for wood in WOODS:
        rm.data(
            ('tfc', 'supports', wood), {
                'ingredient': 'tfc:wood/horizontal_support/%s' % wood,
                'support_up': 1,
                'support_down': 1,
                'support_horizontal': 4
            })

    # Forge you dingus, use vanilla tags
    rm.block_tag('forge:sand', '#minecraft:sand')

    # Tags
    rm.item_tag('forge:ingots/cast_iron', 'minecraft:iron_ingot')
    rm.block_tag('tree_grows_on', 'minecraft:grass_block', '#forge:dirt',
                 '#tfc:grass')
    rm.block_tag('supports_landslide', 'minecraft:grass_path')
    rm.block_tag('bush_plantable_on', 'minecraft:grass_block', '#forge:dirt',
                 '#tfc:grass')
    rm.block_tag('sea_bush_plantable_on', '#forge:dirt', '#minecraft:sand',
                 '#forge:gravel')
    rm.block_tag('creeping_plantable_on', 'minecraft:grass_block',
                 '#tfc:grass', '#minecraft:base_stone_overworld',
                 '#minecraft:logs')
    rm.block_tag('minecraft:bamboo_plantable_on', '#tfc:grass')
    rm.block_tag('minecraft:climbable', 'tfc:plant/hanging_vines',
                 'tfc:plant/hanging_vines_plant', 'tfc:plant/liana',
                 'tfc:plant/liana_plant')
    rm.block_tag('kelp_tree', 'tfc:plant/giant_kelp_flower',
                 'tfc:plant/giant_kelp_plant')
    rm.block_tag('kelp_flower', 'tfc:plant/giant_kelp_flower')
    rm.block_tag('kelp_branch', 'tfc:plant/giant_kelp_plant')

    # Thatch Bed
    rm.item_tag('thatch_bed_hides', 'tfc:large_raw_hide',
                'tfc:large_sheepskin_hide')
    rm.block_tag('thatch_bed_thatch', 'tfc:thatch')

    rm.block_tag('snow', 'minecraft:snow', 'minecraft:snow_block',
                 'tfc:snow_pile')

    # Valid spawn tag - grass, sand, or raw rock
    rm.block_tag('minecraft:valid_spawn',
                 *['tfc:grass/%s' % v for v in SOIL_BLOCK_VARIANTS],
                 *['tfc:sand/%s' % c for c in SAND_BLOCK_TYPES],
                 *['tfc:rock/raw/%s' % r for r in ROCKS.keys()])
Esempio n. 27
0
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')})
Esempio n. 28
0
def generate(rm: ResourceManager):
    def stone_cutting(name, item: str, result: str, count: int = 1) -> RecipeContext:
        return rm.recipe(('stonecutting', name), 'minecraft:stonecutting', {
            'ingredient': utils.ingredient(item),
            'result': result,
            'count': count
        })

    def damage_shapeless(name_parts: utils.ResourceIdentifier, ingredients: utils.Json, result: utils.Json, group: str = None, conditions: utils.Json = None) -> RecipeContext:
        res = utils.resource_location(rm.domain, name_parts)
        rm.write((*rm.resource_dir, 'data', res.domain, 'recipes', res.path), {
            'type': 'tfc:damage_inputs_crafting',
            'recipe': {
                'type': 'minecraft:crafting_shapeless',
                'group': group,
                'ingredients': utils.item_stack_list(ingredients),
                'result': utils.item_stack(result),
                'conditions': utils.recipe_condition(conditions)
            }
        })
        return RecipeContext(rm, res)

    # Rock Things
    for rock in ROCKS.keys():

        cobble = 'tfc:rock/cobble/%s' % rock
        raw = 'tfc:rock/raw/%s' % rock
        loose = 'tfc:rock/loose/%s' % rock
        hardened = 'tfc:rock/hardened/%s' % rock
        bricks = 'tfc:rock/bricks/%s' % rock
        smooth = 'tfc:rock/smooth/%s' % rock
        cracked_bricks = 'tfc:rock/cracked_bricks/%s' % rock
        chiseled = 'tfc:rock/chiseled/%s' % rock

        brick = 'tfc:brick/%s' % rock

        # Cobble <-> Loose Rocks
        rm.crafting_shapeless('crafting/rock/%s_cobble_to_loose_rocks' % rock, cobble, (4, loose)).with_advancement(cobble)
        rm.crafting_shaped('crafting/rock/%s_loose_rocks_to_cobble' % rock, ['XX', 'XX'], loose, cobble).with_advancement(loose)

        # Stairs, Slabs and Walls
        for block_type in CUTTABLE_ROCKS:
            block = 'tfc:rock/%s/%s' % (block_type, rock)

            rm.crafting_shaped('crafting/rock/%s_%s_slab' % (rock, block_type), ['XXX'], block, (6, block + '_slab')).with_advancement(block)
            rm.crafting_shaped('crafting/rock/%s_%s_stairs' % (rock, block_type), ['X  ', 'XX ', 'XXX'], block, (6, block + '_stairs')).with_advancement(block)
            rm.crafting_shaped('crafting/rock/%s_%s_wall' % (rock, block_type), ['XXX', 'XXX'], block, (6, block + '_wall')).with_advancement(block)

            # Vanilla allows stone cutting from any -> any, we only allow stairs/slabs/walls as other variants require mortar / chisel
            stone_cutting('rock/%s_%s_slab' % (rock, block_type), block, block + '_slab', 2).with_advancement(block)
            stone_cutting('rock/%s_%s_stairs' % (rock, block_type), block, block + '_stairs', 1).with_advancement(block)
            stone_cutting('rock/%s_%s_wall' % (rock, block_type), block, block + '_wall', 1).with_advancement(block)

        # Other variants
        damage_shapeless('crafting/rock/%s_smooth' % rock, (raw, 'tag!tfc:chisels'), smooth).with_advancement(raw)
        damage_shapeless('crafting/rock/%s_brick' % rock, (loose, 'tag!tfc:chisels'), brick).with_advancement(loose)
        damage_shapeless('crafting/rock/%s_chiseled' % rock, (smooth, 'tag!tfc:chisels'), chiseled).with_advancement(smooth)

        rm.crafting_shaped('crafting/rock/%s_hardened' % rock, ['XMX', 'MXM', 'XMX'], {'X': raw, 'M': 'tag!tfc:mortar'}, (2, hardened)).with_advancement(raw)
        rm.crafting_shaped('crafting/rock/%s_bricks' % rock, ['XMX', 'MXM', 'XMX'], {'X': brick, 'M': 'tag!tfc:mortar'}, (4, bricks)).with_advancement(brick)

        damage_shapeless('crafting/rock/%s_cracked' % rock, (bricks, 'tag!tfc:hammers'), cracked_bricks).with_advancement(bricks)
Esempio n. 29
0
def generate(rm: ResourceManager):
    """ Handles all landslide and collapse recipes, including the relevant tags """
    def collapse(name: str,
                 ingredient,
                 result=None,
                 copy_input: Optional[bool] = None):
        if result is None and not copy_input:
            raise RuntimeError(
                'This is probably wrong: %s has result = None and copy_input = False'
                % name)
        rm.recipe(('collapse', name), 'tfc:collapse', {
            'ingredient': ingredient,
            'result': result,
            'copy_input': copy_input
        })

    def landslide(name: str, ingredient, result):
        rm.recipe(('landslide', name), 'tfc:landslide', {
            'ingredient': ingredient,
            'result': result
        })

    for rock in ROCKS:
        raw = 'tfc:rock/raw/%s' % rock
        cobble = 'tfc:rock/cobble/%s' % rock
        mossy_cobble = 'tfc:rock/mossy_cobble/%s' % rock
        gravel = 'tfc:rock/gravel/%s' % rock
        spike = 'tfc:rock/spike/%s' % rock

        # Raw rock can TRIGGER and START, and FALL into cobble
        # Ores can FALL into cobble
        rm.block_tag('can_trigger_collapse', raw)
        rm.block_tag('can_start_collapse', raw)
        rm.block_tag('can_collapse', raw)

        collapse('%s_cobble' % rock, [
            raw, *[
                'tfc:ore/%s/%s' % (ore, rock)
                for ore, ore_data in ORES.items() if not ore_data.graded
            ], *[
                'tfc:ore/poor_%s/%s' % (ore, rock)
                for ore, ore_data in ORES.items() if ore_data.graded
            ], *[
                'tfc:ore/normal_%s/%s' % (ore, rock)
                for ore, ore_data in ORES.items() if ore_data.graded
            ], *[
                'tfc:ore/rich_%s/%s' % (ore, rock)
                for ore, ore_data in ORES.items() if ore_data.graded
            ]
        ], cobble)

        for ore, ore_data in ORES.items():
            if ore_data.graded:
                for grade in ORE_GRADES.keys():
                    rm.block_tag('can_start_collapse',
                                 'tfc:ore/%s_%s/%s' % (grade, ore, rock))
                    rm.block_tag('can_collapse',
                                 'tfc:ore/%s_%s/%s' % (grade, ore, rock))
            else:
                rm.block_tag('can_start_collapse',
                             'tfc:ore/%s/%s' % (ore, rock))
                rm.block_tag('can_collapse', 'tfc:ore/%s/%s' % (ore, rock))

        # Gravel and cobblestone have landslide recipes
        rm.block_tag('can_landslide', cobble, gravel, mossy_cobble)

        landslide('%s_cobble' % rock, cobble, cobble)
        landslide('%s_mossy_cobble' % rock, mossy_cobble, mossy_cobble)
        landslide('%s_gravel' % rock, gravel, gravel)

        # Spikes can collapse, but produce nothing
        rm.block_tag('can_collapse', spike)
        collapse('%s_spike' % rock, spike, copy_input=True)

    # Soil Blocks
    for variant in SOIL_BLOCK_VARIANTS:
        for block_type in SOIL_BLOCK_TYPES:
            rm.block_tag('can_landslide', 'tfc:%s/%s' % (block_type, variant))

        # Blocks that create normal dirt
        landslide('%s_dirt' % variant, [
            'tfc:%s/%s' % (block_type, variant)
            for block_type in ('dirt', 'grass', 'grass_path', 'farmland')
        ], 'tfc:dirt/%s' % variant)
        landslide('%s_clay_dirt' % variant, [
            'tfc:%s/%s' % (block_type, variant)
            for block_type in ('clay', 'clay_grass')
        ], 'tfc:clay/%s' % variant)

    # Sand
    for variant in SAND_BLOCK_TYPES:
        rm.block_tag('can_landslide', 'tfc:sand/%s' % variant)
        landslide('%s_sand' % variant, 'tfc:sand/%s' % variant,
                  'tfc:sand/%s' % variant)

    # Vanilla landslide blocks
    for block in ('sand', 'red_sand', 'gravel', 'cobblestone',
                  'mossy_cobblestone'):
        rm.block_tag('can_landslide', 'minecraft:%s' % block)
        landslide('vanilla_%s' % block, 'minecraft:%s' % block,
                  'minecraft:%s' % block)

    vanilla_dirt_landslides = ('grass_block', 'dirt', 'coarse_dirt', 'podzol')
    for block in vanilla_dirt_landslides:
        rm.block_tag('can_landslide', 'minecraft:%s' % block)
    landslide('vanilla_dirt',
              ['minecraft:%s' % block for block in vanilla_dirt_landslides],
              'minecraft:dirt')

    # Vanilla collapsible blocks
    for rock in ('stone', 'andesite', 'granite', 'diorite'):
        block = 'minecraft:%s' % rock
        rm.block_tag('can_trigger_collapse', block)
        rm.block_tag('can_start_collapse', block)
        rm.block_tag('can_collapse', block)

        collapse('vanilla_%s' % rock, block,
                 block if rock != 'stone' else 'minecraft:cobblestone')
Esempio n. 30
0
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')