How to open Crafting Menu on Item Right Click

Started by zyloyoutube on

Topic category: Troubleshooting, bugs, and solutions

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to open Crafting Menu on Item Right Click

Im trying to make a crafting pad that has one use. when right clicked, it is supposed to open the crafting menu, and when closed, its supposed to dissapear from my inventory. ive been tinkering and i cant think of a good way to open the gui without making a new custom one, but i dont want to make every recipie again. What do i do?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This should be simple but…
Sat, 10/04/2025 - 19:07

This should be simple but this sure took a while to figure out lol

if (entity instanceof ServerPlayer _entity) {
			_entity.openMenu(new MenuProvider() {
				@Override
				public Component getDisplayName() {
					return Component.translatable("container.crafting");
				}

				@Override
				public AbstractContainerMenu createMenu(int syncId, Inventory playerInv, Player player) {
					return new CraftingMenu(syncId, playerInv, new ContainerLevelAccess() {
						public <T> Optional<T> evaluate(BiFunction<Level, BlockPos, T> func) {
							return Optional.of(func.apply(player.level(), player.blockPosition()));
						}
					}){
						public boolean stillValid(Player player) {
							return true;
						}
					};
				}
			});
		}

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
does the air block act as…
Sat, 10/04/2025 - 20:45

does the air block act as the "container" somehow, or is it unnecisary?

 

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
no it's just, mcreator won't…
Sat, 10/04/2025 - 20:47

no it's just, mcreator won't automatically know when custom code snippets are using trigger dependencies so you have to "import" them like that.

As you can see that part of the procedure will never actually run,