// priority: 0

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

// made by ekazuya [my friend]

		//Makes it so player does half 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, source } = event
	 let player = source.player
	 let sourceType = source.immediate?.type
	 if (sourceType != "minecraft:player") return
	 let itemID = player.getMainHandItem()
	 let playerData = player.getNbt().toString()
	  if (playerData.includes("VANILLA") && !player.isCreative()) {
		  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)
 }
}

