Recherche d'une "function"
-
Plus simple, tu regardes si l’item n’est plus dans ton inventaire lorsque tu le droppes puis tu enlèves la barre.
-
Bah justement je cherche cette fonction
-
Tien voila se que tu recherche

player.inventory.hasItemStack()Tu fais un truc genre :
if(player.inventory.hasItemStack(new ItemStack(tonMod.tonItem))) { player.addPotionEffect((new PotionEffect(Potion.nightVision.id, 100, 0))); System.out.println("Lol"); } else { player.addPotionEffect((new PotionEffect(Potion.nightVision.id, 0, 0))); System.out.println("Lol2"); }Enjoy

-
Oui mais avant faut checker si il a droppé le bon item, sinon ça exécute la condition à chaque item droppé, ce qui n’est pas très optimisé…

-
Bah un else if == null tout simplement, je teste dans l’après le code
-
Oui mais il y a pas 40 solution car comment tu fais si le gars met sont truc dans un coffre ?
Au faite Zak le code que j ai mit plus haut ne check absolument pas les item dropé il check si le gars a l’item dans l’inventaire
Mais bon si tu veut tjr check si il a drop le bon item alors fais sa :
private void onPlayerTick(EntityPlayer player) { if(player.getCurrentEquippedItem() != null) { ItemStack hand = player.getCurrentEquippedItem(); if(hand == new ItemStack(tonMod.tonItem)) { player.addPotionEffect((new PotionEffect(Potion.nightVision.id, 0, 0))); System.out.println("Lol"); } } } -
if ((player.inventory.hasItemStack(new ItemStack(c_drone.itemShield)) && (par3Entity.ticksExisted % 0.5 == 0) && ((par3Entity instanceof EntityLivingBase)))) { float abs = ((EntityLivingBase)par3Entity).getAbsorptionAmount(); if (abs < 2000.0F) { abs += 1.0F; ((EntityLivingBase)par3Entity).setAbsorptionAmount(abs); } } else{ System.out.println("plus item"); ((EntityLivingBase)par3Entity).setAbsorptionAmount(noAbs); }le problème c’est que le else ne marche pas… La condition quand a elle est bien remplie
-
Tu la mit ou ?
Car il faut que tu face un tick handler -
Nan faut juste le mettre dans l’event qui gère le drop
-
je l’avais mis dans un onUpdate