const $AttributeModifier = Java.loadClass("net.minecraft.world.entity.ai.attributes.AttributeModifier")

const chainmailHelmetFireResistance = new $AttributeModifier("3fda8b12-92c4-4f61-b785-ec1a2e369f48", "rediscovered:fire_resistance", 0.07, "MULTIPLY_BASE")
const chainmailChestplateFireResistance = new $AttributeModifier("eab41f97-62c1-4d3b-9f04-cc39f4170b91", "rediscovered:fire_resistance", 0.07, "MULTIPLY_BASE")
const chainmailLeggingsFireResistance = new $AttributeModifier("7cbe3a54-48d2-4e0c-bda9-8197f3c5e6b3", "rediscovered:fire_resistance", 0.07, "MULTIPLY_BASE")
const chainmailBootsFireResistance = new $AttributeModifier("15a6d8f2-3ef0-4949-bd34-8c2c6e8a715e", "rediscovered:fire_resistance", 0.07, "MULTIPLY_BASE")

const sterlingHelmetSpeed = new $AttributeModifier("a472b910-3d82-4213-a72d-f0e02e937f0c", "generic.movement_speed", 0.04, "MULTIPLY_BASE")
const sterlingChestplateSpeed = new $AttributeModifier("d8c7e3b1-75b4-465a-b9e5-4a27f36c2c48", "generic.movement_speed", 0.04, "MULTIPLY_BASE")
const sterlingLeggingsSpeed = new $AttributeModifier("29e6148f-4971-4019-8757-1c5938adfd2a", "generic.movement_speed", 0.04, "MULTIPLY_BASE")
const sterlingBootsSpeed = new $AttributeModifier("f3a27865-0f41-4b24-9e6b-e3dc06d46b89", "generic.movement_speed", 0.04, "MULTIPLY_BASE")


ForgeEvents.onEvent("net.minecraftforge.event.ItemAttributeModifierEvent", (event) => {
	
	if (event.itemStack.id == "galosphere:sterling_helmet" && event.slotType == "head") {
		event.removeAttribute("galosphere:illager_resistance")
		event.addModifier("minecraft:generic.movement_speed", sterlingHelmetSpeed)
	}
	if (event.itemStack.id == "galosphere:sterling_chestplate" && event.slotType == "chest") {
		event.removeAttribute("galosphere:illager_resistance")
		event.addModifier("minecraft:generic.movement_speed", sterlingChestplateSpeed)
	}
	if (event.itemStack.id == "galosphere:sterling_leggings" && event.slotType == "legs") {
		event.removeAttribute("galosphere:illager_resistance")
		event.addModifier("minecraft:generic.movement_speed", sterlingLeggingsSpeed)
	}
	if (event.itemStack.id == "galosphere:sterling_boots" && event.slotType == "feet") {
		event.removeAttribute("galosphere:illager_resistance")
		event.addModifier("minecraft:generic.movement_speed", sterlingBootsSpeed)
	}

	if (event.itemStack.id == "minecraft:chainmail_helmet" && event.slotType == "head") {
		event.addModifier("rediscovered:fire_resistance", chainmailHelmetFireResistance)
	}
	if (event.itemStack.id == "minecraft:chainmail_chestplate" && event.slotType == "chest") {
		event.addModifier("rediscovered:fire_resistance", chainmailChestplateFireResistance)
	}
	if (event.itemStack.id == "minecraft:chainmail_leggings" && event.slotType == "legs") {
		event.addModifier("rediscovered:fire_resistance", chainmailLeggingsFireResistance)
	}
	if (event.itemStack.id == "minecraft:chainmail_boots" && event.slotType == "feet") {
		event.addModifier("rediscovered:fire_resistance", chainmailBootsFireResistance)
	}
})