Fireball code error

Started by Benua2000 on

Topic category: Help with modding (Java Edition)

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Fireball code error

Hi i have a problem, so i took the fireballs code from the guy who posted it and it worked just fine, then i changed the events when you right click in air it will lose durrability by 1, i added the same code at the end (in view source) and now it given me this: onItemRightClick(ItemStack,World,EntityPlayer)is already defined in class ItemfireWand
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
Can someone help please?
 

Last seen on 23:46, 10. May 2017
Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I personally cannot help, for
Thu, 02/11/2016 - 18:44

I personally cannot help, for the lack of knowledge, but if you want anyone to help, id suggest uploading the mcr workspace file, via dropbox or other file site. Also add a full console log, along with link to the reffered "some guy" For source/error logs I bet hastebin or pastebin will be easier on the eyes.

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The guy is CyberRocky, here's
Thu, 02/11/2016 - 18:52

The guy is CyberRocky, here's the pastebin and the link to his post:

http://pastebin.com/aVYzPfwM

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can i see source code of your
Thu, 02/11/2016 - 19:05

Can i see source code of your item?

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You mean the code editor?
Thu, 02/11/2016 - 19:17

You mean the code editor?

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try change it all to this:
Thu, 02/11/2016 - 19:54

Try change it all to this: 
[spoiler]

import net.minecraftforge.fml.client.registry.*;
import net.minecraftforge.fml.common.*;
import net.minecraftforge.fml.common.asm.*;
import net.minecraftforge.fml.common.asm.transformers.*;
import net.minecraftforge.fml.common.discovery.*;
import net.minecraftforge.fml.common.discovery.asm.*;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.functions.*;
import net.minecraftforge.fml.common.network.*;
import net.minecraftforge.fml.common.registry.*;
import net.minecraftforge.fml.common.toposort.*;
import net.minecraftforge.fml.common.versioning.*;
import net.minecraftforge.fml.relauncher.*;
import net.minecraftforge.fml.server.*;
import net.minecraft.block.*;
import net.minecraft.block.material.*;
import net.minecraft.client.*;
import net.minecraft.client.audio.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.*;
import net.minecraft.client.gui.inventory.*;
import net.minecraft.client.model.*;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.particle.*;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.culling.*;
import net.minecraft.client.renderer.entity.*;
import net.minecraft.client.renderer.tileentity.*;
import net.minecraft.client.settings.*;
import net.minecraft.command.*;
import net.minecraft.crash.*;
import net.minecraft.creativetab.*;
import net.minecraft.dispenser.*;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.boss.*;
import net.minecraft.entity.effect.*;
import net.minecraft.entity.item.*;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.*;
import net.minecraft.entity.player.*;
import net.minecraft.entity.projectile.*;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.item.crafting.*;
import net.minecraft.nbt.*;
import net.minecraft.network.*;
import net.minecraft.network.rcon.*;
import net.minecraft.pathfinding.*;
import net.minecraft.potion.*;
import net.minecraft.profiler.*;
import net.minecraft.server.*;
import net.minecraft.server.dedicated.*;
import net.minecraft.server.gui.*;
import net.minecraft.server.integrated.*;
import net.minecraft.server.management.*;
import net.minecraft.stats.*;
import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.village.*;
import net.minecraft.world.*;
import net.minecraft.world.biome.*;
import net.minecraft.world.chunk.*;
import net.minecraft.world.chunk.storage.*;
import net.minecraft.world.demo.*;
import net.minecraft.world.gen.*;
import net.minecraft.world.gen.feature.*;
import net.minecraft.world.gen.layer.*;
import net.minecraft.world.gen.structure.*;
import net.minecraft.world.storage.*;
import net.minecraftforge.classloading.*;
import net.minecraftforge.client.*;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.sound.*;
import net.minecraftforge.common.*;
import net.minecraftforge.event.*;
import net.minecraftforge.event.entity.*;
import net.minecraftforge.event.entity.item.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.minecart.*;
import net.minecraftforge.event.entity.player.*;
import net.minecraftforge.event.terraingen.*;
import net.minecraftforge.event.world.*;
import net.minecraftforge.oredict.*;
import net.minecraft.init.*;
import java.util.*;
import net.minecraftforge.common.util.*;
 
import org.lwjgl.opengl.GL11;
 
import net.minecraft.client.resources.model.*;
 
 
@SuppressWarnings("unchecked")
public class mcreator_fireWand{
 
public mcreator_fireWand(){}
 
public static Item block;public static Object instance;public void load(FMLInitializationEvent event){
if(event.getSide() == Side.CLIENT)
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(block, 0, new ModelResourceLocation("TestEnvironmentMod:FireWand", "inventory"));
}
public void generateNether(World world, Random random, int chunkX, int chunkZ){}
public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
public int addFuel(ItemStack fuel){return 0;}
public void serverLoad(FMLServerStartingEvent event){}
public void preInit(FMLPreInitializationEvent event){}
public void registerRenderers(){
}
 
 
static{
block = (new ItemfireWand(435));
 
}
 
static class ItemfireWand extends Item{
 
public ItemfireWand(int par1){
setMaxDamage(1);
maxStackSize = 1;
setUnlocalizedName("FireWand");
GameRegistry.registerItem(this, "FireWand");
setCreativeTab(CreativeTabs.tabCombat);
}
public int getItemEnchantability()
{
    return 0;
}
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
    return 30;
}
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
{
    return 2.0F;
}

public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List list, boolean par4)
{
list.add("Right click to shoot fireballs");
}
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
itemstack.damageItem(1, player);
        if (!world.isRemote) {
            Vec3 v3 = player.getLook(1);
            EntitySmallFireball smallfireball = new EntitySmallFireball(world, player.posX, player.posY + player.eyeHeight, player.posZ, v3.xCoord, v3.yCoord, v3.zCoord);
            smallfireball.shootingEntity = player;
            world.playSoundAtEntity(player, "mob.ghast.fireball", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
            world.spawnEntityInWorld(smallfireball);
        }
        return itemStack;
    }
 
 
 
 
}}

[/spoiler]

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It gave me an error.
Thu, 02/11/2016 - 20:12

It gave me an error.

[spoiler]C:\Pylo\MCreator162\forge\build\sources\main\java\mod\mcreator\mcreator_fireWand.java:147: error: cannot find symbol
itemstack.damageItem(1, player);
^
  symbol:   variable itemstack
  location: class ItemfireWand
:compileJava FAILED
1 error
BUILD FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Total time: 21.679 secs
C:\Pylo\MCreator162\forge>
Task completed with return code 0 in 26139 milliseconds

[/spoiler]

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh. Change "itemstack" to the
Thu, 02/11/2016 - 20:18

Oh. Change "itemstack" to the "itemStack"

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks!!! but one last thing,
Thu, 02/11/2016 - 20:30

Thanks!!! but one last thing, how do i make so whenever i right click i shoot a fireball right? Well i only want to shoot 30 fireballs, after 30 fireballs it broke, but now i tried it and it broke from a single right click. Do i change item use duration? Because it's set to 30 also i made a event when you right click in the air, it will lose durabilitty by 1 just tell me the numbers please, thanks.

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe would work change
Thu, 02/11/2016 - 20:38

Maybe would work change "onItemStackRightClick" to "onItemUseFinish". But i am not sure.

Last seen on 20:09, 17. Feb 2016
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Maybe would work change
Fri, 02/12/2016 - 17:11

@#9 Could you convert my item into a tool? maybe that would work.