Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

mysticpenguin

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by mysticpenguin

  1. 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;

        }

    }

     

  2. Could the texture/icon be the problem? In the code for the plant icons texture names I have this:  icons = par1IconRegister.registerIcon(CucumbersMod.MODID + ":" + "cucumberplant" + i);

     

    And in resources I named them cucumberplant1 , cucumberplant2, cucumberplant3

     

    Could I naming the textures wrong?

  3. In my mod I made a seed item for a plant. When I right click with the seed the player animation goes to placing a block but no plant is planted. Please help.

     

    Seed Code:

     

                    package com.mystic.cucumbers;

     

    import net.minecraft.block.Block;

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.init.Blocks;

    import net.minecraft.item.Item;

    import net.minecraft.item.ItemStack;

    import net.minecraft.world.IBlockAccess;

    import net.minecraft.world.World;

    import net.minecraftforge.common.EnumPlantType;

    import net.minecraftforge.common.IPlantable;

     

     

    public class ItemCucumberSeed extends Item implements IPlantable

     

    {

    private Block plant;

    private String name = "CucumberSeed";

     

    public ItemCucumberSeed(Block plant)

    {

    this.plant = plant;

    setUnlocalizedName(CucumbersMod.MODID + "_" + "cucumberseed");

    setTextureName(CucumbersMod.MODID + ":" + "cucumberseed");

    setCreativeTab(CreativeTabs.tabMaterials);

    }

     

     

    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)

    {

    if (par7 != 1)

    {

    return false;

    }

    else if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))

    {

    if(par3World.getBlock(par4, par5, par6) == Blocks.dirt || par3World.getBlock(par4, par5, par6) == Blocks.grass)

    {

    if (par3World.isAirBlock(par4, par5 + 1, par6))

    {

    par3World.setBlock(par4, par5 + 1, par6, this.plant);

    --par1ItemStack.stackSize;

    return true;

    }

    else

    {

    return false;

    }

    }

    else

    {

    return false;

    }

    }

    else

    {

    return false;

    }

    }

     

    @Override

    public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) {

    return EnumPlantType.Crop;

    }

    @Override

    public Block getPlant(IBlockAccess world, int x, int y, int z) {

    return plant;

    }

    @Override

    public int getPlantMetadata(IBlockAccess world, int x, int y, int z) {

    return 0;

    }

    }

     

     

    Plant Code:

     

                    package com.mystic.cucumbers;

     

    import java.util.Random;

     

    import cpw.mods.fml.relauncher.Side;

    import cpw.mods.fml.relauncher.SideOnly;

    import net.minecraft.block.Block;

    import net.minecraft.block.BlockBush;

    import net.minecraft.block.IGrowable;

    import net.minecraft.block.material.Material;

    import net.minecraft.client.renderer.texture.IIconRegister;

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.util.IIcon;

    import net.minecraft.world.World;

     

    public class BlockCucumberPlant extends BlockBush implements IGrowable

    {

    @SideOnly(Side.CLIENT)

    private IIcon[] icons;

     

    public BlockCucumberPlant()

    {

    super(Material.plants);

    setBlockName(CucumbersMod.MODID + "_" + "cucumberplant");

    setHardness(0.0F);

    setBlockBounds(0F, 0.0F, 0F, 1F, 0.25F, 1F);

    setStepSound(soundTypeGrass);

    }

    @Override

    @SideOnly(Side.CLIENT)

    public void registerBlockIcons(IIconRegister par1IconRegister)

    {

    icons = new IIcon[3];

    for (int i = 0; i < icons.length; i++)

    {

    icons = par1IconRegister.registerIcon(CucumbersMod.MODID + ":" + "cucumberplant" + i);

    }

    }

     

    @Override

    @SideOnly(Side.CLIENT)

    public IIcon getIcon(int par1, int par2)

    {

    if(par2 < 0 || par2 >= 3)

    {

    System.out.println("Something is wrong with the metadata for BlockCucumberPlant!");

    return icons[0];

    }

    else

    return icons[par2];

    }

    @Override

    public int getRenderType()

    {

    return 6;

    }

    @Override

    public boolean func_149851_a(World world, int x, int y, int z, boolean var5)

    {

    return world.getBlockMetadata(x, y, z) != 2;

    }

    @Override

    public boolean func_149852_a(World world, Random rand, int x, int y, int z)

    {

    return true;

    }

    @Override

    public void func_149853_b(World world, Random rand, int x, int y, int z)

    {

    int next = world.getBlockMetadata(x, y, z) + 1;

     

    if(next > 2)

    next = 2;

     

    world.setBlockMetadataWithNotify(x, y, z, next, 2);

    }

    public void updateTick(World world, int x, int y, int z, Random rand)

    {

    super.updateTick(world, x, y, z, rand);

     

    if (world.getBlockLightValue(x, y + 1, z) >=9)

    {

    int l = world.getBlockMetadata(x, y, z);

     

    if (1 < 2)

    {

    if (rand.nextInt(5) == 0)

    {

    ++l;

    world.setBlockMetadataWithNotify(x, y, z, 1, 2);

    }

    }

    }

    }

     

    }

     

  4. Hi I have tried everything I can think of and I cant get the name of my item to show up in minecraft. Any help would be great :D.

     

    Main class file:

     

    package com.brickepm.mymod;

     

    import net.minecraft.init.Blocks;

    import net.minecraft.item.Item;

    import cpw.mods.fml.common.Mod;

    import cpw.mods.fml.common.Mod.EventHandler;

    import cpw.mods.fml.common.event.FMLInitializationEvent;

    import cpw.mods.fml.common.event.FMLPreInitializationEvent;

    import cpw.mods.fml.common.registry.GameRegistry;

    import net.minecraftforge.common.util.EnumHelper;

    import net.minecraft.item.Item.ToolMaterial;

     

    @Mod(modid = MyMod.MODID, version = MyMod.VERSION)

    public class MyMod

    {

        public static final String MODID = "Boom Blade Mod";

        public static final String VERSION = "1.0";

        public static Item boomblade;

        public static Item.ToolMaterial boom = EnumHelper.addToolMaterial("mypick", 3, 1000, 9.5F, 3.5F, 10);

       

        @Mod.EventHandler

        public void preinit(FMLPreInitializationEvent event)

        {

    boomblade = new ItemBoomBlade(boom, "boomblade");

    GameRegistry.registerItem(boomblade, "Boomblade");

        }

    }

     

     

     

    boomblade file:

    package com.brickepm.mymod;

     

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.item.Item;

    import net.minecraft.item.Item.ToolMaterial;

    import net.minecraft.item.ItemSword;

     

    public class ItemBoomBlade extends ItemSword

    {

      public ItemBoomBlade(Item.ToolMaterial material, String name)

      {

        super(material);

      setUnlocalizedName(MyMod.MODID + "_" + "boomblade");

      setTextureName(MyMod.MODID + ":" + "boomblade");

      setCreativeTab(CreativeTabs.tabCombat);

      }

    }

     

    en_US.lang file:

     

    item.Boom Blade Mod_Boomblade.name=Boom Blade

  5. Im making my first mod and I learned how to make crafting recipes. When i tried to test it out the game launched and I could play but when I tried the crafting recipe nothing happened :(. Any help would be great :D

     

    code:

     

    package com.ethan.ethansmod;

    import net.minecraft.init.Blocks;

    import net.minecraft.init.Items;

    import net.minecraft.item.ItemStack;

    import cpw.mods.fml.common.Mod;

    import cpw.mods.fml.common.Mod.EventHandler;

    import cpw.mods.fml.common.event.FMLInitializationEvent;

    import cpw.mods.fml.common.registry.GameRegistry;

     

    @Mod(modid = Ethansmod.MODID, version = Ethansmod.VERSION)

     

    public class Ethansmod {

    public static final String MODID = "my mod";

        public static final String VERSION = "1.0";

       

        public void init(FMLInitializationEvent event)

        {

        GameRegistry.addRecipe(new ItemStack(Items.baked_potato),

        "aaa",

        "aaa",

        "aaa",

        'a', Blocks.bookshelf

        );

        }

     

    }

     

     

    -----------------------------

    I am using forge for 1.7.10 on a mac

×
×
  • Create New...

Important Information

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