L'event drop
-
“new ItemStack(Nyvelia.Tissu, 1));” remplace le 1 par rand.nextInt(3) alors

-
" rand cannot be resolved " T_T
-
Mh… envoie ta class !
-
Je l’ai envoyé juste au-dessus ^^ j’ai juste changé " new ItemStack(Nyvelia.Tissu, 1)); " en " new ItemStack(Nyvelia.Tissu, rand.nextInt(3))); ".
-
package nyvelia.common; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingDropsEvent; public class LivingEvent { public final Random rand = new Random(); @ForgeSubscribe public void onLivingDrops(LivingDropsEvent event) { if(event.entity instanceof EntityWolf) { EntityItem newdrop = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(Nyvelia.Tissu, rand.nextInt(3))); event.drops.add(newdrop); } } }Voili voilou

-
Merci ça marche impec

-
Salut petit probleme mon eclipse me propose de créer l’anotation forgesubscribe je doit le faire?
merci de votre réponse
-
Remplace par @SubscribeEvent
-
@‘Portuar’:
Remplace par @SubscribeEvent
merci bien cela marche mais pourquoi je doit utiliser SubscribeEvent?
-
Car ForgeSubscribe a été remplacé par SubscribeEvent en 1.7