Hi,
I'm new to java and I am making testing mods, I'm learning how this all works and I have a little trouble, that I don't understand.
I want to add potion effect to testing armor by "if" but... this is not working. No errors, just when I'm wearing testing helmet there is no potion effects.
Here is my code:
package com.test.testmod.items;
import com.test.testmod.util.RegistryHandler;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Effects;
import net.minecraft.world.World;
public class ArmorEffect extends ArmorItem {
public ArmorEffect(IArmorMaterial materialIn, EquipmentSlotType slot, Properties builder) {
super(materialIn, slot, builder);
}
@Override
public void onArmorTick(ItemStack itemstack, World world, PlayerEntity player){
if ( player.getItemStackFromSlot(EquipmentSlotType.HEAD).getItem() == RegistryHandler.TEST_HELMET.get()
)
{
player.addPotionEffect(new EffectInstance(Effects.FIRE_RESISTANCE, 300, 1, false, false));
}
}
}