// priority 0

ServerEvents.recipes((event) => {
  recipeRemoval(event)
  ieRecipesRemoval(event)
  igRecipesRemoval(event)
  dfcRecipesRemoval(event)
  ncRecipesRemoval(event)
  replaceRecipes(event)
  ieRecipesReplace(event)
  igRecipesReplace(event)
  dfcRecipesReplace(event)
  tfcRecipesReplace(event)
  recipeAdd(event)
  ieRecipesAdd(event)
  replaceTFCHeatingAndCasting(event)
  addCollapse(event)
  tfcGregTools(event)
  recipesTFCGlassblowingLenses(event)
  gtceuAdd(event)
  ncBridges(event)
  ncRecipesAdd(event)
  createAdd(event)
  centrifugeAdd(event)
  tfcRecipesAdd(event)
  dfcRecipesAdd(event)
  //oreWashingAdd(event)
  //oreVibratingAdd(event)
  viSulfuricAcid(event)
  wiresAdd(event)
  addOreConversions(event)
  igRecipesAdd(event)
  create_new_age(event)
  createMaterialProcessingAdd(event)
  coilingTweak(event)
  advancedCreateRecipes(event)
  //pressurizedBasinAdd(event)
  //spaceDustChain(event)
  certusSemiconductors(event)
  gregifyAE2(event)
  gregifyLaserIO(event)
  replaceDisc(event)
  blazeLiquidFuels(event)
})

LootJS.modifiers((event) => {
  // event.enableLogging()
  modifyAndRemoveChestLoot(event)
  modifyAndRemoveBlockLoot(event)
  modifyAndRemoveEntityLoot(event)
  modifyAndRemoveFishingLoot(event)
})

ServerEvents.tags("worldgen/biome", (event) => {
  addTFCBiomesToVanilla(event)
  addStargateBiomes(event)
  removeBiomesFromStructures(event)
  addBiomesToStructures(event)
})

ServerEvents.tags("worldgen/placed_feature", (event) => {
  addGregVeinsToTags(event)
  removeDFCOreVeins(event)
  addIGOresToTags(event)
})

ServerEvents.tags("item", (event) => {
  addItemTags(event)
  dfcAddItemTags(event)
  tfcAddItemTags(event)
})
ServerEvents.tags("entity", (event) => {
  entityTags(event)
})
ServerEvents.tags("block", (event) => {
  addBlockTags(event)
})

ServerEvents.tags('fluid', (event) => {
  addFluidTags(event)
})

ServerEvents.tags("worldgen/configured_feature", (event) => {
  addConfiguredFeaturesTags(event)
})

MoreJSEvents.structureLoad((event) => {
  replaceVanillaBlocks(event)
})

MoreJSEvents.structureAfterPlace((event) => {
  replaceGoldBlocksWithPiles(event)
  runErosionFeature(event)
  replaceVillagesWoodAccordingToClimate(event)
  replaceVillagesStoneAccordingRock(event)
})

ServerEvents.lowPriorityData((event) => {
  addGregTechIngotsToTFC(event)
  addTFCPartHeatingRecipes(event)
  overrideTFCArmourFinalWeld(event)
  addGregVeinData(event)
  addIGVeins(event)
  addGenericData(event)
  overrideTFCWorldPreset(event)
})

NetworkEvents.dataReceived("customTask", (event) => {
  serverObserveGtTask(event) // TODO: needs rework
})

MoreJSEvents.villagerTrades((event) => {
  replaceTrades(event)
})

EntityEvents.spawned("item", event => {
  replaceSpawnedItem(event)
})

EntityEvents.death("player", (event) => {
  addsTimeOfDeathToPlayer(event)
})

FTBQuestsEvents.customReward(event => {
  if (event.reward.tags.isEmpty()) return
  let tag = event.reward.tags.iterator().next()
  if (tag.startsWith("biome:")) {
    handleBiomeMapShop(event, tag)
  }
})

ItemEvents.dropped("immersiveengineering:toolbox", event => {
  event.player.closeMenu()
})


LevelEvents.loaded((event) => {
  loadRegistryVariables(event)
})
