GUI with no slots crashes game

Started by loressa on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
GUI with no slots crashes game

Using Mcreator 2026.1

I made a GUI with no slots, just a PNG background image.

I binded it to an item and had it open on right-click.

The size of inventory was 0

When I right-clicked with the item in hand it crashes the game and I get this error message:

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.inventory.Slot.getItem()" because the return value of "java.util.Map.get(Object)" is null

I also did one for a block and had Enable block entity switched off, and just Bind this block to GUI, open on right-click and Size of inventory (slot count): 0

Also crashed the game.

Let me know if you need to see the code for the GUI or item/block.

Thanks.