Just Enough Items (JEI)

Just Enough Items (JEI)

392M Downloads

1.15 to 1.16 - IGuiContainerHandler change creates compatibility issues.

KingLemming opened this issue · 3 comments

commented

There might be a reason that this change was made, but as is, going from:

public interface IGuiContainerHandler<T extends ContainerScreen>

to

public interface IGuiContainerHandler<T extends ContainerScreen<?>>

is a breaking change which prevents me implementing this using my own parameterized class.

My 1.15 code is as follows: public class PanelBounds implements IGuiContainerHandler<ContainerScreenCoFH>

In 1.16, attempting to change this declaration to: public class PanelBounds implements IGuiContainerHandler<ContainerScreenCoFH<?>> appears to work, but then doesn't as it fails in the main plugin instead with the following error:

java: method addGuiContainerHandler in interface mezz.jei.api.registration.IGuiHandlerRegistration cannot be applied to given types; required: java.lang.Class<? extends T>,mezz.jei.api.gui.handlers.IGuiContainerHandler<T> found: java.lang.Class<cofh.core.client.gui.ContainerScreenCoFH>,cofh.core.plugins.jei.PanelBounds reason: cannot infer type-variable(s) T (argument mismatch; java.lang.Class<cofh.core.client.gui.ContainerScreenCoFH> cannot be converted to java.lang.Class<? extends cofh.core.client.gui.ContainerScreenCoFH<?>>)

Basically, can we just remove that <?> as it seems unnecessary and is causing some issues?

commented

Please see

<T extends ContainerScreen<?>> void addGenericGuiContainerHandler(Class<? extends T> guiClass, IGuiContainerHandler<?> guiHandler);

Using that should make the generics work out like before for your case

commented

Interesting. Thanks! Happy to close this if you like, or want to leave it up for others to see?

commented

No problem! Should be fine to close, searching normally finds stuff that’s closed too, or I can just mark as duplicate.