Giter VIP home page Giter VIP logo

Comments (2)

ZacSharp avatar ZacSharp commented on June 16, 2024

TLDR: it depends.
Baritone has InputOverrideHandler which has some capabilities to "press" WASD, space, shift and mouse buttons, but it doesn't behave exactly like physically pressing keys. Most notably it won't simulate clicks when not looking at a block because it was made for interacting with blocks.
If you want to place a block or interact with a block using InputOverrideHandler is probably the easiest solution (it's on API, right?). There's also some helpers to look at things, but iirc those might be internal.
If you want to eat or otherwise use an item you should probably do the clicking yourself.

You definitely don't want PlayerController.click. That's the function called the first tick you left click a block (i.e. instamine or start breaking). PlayerController.processRightClickBlock/PlayerController.processRightClick might be what you want.

from baritone.

keygun-development avatar keygun-development commented on June 16, 2024

@ZacSharp Right, after trying out a little bit yesterday I indeed find the InputOverrideHandler to be the easiest and probably also the recommended solution.

So now i make the player look at the note block that needs to be right clicked and then call:
baritone.getInputOverrideHandler().setInputForceState(CLICK_RIGHT, true);

from baritone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.