Jump to content

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


Recommended Posts

Posted

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.

Posted

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.

Posted

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/

Posted

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.

Posted

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.

Posted

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.

Posted

Alright, so Jabelar and jeffryfisher were correct, I had overlooked the parameters (the lists in specific). All I needed to do was to correct them as jeffryfisher had done above. Thanks all of you!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://forums.minecraftforge.net/topic/157393-1201-forge-rocket-flame-particle-trail-moves-up-and-crashes-into-the-rocket-during-flight/#comment-584134
    • https://mclo.gs/bjf9fqs The link is the logs from modrinth  
    • "I want to understand how complex mods with ASM transformation and coremods work, such as Xray or AntiXray. Why do they break when you simply rename packages? What features of their architecture make refactoring difficult? And what techniques are used to protect these mods? I am interested in technical aspects in order to better understand the bytecode and Forge loader system."
    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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