-
How to make the player hold down left click? [1.18.1]
I found some Baritone commands that make a click but I cant seems to figure out how it works, can you help? public void Tester() { new Thread(() -> { if(StartTester) { Minecraft minecraft = Minecraft.getInstance(); minecraft.player.sendMessage(new TextComponent("Tester started"), minecraft.player.getUUID()); BaritoneAPI.getSettings().allowSprint.value = true; BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L; ICustomGoalProcess customGoalProcess = BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess(); IPlayerController playerController = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().playerController(); customGoalProcess.setGoalAndPath(new GoalXZ(1000, 0)); while(StartTester) { playerController.clickBlock(null, Direction.fromNormal(0,0,0)); try { Thread.sleep(50); } catch (InterruptedException e) { minecraft.player.sendMessage(new TextComponent("Thread sleep error"), minecraft.player.getUUID()); Thread.currentThread().interrupt(); } } } }).start(); } playerController.clickBlock(); seems to be the thing I need but I dont know how to make it work.
-
How to make the player hold down left click? [1.18.1]
As for listening if the mouse is pressed I found something for you: int pressed = java.awt.event.MouseEvent.BUTTON1; hope it helps, it might not be the exact thing you need but I think the library has listeners.
-
How to make the player hold down left click? [1.18.1]
It doesn't seem like it would work, it doesn't reference the Minecraft instance. If it were to exist it would probably use Minecraft.getInstance() for the input, otherwise I don't think it would make sense, I went over the docs for Minecraft.getInstance().player but I couldn't find anything useful, only setting the rotation and getting the position, I can't find anything for inputs, maybe the only thing I could find is the keys for the player's set controls, but even with that there isn't a way that I know of that could use those keys to make an input onto the client, or register an input.
-
How to make the player hold down left click? [1.18.1]
To add to this, I do not want to make a Minecraft bot like mineFlayer, that was not what I meant. I want to connect to the client side of the client using the mod and help them out like Baritone does, I want to help them farm or mine etc. I know that Baritone has those functions and accessing them would be great but making my own lets say #mine carrot command would be better. Maybe even at the end goal I could make a command to end the game by killing the ender dragon, but for that I need to create player inputs which I cannot seem to find even in the forge documentary, I asked ChatGPT but he only knows everything at and below 1.12.2 which is not what I want. A solution using external APIs would also be a good solution but I would prefer a solution without external APIs.
-
How to make the player hold down left click? [1.18.1]
I think that you are trying to find out the opposite of me, how to detect left click. I'm trying to make the player left click, or mine. I know there is a way to detect the thing that you want using Minecraft.getInstance().player.getAttack() or something like that, I know it has .attack something at the end of it, hope it helps. But still, how do I make the player LEFT CLICK, and how do I make the player HOLD LEFT CLICK? If you know thanks ahead.
-
How to make the player hold down left click? [1.18.1]
So I've been making a Minecraft bot because I want to get into AI and because I'm a bored student and I can't figure out how to make the player hold down left click, I've seen many people use KeyBind or minecraft.player.gameSettings but I figured that that doesn't work anymore because it's only in older versions(I think), I can't make the imports work (net.minecraft.client.settings). So far I figured out how to do it with the Baritone API using a loop but it's very CPU intensive, adding a delay makes it not work. while(true) { BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().setInputForceState(baritone.api.utils.input.Input.CLICK_LEFT, true); }
IPS spam blocked by CleanTalk.