// priority: 0

settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true

console.info('Hello, World! (You will see this line every time server resources reload)')

onEvent('recipes', event => {
	// Change recipes here
})

onEvent('item.tags', event => {
	// Get the #forge:cobblestone tag collection and add Diamond Ore to it
	// event.get('forge:cobblestone').add('minecraft:diamond_ore')
	event.get('minecraft:logs').add('natchathiram:mechanized_block')
	event.get('minecraft:planks').add('natchathiram:mechanized_plank')
	event.get('minecraft:non_flammable_wood').add('natchathiram:mechanized_block')
	event.get('forge:rods').add('natchathiram:mechanized_rod')
	event.get('forge:rods/wooden').add('natchathiram:mechanized_rod')
	event.removeAll('industrialforegoing:sludge')
	event.add('industrialforegoing:sludge', 'minecraft:clay')
	event.add('minecraft:piglin_loved', 'mekanism:mekasuit_boots')
	event.add('minecraft:piglin_loved', 'mekanism:mekasuit_helmet')
	event.add('minecraft:piglin_loved', 'mekanism:mekasuit_bodyarmor')
	event.add('minecraft:piglin_loved', 'mekanism:mekasuit_pants')
	event.add('undergarden:portal_frame_blocks', 'natchathiram:stone_bricks')
	event.add('forge:elytra', 'minecraft:elytra')
	//event.add('', 'mekanism:upgrades')
	// Get the #forge:cobblestone tag collection and remove Mossy Cobblestone from it
	// event.get('forge:cobblestone').remove('minecraft:mossy_cobblestone')
	event.removeAll('forge:mushrooms')
	event.add('forge:mushrooms', 'minecraft:brown_mushroom')
	event.add('forge:mushrooms', 'minecraft:red_mushroom')
	event.add('forge:mushrooms', 'undergarden:indigo_mushroom')
	event.add('forge:mushrooms', 'undergarden:veil_mushroom')
	event.add('forge:mushrooms', 'undergarden:blood_mushroom')
})


onEvent('recipes', event => {

event.replaceInput({type: 'minecraft:crafting_shaped'}, 'minecraft:dragon_head', 'theabyss:loran_energy')
event.replaceOutput({}, 'minecraft:stone_bricks', 'natchathiram:stone_bricks')
event.replaceInput({type: 'minecraft:crafting_shaped'}, 'minecraft:stone_bricks', 'natchathiram:stone_bricks')
event.replaceInput({type: 'minecraft:crafting_shapeless'}, 'minecraft:stone_bricks', 'natchathiram:stone_bricks')


})

onEvent('worldgen.remove', event => {
  event.removeFeatureById('underground_structures', 'minecraft:stronghold')
})
/*
onEvent('block.right_click', event => {
	event.right_click('natchathiram:theuniverse')
	event.player.tell('Hi!')
})
*/

onEvent('block.right_click', event => {
  if(event.item.id == "extendedcrafting:the_ultimate_ingot" && event.block.id == "natchathiram:theuniverse") {
    event.server.runCommand(`execute positioned ${event.block.x} ${event.block.y} ${event.block.z} run fill ^2 ^-1 ^-2 ^-2 ^-1 ^-6 minecraft:dirt`),
	event.server.runCommand(`execute positioned ${event.block.x} ${event.block.y} ${event.block.z} run fill ^2 ^ ^-2 ^-2 ^ ^-6 minecraft:stone_bricks`),
	event.server.runCommand(`execute positioned ${event.block.x} ${event.block.y} ${event.block.z} run fill ^1 ^ ^-3 ^-1 ^ ^-5 overworldmirror:portal`)
	event.server.runCommand(`replaceitem entity @p weapon.mainhand air`)
  }
})


onEvent('player.chat', (event) => {
  // Check if message equals creeper, ignoring case
  if (event.message.trim().equalsIgnoreCase('creeper')) {
    // Schedule task in 1 tick, because if you reply immidiently, it will print before player's message
    event.server.scheduleInTicks(1, event.server, (callback) => {
      // Tell everyone Aw man, colored green. Callback data is the server
      callback.data.tell(Text.green('Aw man'))
    })
  }
})
