I am trying make a inventory-like Gui appear when the player press a button but after i followed a tutorial, it seems i got stuck with the code being a container for a entity instead of a inventory
The "CharmScreenHandler::new" is the one with the red underline mark
import com.hk.HollowKnight;
import com.hk.screens.custom.CharmScreenHandler;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.math.BlockPos;
import org.intellij.lang.annotations.Identifier;
public class ModScreensHandlers {
//public static final ScreenHandlerType<CharmScreenHandler> CHARM_SCREEN_HANDLER =
// Registry.register(Registries.SCREEN_HANDLER, Identifier.of(HollowKnight.MOD_ID, "charm_screen_handler"),
// new ExtendedScreenHandlerType<>(CharmScreenHandler::new, BlockPos.PACKET_CODEC));
public static final ScreenHandlerType<CharmScreenHandler> CHARM_SCREEN_HANDLER =
Registry.register(
Registries.SCREEN_HANDLER,
new ExtendedScreenHandlerType<>(CharmScreenHandler::new)
);
public static void registerScreenHandlers() {
HollowKnight.LOGGER.info("Registering Screen Handlers " + HollowKnight.MOD_ID);
}
}```