Everything posted by Zappic3
-
Key Press Detection while a Menu (like Inventory) is Open - 1.18.2
Thanks for your help, I figured it out!
-
Key Press Detection while a Menu (like Inventory) is Open - 1.18.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!
-
How to get the item description from an item inside the current open container menu (clientside) (1.18.2)
Sorry for the late reply, but that method was exactly what I was looking for. Thanks a lot for your help!
-
How to get the item description from an item inside the current open container menu (clientside) (1.18.2)
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.
-
How to click an item in chest menu?
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);
-
How to click an item in chest menu?
And there is no way to send a request to the server to move the items?
-
How to click an item in chest menu?
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.
-
[1.19.2] How do you get the mod to send a message in the chat?
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.
IPS spam blocked by CleanTalk.