Topic category: Help with Minecraft modding (Java Edition)
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:
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:
- Vanilla crafting table works perfectly: the issue is specific to custom blocks
- Tried different approaches:
- Using
getMenuProvider()
override - Extending
CraftingTableBlock
directly - Adding delays with
level.getServer().execute()
- Different
InteractionResult
return values
- Using
- No other procedures or triggers are set in MCreator for this block
- 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:
- Is this a known issue with MCreator + NeoForge 1.21.4?
- Should I use MCreator's GUI system instead of custom CraftingMenu?
- Are there any specific MCreator settings that might interfere with custom GUI code?
- 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.
If you use custom menu, there is a chance something is wrong in your code that causes it to close immediately
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:
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
Then, I also tried:
All approaches failed with the same behavior; server-side works perfectly, client-side GUI closes immediately.
Key Findings:
Environment Details:
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.