Jump to content

Zappic3

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by Zappic3

  1. Thanks for your help, I figured it out!
  2. Hello, I have registered a key bind like this: public final class KeyInit { private KeyInit() { } public static KeyMapping exampleStartKeyMapping; public static final String EXAMPLE_KEY_CATEGORY = "key." + Example.MOD_ID + ".category"; public static void init() { bazaarStartKeyMapping = registerKey("start_key", EXAMPLE_KEY_CATEGORY, InputConstants.KEY_B); } private static KeyMapping registerKey(String name, String category, int keycode) { final var key = new KeyMapping("key."+Example.MOD_ID + "." + name, keycode, category); ClientRegistry.registerKeyBinding(key); return key; } } And I get the input from this key bind in the ClientTickEvent like this: @SubscribeEvent public static void clientTick(ClientTickEvent event) { if(KeyInit.exampleStartKeyMapping.consumeClick()) { // do stuff } } This event, however, triggers only when the key is pressed and the player has currently no menu, like the Inventory, open. I would like to also detect a key press while such menus are open. How would I achieve something like this? Thanks in advance!
  3. Sorry for the late reply, but that method was exactly what I was looking for. Thanks a lot for your help!
  4. Hello, I'm currently working on a client side mod, and I'm trying to get the description of an item inside the currently open container menu. I can get the title of an item like this: Minecraft.getInstance().player.containerMenu.getSlot(i).getItem().getDisplayName(); But I can't find a way to get the description. Any help is appreciated, thanks in advance.
  5. Thanks for your time warjort, I found the solution by looking at the source code from the controllable mod. For anyone that is interested, use the following method: Minecraft.getInstance().gameMode.handleInventoryMouseClick(menu_id, slot_to_click, mouse_button, click_type, Minecraft.getInstance().player);
  6. And there is no way to send a request to the server to move the items?
  7. Hello, I'm currently trying to create a client side mod for forge 1.18.2. I want to quickly move an item from an open chest inventory to the player's inventory. (like shift + left click) I found a method called "clicked". When I use that method, the item is moved, though it is only moved for the client. As soon as I interact with the item in my inventory, it disappears. It seems like the method only simulates a click for the client and doesn't apply/send the click to the world or server. Here is my code: Minecraft.getInstance().player.containerMenu.clicked(0, 0, ClickType.QUICK_MOVE, Minecraft.getInstance().player); And here is a video showing the clicking that is done by this method: https://youtu.be/B1O8fLzATXk I hope someone can help me, thanks in advance.
  8. PineApplePen, I had the same issue as you and I think I found a solution. Try: Minecraft.getInstance().player.chat("your message here!"); This is executed by the client, and It also works on multiplayer servers, but I only tested it in Forge 1.18.2.
×
×
  • Create New...

Important Information

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