Jump to content

maximuslotro

Members
  • Posts

    8
  • Joined

  • Last visited

maximuslotro's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Understood. Just to clarify, the client doesn't need to be modded? I just want to have a vanilla client use the crafting gui without a physical table, or mods.
  2. Using: NetworkHooks.openGui(Splayer, new SimpleMenuProvider( (containerId, playerInventory, player) -> new VirtualCraftingMenu(containerId, playerInventory), CONTAINER_TITLE )); to open the menu results in the same problem
  3. Using this code: player.openMenu(getMenuProvider(player.level, player.blockPosition())); public MenuProvider getMenuProvider(Level p_52241_, BlockPos p_52242_) { return new SimpleMenuProvider((p_52229_, p_52230_, p_52231_) -> { return new VirtualCraftingMenu(p_52229_, p_52230_); }, CONTAINER_TITLE); } I get the crafting gui to fully open stay open, but putting items into the crafting gid will not show an output item
  4. I have extended the crafting menu public class VirtualCraftingMenu extends CraftingMenu { private final ContainerLevelAccess access; public VirtualCraftingMenu(int p_39356_, Inventory p_39357_, ContainerLevelAccess p_39358_) { super(p_39356_, p_39357_, p_39358_); this.access = p_39358_; } public VirtualCraftingMenu(int p_39353_, Inventory p_39354_) { this(p_39353_, p_39354_, ContainerLevelAccess.NULL); } // Override to return your menu type that identifies the screen to use @Override public MenuType<?> getType() { return MenuType.CRAFTING; } // Override to identify the block instance (used to force the user out of the screen if the block is destroyed) @Override public boolean stillValid(Player p_39368_) { //return stillValid(this.access, p_39368_, MY_CRAFTING_BLOCK.get()); return true; } } How would i now open it with player.openMenu() it is asking for a MenuProvider.
  5. Ok, I kinda new that wouldn't be ideal 😥 Thanks so much! I will try and implement that and will get back to you
  6. I'm creating a server-side mod that would allow one to use the command /craft and the crafting gui opens. In old versions (1.12.2) it would be done with this code. EntityPlayerMP player = someMethod(args) player.displayGui(new BlockWorkbench.InterfaceCraftingTable(player.world, player.getPosition())); In 1.18.2, I can cause the crafting gui/menu to open for a brief second with this code. if (commandContext.getSource().getEntity() instanceof Player) { ServerPlayer player = (ServerPlayer)commandContext.getSource().getEntity(); player.sendMessage(new TextComponent("Opening Crafting table"), player.getUUID()); CraftingTableBlock craftingTableBlock = new CraftingTableBlock(BlockBehaviour.Properties.of(Material.WOOD).strength(2.5F).sound(SoundType.WOOD)); player.openMenu(craftingTableBlock.getMenuProvider(craftingTableBlock.defaultBlockState(), player.getLevel(), player.blockPosition())); return Command.SINGLE_SUCCESS; } How do i stop it from closing? I'm probably calling the wrong methods.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.