[HELP] Custom Crafting Table GUI Opens and Closes Immediately - NeoForge 1.21.4

Started by Sanya Lamhfheathoff on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[HELP] Custom Crafting Table GUI Opens and Closes Immediately - NeoForge 1.21.4

MCreator Version: Latest
Forge/NeoForge Version: NeoForge 1.21.4 (21.4.137)
Minecraft Version: 1.21.4

 

I'm trying to create a custom crafting table block that opens a crafting GUI with a custom name ("Temporary Crafting Table"). The block is created using custom code in MCreator. However, the GUI opens for just a split second and then immediately closes.

 

I've implemented the block using custom Java code, replacing the default MCreator-generated code entirely. Here's my current implementation:

TemporaryCraftingTable

 

Then the server logs show that everything works correctly on the server side:

[Server thread/INFO] [Erflettmod/]: Opening crafting menu for player: Dev

[Server thread/INFO] [Erflettmod/]: Menu opened successfully

However, the GUI still closes immediately on the client side.

 

What I've tested:

  1. Vanilla crafting table works perfectly: the issue is specific to custom blocks
  2. Tried different approaches:
    1. Using getMenuProvider() override
    2. Extending CraftingTableBlock directly
    3. Adding delays with level.getServer().execute()
    4. Different InteractionResult return values
  3. No other procedures or triggers are set in MCreator for this block
  4. Disabled all MCreator-generated code and replaced with custom implementation

 

Setup of this block: 

  • Created block element in MCreator
  • Disabled procedures and block entities
  • Opened the Java file and replaced all content with custom code
  • No "When right clicked" procedures set
  • No GUI elements configured in MCreator UI

 

I have four questions:

  1. Is this a known issue with MCreator + NeoForge 1.21.4?
  2. Should I use MCreator's GUI system instead of custom CraftingMenu?
  3. Are there any specific MCreator settings that might interfere with custom GUI code?
  4. Is there a client-server synchronization issue I'm missing?

Any help or suggestions would be greatly appreciated! The server-side logic works perfectly, but something prevents the client from keeping the GUI open.

Should I use MCreator's GUI…
Wed, 08/06/2025 - 16:37
  1. Should I use MCreator's GUI system instead of custom CraftingMenu?

If you use custom menu, there is a chance something is wrong in your code that causes it to close immediately

Joined Aug 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you for the suggestion…
Sat, 08/09/2025 - 08:11

Thank you for the suggestion about checking the custom menu code. I've conducted extensive debugging and found some very interesting results that point to a potential MCreator-specific bug with CraftingMenu.

 

Debug Results:

  • Test 1: Simple ChestMenu WORKS PERFECTLY
MenuProvider menuProvider = new SimpleMenuProvider(
    (id, inventory, p) -> ChestMenu.threeRows(id, inventory, new SimpleContainer(27)),
    Component.literal("Test GUI")
);

Opens and stays open normally, and no issues whatsoever

 

  • Test 2: CraftingMenu with detailed logging FAILS (Closes immediately)

    Test2Code

    Server logs show everything works perfectly

[Server thread/INFO] [Erflettmod/]: === DEBUG: Starting menu creation ===
[Server thread/INFO] [Erflettmod/]: ContainerLevelAccess created: net.minecraft.world.inventory.ContainerLevelAccess$2@7234d79
[Server thread/INFO] [Erflettmod/]: MenuProvider created: net.minecraft.world.SimpleMenuProvider@7bf5e2a3
[Server thread/INFO] [Erflettmod/]: Opening menu...
[Server thread/INFO] [Erflettmod/]: Creating CraftingMenu - ID: 2, Player: Dev
[Server thread/INFO] [Erflettmod/]: CraftingMenu created successfully: net.minecraft.world.inventory.CraftingMenu@3a8a1531
[Server thread/INFO] [Erflettmod/]: Menu opened successfully

 

Then, I also tried:

  • Different InteractionResult return values
  • Extending CraftingTableBlock directly
  • Using getMenuProvider() override method
  • Adding delays and explicit container closing
  • Manual synchronization attempts

All approaches failed with the same behavior; server-side works perfectly, client-side GUI closes immediately.

 

Key Findings:

  • Vanilla crafting table works perfectly
  • ChestMenu works perfectly in custom blocks
  • CraftingMenu fails ONLY in custom blocks
  • Server-side CraftingMenu creation is completely successful
  • Client-side synchronization appears to be broken

 

Environment Details:

  • MCreator Version: Latest
  • NeoForge: 1.21.4 (21.4.137)
  • Custom Code Approach, Replaced all MCreator-generated code
  • No other procedures/triggers set in MCreator
  • Single player testing environment

 

I think, this appears to be a client-server synchronisation bug specific to CraftingMenu in MCreator-generated custom blocks. The issue is not in the custom code itself (as evidenced by perfect server-side operation and working ChestMenu), but rather in how MCreator handles the network synchronisation for CraftingMenu specifically.