7 janv. 2015, 09:15

salut je voudrai savoir quel est la condition a mettre pour dire a mon armure que les effet doit être actif quand mon set d’armure est complète. Merci d’avance ^^

package CrystalCombats;

import CrystalTools.CrystalTool;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;

public class ItemGreenCrystalArmor extends ItemArmor
{
public ItemGreenCrystalArmor(ArmorMaterial enumArmorMaterial, int slot, int layer)
{
super(enumArmorMaterial, slot, layer);
}

@SideOnly(Side.CLIENT)
@Override
public EnumRarity getRarity(ItemStack stack)
{
return EnumRarity.rare;
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
if(stack.getItem() == CrystalCombat.greenCrystalHelmet || stack.getItem() == CrystalCombat.greenCrystalChestPlate || stack.getItem() == CrystalCombat.greenCrystalBoots)
return "minecraft:textures/models/armor/greencrystal_layer_1.png";
else if(stack.getItem() == CrystalCombat.greenCrystalLeggings)
return "minecraft:textures/models/armor/greencrystal_layer_2.png";
else
return null;
}
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
player.addPotionEffect(new PotionEffect(Potion.waterBreathing.id, 20, 0));
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 20, 0));
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 20, 0));
}
}