Mettre plusieurs effets de potion sur un item mangeable
-
met des balise java
-
Tu pourrais etre plus precis ?
-
[java][/java] sans les *
-
Désolé mais la je comprend pas

-
Voilà
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); }Pour les balises java tu fais comme ça

-
Moi sa me emt une erreur looker sa
package IceFightMods; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class PommeEnOnyx extends ItemFood { public PommeEnOnyx(int id, int foodAmount, float saturation, boolean isWolfFood) { super(id, foodAmount, saturation, isWolfFood); protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); } } public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.eat; //remplacer eat par drink pour en faire une boisson } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return stack; } }
merci
-
les balise!
-
Salut,
@‘pechtoul’:Moi sa me emt une erreur looker sa
public PommeEnOnyx(int id, int foodAmount, float saturation, boolean isWolfFood) { super(id, foodAmount, saturation, isWolfFood); protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); } }–’
Google -> programmation java.
On peut peut pas mettre une méthode dans un constructeur …package IceFightMods; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class PommeEnOnyx extends ItemFood { public PommeEnOnyx(int id, int foodAmount, float saturation, boolean isWolfFood) { super(id, foodAmount, saturation, isWolfFood); } protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); } public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.eat; //remplacer eat par drink pour en faire une boisson } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return stack; } }Comme ça c’est bon.
-
@‘pechtoul’:
Moi sa me emt une erreur looker sa
package IceFightMods; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class PommeEnOnyx extends ItemFood { public PommeEnOnyx(int id, int foodAmount, float saturation, boolean isWolfFood) { super(id, foodAmount, saturation, isWolfFood); protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); player.addPotionEffect(new PotionEffect(Potion.xxxxx.id, durée, niveau)); } } public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.eat; //remplacer eat par drink pour en faire une boisson } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); return stack; } }
merci
http://fr.openclassrooms.com/informatique/cours/apprenez-a-programmer-en-java
http://java.developpez.com/cours/ -

Et remplace xxxxx durée et niveau par les valeurs que tu veux!
