Jump to content

[Solved] [1.8.9] addinformation() and getSubItems() name clash issue


ChaKha

Recommended Posts

Hello,

 

So I've been trying to get this ItemBlock going, but I've run into a snag. These two methods:

 

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)

@SideOnly(Side.CLIENT)
@Override
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)

 

I'm trying to override these methods from the original ItemBlock/Item classes, but I keep recieving the message (from eclipse) that I can't override them and that it's causing a name clash. Any solutions or work-arounds would be greatly appreciated.

 

Edit: Using forge version 1.8-11.14.4.1577.

Link to comment
Share on other sites

Have you included only method stubs here, or are you actually defining them as methods with

{ }

  (optionally with code in between)?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It usually means that you either did not make your class properly extend the parent class (i.e. there are no parent methods to override), or it means that you didn't exactly get the prototype of the method correct (either the return type or the parameter list differs from the parent method).

 

Can you just post the whole code for your class?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

I definitely included more than just the method stubs, sorry if it wasn't clear that I was omitting the rest of the code!

 

I asked because the way you posted it, you posted an abstract method, which has different rules.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

The super profile for addInformation (as of mc 1.8 ):

    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {}

It looks as if you qualified the List in yours.

 

And getSubitems:

    @SideOnly(Side.CLIENT)
    public void getSubItems(Item itemIn, CreativeTabs tab, List subItems)
    {
        this.block.getSubBlocks(itemIn, tab, subItems);
    }

It looks as if you again added a qualifier to your List.

 

If these are still like this in 1.8.9, then try again without qualifiers. If that works, and you still want to enforce the nature of the lists, then you might need a runtime data-integrity check.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

The super profile for addInformation (as of mc 1.8 ):

    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) {}

It looks as if you qualified the List in yours.

 

And getSubitems:

    @SideOnly(Side.CLIENT)
    public void getSubItems(Item itemIn, CreativeTabs tab, List subItems)
    {
        this.block.getSubBlocks(itemIn, tab, subItems);
    }

It looks as if you again added a qualifier to your List.

 

If these are still like this in 1.8.9, then try again without qualifiers. If that works, and you still want to enforce the nature of the lists, then you might need a runtime data-integrity check.

 

1.8.8 added generics to vanilla code. The OP has the correct method signatures.

 

Edit: The title says 1.8.9, but the OP is actually using 1.8; so there aren't any generics.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

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.