#Problems with ScreenHandler / ScreenHandlerType

4 messages · Page 1 of 1 (latest)

analog yew
#

Hello guys 👋
I am having some problems regarding my Minecraft mod at the moment. I am trying to fix the ScreenHandlerType but I don’t really know what is wrong right now. On the first picture, you can see the code and the error I have and on the second picture you can see the associated class. Maybe it is important for you to know what the console says after trying to run:

    new ScreenHandlerType<TimerScreenHandler>((syncId, playerInventory) ->
    ^

Required: Factory<TimerScreenHandler>, FeatureSet
Determined: (syncId, pl[…]tory)
Reason: List of actual arguments has a different length than that of formal arguments
T is a type variable:
T expands ScreenHandler, declared in class ScreenHandlerType

The word „register“ is also underlined in red with the reason:
Cannot resolve method 'register(Registry<ScreenHandlerType<?>>, ScreenHandlerType<TimeeScreenHandler>)'

Would be very nice if someone knows what to do 🙂

last shoal
#

you are missing one argument. Instead try new ScreenHandlerType<>((syncId, playerInventory) -> new TimerScreenHandler(syncId, playerInventory), FeatureFlags.VANILLA_FEATURES);

#

also you could simplify it by changing lambda into constructor reference: TimerScreenHandler::new should be fine

analog yew