Custom Block Entity With A GUI Blinks #2477
-
i wanted to make a diamond crafting table block entity with a gui, but for some reason, when i open this gui, it opens with an expected gui, then it closes, i have a repository for this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 31 replies
-
Check your run/logs/latest.log there is likely an error in there. e.g. First thing I find is this is never registered. |
Beta Was this translation helpful? Give feedback.
-
Your next problem is here: You are telling it to display the vanilla crafting table screen. You want it to use your ScreenHandler You want something like the following in DiamondCraftingTable (untested code):
You don't need that createScreenHandlerFactory() method in that class. Your BlockEntity is a NamedScreenHandlerFactory |
Beta Was this translation helpful? Give feedback.
Your next problem is here:
https://github.com/Gamer069/illia_fabric_1_19_mod/blob/1d1864562ece267a6bbf5f35f2f9c0d9cfd1cdd6/src/main/java/net/illia/illiafabricmod1_19/block/custom/DiamondCraftingTable.java#L77
You are telling it to display the vanilla crafting table screen.
This will check your block is a vanilla crafting table and close the screen if it is not.
See CraftingScreenHandler.canUse()
You want it to use your ScreenHandler
You are using a BlockEntity - the vanilla crafting table is not a block entity so the code is different.
You want something like the following in DiamondCraftingTable (untested code):