im having trouble closing this class, ive been trying for 2 hours

Its a huge collection of ifs

package net.minecraft.src;

import java.util.Random;
import java.util.*;

public class ItemTestItem extends Item
{
    public int TimesShot;

    public ItemTestItem(int i)
    {
        super(i);
        maxStackSize = 1;
                setMaxDamage(50);
    }

    public void onUpdate(ItemStack itemstack, World world, EntityLiving entityliving, int i, boolean flag)
    {
        if(itemstack.getItemDamage() != 0)
        {
            itemstack.damageItem(-1, entityliving);
        }
    }

    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, TimesShot timesshot)
    {
	if(timesshot == 5)
	{
	if(itemstack.getItemDamage() == 0)
	{
	if(entityplayer.inventory.consumeInventoryItem(mod_WIP.LAWRocket.shiftedIndex))
	{
        world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if(!world.multiplayerWorld)
	{
	world.entityJoinedWorld(new EntityRocketLAW(world, entityplayer));
	itemstack.damageItem(50, entityplayer);
	timesshot = 0;
	return itemstack; 
	} else {
	if(itemstack.getItemDamage() == 0)
        {
        if(entityplayer.inventory.consumeInventoryItem(mod_WIP.LAWRocket.shiftedIndex))
        {
        world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
        if(!world.multiplayerWorld)
        {
        world.entityJoinedWorld(new EntityRocketLAW(world, entityplayer));
	++timesshot;
	{
	itemstack.damageItem(6, entityplayer);
	return itemstack;	
	}
    }
}

The error is a end of file parsing

help please

re-check every { and }

for instance: why do you open a bracket on the next line

if(!world.multiplayerWorld)
        {
        world.entityJoinedWorld(new EntityRocketLAW(world, entityplayer));
	++timesshot;
	[B]{[/B]
	itemstack.damageItem(6, entityplayer);
	return itemstack;

I think you'll find you didn't close all your blocks that you open with a '{'.

Use Ctrl+Shift+F when you work in Eclipse, this will format your code. It's very useful when you don't know where you missed a bracket. The formatter will space out the code in the wrong way when you missed one, so you can see where you made an error!

Use Ctrl+Shift+F when you work in Eclipse,

for all we know, he's writing his code in Notepad ..

Edited 5 Years Ago by stultuske: corrected typo

Maybe, that's why I said 'if'.

I always encourage people to start programming with a good IDE (no, let's not start a discussion which is the best), to avoid these kind of mistakes.

Maybe, that's why I said 'if'.

I always encourage people to start programming with a good IDE (no, let's not start a discussion which is the best), to avoid these kind of mistakes.

just re-read your previous post. I don't see an 'if' there, just a 'when' what is not entirely a synonym for if.

there is no 'Best' IDE, so discussing which is the best is indeed very pointless, but when starting to develop, I think it's better to use a simple text-editor. an IDE is capable of doing a lot of the work for you, which is one of the reasons why it's best to start with an IDE when you already have the hang of: writing small applications, working with packages, compiling and running from the command line, ..

which is why I said, that, for all we know, he(/she) is using notepad (or a similar editor). Indenting the code, especially when the class is as small as the one posted above, can be quite easily done manually, and when doing so, he'll find the mistakes as soon as he tries to indent a non-existing bracket.

Oh! I'm sorry, I thought I said 'if'. (I'm Dutch, so my English is not really good.)

Yes, if you indent your code manually, you'll find out eventually. I still think starting programmers should learn to code with IDE's, because they'll learn a lot faster, and never forget little stupid problems you would make in Notepad.

Comments
nothing against using IDE's, but it's better not to depend completely on them. btw: mijn nederlands is hoogstwaarschijnlijk ook beter dan mijn Engels :)
This question has already been answered. Start a new discussion instead.