Jump to content

Recommended Posts

Posted

Hello I'm making a 1.7.10 forge mod and I am trying to give the player 3 potion effects. It works with 2 and the code does not seem to have any errors for 3 potion effects, but only 2 show up. Any help would be great  ;D

 

 

Food Item Code:

 

package com.mystic.potatoes;

 

import net.minecraft.entity.player.EntityPlayer;

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 ItemRainbowPotato extends ItemFood

{

private int secondpotionid;

private int secondpotionDuration;

private int secondpotionAmplifier;

private float secondpotionEffectPropability;

 

private int thirdpotionid;

private int thirdpotionDuration;

private int thirdpotionAmplifier;

private float thirdpotionEffectPropability;

 

    public ItemRainbowPotato(int hunger, float saturation,

boolean wolfFood) {

    super(hunger, saturation, wolfFood);

        setAlwaysEdible();

        setPotionEffect(Potion.moveSpeed.id, 120, 5, 1.0F);

        setSecondPotionEffect(Potion.jump.id, 120, 3, 1.0F);

        setThirdPotionEffect(Potion.damageBoost.id, 120, 3, 1.0F);

}

//second potion effect

    protected void onFoodEaten(ItemStack par1ItemStack, World par2world, EntityPlayer par3EntityPlayer)

    {

    super.onFoodEaten(par1ItemStack, par2world, par3EntityPlayer);

   

    if (!par2world.isRemote && this.secondpotionid > 0 && par2world.rand.nextFloat() < this.secondpotionDuration * 20)

    {

    par3EntityPlayer.addPotionEffect(new PotionEffect (this.secondpotionid, this.secondpotionDuration * 20, this.secondpotionAmplifier));;

    }

    }

    public ItemFood setSecondPotionEffect(int par1, int par2, int par3,float par4)

    {

    this.secondpotionid = par1;

    this.secondpotionDuration = par2;

    this.secondpotionAmplifier = par3;

    this.secondpotionEffectPropability = par4;

    return this;

    }

    public ItemFood setThirdPotionEffect(int par1, int par2, int par3,float par4)

    {

    this.thirdpotionid = par1;

    this.thirdpotionDuration = par2;

    this.thirdpotionAmplifier = par3;

    this.thirdpotionEffectPropability = par4;

    return this;

    }

}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.