Item qui devient invisible quand on le tien



  • bonjour jais un problème avec le code de mon mod.

    package fr.yalouor.yalouor.item.stick;
    
    import java.util.Set;
    
    import com.google.common.collect.ImmutableSet;
    import com.google.common.collect.Sets;
    
    import fr.yalouor.yalouor.ModYalouor;
    import fr.yalouor.yalouor.Reference;
    import fr.yalouor.yalouor.init.ItemsMod;
    import net.minecraft.block.Block;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.ItemPickaxe;
    import net.minecraft.item.ItemStack;
    import net.minecraft.potion.Potion;
    import net.minecraft.potion.PotionEffect;
    import net.minecraft.world.World;
    
    public class stick_inv extends ItemPickaxe {		
    
    	public stick_inv(ToolMaterial string) {
    		super(string);
    	}
    
    	
    	private static Set<Block> effectivaAgainst = Sets.newHashSet(new Block[]
    			{
    			});
    	
    	@Override
    	public Set<String> getToolClasses(ItemStack stack){
    		return ImmutableSet.of("pickaxe");
    	}
    	
    	@Override
    	public boolean canHarvestBlock(Block block, ItemStack stack)
    	{
    		return effectivaAgainst.contains(block) ? true : super.canHarvestBlock(block, stack);
    	}
    	
    	@Override
    	public float func_150893_a(ItemStack stack, Block block)
    	{
    		return effectivaAgainst.contains(block) ? this.efficiencyOnProperMaterial : super.func_150893_a(stack, block);
    	}
    	public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean flag) {
            super.onUpdate(stack, world, entity, i, flag);
    
            EntityPlayer player = (EntityPlayer) entity;
            ItemStack hand = player.getCurrentEquippedItem();
            if (hand == stack) {
                player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 10, true));
                
            }
        }
    public boolean getIsRepairable(ItemStack input, ItemStack repair) {
            if ((input.getItem() == this) && (repair.getItem() == ItemsMod.stick_speed)) {
                return true;
            }
            return false;
        }
    
    }
    
    

    je voudrais que au moment ou le Player devine invisible le stick aussi donc le changer de texture

    merci a la personne qui pourra m'aider


Log in to reply