Jump to content

Recommended Posts

Posted

Forge Version: 11.14.3.1487

 

Basic Setup:

I've created a Helper Interface for Gui Elements called GuiElement, so my custom Gui Elements provide some basic methods like isHovering(), mouseClick() or setEnabled().

 

In my case I created a GuiAdvancedTextField, which extends GuiTextField and implements GuiElement.

To satisfy the interface, I override

void setEnabled(boolean enabled);

 

When calling this Method while in the Development Environment, everything works fine, but after compiling the following error occurs:

java.lang.AbstractMethodError: somepackets.GuiAdvancedTextField.setEnabled(Z)V

 

As far as I understand, this is caused by setEnabled both overriding GuiTextField's setEnabled method with the same signature and implementing GuiElement's setEnabled method where GuiTextField doesn't implement GuiElement.

Renaming the interface's setEnabled method to setElementEnabled was a functioning workaround.

 

Thanks in advance for the fix,

Pixel

Posted

Thanks, this worked, but your example was wrong - you need the Method's return type in the signature.

What worked for me:

srgExtra "MD: my/mod/my/packages/GuiElement/setEnabled (Z)V my/mod/my/packages/GuiElement/func_146184_c (Z)V"

Posted

No problem, didn't take too long to figure that out.

I've decided to rename the interface's method now anyway, because of the possibility of other "native" Gui Elements having a method with the setEnabled(Z)V signature, and in that case, it wouldn't work again.

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.