How to open GUI from another mod

Started by NightShark115 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to open GUI from another mod

In my mod, I am trying to make an item that opens a GUI from another mod (specifically FTB Quests). I have created PlaceholderGui as a substitute for what the intended GUI would be. I understand that this would need to edit the current code, but I do not know how to do so.

 

My current code:

package net.mcreator.yggdrasil.procedures;

/* imports omitted */

public class GuideBookOpenQuestsProcedure {
	public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) {
		if (entity == null)
			return;
		{
			if (entity instanceof ServerPlayer _ent) {
				BlockPos _bpos = new BlockPos(x, y, z);
				NetworkHooks.openScreen((ServerPlayer) _ent, new MenuProvider() {
					@Override
					public Component getDisplayName() {
						return Component.literal("PlaceholderGui");
					}

					@Override
					public AbstractContainerMenu createMenu(int id, Inventory inventory, Player player) {
						return new PlaceholderGuiMenu(id, inventory, new FriendlyByteBuf(Unpooled.buffer()).writeBlockPos(_bpos));
					}
				}, _bpos);
			}
		}
	}
}

I see where "PlaceholdGui" is written, but how can I substitute this for the GUI I need?