from index import GOAL_INDEX
import os
import argparse
import re
import json
from datetime import datetime, timedelta, time


def createTriggers():

    # This is used to automatically generate all the functions that are called when a goal is achieved.

    try:
        os.mkdir('./triggers')
    except FileExistsError:
        print('Triggers directory already exists. Proceeding...')
        pass

    for goal in GOAL_INDEX:
        file = open(f'./triggers/{goal.lower()}.mcfunction', 'w')
        number = goal[1:]
        # Write most function for Most goals
        if 'M' in goal:
            file.write("execute as @s run function lockout:goals/skeleton/most {" + f'"goalid": "{goal}", "goalnum": "{ord(goal[0])}{number}", "goalname": "{GOAL_INDEX[goal][0]}"' + '}')

        # Write reversed function for Opponent goals
        elif 'N' in goal:
            file.write("execute as @s run function lockout:goals/skeleton/opponent {" + f'"goalid": "{goal}", "goalnum": "{ord(goal[0])}{number}", "goalname": "{GOAL_INDEX[goal][0]}"' + '}')

        else:
            # Write goal triggers for all other goals
            file.write("execute as @s run function lockout:goals/skeleton/master {" + f'"goalid": "{goal}", "goalnum": "{ord(goal[0])}{number}", "goalname": "{GOAL_INDEX[goal][0]}"' + '}')

        file.close()




def createListeners():

    try:
        os.mkdir('./listeners')
    except FileExistsError:
        print('Listeners directory already exists. Proceeding...')
        pass

    for goalId in GOAL_INDEX:

        template = '''{
    "criteria": {
      "<CRITERIA>": {
        "trigger": "minecraft:<TRIGGER>",
        "conditions": {
          "<CONDITION>": {
            <CONDITION_VALUE>
          }
        }
      }
    },
    "requirements": [
      [
        "<CRITERIA>"
      ]
    ],
    "rewards": {
      "function": "lockout:goals/<GOALID>"
    }
}'''

        item_template = '''{
    "criteria": {
      "<CRITERIA>": {
        "trigger": "minecraft:<TRIGGER>",
        "conditions": {
            "<CONDITION>": [
                {
                    <CONDITION_VALUE>
                }
            ]
        }
      }
    },
    "requirements": [
      [
        "<CRITERIA>"
      ]
    ],
    "rewards": {
      "function": "lockout:goals/<GOALID>"
    }
}'''
        goal = GOAL_INDEX[goalId]
        goalType = goalId[0]

        if goalType == 'I':
            criteria = 'getitem'
            item = goal[1]
            trigger = 'inventory_changed'
            condition = 'items'

            if '64' in goal[0]:
                condition_value = f'"items": "minecraft:{item}",\n"count": 64'
            else:
                condition_value = f'"items": "minecraft:{item}"'
        
            file = open(f'listeners/{goalId.lower()}.json', 'w')
            item_template = item_template.replace('<CRITERIA>', criteria)
            item_template = item_template.replace('<TRIGGER>', trigger)
            item_template = item_template.replace('<CONDITION>', condition)
            item_template = item_template.replace('<CONDITION_VALUE>', condition_value)
            item_template = item_template.replace('<GOALID>', goalId.lower())

            file.write(item_template)
            file.close()

        elif goalType == 'K':
            criteria = 'killentity'
            entity = goal[0][5:].lower().replace(' ', '_')
            trigger = 'player_killed_entity'
            condition = 'entity'
            condition_value = f'"type": "minecraft:{entity}"'
        
            file = open(f'listeners/{goalId.lower()}.json', 'w')
            template = template.replace('<CRITERIA>', criteria)
            template = template.replace('<TRIGGER>', trigger)
            template = template.replace('<CONDITION>', condition)
            template = template.replace('<CONDITION_VALUE>', condition_value)
            template = template.replace('<GOALID>', goalId.lower())

            file.write(template)
            file.close()

        elif goalType == 'D':
            criteria = 'dieto'
            entity = goal[0][7:].lower().replace(' ', '_')
            trigger = 'entity_killed_player'
            condition = 'entity'
            condition_value = f'"type": "minecraft:{entity}"'
        
            file = open(f'listeners/{goalId.lower()}.json', 'w')
            template = template.replace('<CRITERIA>', criteria)
            template = template.replace('<TRIGGER>', trigger)
            template = template.replace('<CONDITION>', condition)
            template = template.replace('<CONDITION_VALUE>', condition_value)
            template = template.replace('<GOALID>', goalId.lower())

            file.write(template)
            file.close()

        elif goalType == 'E':
            criteria = 'eat'
            food = goal[0][4:].lower().replace(' ', '_')
            trigger = 'consume_item'
            condition = 'item'
            condition_value = f'"items": "minecraft:{food}"'
        
            file = open(f'listeners/{goalId.lower()}.json', 'w')
            template = template.replace('<CRITERIA>', criteria)
            template = template.replace('<TRIGGER>', trigger)
            template = template.replace('<CONDITION>', condition)
            template = template.replace('<CONDITION_VALUE>', condition_value)
            template = template.replace('<GOALID>', goalId.lower())

            file.write(template)
            file.close()

        elif goalType == 'X' and goalId[1] == '1':
            criteria = 'effect'
            effect = goal[0][4:].lower().replace(' ', '_')
            trigger = 'effects_changed'
            condition = 'effects'
            condition_value = f'"minecraft:{effect}": ' + '{}'
        
            file = open(f'listeners/{goalId.lower()}.json', 'w')
            template = template.replace('<CRITERIA>', criteria)
            template = template.replace('<TRIGGER>', trigger)
            template = template.replace('<CONDITION>', condition)
            template = template.replace('<CONDITION_VALUE>', condition_value)
            template = template.replace('<GOALID>', goalId.lower())

            file.write(template)
            file.close()





def convertLegacyDictToModernFormat():
    # this does not change the difficulty -- that must be modified manually
    for i in goalDictionaryLegacy:
        print(f"        '{i}': ['{goalDictionaryLegacy[i][0]}', '{goalDictionaryLegacy[i][1][17:(goalDictionaryLegacy[i][1].find('comp')-3 if 'components' in goalDictionaryLegacy[i][1] else -1)].replace('\"', '\'')}', {'True' if 'components' in goalDictionaryLegacy[i][1] else 'False'}, {goalDictionaryLegacy[i][2]}],")




def createGoalIdStrings(letter, length):

    for i in range(length):
        zeros = 4 - len(str(i+1)) 
        print(letter + ("0" * zeros) + str(i+1))





item_files = '''acacia_boat.json
              acacia_button.json
              acacia_chest_boat.json
              acacia_door.json
              acacia_fence.json
              acacia_fence_gate.json
              acacia_hanging_sign.json
              acacia_planks.json
              acacia_pressure_plate.json
              acacia_sign.json
              acacia_slab.json
              acacia_stairs.json
              acacia_trapdoor.json
              acacia_wood.json
              activator_rail.json
              amethyst_block.json
              andesite.json
              andesite_slab.json
              andesite_slab_from_andesite_stonecutting.json
              andesite_stairs.json
              andesite_stairs_from_andesite_stonecutting.json
              andesite_wall.json
              andesite_wall_from_andesite_stonecutting.json
              anvil.json
              armor_dye.json
              armor_stand.json
              arrow.json
              baked_potato.json
              baked_potato_from_campfire_cooking.json
              baked_potato_from_smoking.json
              bamboo_block.json
              bamboo_button.json
              bamboo_chest_raft.json
              bamboo_door.json
              bamboo_fence.json
              bamboo_fence_gate.json
              bamboo_hanging_sign.json
              bamboo_mosaic.json
              bamboo_mosaic_slab.json
              bamboo_mosaic_stairs.json
              bamboo_planks.json
              bamboo_pressure_plate.json
              bamboo_raft.json
              bamboo_sign.json
              bamboo_slab.json
              bamboo_stairs.json
              bamboo_trapdoor.json
              banner_duplicate.json
              barrel.json
              beacon.json
              beehive.json
              beetroot_soup.json
              birch_boat.json
              birch_button.json
              birch_chest_boat.json
              birch_door.json
              birch_fence.json
              birch_fence_gate.json
              birch_hanging_sign.json
              birch_planks.json
              birch_pressure_plate.json
              birch_sign.json
              birch_slab.json
              birch_stairs.json
              birch_trapdoor.json
              birch_wood.json
              black_banner.json
              black_bed.json
              black_bundle.json
              black_candle.json
              black_carpet.json
              black_concrete_powder.json
              black_dye.json
              black_dye_from_wither_rose.json
              black_glazed_terracotta.json
              black_shulker_box.json
              black_stained_glass.json
              black_stained_glass_pane.json
              black_stained_glass_pane_from_glass_pane.json
              black_terracotta.json
              blackstone_slab.json
              blackstone_slab_from_blackstone_stonecutting.json
              blackstone_stairs.json
              blackstone_stairs_from_blackstone_stonecutting.json
              blackstone_wall.json
              blackstone_wall_from_blackstone_stonecutting.json
              blast_furnace.json
              blaze_powder.json
              blue_banner.json
              blue_bed.json
              blue_bundle.json
              blue_candle.json
              blue_carpet.json
              blue_concrete_powder.json
              blue_dye.json
              blue_dye_from_cornflower.json
              blue_glazed_terracotta.json
              blue_ice.json
              blue_shulker_box.json
              blue_stained_glass.json
              blue_stained_glass_pane.json
              blue_stained_glass_pane_from_glass_pane.json
              blue_terracotta.json
              bolt_armor_trim_smithing_template.json
              bolt_armor_trim_smithing_template_smithing_trim.json
              bone_block.json
              bone_meal.json
              bone_meal_from_bone_block.json
              book.json
              book_cloning.json
              bookshelf.json
              bordure_indented_banner_pattern.json
              bow.json
              bowl.json
              bread.json
              brewing_stand.json
              brick.json
              brick_slab.json
              brick_slab_from_bricks_stonecutting.json
              brick_stairs.json
              brick_stairs_from_bricks_stonecutting.json
              brick_wall.json
              brick_wall_from_bricks_stonecutting.json
              bricks.json
              brown_banner.json
              brown_bed.json
              brown_bundle.json
              brown_candle.json
              brown_carpet.json
              brown_concrete_powder.json
              brown_dye.json
              brown_glazed_terracotta.json
              brown_shulker_box.json
              brown_stained_glass.json
              brown_stained_glass_pane.json
              brown_stained_glass_pane_from_glass_pane.json
              brown_terracotta.json
              brush.json
              bucket.json
              bundle.json
              cake.json
              calibrated_sculk_sensor.json
              campfire.json
              candle.json
              carrot_on_a_stick.json
              cartography_table.json
              cauldron.json
              chain.json
              charcoal.json
              cherry_boat.json
              cherry_button.json
              cherry_chest_boat.json
              cherry_door.json
              cherry_fence.json
              cherry_fence_gate.json
              cherry_hanging_sign.json
              cherry_planks.json
              cherry_pressure_plate.json
              cherry_sign.json
              cherry_slab.json
              cherry_stairs.json
              cherry_trapdoor.json
              cherry_wood.json
              chest.json
              chest_minecart.json
              chiseled_bookshelf.json
              chiseled_copper.json
              chiseled_copper_from_copper_block_stonecutting.json
              chiseled_copper_from_cut_copper_stonecutting.json
              chiseled_deepslate.json
              chiseled_deepslate_from_cobbled_deepslate_stonecutting.json
              chiseled_nether_bricks.json
              chiseled_nether_bricks_from_nether_bricks_stonecutting.json
              chiseled_polished_blackstone.json
              chiseled_polished_blackstone_from_blackstone_stonecutting.json
              chiseled_polished_blackstone_from_polished_blackstone_stonecutting.json
              chiseled_quartz_block.json
              chiseled_quartz_block_from_quartz_block_stonecutting.json
              chiseled_red_sandstone.json
              chiseled_red_sandstone_from_red_sandstone_stonecutting.json
              chiseled_resin_bricks.json
              chiseled_resin_bricks_from_resin_bricks_stonecutting.json
              chiseled_sandstone.json
              chiseled_sandstone_from_sandstone_stonecutting.json
              chiseled_stone_bricks.json
              chiseled_stone_bricks_from_stone_bricks_stonecutting.json
              chiseled_stone_bricks_stone_from_stonecutting.json
              chiseled_tuff.json
              chiseled_tuff_bricks.json
              chiseled_tuff_bricks_from_polished_tuff_stonecutting.json
              chiseled_tuff_bricks_from_tuff_bricks_stonecutting.json
              chiseled_tuff_bricks_from_tuff_stonecutting.json
              chiseled_tuff_from_tuff_stonecutting.json
              clay.json
              clock.json
              coal.json
              coal_block.json
              coal_from_blasting_coal_ore.json
              coal_from_blasting_deepslate_coal_ore.json
              coal_from_smelting_coal_ore.json
              coal_from_smelting_deepslate_coal_ore.json
              coarse_dirt.json
              coast_armor_trim_smithing_template.json
              coast_armor_trim_smithing_template_smithing_trim.json
              cobbled_deepslate_slab.json
              cobbled_deepslate_slab_from_cobbled_deepslate_stonecutting.json
              cobbled_deepslate_stairs.json
              cobbled_deepslate_stairs_from_cobbled_deepslate_stonecutting.json
              cobbled_deepslate_wall.json
              cobbled_deepslate_wall_from_cobbled_deepslate_stonecutting.json
              cobblestone_slab.json
              cobblestone_slab_from_cobblestone_stonecutting.json
              cobblestone_stairs.json
              cobblestone_stairs_from_cobblestone_stonecutting.json
              cobblestone_wall.json
              cobblestone_wall_from_cobblestone_stonecutting.json
              comparator.json
              compass.json
              composter.json
              conduit.json
              cooked_beef.json
              cooked_beef_from_campfire_cooking.json
              cooked_beef_from_smoking.json
              cooked_chicken.json
              cooked_chicken_from_campfire_cooking.json
              cooked_chicken_from_smoking.json
              cooked_cod.json
              cooked_cod_from_campfire_cooking.json
              cooked_cod_from_smoking.json
              cooked_mutton.json
              cooked_mutton_from_campfire_cooking.json
              cooked_mutton_from_smoking.json
              cooked_porkchop.json
              cooked_porkchop_from_campfire_cooking.json
              cooked_porkchop_from_smoking.json
              cooked_rabbit.json
              cooked_rabbit_from_campfire_cooking.json
              cooked_rabbit_from_smoking.json
              cooked_salmon.json
              cooked_salmon_from_campfire_cooking.json
              cooked_salmon_from_smoking.json
              cookie.json
              copper_block.json
              copper_bulb.json
              copper_door.json
              copper_grate.json
              copper_grate_from_copper_block_stonecutting.json
              copper_ingot.json
              copper_ingot_from_blasting_copper_ore.json
              copper_ingot_from_blasting_deepslate_copper_ore.json
              copper_ingot_from_blasting_raw_copper.json
              copper_ingot_from_smelting_copper_ore.json
              copper_ingot_from_smelting_deepslate_copper_ore.json
              copper_ingot_from_smelting_raw_copper.json
              copper_ingot_from_waxed_copper_block.json
              copper_trapdoor.json
              cracked_deepslate_bricks.json
              cracked_deepslate_tiles.json
              cracked_nether_bricks.json
              cracked_polished_blackstone_bricks.json
              cracked_stone_bricks.json
              crafter.json
              crafting_table.json
              creaking_heart.json
              creeper_banner_pattern.json
              crimson_button.json
              crimson_door.json
              crimson_fence.json
              crimson_fence_gate.json
              crimson_hanging_sign.json
              crimson_hyphae.json
              crimson_planks.json
              crimson_pressure_plate.json
              crimson_sign.json
              crimson_slab.json
              crimson_stairs.json
              crimson_trapdoor.json
              crossbow.json
              cut_copper.json
              cut_copper_from_copper_block_stonecutting.json
              cut_copper_slab.json
              cut_copper_slab_from_copper_block_stonecutting.json
              cut_copper_slab_from_cut_copper_stonecutting.json
              cut_copper_stairs.json
              cut_copper_stairs_from_copper_block_stonecutting.json
              cut_copper_stairs_from_cut_copper_stonecutting.json
              cut_red_sandstone.json
              cut_red_sandstone_from_red_sandstone_stonecutting.json
              cut_red_sandstone_slab.json
              cut_red_sandstone_slab_from_cut_red_sandstone_stonecutting.json
              cut_red_sandstone_slab_from_red_sandstone_stonecutting.json
              cut_sandstone.json
              cut_sandstone_from_sandstone_stonecutting.json
              cut_sandstone_slab.json
              cut_sandstone_slab_from_cut_sandstone_stonecutting.json
              cut_sandstone_slab_from_sandstone_stonecutting.json
              cyan_banner.json
              cyan_bed.json
              cyan_bundle.json
              cyan_candle.json
              cyan_carpet.json
              cyan_concrete_powder.json
              cyan_dye.json
              cyan_dye_from_pitcher_plant.json
              cyan_glazed_terracotta.json
              cyan_shulker_box.json
              cyan_stained_glass.json
              cyan_stained_glass_pane.json
              cyan_stained_glass_pane_from_glass_pane.json
              cyan_terracotta.json
              dark_oak_boat.json
              dark_oak_button.json
              dark_oak_chest_boat.json
              dark_oak_door.json
              dark_oak_fence.json
              dark_oak_fence_gate.json
              dark_oak_hanging_sign.json
              dark_oak_planks.json
              dark_oak_pressure_plate.json
              dark_oak_sign.json
              dark_oak_slab.json
              dark_oak_stairs.json
              dark_oak_trapdoor.json
              dark_oak_wood.json
              dark_prismarine.json
              dark_prismarine_slab.json
              dark_prismarine_slab_from_dark_prismarine_stonecutting.json
              dark_prismarine_stairs.json
              dark_prismarine_stairs_from_dark_prismarine_stonecutting.json
              daylight_detector.json
              decorated_pot.json
              decorated_pot_simple.json
              deepslate.json
              deepslate_brick_slab.json
              deepslate_brick_slab_from_cobbled_deepslate_stonecutting.json
              deepslate_brick_slab_from_deepslate_bricks_stonecutting.json
              deepslate_brick_slab_from_polished_deepslate_stonecutting.json
              deepslate_brick_stairs.json
              deepslate_brick_stairs_from_cobbled_deepslate_stonecutting.json
              deepslate_brick_stairs_from_deepslate_bricks_stonecutting.json
              deepslate_brick_stairs_from_polished_deepslate_stonecutting.json
              deepslate_brick_wall.json
              deepslate_brick_wall_from_cobbled_deepslate_stonecutting.json
              deepslate_brick_wall_from_deepslate_bricks_stonecutting.json
              deepslate_brick_wall_from_polished_deepslate_stonecutting.json
              deepslate_bricks.json
              deepslate_bricks_from_cobbled_deepslate_stonecutting.json
              deepslate_bricks_from_polished_deepslate_stonecutting.json
              deepslate_tile_slab.json
              deepslate_tile_slab_from_cobbled_deepslate_stonecutting.json
              deepslate_tile_slab_from_deepslate_bricks_stonecutting.json
              deepslate_tile_slab_from_deepslate_tiles_stonecutting.json
              deepslate_tile_slab_from_polished_deepslate_stonecutting.json
              deepslate_tile_stairs.json
              deepslate_tile_stairs_from_cobbled_deepslate_stonecutting.json
              deepslate_tile_stairs_from_deepslate_bricks_stonecutting.json
              deepslate_tile_stairs_from_deepslate_tiles_stonecutting.json
              deepslate_tile_stairs_from_polished_deepslate_stonecutting.json
              deepslate_tile_wall.json
              deepslate_tile_wall_from_cobbled_deepslate_stonecutting.json
              deepslate_tile_wall_from_deepslate_bricks_stonecutting.json
              deepslate_tile_wall_from_deepslate_tiles_stonecutting.json
              deepslate_tile_wall_from_polished_deepslate_stonecutting.json
              deepslate_tiles.json
              deepslate_tiles_from_cobbled_deepslate_stonecutting.json
              deepslate_tiles_from_deepslate_bricks_stonecutting.json
              deepslate_tiles_from_polished_deepslate_stonecutting.json
              detector_rail.json
              diamond.json
              diamond_axe.json
              diamond_block.json
              diamond_boots.json
              diamond_chestplate.json
              diamond_from_blasting_deepslate_diamond_ore.json
              diamond_from_blasting_diamond_ore.json
              diamond_from_smelting_deepslate_diamond_ore.json
              diamond_from_smelting_diamond_ore.json
              diamond_helmet.json
              diamond_hoe.json
              diamond_leggings.json
              diamond_pickaxe.json
              diamond_shovel.json
              diamond_sword.json
              diorite.json
              diorite_slab.json
              diorite_slab_from_diorite_stonecutting.json
              diorite_stairs.json
              diorite_stairs_from_diorite_stonecutting.json
              diorite_wall.json
              diorite_wall_from_diorite_stonecutting.json
              dispenser.json
              dried_kelp.json
              dried_kelp_block.json
              dried_kelp_from_campfire_cooking.json
              dried_kelp_from_smelting.json
              dried_kelp_from_smoking.json
              dripstone_block.json
              dropper.json
              dune_armor_trim_smithing_template.json
              dune_armor_trim_smithing_template_smithing_trim.json
              dye_black_bed.json
              dye_black_carpet.json
              dye_black_wool.json
              dye_blue_bed.json
              dye_blue_carpet.json
              dye_blue_wool.json
              dye_brown_bed.json
              dye_brown_carpet.json
              dye_brown_wool.json
              dye_cyan_bed.json
              dye_cyan_carpet.json
              dye_cyan_wool.json
              dye_gray_bed.json
              dye_gray_carpet.json
              dye_gray_wool.json
              dye_green_bed.json
              dye_green_carpet.json
              dye_green_wool.json
              dye_light_blue_bed.json
              dye_light_blue_carpet.json
              dye_light_blue_wool.json
              dye_light_gray_bed.json
              dye_light_gray_carpet.json
              dye_light_gray_wool.json
              dye_lime_bed.json
              dye_lime_carpet.json
              dye_lime_wool.json
              dye_magenta_bed.json
              dye_magenta_carpet.json
              dye_magenta_wool.json
              dye_orange_bed.json
              dye_orange_carpet.json
              dye_orange_wool.json
              dye_pink_bed.json
              dye_pink_carpet.json
              dye_pink_wool.json
              dye_purple_bed.json
              dye_purple_carpet.json
              dye_purple_wool.json
              dye_red_bed.json
              dye_red_carpet.json
              dye_red_wool.json
              dye_white_bed.json
              dye_white_carpet.json
              dye_white_wool.json
              dye_yellow_bed.json
              dye_yellow_carpet.json
              dye_yellow_wool.json
              emerald.json
              emerald_block.json
              emerald_from_blasting_deepslate_emerald_ore.json
              emerald_from_blasting_emerald_ore.json
              emerald_from_smelting_deepslate_emerald_ore.json
              emerald_from_smelting_emerald_ore.json
              enchanting_table.json
              end_crystal.json
              end_rod.json
              end_stone_brick_slab.json
              end_stone_brick_slab_from_end_stone_brick_stonecutting.json
              end_stone_brick_slab_from_end_stone_stonecutting.json
              end_stone_brick_stairs.json
              end_stone_brick_stairs_from_end_stone_brick_stonecutting.json
              end_stone_brick_stairs_from_end_stone_stonecutting.json
              end_stone_brick_wall.json
              end_stone_brick_wall_from_end_stone_brick_stonecutting.json
              end_stone_brick_wall_from_end_stone_stonecutting.json
              end_stone_bricks.json
              end_stone_bricks_from_end_stone_stonecutting.json
              ender_chest.json
              ender_eye.json
              exposed_chiseled_copper.json
              exposed_chiseled_copper_from_exposed_copper_stonecutting.json
              exposed_chiseled_copper_from_exposed_cut_copper_stonecutting.json
              exposed_copper_bulb.json
              exposed_copper_grate.json
              exposed_copper_grate_from_exposed_copper_stonecutting.json
              exposed_cut_copper.json
              exposed_cut_copper_from_exposed_copper_stonecutting.json
              exposed_cut_copper_slab.json
              exposed_cut_copper_slab_from_exposed_copper_stonecutting.json
              exposed_cut_copper_slab_from_exposed_cut_copper_stonecutting.json
              exposed_cut_copper_stairs.json
              exposed_cut_copper_stairs_from_exposed_copper_stonecutting.json
              exposed_cut_copper_stairs_from_exposed_cut_copper_stonecutting.json
              eye_armor_trim_smithing_template.json
              eye_armor_trim_smithing_template_smithing_trim.json
              fermented_spider_eye.json
              field_masoned_banner_pattern.json
              fire_charge.json
              firework_rocket.json
              firework_rocket_simple.json
              firework_star.json
              firework_star_fade.json
              fishing_rod.json
              fletching_table.json
              flint_and_steel.json
              flow_armor_trim_smithing_template.json
              flow_armor_trim_smithing_template_smithing_trim.json
              flower_banner_pattern.json
              flower_pot.json
              furnace.json
              furnace_minecart.json
              glass.json
              glass_bottle.json
              glass_pane.json
              glistering_melon_slice.json
              glow_item_frame.json
              glowstone.json
              gold_block.json
              gold_ingot_from_blasting_deepslate_gold_ore.json
              gold_ingot_from_blasting_gold_ore.json
              gold_ingot_from_blasting_nether_gold_ore.json
              gold_ingot_from_blasting_raw_gold.json
              gold_ingot_from_gold_block.json
              gold_ingot_from_nuggets.json
              gold_ingot_from_smelting_deepslate_gold_ore.json
              gold_ingot_from_smelting_gold_ore.json
              gold_ingot_from_smelting_nether_gold_ore.json
              gold_ingot_from_smelting_raw_gold.json
              gold_nugget.json
              gold_nugget_from_blasting.json
              gold_nugget_from_smelting.json
              golden_apple.json
              golden_axe.json
              golden_boots.json
              golden_carrot.json
              golden_chestplate.json
              golden_helmet.json
              golden_hoe.json
              golden_leggings.json
              golden_pickaxe.json
              golden_shovel.json
              golden_sword.json
              granite.json
              granite_slab.json
              granite_slab_from_granite_stonecutting.json
              granite_stairs.json
              granite_stairs_from_granite_stonecutting.json
              granite_wall.json
              granite_wall_from_granite_stonecutting.json
              gray_banner.json
              gray_bed.json
              gray_bundle.json
              gray_candle.json
              gray_carpet.json
              gray_concrete_powder.json
              gray_dye.json
              gray_dye_from_closed_eyeblossom.json
              gray_glazed_terracotta.json
              gray_shulker_box.json
              gray_stained_glass.json
              gray_stained_glass_pane.json
              gray_stained_glass_pane_from_glass_pane.json
              gray_terracotta.json
              green_banner.json
              green_bed.json
              green_bundle.json
              green_candle.json
              green_carpet.json
              green_concrete_powder.json
              green_dye.json
              green_glazed_terracotta.json
              green_shulker_box.json
              green_stained_glass.json
              green_stained_glass_pane.json
              green_stained_glass_pane_from_glass_pane.json
              green_terracotta.json
              grindstone.json
              hay_block.json
              heavy_weighted_pressure_plate.json
              honey_block.json
              honey_bottle.json
              honeycomb_block.json
              hopper.json
              hopper_minecart.json
              host_armor_trim_smithing_template.json
              host_armor_trim_smithing_template_smithing_trim.json
              iron_axe.json
              iron_bars.json
              iron_block.json
              iron_boots.json
              iron_chestplate.json
              iron_door.json
              iron_helmet.json
              iron_hoe.json
              iron_ingot_from_blasting_deepslate_iron_ore.json
              iron_ingot_from_blasting_iron_ore.json
              iron_ingot_from_blasting_raw_iron.json
              iron_ingot_from_iron_block.json
              iron_ingot_from_nuggets.json
              iron_ingot_from_smelting_deepslate_iron_ore.json
              iron_ingot_from_smelting_iron_ore.json
              iron_ingot_from_smelting_raw_iron.json
              iron_leggings.json
              iron_nugget.json
              iron_nugget_from_blasting.json
              iron_nugget_from_smelting.json
              iron_pickaxe.json
              iron_shovel.json
              iron_sword.json
              iron_trapdoor.json
              item_frame.json
              jack_o_lantern.json
              jukebox.json
              jungle_boat.json
              jungle_button.json
              jungle_chest_boat.json
              jungle_door.json
              jungle_fence.json
              jungle_fence_gate.json
              jungle_hanging_sign.json
              jungle_planks.json
              jungle_pressure_plate.json
              jungle_sign.json
              jungle_slab.json
              jungle_stairs.json
              jungle_trapdoor.json
              jungle_wood.json
              ladder.json
              lantern.json
              lapis_block.json
              lapis_lazuli.json
              lapis_lazuli_from_blasting_deepslate_lapis_ore.json
              lapis_lazuli_from_blasting_lapis_ore.json
              lapis_lazuli_from_smelting_deepslate_lapis_ore.json
              lapis_lazuli_from_smelting_lapis_ore.json
              lead.json
              leather.json
              leather_boots.json
              leather_chestplate.json
              leather_helmet.json
              leather_horse_armor.json
              leather_leggings.json
              lectern.json
              lever.json
              light_blue_banner.json
              light_blue_bed.json
              light_blue_bundle.json
              light_blue_candle.json
              light_blue_carpet.json
              light_blue_concrete_powder.json
              light_blue_dye_from_blue_orchid.json
              light_blue_dye_from_blue_white_dye.json
              light_blue_glazed_terracotta.json
              light_blue_shulker_box.json
              light_blue_stained_glass.json
              light_blue_stained_glass_pane.json
              light_blue_stained_glass_pane_from_glass_pane.json
              light_blue_terracotta.json
              light_gray_banner.json
              light_gray_bed.json
              light_gray_bundle.json
              light_gray_candle.json
              light_gray_carpet.json
              light_gray_concrete_powder.json
              light_gray_dye_from_azure_bluet.json
              light_gray_dye_from_black_white_dye.json
              light_gray_dye_from_gray_white_dye.json
              light_gray_dye_from_oxeye_daisy.json
              light_gray_dye_from_white_tulip.json
              light_gray_glazed_terracotta.json
              light_gray_shulker_box.json
              light_gray_stained_glass.json
              light_gray_stained_glass_pane.json
              light_gray_stained_glass_pane_from_glass_pane.json
              light_gray_terracotta.json
              light_weighted_pressure_plate.json
              lightning_rod.json
              lime_banner.json
              lime_bed.json
              lime_bundle.json
              lime_candle.json
              lime_carpet.json
              lime_concrete_powder.json
              lime_dye.json
              lime_dye_from_smelting.json
              lime_glazed_terracotta.json
              lime_shulker_box.json
              lime_stained_glass.json
              lime_stained_glass_pane.json
              lime_stained_glass_pane_from_glass_pane.json
              lime_terracotta.json
              lodestone.json
              loom.json
              mace.json
              magenta_banner.json
              magenta_bed.json
              magenta_bundle.json
              magenta_candle.json
              magenta_carpet.json
              magenta_concrete_powder.json
              magenta_dye_from_allium.json
              magenta_dye_from_blue_red_pink.json
              magenta_dye_from_blue_red_white_dye.json
              magenta_dye_from_lilac.json
              magenta_dye_from_purple_and_pink.json
              magenta_glazed_terracotta.json
              magenta_shulker_box.json
              magenta_stained_glass.json
              magenta_stained_glass_pane.json
              magenta_stained_glass_pane_from_glass_pane.json
              magenta_terracotta.json
              magma_block.json
              magma_cream.json
              mangrove_boat.json
              mangrove_button.json
              mangrove_chest_boat.json
              mangrove_door.json
              mangrove_fence.json
              mangrove_fence_gate.json
              mangrove_hanging_sign.json
              mangrove_planks.json
              mangrove_pressure_plate.json
              mangrove_sign.json
              mangrove_slab.json
              mangrove_stairs.json
              mangrove_trapdoor.json
              mangrove_wood.json
              map.json
              map_cloning.json
              map_extending.json
              melon.json
              melon_seeds.json
              minecart.json
              mojang_banner_pattern.json
              moss_carpet.json
              mossy_cobblestone_from_moss_block.json
              mossy_cobblestone_from_vine.json
              mossy_cobblestone_slab.json
              mossy_cobblestone_slab_from_mossy_cobblestone_stonecutting.json
              mossy_cobblestone_stairs.json
              mossy_cobblestone_stairs_from_mossy_cobblestone_stonecutting.json
              mossy_cobblestone_wall.json
              mossy_cobblestone_wall_from_mossy_cobblestone_stonecutting.json
              mossy_stone_brick_slab.json
              mossy_stone_brick_slab_from_mossy_stone_brick_stonecutting.json
              mossy_stone_brick_stairs.json
              mossy_stone_brick_stairs_from_mossy_stone_brick_stonecutting.json
              mossy_stone_brick_wall.json
              mossy_stone_brick_wall_from_mossy_stone_brick_stonecutting.json
              mossy_stone_bricks_from_moss_block.json
              mossy_stone_bricks_from_vine.json
              mud_brick_slab.json
              mud_brick_slab_from_mud_bricks_stonecutting.json
              mud_brick_stairs.json
              mud_brick_stairs_from_mud_bricks_stonecutting.json
              mud_brick_wall.json
              mud_brick_wall_from_mud_bricks_stonecutting.json
              mud_bricks.json
              muddy_mangrove_roots.json
              mushroom_stew.json
              music_disc_5.json
              nether_brick.json
              nether_brick_fence.json
              nether_brick_slab.json
              nether_brick_slab_from_nether_bricks_stonecutting.json
              nether_brick_stairs.json
              nether_brick_stairs_from_nether_bricks_stonecutting.json
              nether_brick_wall.json
              nether_brick_wall_from_nether_bricks_stonecutting.json
              nether_bricks.json
              nether_wart_block.json
              netherite_axe_smithing.json
              netherite_block.json
              netherite_boots_smithing.json
              netherite_chestplate_smithing.json
              netherite_helmet_smithing.json
              netherite_hoe_smithing.json
              netherite_ingot.json
              netherite_ingot_from_netherite_block.json
              netherite_leggings_smithing.json
              netherite_pickaxe_smithing.json
              netherite_scrap.json
              netherite_scrap_from_blasting.json
              netherite_shovel_smithing.json
              netherite_sword_smithing.json
              netherite_upgrade_smithing_template.json
              note_block.json
              oak_boat.json
              oak_button.json
              oak_chest_boat.json
              oak_door.json
              oak_fence.json
              oak_fence_gate.json
              oak_hanging_sign.json
              oak_planks.json
              oak_pressure_plate.json
              oak_sign.json
              oak_slab.json
              oak_stairs.json
              oak_trapdoor.json
              oak_wood.json
              observer.json
              orange_banner.json
              orange_bed.json
              orange_bundle.json
              orange_candle.json
              orange_carpet.json
              orange_concrete_powder.json
              orange_dye_from_open_eyeblossom.json
              orange_dye_from_orange_tulip.json
              orange_dye_from_red_yellow.json
              orange_dye_from_torchflower.json
              orange_glazed_terracotta.json
              orange_shulker_box.json
              orange_stained_glass.json
              orange_stained_glass_pane.json
              orange_stained_glass_pane_from_glass_pane.json
              orange_terracotta.json
              oxidized_chiseled_copper.json
              oxidized_chiseled_copper_from_oxidized_copper_stonecutting.json
              oxidized_chiseled_copper_from_oxidized_cut_copper_stonecutting.json
              oxidized_copper_bulb.json
              oxidized_copper_grate.json
              oxidized_copper_grate_from_oxidized_copper_stonecutting.json
              oxidized_cut_copper.json
              oxidized_cut_copper_from_oxidized_copper_stonecutting.json
              oxidized_cut_copper_slab.json
              oxidized_cut_copper_slab_from_oxidized_copper_stonecutting.json
              oxidized_cut_copper_slab_from_oxidized_cut_copper_stonecutting.json
              oxidized_cut_copper_stairs.json
              oxidized_cut_copper_stairs_from_oxidized_copper_stonecutting.json
              oxidized_cut_copper_stairs_from_oxidized_cut_copper_stonecutting.json
              packed_ice.json
              packed_mud.json
              painting.json
              pale_moss_carpet.json
              pale_oak_boat.json
              pale_oak_button.json
              pale_oak_chest_boat.json
              pale_oak_door.json
              pale_oak_fence.json
              pale_oak_fence_gate.json
              pale_oak_hanging_sign.json
              pale_oak_planks.json
              pale_oak_pressure_plate.json
              pale_oak_sign.json
              pale_oak_slab.json
              pale_oak_stairs.json
              pale_oak_trapdoor.json
              pale_oak_wood.json
              paper.json
              pink_banner.json
              pink_bed.json
              pink_bundle.json
              pink_candle.json
              pink_carpet.json
              pink_concrete_powder.json
              pink_dye_from_peony.json
              pink_dye_from_pink_petals.json
              pink_dye_from_pink_tulip.json
              pink_dye_from_red_white_dye.json
              pink_glazed_terracotta.json
              pink_shulker_box.json
              pink_stained_glass.json
              pink_stained_glass_pane.json
              pink_stained_glass_pane_from_glass_pane.json
              pink_terracotta.json
              piston.json
              polished_andesite.json
              polished_andesite_from_andesite_stonecutting.json
              polished_andesite_slab.json
              polished_andesite_slab_from_andesite_stonecutting.json
              polished_andesite_slab_from_polished_andesite_stonecutting.json
              polished_andesite_stairs.json
              polished_andesite_stairs_from_andesite_stonecutting.json
              polished_andesite_stairs_from_polished_andesite_stonecutting.json
              polished_basalt.json
              polished_basalt_from_basalt_stonecutting.json
              polished_blackstone.json
              polished_blackstone_brick_slab.json
              polished_blackstone_brick_slab_from_blackstone_stonecutting.json
              polished_blackstone_brick_slab_from_polished_blackstone_bricks_stonecutting.json
              polished_blackstone_brick_slab_from_polished_blackstone_stonecutting.json
              polished_blackstone_brick_stairs.json
              polished_blackstone_brick_stairs_from_blackstone_stonecutting.json
              polished_blackstone_brick_stairs_from_polished_blackstone_bricks_stonecutting.json
              polished_blackstone_brick_stairs_from_polished_blackstone_stonecutting.json
              polished_blackstone_brick_wall.json
              polished_blackstone_brick_wall_from_blackstone_stonecutting.json
              polished_blackstone_brick_wall_from_polished_blackstone_bricks_stonecutting.json
              polished_blackstone_brick_wall_from_polished_blackstone_stonecutting.json
              polished_blackstone_bricks.json
              polished_blackstone_bricks_from_blackstone_stonecutting.json
              polished_blackstone_bricks_from_polished_blackstone_stonecutting.json
              polished_blackstone_button.json
              polished_blackstone_from_blackstone_stonecutting.json
              polished_blackstone_pressure_plate.json
              polished_blackstone_slab.json
              polished_blackstone_slab_from_blackstone_stonecutting.json
              polished_blackstone_slab_from_polished_blackstone_stonecutting.json
              polished_blackstone_stairs.json
              polished_blackstone_stairs_from_blackstone_stonecutting.json
              polished_blackstone_stairs_from_polished_blackstone_stonecutting.json
              polished_blackstone_wall.json
              polished_blackstone_wall_from_blackstone_stonecutting.json
              polished_blackstone_wall_from_polished_blackstone_stonecutting.json
              polished_deepslate.json
              polished_deepslate_from_cobbled_deepslate_stonecutting.json
              polished_deepslate_slab.json
              polished_deepslate_slab_from_cobbled_deepslate_stonecutting.json
              polished_deepslate_slab_from_polished_deepslate_stonecutting.json
              polished_deepslate_stairs.json
              polished_deepslate_stairs_from_cobbled_deepslate_stonecutting.json
              polished_deepslate_stairs_from_polished_deepslate_stonecutting.json
              polished_deepslate_wall.json
              polished_deepslate_wall_from_cobbled_deepslate_stonecutting.json
              polished_deepslate_wall_from_polished_deepslate_stonecutting.json
              polished_diorite.json
              polished_diorite_from_diorite_stonecutting.json
              polished_diorite_slab.json
              polished_diorite_slab_from_diorite_stonecutting.json
              polished_diorite_slab_from_polished_diorite_stonecutting.json
              polished_diorite_stairs.json
              polished_diorite_stairs_from_diorite_stonecutting.json
              polished_diorite_stairs_from_polished_diorite_stonecutting.json
              polished_granite.json
              polished_granite_from_granite_stonecutting.json
              polished_granite_slab.json
              polished_granite_slab_from_granite_stonecutting.json
              polished_granite_slab_from_polished_granite_stonecutting.json
              polished_granite_stairs.json
              polished_granite_stairs_from_granite_stonecutting.json
              polished_granite_stairs_from_polished_granite_stonecutting.json
              polished_tuff.json
              polished_tuff_from_tuff_stonecutting.json
              polished_tuff_slab.json
              polished_tuff_slab_from_polished_tuff_stonecutting.json
              polished_tuff_slab_from_tuff_stonecutting.json
              polished_tuff_stairs.json
              polished_tuff_stairs_from_polished_tuff_stonecutting.json
              polished_tuff_stairs_from_tuff_stonecutting.json
              polished_tuff_wall.json
              polished_tuff_wall_from_polished_tuff_stonecutting.json
              polished_tuff_wall_from_tuff_stonecutting.json
              popped_chorus_fruit.json
              powered_rail.json
              prismarine.json
              prismarine_brick_slab.json
              prismarine_brick_slab_from_prismarine_stonecutting.json
              prismarine_brick_stairs.json
              prismarine_brick_stairs_from_prismarine_stonecutting.json
              prismarine_bricks.json
              prismarine_slab.json
              prismarine_slab_from_prismarine_stonecutting.json
              prismarine_stairs.json
              prismarine_stairs_from_prismarine_stonecutting.json
              prismarine_wall.json
              prismarine_wall_from_prismarine_stonecutting.json
              pumpkin_pie.json
              pumpkin_seeds.json
              purple_banner.json
              purple_bed.json
              purple_bundle.json
              purple_candle.json
              purple_carpet.json
              purple_concrete_powder.json
              purple_dye.json
              purple_glazed_terracotta.json
              purple_shulker_box.json
              purple_stained_glass.json
              purple_stained_glass_pane.json
              purple_stained_glass_pane_from_glass_pane.json
              purple_terracotta.json
              purpur_block.json
              purpur_pillar.json
              purpur_pillar_from_purpur_block_stonecutting.json
              purpur_slab.json
              purpur_slab_from_purpur_block_stonecutting.json
              purpur_stairs.json
              purpur_stairs_from_purpur_block_stonecutting.json
              quartz.json
              quartz_block.json
              quartz_bricks.json
              quartz_bricks_from_quartz_block_stonecutting.json
              quartz_from_blasting.json
              quartz_pillar.json
              quartz_pillar_from_quartz_block_stonecutting.json
              quartz_slab.json
              quartz_slab_from_stonecutting.json
              quartz_stairs.json
              quartz_stairs_from_quartz_block_stonecutting.json
              rabbit_stew_from_brown_mushroom.json
              rabbit_stew_from_red_mushroom.json
              rail.json
              raiser_armor_trim_smithing_template.json
              raiser_armor_trim_smithing_template_smithing_trim.json
              raw_copper.json
              raw_copper_block.json
              raw_gold.json
              raw_gold_block.json
              raw_iron.json
              raw_iron_block.json
              recovery_compass.json
              red_banner.json
              red_bed.json
              red_bundle.json
              red_candle.json
              red_carpet.json
              red_concrete_powder.json
              red_dye_from_beetroot.json
              red_dye_from_poppy.json
              red_dye_from_rose_bush.json
              red_dye_from_tulip.json
              red_glazed_terracotta.json
              red_nether_brick_slab.json
              red_nether_brick_slab_from_red_nether_bricks_stonecutting.json
              red_nether_brick_stairs.json
              red_nether_brick_stairs_from_red_nether_bricks_stonecutting.json
              red_nether_brick_wall.json
              red_nether_brick_wall_from_red_nether_bricks_stonecutting.json
              red_nether_bricks.json
              red_sandstone.json
              red_sandstone_slab.json
              red_sandstone_slab_from_red_sandstone_stonecutting.json
              red_sandstone_stairs.json
              red_sandstone_stairs_from_red_sandstone_stonecutting.json
              red_sandstone_wall.json
              red_sandstone_wall_from_red_sandstone_stonecutting.json
              red_shulker_box.json
              red_stained_glass.json
              red_stained_glass_pane.json
              red_stained_glass_pane_from_glass_pane.json
              red_terracotta.json
              redstone.json
              redstone_block.json
              redstone_from_blasting_deepslate_redstone_ore.json
              redstone_from_blasting_redstone_ore.json
              redstone_from_smelting_deepslate_redstone_ore.json
              redstone_from_smelting_redstone_ore.json
              redstone_lamp.json
              redstone_torch.json
              repair_item.json
              repeater.json
              resin_block.json
              resin_brick.json
              resin_brick_slab.json
              resin_brick_slab_from_resin_bricks_stonecutting.json
              resin_brick_stairs.json
              resin_brick_stairs_from_resin_bricks_stonecutting.json
              resin_brick_wall.json
              resin_brick_wall_from_resin_bricks_stonecutting.json
              resin_bricks.json
              resin_clump.json
              respawn_anchor.json
              rib_armor_trim_smithing_template.json
              rib_armor_trim_smithing_template_smithing_trim.json
              sandstone.json
              sandstone_slab.json
              sandstone_slab_from_sandstone_stonecutting.json
              sandstone_stairs.json
              sandstone_stairs_from_sandstone_stonecutting.json
              sandstone_wall.json
              sandstone_wall_from_sandstone_stonecutting.json
              scaffolding.json
              sea_lantern.json
              sentry_armor_trim_smithing_template.json
              sentry_armor_trim_smithing_template_smithing_trim.json
              shaper_armor_trim_smithing_template.json
              shaper_armor_trim_smithing_template_smithing_trim.json
              shears.json
              shield.json
              shield_decoration.json
              shulker_box.json
              silence_armor_trim_smithing_template.json
              silence_armor_trim_smithing_template_smithing_trim.json
              skull_banner_pattern.json
              slime_ball.json
              slime_block.json
              smithing_table.json
              smoker.json
              smooth_basalt.json
              smooth_quartz.json
              smooth_quartz_slab.json
              smooth_quartz_slab_from_smooth_quartz_stonecutting.json
              smooth_quartz_stairs.json
              smooth_quartz_stairs_from_smooth_quartz_stonecutting.json
              smooth_red_sandstone.json
              smooth_red_sandstone_slab.json
              smooth_red_sandstone_slab_from_smooth_red_sandstone_stonecutting.json
              smooth_red_sandstone_stairs.json
              smooth_red_sandstone_stairs_from_smooth_red_sandstone_stonecutting.json
              smooth_sandstone.json
              smooth_sandstone_slab.json
              smooth_sandstone_slab_from_smooth_sandstone_stonecutting.json
              smooth_sandstone_stairs.json
              smooth_sandstone_stairs_from_smooth_sandstone_stonecutting.json
              smooth_stone.json
              smooth_stone_slab.json
              smooth_stone_slab_from_smooth_stone_stonecutting.json
              snout_armor_trim_smithing_template.json
              snout_armor_trim_smithing_template_smithing_trim.json
              snow.json
              snow_block.json
              soul_campfire.json
              soul_lantern.json
              soul_torch.json
              spectral_arrow.json
              spire_armor_trim_smithing_template.json
              spire_armor_trim_smithing_template_smithing_trim.json
              sponge.json
              spruce_boat.json
              spruce_button.json
              spruce_chest_boat.json
              spruce_door.json
              spruce_fence.json
              spruce_fence_gate.json
              spruce_hanging_sign.json
              spruce_planks.json
              spruce_pressure_plate.json
              spruce_sign.json
              spruce_slab.json
              spruce_stairs.json
              spruce_trapdoor.json
              spruce_wood.json
              spyglass.json
              stick.json
              stick_from_bamboo_item.json
              sticky_piston.json
              stone.json
              stone_axe.json
              stone_brick_slab.json
              stone_brick_slab_from_stone_bricks_stonecutting.json
              stone_brick_slab_from_stone_stonecutting.json
              stone_brick_stairs.json
              stone_brick_stairs_from_stone_bricks_stonecutting.json
              stone_brick_stairs_from_stone_stonecutting.json
              stone_brick_wall.json
              stone_brick_wall_from_stone_bricks_stonecutting.json
              stone_brick_walls_from_stone_stonecutting.json
              stone_bricks.json
              stone_bricks_from_stone_stonecutting.json
              stone_button.json
              stone_hoe.json
              stone_pickaxe.json
              stone_pressure_plate.json
              stone_shovel.json
              stone_slab.json
              stone_slab_from_stone_stonecutting.json
              stone_stairs.json
              stone_stairs_from_stone_stonecutting.json
              stone_sword.json
              stonecutter.json
              stripped_acacia_wood.json
              stripped_birch_wood.json
              stripped_cherry_wood.json
              stripped_crimson_hyphae.json
              stripped_dark_oak_wood.json
              stripped_jungle_wood.json
              stripped_mangrove_wood.json
              stripped_oak_wood.json
              stripped_pale_oak_wood.json
              stripped_spruce_wood.json
              stripped_warped_hyphae.json
              sugar_from_honey_bottle.json
              sugar_from_sugar_cane.json
              suspicious_stew_from_allium.json
              suspicious_stew_from_azure_bluet.json
              suspicious_stew_from_blue_orchid.json
              suspicious_stew_from_closed_eyeblossom.json
              suspicious_stew_from_cornflower.json
              suspicious_stew_from_dandelion.json
              suspicious_stew_from_lily_of_the_valley.json
              suspicious_stew_from_open_eyeblossom.json
              suspicious_stew_from_orange_tulip.json
              suspicious_stew_from_oxeye_daisy.json
              suspicious_stew_from_pink_tulip.json
              suspicious_stew_from_poppy.json
              suspicious_stew_from_red_tulip.json
              suspicious_stew_from_torchflower.json
              suspicious_stew_from_white_tulip.json
              suspicious_stew_from_wither_rose.json
              target.json
              terracotta.json
              tide_armor_trim_smithing_template.json
              tide_armor_trim_smithing_template_smithing_trim.json
              tinted_glass.json
              tipped_arrow.json
              tnt.json
              tnt_minecart.json
              torch.json
              trapped_chest.json
              tripwire_hook.json
              tuff_brick_slab.json
              tuff_brick_slab_from_polished_tuff_stonecutting.json
              tuff_brick_slab_from_tuff_bricks_stonecutting.json
              tuff_brick_slab_from_tuff_stonecutting.json
              tuff_brick_stairs.json
              tuff_brick_stairs_from_polished_tuff_stonecutting.json
              tuff_brick_stairs_from_tuff_bricks_stonecutting.json
              tuff_brick_stairs_from_tuff_stonecutting.json
              tuff_brick_wall.json
              tuff_brick_wall_from_polished_tuff_stonecutting.json
              tuff_brick_wall_from_tuff_bricks_stonecutting.json
              tuff_brick_wall_from_tuff_stonecutting.json
              tuff_bricks.json
              tuff_bricks_from_polished_tuff_stonecutting.json
              tuff_bricks_from_tuff_stonecutting.json
              tuff_slab.json
              tuff_slab_from_tuff_stonecutting.json
              tuff_stairs.json
              tuff_stairs_from_tuff_stonecutting.json
              tuff_wall.json
              tuff_wall_from_tuff_stonecutting.json
              turtle_helmet.json
              vex_armor_trim_smithing_template.json
              vex_armor_trim_smithing_template_smithing_trim.json
              ward_armor_trim_smithing_template.json
              ward_armor_trim_smithing_template_smithing_trim.json
              warped_button.json
              warped_door.json
              warped_fence.json
              warped_fence_gate.json
              warped_fungus_on_a_stick.json
              warped_hanging_sign.json
              warped_hyphae.json
              warped_planks.json
              warped_pressure_plate.json
              warped_sign.json
              warped_slab.json
              warped_stairs.json
              warped_trapdoor.json
              waxed_chiseled_copper.json
              waxed_chiseled_copper_from_honeycomb.json
              waxed_chiseled_copper_from_waxed_copper_block_stonecutting.json
              waxed_chiseled_copper_from_waxed_cut_copper_stonecutting.json
              waxed_copper_block_from_honeycomb.json
              waxed_copper_bulb.json
              waxed_copper_bulb_from_honeycomb.json
              waxed_copper_door_from_honeycomb.json
              waxed_copper_grate.json
              waxed_copper_grate_from_honeycomb.json
              waxed_copper_grate_from_waxed_copper_block_stonecutting.json
              waxed_copper_trapdoor_from_honeycomb.json
              waxed_cut_copper.json
              waxed_cut_copper_from_honeycomb.json
              waxed_cut_copper_from_waxed_copper_block_stonecutting.json
              waxed_cut_copper_slab.json
              waxed_cut_copper_slab_from_honeycomb.json
              waxed_cut_copper_slab_from_waxed_copper_block_stonecutting.json
              waxed_cut_copper_slab_from_waxed_cut_copper_stonecutting.json
              waxed_cut_copper_stairs.json
              waxed_cut_copper_stairs_from_honeycomb.json
              waxed_cut_copper_stairs_from_waxed_copper_block_stonecutting.json
              waxed_cut_copper_stairs_from_waxed_cut_copper_stonecutting.json
              waxed_exposed_chiseled_copper.json
              waxed_exposed_chiseled_copper_from_honeycomb.json
              waxed_exposed_chiseled_copper_from_waxed_exposed_copper_stonecutting.json
              waxed_exposed_chiseled_copper_from_waxed_exposed_cut_copper_stonecutting.json
              waxed_exposed_copper_bulb.json
              waxed_exposed_copper_bulb_from_honeycomb.json
              waxed_exposed_copper_door_from_honeycomb.json
              waxed_exposed_copper_from_honeycomb.json
              waxed_exposed_copper_grate.json
              waxed_exposed_copper_grate_from_honeycomb.json
              waxed_exposed_copper_grate_from_waxed_exposed_copper_stonecutting.json
              waxed_exposed_copper_trapdoor_from_honeycomb.json
              waxed_exposed_cut_copper.json
              waxed_exposed_cut_copper_from_honeycomb.json
              waxed_exposed_cut_copper_from_waxed_exposed_copper_stonecutting.json
              waxed_exposed_cut_copper_slab.json
              waxed_exposed_cut_copper_slab_from_honeycomb.json
              waxed_exposed_cut_copper_slab_from_waxed_exposed_copper_stonecutting.json
              waxed_exposed_cut_copper_slab_from_waxed_exposed_cut_copper_stonecutting.json
              waxed_exposed_cut_copper_stairs.json
              waxed_exposed_cut_copper_stairs_from_honeycomb.json
              waxed_exposed_cut_copper_stairs_from_waxed_exposed_copper_stonecutting.json
              waxed_exposed_cut_copper_stairs_from_waxed_exposed_cut_copper_stonecutting.json
              waxed_oxidized_chiseled_copper.json
              waxed_oxidized_chiseled_copper_from_honeycomb.json
              waxed_oxidized_chiseled_copper_from_waxed_oxidized_copper_stonecutting.json
              waxed_oxidized_chiseled_copper_from_waxed_oxidized_cut_copper_stonecutting.json
              waxed_oxidized_copper_bulb.json
              waxed_oxidized_copper_bulb_from_honeycomb.json
              waxed_oxidized_copper_door_from_honeycomb.json
              waxed_oxidized_copper_from_honeycomb.json
              waxed_oxidized_copper_grate.json
              waxed_oxidized_copper_grate_from_honeycomb.json
              waxed_oxidized_copper_grate_from_waxed_oxidized_copper_stonecutting.json
              waxed_oxidized_copper_trapdoor_from_honeycomb.json
              waxed_oxidized_cut_copper.json
              waxed_oxidized_cut_copper_from_honeycomb.json
              waxed_oxidized_cut_copper_from_waxed_oxidized_copper_stonecutting.json
              waxed_oxidized_cut_copper_slab.json
              waxed_oxidized_cut_copper_slab_from_honeycomb.json
              waxed_oxidized_cut_copper_slab_from_waxed_oxidized_copper_stonecutting.json
              waxed_oxidized_cut_copper_slab_from_waxed_oxidized_cut_copper_stonecutting.json
              waxed_oxidized_cut_copper_stairs.json
              waxed_oxidized_cut_copper_stairs_from_honeycomb.json
              waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_copper_stonecutting.json
              waxed_oxidized_cut_copper_stairs_from_waxed_oxidized_cut_copper_stonecutting.json
              waxed_weathered_chiseled_copper.json
              waxed_weathered_chiseled_copper_from_honeycomb.json
              waxed_weathered_chiseled_copper_from_waxed_weathered_copper_stonecutting.json
              waxed_weathered_chiseled_copper_from_waxed_weathered_cut_copper_stonecutting.json
              waxed_weathered_copper_bulb.json
              waxed_weathered_copper_bulb_from_honeycomb.json
              waxed_weathered_copper_door_from_honeycomb.json
              waxed_weathered_copper_from_honeycomb.json
              waxed_weathered_copper_grate.json
              waxed_weathered_copper_grate_from_honeycomb.json
              waxed_weathered_copper_grate_from_waxed_weathered_copper_stonecutting.json
              waxed_weathered_copper_trapdoor_from_honeycomb.json
              waxed_weathered_cut_copper.json
              waxed_weathered_cut_copper_from_honeycomb.json
              waxed_weathered_cut_copper_from_waxed_weathered_copper_stonecutting.json
              waxed_weathered_cut_copper_slab.json
              waxed_weathered_cut_copper_slab_from_honeycomb.json
              waxed_weathered_cut_copper_slab_from_waxed_weathered_copper_stonecutting.json
              waxed_weathered_cut_copper_slab_from_waxed_weathered_cut_copper_stonecutting.json
              waxed_weathered_cut_copper_stairs.json
              waxed_weathered_cut_copper_stairs_from_honeycomb.json
              waxed_weathered_cut_copper_stairs_from_waxed_weathered_copper_stonecutting.json
              waxed_weathered_cut_copper_stairs_from_waxed_weathered_cut_copper_stonecutting.json
              wayfinder_armor_trim_smithing_template.json
              wayfinder_armor_trim_smithing_template_smithing_trim.json
              weathered_chiseled_copper.json
              weathered_chiseled_copper_from_weathered_copper_stonecutting.json
              weathered_chiseled_copper_from_weathered_cut_copper_stonecutting.json
              weathered_copper_bulb.json
              weathered_copper_grate.json
              weathered_copper_grate_from_weathered_copper_stonecutting.json
              weathered_cut_copper.json
              weathered_cut_copper_from_weathered_copper_stonecutting.json
              weathered_cut_copper_slab.json
              weathered_cut_copper_slab_from_weathered_copper_stonecutting.json
              weathered_cut_copper_slab_from_weathered_cut_copper_stonecutting.json
              weathered_cut_copper_stairs.json
              weathered_cut_copper_stairs_from_weathered_copper_stonecutting.json
              weathered_cut_copper_stairs_from_weathered_cut_copper_stonecutting.json
              wheat.json
              white_banner.json
              white_bed.json
              white_bundle.json
              white_candle.json
              white_carpet.json
              white_concrete_powder.json
              white_dye.json
              white_dye_from_lily_of_the_valley.json
              white_glazed_terracotta.json
              white_shulker_box.json
              white_stained_glass.json
              white_stained_glass_pane.json
              white_stained_glass_pane_from_glass_pane.json
              white_terracotta.json
              white_wool_from_string.json
              wild_armor_trim_smithing_template.json
              wild_armor_trim_smithing_template_smithing_trim.json
              wind_charge.json
              wolf_armor.json
              wooden_axe.json
              wooden_hoe.json
              wooden_pickaxe.json
              wooden_shovel.json
              wooden_sword.json
              writable_book.json
              yellow_banner.json
              yellow_bed.json
              yellow_bundle.json
              yellow_candle.json
              yellow_carpet.json
              yellow_concrete_powder.json
              yellow_dye_from_dandelion.json
              yellow_dye_from_sunflower.json
              yellow_glazed_terracotta.json
              yellow_shulker_box.json
              yellow_stained_glass.json
              yellow_stained_glass_pane.json
              yellow_stained_glass_pane_from_glass_pane.json
              yellow_terracotta.json'''

item_file_list = item_files.split('\n')


def generateTextureTestFile():
    with open('./test_textures.mcfunction', 'w') as file:
        for key, goal in GOAL_INDEX.items():
            file.write("give @s minecraft:" + goal[1] + "[custom_model_data={'strings':['" + key + "']}]\n")

        file.close()

def generateWoolItemModelFiles():

    colors = [
            'white',
            'pink',
            'magenta',
            'red',
            'orange',
            'yellow',
            'lime',
            'green',
            'aqua',
            'light_blue',
            'blue',
            'purple',
            'brown',
            'light_gray',
            'gray',
            'black'
    ]


    x = 1
    for c in colors:
        with open(f'{c}_wool.json', 'w') as f:
            f.write('''
    {
      "model": {
        "type": "select",
        "property": "custom_model_data",
        "fallback": {
          "type": "model",
          "model": "block/''' + c + '''_wool"
        },
        "cases": [
          {
            "when": "K100''' + str(x) +'''",
            "model": {
              "type": "model",
              "model": "item/kill_''' + c + '''_sheep"
            }
          }
        ]
      }
    }
    ''')
            x += 1
            f.close()


def parseLogFile(file):

    log = open(file, '+r')
    
    mode = 'scanning'
    goals = []
    start_time = datetime(year=1, month=1, day=1)
    end_type = None
    players = {}

    for line in log:

        if mode == 'scanning':
            start = re.match('\[(.*)\] \[.*Running function lockout.*', line)
            if start:
                start_time = datetime.strptime(start.groups()[0], '%H:%M:%S')
                print('Located Start Command at time', start_time)
                mode = 'game'
        elif mode == 'game':
            goal = re.match('\[(.*)\] \[.*\[(.*)\] completed \"(.*)\".*', line)
            failed_goal = re.match('\[(.*)\] \[.*\[(.*)\] failed \"(.*)\".*', line)

            if goal:
                time, player, goal = goal.groups()
                timecode = datetime.strptime(time, '%H:%M:%S')
                timestamp = timecode - start_time 
                goals.append({
                        "time": time,
                        "timestamp": f"{int(timestamp.total_seconds() // 60)}:{int(timestamp.total_seconds() % 60)}",
                        "player": player,
                        "goal": goal,
                        "failed": False,
                        "log_line": line,
                })

            if failed_goal:
                time, player, goal = failed_goal.groups()
                timecode = datetime.strptime(time, '%H:%M:%S')
                timestamp = timecode - start_time
                goals.append({
                        "time": time,
                        "timestamp": f"{int(timestamp.total_seconds() // 60)}:{int(timestamp.total_seconds() % 60)}",
                        "player": player,
                        "goal": goal,
                        "failed": True,
                        "log_line": line,
                })

            # end_type = re.match(".*Game Over - (.*)$", line)
            end = re.match(".*wins!.*", line)

            if end:
                mode = 'end'
                print(f'Game Over')

        elif mode == 'end':
            pass
            # max_time = 
            # duration = 
            # team1score = 
            # team2score = 
            # goals, failed, deaths, kills = 


    game_data = {
        "start_time": start_time.strftime('%H:%M:%S'),
        "goals": goals,
        # "end_type": end_type,
        # "players": players,
    }

    print(json.dumps(game_data, indent=4))
    return game_data


def createCraftFiles():
    item_ids = []

    for file in item_file_list:
        item_ids.append((file.strip(' '))[:-5])

    print(item_ids)

    try:
        os.mkdir('./create_craft_files')
    except FileExistsError:
        print('Craft files directory already exists. Proceeding...')
        pass

    for item in item_ids:
        print(item)
        with open(f'unique_crafts/{item}.json', 'w') as file:
            advancement = str('{"criteria": {"craft": {"trigger": "minecraft:recipe_crafted","conditions": {"recipe_id": "' + f'minecraft:{item}"' + '}}},"requirements": [["craft"]],"rewards": {"function": "lockout:goals/count_crafts"}}')
            file.write(advancement)
            file.close()


def main():
    parser = argparse.ArgumentParser(description='Run tools for generating data pack files')

    parser.add_argument('function')
    parser.add_argument('-f', '--file',
                        help='File to pass to the function')
    parser.add_argument('args',
                        nargs='*',
                        help='Arguments to pass to the function')

    args = parser.parse_args()

    exec(f'{args.function}({",".join(args.args)} "{args.file}")')


if __name__ == '__main__':
    main()
