const spearStone = Item.of('tetra:modular_single', '{Damage:0,HideFlags:1,honing_progress:180,id:"107ec64a-bdd1-44cb-9219-082dc36dcbce","single/basic_handle_material":"basic_handle/stick","single/handle":"single/basic_handle","single/head":"single/spearhead","single/spearhead_material":"spearhead/stone"}')
const spearIron = Item.of('tetra:modular_single', '{Damage:0,HideFlags:1,honing_progress:240,id:"c3c786e4-603f-471b-b4eb-aa2ce52b0fee","single/basic_handle_material":"basic_handle/stick","single/handle":"single/basic_handle","single/head":"single/spearhead","single/spearhead_material":"spearhead/iron"}')

ServerEvents.recipes(recipes => {
	recipes.shaped(
        Item.of('tetra:modular_single', '{id:"56ff2749-3830-449b-91fd-fa7cb972bf9a","single/basic_handle_material":"basic_handle/stick","single/handle":"single/basic_handle","single/head":"single/spearhead","single/spearhead_material":"spearhead/oak"}'),
        [
            '  B',
            ' A ',
            'A  '
        ],
        {
            A: '#forge:rods/wooden',
            B: '#minecraft:planks',
        }
    )
    recipes.shaped(
        spearStone,
        [
            '  B',
            ' A ',
            'A  '
        ],
        {
            A: '#forge:rods/wooden',
            B: '#forge:stone',
        }
    )
    recipes.shaped(
        spearIron,
        [
            '  B',
            ' A ',
            'A  '
        ],
        {
            A: '#forge:rods/wooden',
            B: '#forge:ingots/iron',
        }
    )
    recipes.shaped(
        Item.of('tetra:modular_single', '{Damage:0,HideFlags:1,honing_progress:240,id:"0562ce6e-ac0e-4882-826e-65d8662eaa2a","single/basic_handle_material":"basic_handle/stick","single/handle":"single/basic_handle","single/head":"single/spearhead","single/head:arrested":0,"single/spearhead_material":"spearhead/diamond"}'),
        [
            '  B',
            ' A ',
            'A  '
        ],
        {
            A: '#forge:rods/wooden',
            B: '#c:diamonds',
        }
    )
})

LootJS.modifiers(event => {
    const chests = [
        'betterdungeons:skeleton_dungeon/chests/middle',
        'betterfortresses:chests/hall',
        'betterdungeons:zombie_dungeon/chests/common',
        'betterdungeons:zombie_dungeon/chests/special'
    ]

    event
        .addLootTableModifier(chests)
        .randomChance(0.2)
        .addLoot(spearStone)

    
    event
        .addLootTableModifier(chests)
        .randomChance(0.2)
        .addLoot(spearIron)
})