// priority: 0

// Visit the wiki for more info - https://kubejs.com/

// made by ekazuya [my friend]

		//Makes it so player does 1/4th damage in EpicFight Mining Mode
ForgeEvents.onEvent("net.minecraftforge.event.entity.living.LivingHurtEvent", event => global.onHurt(event))
/**
 * 
 * @param {Internal.LivingHurtEvent} event 
 */
global.onHurt = event => {
	try {
     let { entity, amount } = event
	 let player = event.source.player
	 let itemID = player.getMainHandItem()
	 if (!player) return
	 let playerData = player.getNbt().toString()
	  if (playerData.includes("VANILLA") && !player.isCreative() && !Ingredient.of(global.exceptions).test(itemID)) {
		  player.displayClientMessage(Component.of(Text.of("You're in mining mode so no full damage for you").darkRed()), true)
		  event.setAmount(amount * 0.5)
		  }
 } catch (error) {
     console.log(error)
 }
}

//Exception list (like terramity guns) defined in global in case it grows and needs to be moved to reduce clutter in here
global.exceptions = [
	/^terramity:(plague_pistol|requiem|vulcan|celestial_sixty|five_thousand_magnum|gaias_tempest|stairway_to_heaven|anti_material_rifle|antimatter_rifle|davy_jones|divine_intervention|fortunes_favor|blasphemic_rapture|onyx_storm|plaguebringer|cosmic_storm|hellfire_flurry|asphodel|olympus|meteor_cannon|overclocked_microwave|railgun|planet_buster|conductite_laser_rifle)$/,
]