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,

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so you need something that…
Sat, 10/04/2025 - 22:26

so you need something that isnt custom for it to process?

 

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you just need it to tell…
Sat, 10/04/2025 - 22:30

you just need it to tell mcreator, like "hey this procedure actually needs these dependencies". That's it.

You can try making the procedure without it to see what happens, you'll get a build error.

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
one slight critique, on my…
Sat, 10/04/2025 - 22:31

one slight critique, on my end it cant find entity on line 24. any idea why?

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OMG I JUST SAW YOUR MESSAGE…
Sat, 10/04/2025 - 22:32

OMG I JUST SAW YOUR MESSAGE TY

 

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It worked PERFECTLY!! Thank…
Sat, 10/04/2025 - 22:37

It worked PERFECTLY!! Thank you so much for the guidance!

 

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
what trigger would work best…
Sat, 10/04/2025 - 22:42

what trigger would work best to make it take damage after the gui opens?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
why couldn't you just place…
Sat, 10/04/2025 - 22:44

why couldn't you just place the damage block after the block that opens gui?

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thats item damage, not block…
Sat, 10/04/2025 - 23:20

thats item damage, not block damage

also doesnt it pause the game when the gui is open?

 

Joined Sep 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind it worked lol TY…
Sat, 10/04/2025 - 23:31

Nevermind it worked lol

TY FOR ALL OF THE HELP!!!!