// 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 and against players
ForgeEvents.onEvent("net.minecraftforge.event.entity.living.LivingHurtEvent", event => global.onHurt(event))
/**
 * 
 * @param {Internal.LivingHurtEvent} event 
 */
global.onHurt = event => {
	 //Defining things dont touch
	try {
     let { entity, amount, source } = event
	 let player = source.player
	 let sourceType = source.immediate?.type
	 if (sourceType != "minecraft:player") return
	 if (event.entity.level.isClientSide()) return
	 let itemID = player.getMainHandItem()
	 let playerData = player.getNbt().toString()
	 
	 //Decreased damage in Mining mode part
	 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)
		 }

	 //Decreased damage against players part
	 else if (entity.type == "minecraft:player") {
		event.setAmount(amount * 0.2)
		}

 } catch (error) {
     console.log(error)
 }
}

