Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c72eb3e195 | |||
| a4237bf1f9 | |||
| e767e34b92 | |||
| 8ac82ebe2a | |||
| 0ed6ccab71 | |||
| bf25d7328e | |||
| a47b0c0581 | |||
| 596849c7e6 | |||
| 76914b7859 | |||
| 3dbbe053d7 | |||
| c474cdb1f8 | |||
| 3de02cbf21 | |||
| 26fefc70f0 | |||
| 4086c9f4b5 | |||
| c947c77853 | |||
| 9be44c0371 | |||
| 5412fa6cfd | |||
| 6e7320b954 | |||
| fbb2d37634 | |||
| 7afe16fc10 | |||
| b19f241d81 | |||
| 583ce80003 | |||
| 195c33407e |
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
- **Block breaking** Baritone considers breaking blocks as part of its path. It also takes into account your current tool set and hot bar. For example, if you have a Eff V diamond pick, it may choose to mine through a stone barrier, while if you only had a wood pick it might be faster to climb over it.
|
- **Block breaking** Baritone considers breaking blocks as part of its path. It also takes into account your current tool set and hot bar. For example, if you have a Eff V diamond pick, it may choose to mine through a stone barrier, while if you only had a wood pick it might be faster to climb over it.
|
||||||
- **Block placing** Baritone considers placing blocks as part of its path. This includes sneak-back-placing, pillaring, etc. It has a configurable penalty of placing a block (set to 1 second by default), to conserve its resources. The list of acceptable throwaway blocks is also configurable, and is cobble, dirt, or netherrack by default. <a href="https://www.youtube.com/watch?v=F6FbI1L9UmU">Example</a>
|
- **Block placing** Baritone considers placing blocks as part of its path. This includes sneak-back-placing, pillaring, etc. It has a configurable penalty of placing a block (set to 1 second by default), to conserve its resources. The list of acceptable throwaway blocks is also configurable, and is cobble, dirt, or netherrack by default. <a href="https://www.youtube.com/watch?v=F6FbI1L9UmU">Example</a>
|
||||||
- **Falling** Baritone will fall up to 3 blocks onto solid ground (configurable, if you have Feather Falling and/or don't mind taking a little damage). If you have a water bucket on your hotbar, it will fall up to 23 blocks and place the bucket beneath it. It will fall an unlimited distance into existing still water.
|
- **Falling** Baritone will fall up to 3 blocks onto solid ground (configurable, if you have Feather Falling and/or don't mind taking a little damage). If you have a water bucket on your hotbar, it will fall up to 23 blocks and place the bucket beneath it. It will fall an unlimited distance into existing still water.
|
||||||
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`).
|
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`). Baritone can break its fall by grabbing ladders / vines midair, and understands when that is and isn't possible.
|
||||||
- **Opening fence gates and doors**
|
- **Opening fence gates and doors**
|
||||||
- **Slabs and stairs**
|
- **Slabs and stairs**
|
||||||
- **Falling blocks** Baritone understands the costs of breaking blocks with falling blocks on top, and includes all of their break costs. Additionally, since it avoids breaking any blocks touching a liquid, it won't break the bottom of a gravel stack below a lava lake (anymore).
|
- **Falling blocks** Baritone understands the costs of breaking blocks with falling blocks on top, and includes all of their break costs. Additionally, since it avoids breaking any blocks touching a liquid, it won't break the bottom of a gravel stack below a lava lake (anymore).
|
||||||
|
|||||||
-90
@@ -1,90 +0,0 @@
|
|||||||
# Integration between Baritone and Impact
|
|
||||||
Impact 4.4 has Baritone included.
|
|
||||||
|
|
||||||
These instructions apply to Impact 4.3.
|
|
||||||
|
|
||||||
For Forge follow the instructions in [Setup](SETUP.md).
|
|
||||||
|
|
||||||
To run Baritone on Vanilla, just follow the instructions in the README (it's `./gradlew runClient`).
|
|
||||||
|
|
||||||
## An Introduction
|
|
||||||
There are some basic steps to getting Baritone setup with Impact.
|
|
||||||
- Acquiring a build of Baritone
|
|
||||||
- Placing Baritone in the libraries directory
|
|
||||||
- Modifying the Impact Profile JSON to run baritone
|
|
||||||
- How to use Baritone
|
|
||||||
|
|
||||||
## Acquiring a build of Baritone
|
|
||||||
There are two methods of acquiring a build of Baritone
|
|
||||||
|
|
||||||
### Official Release (Not always up to date)
|
|
||||||
https://github.com/cabaletta/baritone/releases
|
|
||||||
|
|
||||||
For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`. **For the rest of this guide, replace `X.Y.Z` with the actual numeric version you are using.**
|
|
||||||
|
|
||||||
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`.
|
|
||||||
|
|
||||||
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
|
|
||||||
|
|
||||||
### Building Baritone yourself
|
|
||||||
You can either build Baritone through a command line or through IntelliJ's UI, information on that can be found [here](SETUP.md#building).
|
|
||||||
|
|
||||||
## Placing Baritone in the libraries directory
|
|
||||||
``/libraries`` is a neat directory in your <a href="https://minecraft.gamepedia.com/.minecraft">Minecraft Installation Directory</a>
|
|
||||||
that contains all of the dependencies that are required from the game and some mods. This is where we will be
|
|
||||||
putting baritone.
|
|
||||||
- Locate the ``libraries`` folder, it should be in the Minecraft Installation Directory
|
|
||||||
- Create 3 new subdirectories starting from ``libraries``
|
|
||||||
- ``cabaletta``
|
|
||||||
- ``baritone``
|
|
||||||
- ``X.Y.Z``
|
|
||||||
- Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder, renamed like so:
|
|
||||||
- The full path should look like ``<Minecraft>/libraries/cabaletta/baritone/X.Y.Z/baritone-X.Y.Z.jar``
|
|
||||||
|
|
||||||
## Modifying the Impact Profile JSON to run baritone
|
|
||||||
The final step is "registering" the Baritone library with Impact, so that it loads on launch.
|
|
||||||
- Ensure your Minecraft launcher is closed
|
|
||||||
- Navigate back to the Minecraft Installation Directory
|
|
||||||
- Find the ``versions`` directory, and open in
|
|
||||||
- In here there should be a ``1.12.2-Impact_4.3`` folder.
|
|
||||||
- If you don't have any Impact folder or have a version older than 4.3, you can download Impact <a href="https://impactdevelopment.github.io">here</a>.
|
|
||||||
- Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json``
|
|
||||||
- Open the JSON file with a text editor that supports your system's line endings
|
|
||||||
- For example, Notepad on Windows likely will NOT work for this. You should instead use a Text Editor like
|
|
||||||
<a href="https://notepad-plus-plus.org/">Notepad++</a> if you're on Windows. (For other systems, I'm not sure
|
|
||||||
what would work the best so you may have to do some research.)
|
|
||||||
- Find the ``libraries`` array in the JSON. It should look something like this.
|
|
||||||
```
|
|
||||||
"libraries": [
|
|
||||||
{
|
|
||||||
"name": "net.minecraft:launchwrapper:1.12"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "com.github.ImpactDevelopment:Impact:4.3-1.12.2",
|
|
||||||
"url": "https://impactdevelopment.github.io/maven/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "com.github.ImpactDeveloment:ClientAPI:3.0.2",
|
|
||||||
"url": "https://impactdevelopment.github.io/maven/"
|
|
||||||
},
|
|
||||||
...
|
|
||||||
```
|
|
||||||
- Create two new objects in the array, between the ``Impact`` and ``ClientAPI`` dependencies preferably.
|
|
||||||
```
|
|
||||||
{
|
|
||||||
"name": "cabaletta:baritone:X.Y.Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "com.github.ImpactDevelopment:SimpleTweaker:1.2",
|
|
||||||
"url": "https://impactdevelopment.github.io/maven/"
|
|
||||||
},
|
|
||||||
```
|
|
||||||
- Now find the ``"minecraftArguments": "..."`` text near the top.
|
|
||||||
- At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like:
|
|
||||||
- ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweaker"``
|
|
||||||
- If you didn't close your launcher for this step, restart it now.
|
|
||||||
- You can now launch Impact 4.3 as normal, and Baritone should start up
|
|
||||||
|
|
||||||
## How to use Baritone
|
|
||||||
|
|
||||||
- [Baritone chat control usage](USAGE.md)
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -1,7 +1,7 @@
|
|||||||
# Baritone
|
# Baritone
|
||||||
[](https://travis-ci.com/cabaletta/baritone)
|
[](https://travis-ci.com/cabaletta/baritone)
|
||||||
[](https://github.com/cabaletta/baritone/releases)
|
[](https://github.com/cabaletta/baritone/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade)
|
[](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade)
|
||||||
[](http://hits.dwyl.com/cabaletta/baritone)
|
[](http://hits.dwyl.com/cabaletta/baritone)
|
||||||
[](https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle)
|
[](https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle)
|
||||||
@@ -40,11 +40,9 @@ Here are some links to help to get started:
|
|||||||
|
|
||||||
- [Features](FEATURES.md)
|
- [Features](FEATURES.md)
|
||||||
|
|
||||||
- [Setup](SETUP.md)
|
- [Installation & setup](SETUP.md)
|
||||||
|
|
||||||
- [Installation](INSTALL.md)
|
- [API Javadocs](https://baritone.leijurv.com/)
|
||||||
|
|
||||||
- [Javadocs](https://baritone.leijurv.com/)
|
|
||||||
|
|
||||||
- [Settings](https://baritone.leijurv.com/baritone/api/Settings.html#field.detail)
|
- [Settings](https://baritone.leijurv.com/baritone/api/Settings.html#field.detail)
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
# Setup
|
# Installation
|
||||||
|
|
||||||
## Prebuilt
|
## Prebuilt official releases
|
||||||
(not always completely up to date with latest features)
|
These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `builder` branch for example, you'll have to build it yourself)
|
||||||
|
|
||||||
Download from the [Releases](https://github.com/cabaletta/baritone/releases)
|
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
|
||||||
|
|
||||||
The Forge releases can simply be added as a Forge mod.
|
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`.
|
||||||
|
|
||||||
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
|
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
|
||||||
|
|
||||||
Previously (Baritone v1.1.2 and below), it was not fully compatible with the latest version of Forge. `freeLook` was broken in Forge 14.23.4.2744. Forge 14.23.4.2743 or **older** worked with Baritone v1.1.2 and lower. Newer versions of Forge "worked", sort of, but Baritone's movement became unreliable and `freeLook` must be off.
|
|
||||||
|
|
||||||
## Artifacts
|
## Artifacts
|
||||||
|
|
||||||
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
|
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
|
||||||
|
|
||||||
|
**The Forge release can simply be added as a Forge mod.**
|
||||||
|
|
||||||
|
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
|
||||||
|
|
||||||
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
|
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
|
||||||
- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration.
|
- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration.
|
||||||
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
|
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
|
||||||
@@ -22,9 +25,9 @@ Building Baritone will result in 5 artifacts created in the ``dist`` directory.
|
|||||||
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
|
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
|
||||||
|
|
||||||
## More Info
|
## More Info
|
||||||
To replace out Impact 4.4's Baritone build with a customized one, switch to the `impact4.4-compat` branch, build Baritone as above then copy `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.0.0/baritone-api-1.0.0.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.4/1.12.2-Impact_4.4.json`, find the line `"name": "cabaletta:baritone-api:1.0.0"`, remove the comma from the end, and entirely remove the line that's immediately after (starts with `"url"`).
|
To replace out Impact 4.5's Baritone build with a customized one, build Baritone as above then copy `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.2/baritone-api-1.2.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.5/1.12.2-Impact_4.5.json`, find the line `"name": "cabaletta:baritone-api:1.2"`, remove the comma from the end, and **entirely remove the next line** (starts with `"url"`).
|
||||||
|
|
||||||
Impact 4.4 **only** works with builds from the quite outdated `impact4.4-compat` branch. If you must have the latest Baritone features with Impact, and can't wait for 4.5, consider creating a standalone (non forge) build then adding it to Impact 4.**3** via the instructions in [Install](INSTALL.md).
|
You can verify whether or not it worked by running `.b version` in chat (only valid in Impact). If it says `v1.2.0` then you didn't do it properly, and it's still running the version that came with 4.5.
|
||||||
|
|
||||||
## Build it yourself
|
## Build it yourself
|
||||||
- Clone or download Baritone
|
- Clone or download Baritone
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Therefore you can use a prefix before your messages.
|
|||||||
On Baritone v1.1.0 and newer: The prefix is `#` by default. Anything beginning with `#` isn't sent, and is only interpreted by Baritone.
|
On Baritone v1.1.0 and newer: The prefix is `#` by default. Anything beginning with `#` isn't sent, and is only interpreted by Baritone.
|
||||||
For older than v1.1.0, `#` must be enabled by toggling on the `prefix` setting.
|
For older than v1.1.0, `#` must be enabled by toggling on the `prefix` setting.
|
||||||
|
|
||||||
**Only** in Impact 4.4 is `.b` also a valid prefix. In 4.4, `#` does **not** work, neither does saying the commands directly in chat.
|
**Only** in Impact is `.b` also a valid prefix. In 4.4, `#` does **not** work, neither does saying the commands directly in chat. `#` works by default in 4.5 (not 4.4).
|
||||||
|
|
||||||
Other clients like Kami and Asuna have their own custom things (like `-path`), and can disable direct chat control entirely.
|
Other clients like Kami and Asuna have their own custom things (like `-path`), and can disable direct chat control entirely.
|
||||||
|
|
||||||
@@ -39,6 +39,7 @@ Some common examples:
|
|||||||
- `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120).
|
- `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120).
|
||||||
- `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start.
|
- `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start.
|
||||||
- `render` to rerender the world in case `renderCachedChunks` is being glitchy
|
- `render` to rerender the world in case `renderCachedChunks` is being glitchy
|
||||||
|
- `version` to get the version of Baritone you're running
|
||||||
- `damn` daniel
|
- `damn` daniel
|
||||||
|
|
||||||
For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/main/java/baritone/utils/ExampleBaritoneControl.java).
|
For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/main/java/baritone/utils/ExampleBaritoneControl.java).
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
group 'baritone'
|
group 'baritone'
|
||||||
version '1.2.0'
|
version '1.2.3'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
Vendored
+1
-2
@@ -13,8 +13,7 @@
|
|||||||
-repackageclasses 'baritone'
|
-repackageclasses 'baritone'
|
||||||
|
|
||||||
# lwjgl is weird
|
# lwjgl is weird
|
||||||
-dontwarn org.lwjgl.opengl.GL14
|
-dontwarn org.lwjgl.**
|
||||||
-dontwarn org.lwjgl.opengl.GL11
|
|
||||||
|
|
||||||
-keep class baritone.api.** { *; } # this is the keep api
|
-keep class baritone.api.** { *; } # this is the keep api
|
||||||
|
|
||||||
|
|||||||
@@ -170,6 +170,11 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public final Setting<Boolean> sprintAscends = new Setting<>(true);
|
public final Setting<Boolean> sprintAscends = new Setting<>(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many ticks between right clicks are allowed. Default in game is 4
|
||||||
|
*/
|
||||||
|
public final Setting<Integer> rightClickSpeed = new Setting<>(4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the big A* setting.
|
* This is the big A* setting.
|
||||||
* As long as your cost heuristic is an *underestimate*, it's guaranteed to find you the best path.
|
* As long as your cost heuristic is an *underestimate*, it's guaranteed to find you the best path.
|
||||||
@@ -386,11 +391,6 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
|
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel baritone on left click, as a form of "panic button"
|
|
||||||
*/
|
|
||||||
public final Setting<Boolean> clickCancel = new Setting<>(false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remember the contents of containers (chests, echests, furnaces)
|
* Remember the contents of containers (chests, echests, furnaces)
|
||||||
* <p>
|
* <p>
|
||||||
@@ -509,11 +509,6 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public final Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
|
public final Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
|
||||||
|
|
||||||
/**
|
|
||||||
* If true, Baritone will not allow you to left or right click while pathing
|
|
||||||
*/
|
|
||||||
public final Setting<Boolean> suppressClicks = new Setting<>(false);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not to use the "#" command prefix
|
* Whether or not to use the "#" command prefix
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package baritone.api.utils;
|
|||||||
|
|
||||||
import baritone.api.behavior.IBehavior;
|
import baritone.api.behavior.IBehavior;
|
||||||
import baritone.api.utils.input.Input;
|
import baritone.api.utils.input.Input;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
@@ -27,8 +26,6 @@ import net.minecraft.client.settings.KeyBinding;
|
|||||||
*/
|
*/
|
||||||
public interface IInputOverrideHandler extends IBehavior {
|
public interface IInputOverrideHandler extends IBehavior {
|
||||||
|
|
||||||
Boolean isInputForcedDown(KeyBinding key);
|
|
||||||
|
|
||||||
boolean isInputForcedDown(Input input);
|
boolean isInputForcedDown(Input input);
|
||||||
|
|
||||||
void setInputForceState(Input input, boolean forced);
|
void setInputForceState(Input input, boolean forced);
|
||||||
|
|||||||
@@ -17,12 +17,17 @@
|
|||||||
|
|
||||||
package baritone.api.utils;
|
package baritone.api.utils;
|
||||||
|
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ClickType;
|
import net.minecraft.inventory.ClickType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.GameType;
|
import net.minecraft.world.GameType;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Brady
|
* @author Brady
|
||||||
@@ -43,4 +48,6 @@ public interface IPlayerController {
|
|||||||
default double getBlockReachDistance() {
|
default double getBlockReachDistance() {
|
||||||
return this.getGameType().isCreative() ? 5.0F : 4.5F;
|
return this.getGameType().isCreative() ? 5.0F : 4.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnumActionResult processRightClickBlock(EntityPlayerSP player, World world, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of Baritone.
|
|
||||||
*
|
|
||||||
* Baritone is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Baritone is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package baritone.launch.mixins;
|
|
||||||
|
|
||||||
import baritone.Baritone;
|
|
||||||
import baritone.api.BaritoneAPI;
|
|
||||||
import baritone.utils.Helper;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Brady
|
|
||||||
* @since 7/31/2018
|
|
||||||
*/
|
|
||||||
@Mixin(KeyBinding.class)
|
|
||||||
public class MixinKeyBinding {
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
private int pressTime;
|
|
||||||
|
|
||||||
@Inject(
|
|
||||||
method = "isKeyDown",
|
|
||||||
at = @At("HEAD"),
|
|
||||||
cancellable = true
|
|
||||||
)
|
|
||||||
private void isKeyDown(CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
// only the primary baritone forces keys
|
|
||||||
Boolean force = BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this);
|
|
||||||
if (force != null) {
|
|
||||||
if (!force && !Baritone.settings().suppressClicks.get()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cir.setReturnValue(force); // :sunglasses:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(
|
|
||||||
method = "isPressed",
|
|
||||||
at = @At("HEAD"),
|
|
||||||
cancellable = true
|
|
||||||
)
|
|
||||||
private void isPressed(CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
// only the primary baritone forces keys
|
|
||||||
Boolean force = BaritoneAPI.getProvider().getPrimaryBaritone().getInputOverrideHandler().isInputForcedDown((KeyBinding) (Object) this);
|
|
||||||
if (pressTime > 0 && (KeyBinding) (Object) this == Minecraft.getMinecraft().gameSettings.keyBindAttack && Baritone.settings().clickCancel.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing()) {
|
|
||||||
Helper.HELPER.logDirect("Cancelling path on left click since the clickCancel setting is enabled!");
|
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (force != null && !force && Baritone.settings().suppressClicks.get()) { // <-- cursed
|
|
||||||
if (pressTime > 0) {
|
|
||||||
Helper.HELPER.logDirect("You're trying to press this mouse button but I won't let you.");
|
|
||||||
Helper.HELPER.logDirect("Turn off the suppressClicks setting to allow clicking while pathing.");
|
|
||||||
pressTime--;
|
|
||||||
}
|
|
||||||
cir.setReturnValue(force); // :sunglasses:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
"MixinEntityLivingBase",
|
"MixinEntityLivingBase",
|
||||||
"MixinEntityPlayerSP",
|
"MixinEntityPlayerSP",
|
||||||
"MixinEntityRenderer",
|
"MixinEntityRenderer",
|
||||||
"MixinKeyBinding",
|
|
||||||
"MixinMinecraft",
|
"MixinMinecraft",
|
||||||
"MixinNetHandlerPlayClient",
|
"MixinNetHandlerPlayClient",
|
||||||
"MixinNetworkManager",
|
"MixinNetworkManager",
|
||||||
|
|||||||
+10
-7
@@ -19,10 +19,7 @@ package baritone.cache;
|
|||||||
|
|
||||||
import baritone.pathing.movement.MovementHelper;
|
import baritone.pathing.movement.MovementHelper;
|
||||||
import baritone.utils.pathing.PathingBlockType;
|
import baritone.utils.pathing.PathingBlockType;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.BlockDoublePlant;
|
|
||||||
import net.minecraft.block.BlockFlower;
|
|
||||||
import net.minecraft.block.BlockTallGrass;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -73,7 +70,7 @@ public final class ChunkPacker {
|
|||||||
for (int x = 0; x < 16; x++) {
|
for (int x = 0; x < 16; x++) {
|
||||||
int index = CachedChunk.getPositionIndex(x, y, z);
|
int index = CachedChunk.getPositionIndex(x, y, z);
|
||||||
IBlockState state = bsc.get(x, y1, z);
|
IBlockState state = bsc.get(x, y1, z);
|
||||||
boolean[] bits = getPathingBlockType(state).getBits();
|
boolean[] bits = getPathingBlockType(state, chunk, x, y, z).getBits();
|
||||||
bitSet.set(index, bits[0]);
|
bitSet.set(index, bits[0]);
|
||||||
bitSet.set(index + 1, bits[1]);
|
bitSet.set(index + 1, bits[1]);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
@@ -122,11 +119,17 @@ public final class ChunkPacker {
|
|||||||
return resourceCache.computeIfAbsent(name, n -> Block.getBlockFromName(n.contains(":") ? n : "minecraft:" + n));
|
return resourceCache.computeIfAbsent(name, n -> Block.getBlockFromName(n.contains(":") ? n : "minecraft:" + n));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathingBlockType getPathingBlockType(IBlockState state) {
|
private static PathingBlockType getPathingBlockType(IBlockState state, Chunk chunk, int x, int y, int z) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if ((block == Blocks.WATER || block == Blocks.FLOWING_WATER) && !MovementHelper.isFlowing(state)) {
|
if (block == Blocks.WATER || block == Blocks.FLOWING_WATER) {
|
||||||
// only water source blocks are plausibly usable, flowing water should be avoid
|
// only water source blocks are plausibly usable, flowing water should be avoid
|
||||||
// FLOWING_WATER is a waterfall, it doesn't really matter and caching it as AVOID just makes it look wrong
|
// FLOWING_WATER is a waterfall, it doesn't really matter and caching it as AVOID just makes it look wrong
|
||||||
|
if (!MovementHelper.possiblyFlowing(state)) {
|
||||||
|
return PathingBlockType.WATER;
|
||||||
|
}
|
||||||
|
if (BlockLiquid.getSlopeAngle(chunk.getWorld(), new BlockPos(x + chunk.x << 4, y, z + chunk.z << 4), state.getMaterial(), state) != -1000.0F) {
|
||||||
|
return PathingBlockType.AVOID;
|
||||||
|
}
|
||||||
return PathingBlockType.WATER;
|
return PathingBlockType.WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ import net.minecraft.util.math.BlockPos;
|
|||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP;
|
import static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,7 +76,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
if (block == Blocks.AIR) { // early return for most common case
|
if (block == Blocks.AIR) { // early return for most common case
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA) {
|
if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof BlockSkull) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (block instanceof BlockDoor || block instanceof BlockFenceGate) {
|
if (block instanceof BlockDoor || block instanceof BlockFenceGate) {
|
||||||
@@ -107,7 +109,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
}
|
}
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
if (isFlowing(state)) {
|
if (isFlowing(x, y, z, state, bsi)) {
|
||||||
return false; // Don't walk through flowing liquids
|
return false; // Don't walk through flowing liquids
|
||||||
}
|
}
|
||||||
if (block instanceof BlockLiquid) {
|
if (block instanceof BlockLiquid) {
|
||||||
@@ -157,7 +159,8 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
|| block instanceof BlockSnow
|
|| block instanceof BlockSnow
|
||||||
|| block instanceof BlockLiquid
|
|| block instanceof BlockLiquid
|
||||||
|| block instanceof BlockTrapDoor
|
|| block instanceof BlockTrapDoor
|
||||||
|| block instanceof BlockEndPortal) {
|
|| block instanceof BlockEndPortal
|
||||||
|
|| block instanceof BlockSkull) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// door, fence gate, liquid, trapdoor have been accounted for, nothing else uses the world or pos parameters
|
// door, fence gate, liquid, trapdoor have been accounted for, nothing else uses the world or pos parameters
|
||||||
@@ -285,10 +288,10 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
// since this is called literally millions of times per second, the benefit of not allocating millions of useless "pos.up()"
|
// since this is called literally millions of times per second, the benefit of not allocating millions of useless "pos.up()"
|
||||||
// BlockPos s that we'd just garbage collect immediately is actually noticeable. I don't even think its a decrease in readability
|
// BlockPos s that we'd just garbage collect immediately is actually noticeable. I don't even think its a decrease in readability
|
||||||
Block up = bsi.get0(x, y + 1, z).getBlock();
|
Block up = bsi.get0(x, y + 1, z).getBlock();
|
||||||
if (up == Blocks.WATERLILY) {
|
if (up == Blocks.WATERLILY || up == Blocks.CARPET) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isFlowing(state) || block == Blocks.FLOWING_WATER) {
|
if (isFlowing(x, y, z, state, bsi) || block == Blocks.FLOWING_WATER) {
|
||||||
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
|
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
|
||||||
return isWater(up) && !Baritone.settings().assumeWalkOnWater.get();
|
return isWater(up) && !Baritone.settings().assumeWalkOnWater.get();
|
||||||
}
|
}
|
||||||
@@ -485,15 +488,34 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
return BlockStateInterface.getBlock(ctx, p) instanceof BlockLiquid;
|
return BlockStateInterface.getBlock(ctx, p) instanceof BlockLiquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isFlowing(IBlockState state) {
|
static boolean possiblyFlowing(IBlockState state) {
|
||||||
// Will be IFluidState in 1.13
|
// Will be IFluidState in 1.13
|
||||||
return state.getBlock() instanceof BlockLiquid
|
return state.getBlock() instanceof BlockLiquid
|
||||||
&& state.getValue(BlockLiquid.LEVEL) != 0;
|
&& state.getValue(BlockLiquid.LEVEL) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean isFlowing(int x, int y, int z, IBlockState state, BlockStateInterface bsi) {
|
||||||
|
if (!(state.getBlock() instanceof BlockLiquid)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (state.getValue(BlockLiquid.LEVEL) != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return possiblyFlowing(bsi.get0(x + 1, y, z))
|
||||||
|
|| possiblyFlowing(bsi.get0(x - 1, y, z))
|
||||||
|
|| possiblyFlowing(bsi.get0(x, y, z + 1))
|
||||||
|
|| possiblyFlowing(bsi.get0(x, y, z - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static PlaceResult attemptToPlaceABlock(MovementState state, IBaritone baritone, BlockPos placeAt, boolean preferDown) {
|
static PlaceResult attemptToPlaceABlock(MovementState state, IBaritone baritone, BlockPos placeAt, boolean preferDown) {
|
||||||
IPlayerContext ctx = baritone.getPlayerContext();
|
IPlayerContext ctx = baritone.getPlayerContext();
|
||||||
|
Optional<Rotation> direct = RotationUtils.reachable(ctx, placeAt); // we assume that if there is a block there, it must be replacable
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
if (direct.isPresent()) {
|
||||||
|
state.setTarget(new MovementState.MovementTarget(direct.get(), true));
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
BlockPos against1 = placeAt.offset(HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i]);
|
BlockPos against1 = placeAt.offset(HORIZONTALS_BUT_ALSO_DOWN____SO_EVERY_DIRECTION_EXCEPT_UP[i]);
|
||||||
if (MovementHelper.canPlaceAgainst(ctx, against1)) {
|
if (MovementHelper.canPlaceAgainst(ctx, against1)) {
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class MovementDescend extends Movement {
|
|||||||
if (context.assumeWalkOnWater) {
|
if (context.assumeWalkOnWater) {
|
||||||
return false; // TODO fix
|
return false; // TODO fix
|
||||||
}
|
}
|
||||||
if (MovementHelper.isFlowing(ontoBlock)) {
|
if (MovementHelper.isFlowing(destX, newY, destZ, ontoBlock, context.bsi)) {
|
||||||
return false; // TODO flowing check required here?
|
return false; // TODO flowing check required here?
|
||||||
}
|
}
|
||||||
if (!MovementHelper.canWalkOn(context.bsi, destX, newY - 1, destZ)) {
|
if (!MovementHelper.canWalkOn(context.bsi, destX, newY - 1, destZ)) {
|
||||||
@@ -202,7 +202,8 @@ public class MovementDescend extends Movement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BlockPos playerFeet = ctx.playerFeet();
|
BlockPos playerFeet = ctx.playerFeet();
|
||||||
if (playerFeet.equals(dest) && (MovementHelper.isLiquid(ctx, dest) || ctx.player().posY - playerFeet.getY() < 0.094)) { // lilypads
|
BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
|
||||||
|
if ((playerFeet.equals(dest) || playerFeet.equals(fakeDest)) && (MovementHelper.isLiquid(ctx, dest) || ctx.player().posY - dest.getY() < 0.5)) { // lilypads
|
||||||
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
|
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
|
||||||
return state.setStatus(MovementStatus.SUCCESS);
|
return state.setStatus(MovementStatus.SUCCESS);
|
||||||
/* else {
|
/* else {
|
||||||
@@ -228,12 +229,8 @@ public class MovementDescend extends Movement {
|
|||||||
double z = ctx.player().posZ - (src.getZ() + 0.5);
|
double z = ctx.player().posZ - (src.getZ() + 0.5);
|
||||||
double fromStart = Math.sqrt(x * x + z * z);
|
double fromStart = Math.sqrt(x * x + z * z);
|
||||||
if (!playerFeet.equals(dest) || ab > 0.25) {
|
if (!playerFeet.equals(dest) || ab > 0.25) {
|
||||||
BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
|
if (numTicks++ < 20 && fromStart < 1.25) {
|
||||||
if (numTicks++ < 20) {
|
|
||||||
MovementHelper.moveTowards(ctx, state, fakeDest);
|
MovementHelper.moveTowards(ctx, state, fakeDest);
|
||||||
if (fromStart > 1.25) {
|
|
||||||
state.getTarget().rotation = new Rotation(state.getTarget().rotation.getYaw() + 180F, state.getTarget().rotation.getPitch());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
MovementHelper.moveTowards(ctx, state, dest);
|
MovementHelper.moveTowards(ctx, state, dest);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import baritone.pathing.movement.MovementState;
|
|||||||
import baritone.utils.BlockStateInterface;
|
import baritone.utils.BlockStateInterface;
|
||||||
import baritone.utils.pathing.MutableMoveResult;
|
import baritone.utils.pathing.MutableMoveResult;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@@ -85,7 +86,7 @@ public class MovementParkour extends Movement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IBlockState standingOn = context.get(x, y - 1, z);
|
IBlockState standingOn = context.get(x, y - 1, z);
|
||||||
if (standingOn.getBlock() == Blocks.VINE || standingOn.getBlock() == Blocks.LADDER || standingOn.getBlock() instanceof BlockStairs || MovementHelper.isBottomSlab(standingOn)) {
|
if (standingOn.getBlock() == Blocks.VINE || standingOn.getBlock() == Blocks.LADDER || standingOn.getBlock() instanceof BlockStairs || MovementHelper.isBottomSlab(standingOn) || standingOn.getBlock() instanceof BlockLiquid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int maxJump;
|
int maxJump;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class MovementPillar extends Movement {
|
|||||||
if (!(fr instanceof BlockAir || fr.isReplaceable(ctx.world(), src))) {
|
if (!(fr instanceof BlockAir || fr.isReplaceable(ctx.world(), src))) {
|
||||||
state.setInput(Input.CLICK_LEFT, true);
|
state.setInput(Input.CLICK_LEFT, true);
|
||||||
blockIsThere = false;
|
blockIsThere = false;
|
||||||
} else if (ctx.player().isSneaking() && (Objects.equals(src.down(), ctx.objectMouseOver().getBlockPos()) || Objects.equals(src, ctx.objectMouseOver().getBlockPos()))) {
|
} else if (ctx.player().isSneaking() && (Objects.equals(src.down(), ctx.objectMouseOver().getBlockPos()) || Objects.equals(src, ctx.objectMouseOver().getBlockPos())) && ctx.player().posY > dest.getY() + 0.1) {
|
||||||
state.setInput(Input.CLICK_RIGHT, true);
|
state.setInput(Input.CLICK_RIGHT, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
|
|||||||
if (this.state == State.NONE) {
|
if (this.state == State.NONE) {
|
||||||
this.state = State.GOAL_SET;
|
this.state = State.GOAL_SET;
|
||||||
}
|
}
|
||||||
|
if (this.state == State.EXECUTING) {
|
||||||
|
this.state = State.PATH_REQUESTED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,7 +84,7 @@ public class CustomGoalProcess extends BaritoneProcessHelper implements ICustomG
|
|||||||
}
|
}
|
||||||
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL);
|
||||||
case PATH_REQUESTED:
|
case PATH_REQUESTED:
|
||||||
PathingCommand ret = new PathingCommand(this.goal, PathingCommandType.SET_GOAL_AND_PATH);
|
PathingCommand ret = new PathingCommand(this.goal, PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH);
|
||||||
this.state = State.EXECUTING;
|
this.state = State.EXECUTING;
|
||||||
return ret;
|
return ret;
|
||||||
case EXECUTING:
|
case EXECUTING:
|
||||||
|
|||||||
@@ -115,7 +115,9 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup Baritone's pathing goal and (if needed) begin pathing
|
// Setup Baritone's pathing goal and (if needed) begin pathing
|
||||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(GOAL);
|
if (!BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().isActive()) {
|
||||||
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(GOAL);
|
||||||
|
}
|
||||||
|
|
||||||
// If we have reached our goal, print a message and safely close the game
|
// If we have reached our goal, print a message and safely close the game
|
||||||
if (GOAL.isInGoal(ctx.playerFeet())) {
|
if (GOAL.isInGoal(ctx.playerFeet())) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public final class BlockBreakHelper implements Helper {
|
|||||||
|
|
||||||
private boolean didBreakLastTick;
|
private boolean didBreakLastTick;
|
||||||
|
|
||||||
private IPlayerContext playerContext;
|
private final IPlayerContext playerContext;
|
||||||
|
|
||||||
public BlockBreakHelper(IPlayerContext playerContext) {
|
public BlockBreakHelper(IPlayerContext playerContext) {
|
||||||
this.playerContext = playerContext;
|
this.playerContext = playerContext;
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Baritone.
|
||||||
|
*
|
||||||
|
* Baritone is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Baritone is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baritone.utils;
|
||||||
|
|
||||||
|
import baritone.Baritone;
|
||||||
|
import baritone.api.utils.IPlayerContext;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
|
||||||
|
public class BlockPlaceHelper implements Helper {
|
||||||
|
private final IPlayerContext ctx;
|
||||||
|
private int rightClickTimer;
|
||||||
|
|
||||||
|
public BlockPlaceHelper(IPlayerContext playerContext) {
|
||||||
|
this.ctx = playerContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick(boolean rightClickRequested) {
|
||||||
|
if (rightClickTimer > 0) {
|
||||||
|
rightClickTimer--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RayTraceResult mouseOver = ctx.objectMouseOver();
|
||||||
|
if (!rightClickRequested || ctx.player().isRowingBoat() || mouseOver == null || mouseOver.getBlockPos() == null || mouseOver.typeOfHit != RayTraceResult.Type.BLOCK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
rightClickTimer = Baritone.settings().rightClickSpeed.get();
|
||||||
|
for (EnumHand hand : EnumHand.values()) {
|
||||||
|
if (ctx.playerController().processRightClickBlock(ctx.player(), ctx.world(), mouseOver.getBlockPos(), mouseOver.sideHit, mouseOver.hitVec, hand) == EnumActionResult.SUCCESS) {
|
||||||
|
ctx.player().swingArm(hand);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -407,6 +407,16 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
|
|||||||
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
|
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (msg.equals("click")) {
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
mc.addScheduledTask(() -> mc.displayGuiScreen(new GuiClickMeme()));
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}).start();
|
||||||
|
logDirect("aight dude");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
|
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
|
||||||
try {
|
try {
|
||||||
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
|
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Baritone.
|
||||||
|
*
|
||||||
|
* Baritone is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Baritone is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package baritone.utils;
|
||||||
|
|
||||||
|
import baritone.api.BaritoneAPI;
|
||||||
|
import baritone.api.pathing.goals.GoalBlock;
|
||||||
|
import baritone.api.pathing.goals.GoalTwoBlocks;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import org.lwjgl.BufferUtils;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
import org.lwjgl.opengl.Display;
|
||||||
|
import org.lwjgl.util.glu.GLU;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
|
|
||||||
|
public class GuiClickMeme extends GuiScreen {
|
||||||
|
|
||||||
|
// My name is Brady and I grant Leijurv permission to use this pasted code
|
||||||
|
private final FloatBuffer MODELVIEW = BufferUtils.createFloatBuffer(16);
|
||||||
|
private final FloatBuffer PROJECTION = BufferUtils.createFloatBuffer(16);
|
||||||
|
private final IntBuffer VIEWPORT = BufferUtils.createIntBuffer(16);
|
||||||
|
private final FloatBuffer TO_SCREEN_BUFFER = BufferUtils.createFloatBuffer(3);
|
||||||
|
private final FloatBuffer TO_WORLD_BUFFER = BufferUtils.createFloatBuffer(3);
|
||||||
|
|
||||||
|
private BlockPos meme;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doesGuiPauseGame() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
int mx = Mouse.getX();
|
||||||
|
int my = Mouse.getY();
|
||||||
|
Vec3d near = toWorld(mx, my, 0);
|
||||||
|
Vec3d far = toWorld(mx, my, 1); // "Use 0.945 that's what stack overflow says" - Leijurv
|
||||||
|
if (near != null && far != null) {
|
||||||
|
Vec3d viewerPos = new Vec3d(mc.getRenderManager().viewerPosX, mc.getRenderManager().viewerPosY, mc.getRenderManager().viewerPosZ);
|
||||||
|
RayTraceResult result = mc.world.rayTraceBlocks(near.add(viewerPos), far.add(viewerPos), false, false, true);
|
||||||
|
if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||||
|
meme = result.getBlockPos();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
if (mouseButton == 0) {
|
||||||
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalTwoBlocks(meme));
|
||||||
|
} else if (mouseButton == 1) {
|
||||||
|
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(meme.up()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRender(float partialTicks) {
|
||||||
|
GlStateManager.getFloat(GL_MODELVIEW_MATRIX, (FloatBuffer) MODELVIEW.clear());
|
||||||
|
GlStateManager.getFloat(GL_PROJECTION_MATRIX, (FloatBuffer) PROJECTION.clear());
|
||||||
|
GlStateManager.glGetInteger(GL_VIEWPORT, (IntBuffer) VIEWPORT.clear());
|
||||||
|
|
||||||
|
if (meme != null) {
|
||||||
|
Entity e = mc.getRenderViewEntity();
|
||||||
|
// drawSingleSelectionBox WHEN?
|
||||||
|
PathRenderer.drawManySelectionBoxes(e, Collections.singletonList(meme), Color.CYAN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3d toWorld(double x, double y, double z) {
|
||||||
|
boolean result = GLU.gluUnProject((float) x, (float) y, (float) z, MODELVIEW, PROJECTION, VIEWPORT, (FloatBuffer) TO_WORLD_BUFFER.clear());
|
||||||
|
if (result) {
|
||||||
|
return new Vec3d(TO_WORLD_BUFFER.get(0), TO_WORLD_BUFFER.get(1), TO_WORLD_BUFFER.get(2));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,6 @@ import baritone.api.utils.IInputOverrideHandler;
|
|||||||
import baritone.api.utils.input.Input;
|
import baritone.api.utils.input.Input;
|
||||||
import baritone.behavior.Behavior;
|
import baritone.behavior.Behavior;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
|
||||||
import net.minecraft.util.MovementInputFromOptions;
|
import net.minecraft.util.MovementInputFromOptions;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -46,38 +45,12 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
|
|||||||
private final Map<Input, Boolean> inputForceStateMap = new HashMap<>();
|
private final Map<Input, Boolean> inputForceStateMap = new HashMap<>();
|
||||||
|
|
||||||
private final BlockBreakHelper blockBreakHelper;
|
private final BlockBreakHelper blockBreakHelper;
|
||||||
|
private final BlockPlaceHelper blockPlaceHelper;
|
||||||
|
|
||||||
public InputOverrideHandler(Baritone baritone) {
|
public InputOverrideHandler(Baritone baritone) {
|
||||||
super(baritone);
|
super(baritone);
|
||||||
this.blockBreakHelper = new BlockBreakHelper(baritone.getPlayerContext());
|
this.blockBreakHelper = new BlockBreakHelper(baritone.getPlayerContext());
|
||||||
}
|
this.blockPlaceHelper = new BlockPlaceHelper(baritone.getPlayerContext());
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not we are forcing down the specified {@link KeyBinding}.
|
|
||||||
*
|
|
||||||
* @param key The KeyBinding object
|
|
||||||
* @return Whether or not it is being forced down
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public final Boolean isInputForcedDown(KeyBinding key) {
|
|
||||||
Input input = Input.getInputForBind(key);
|
|
||||||
if (input == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (input == Input.CLICK_LEFT && inControl()) {
|
|
||||||
// only override left click off when pathing
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (input == Input.CLICK_RIGHT) {
|
|
||||||
if (isInputForcedDown(Input.CLICK_RIGHT)) {
|
|
||||||
// gettoblock and builder can right click even when not pathing; allow them to do so
|
|
||||||
return true;
|
|
||||||
} else if (inControl()) {
|
|
||||||
// but when we are pathing for real, force right click off
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null; // dont force any inputs other than left and right click
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +88,11 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
|
|||||||
if (event.getType() == TickEvent.Type.OUT) {
|
if (event.getType() == TickEvent.Type.OUT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (isInputForcedDown(Input.CLICK_LEFT)) {
|
||||||
|
setInputForceState(Input.CLICK_RIGHT, false);
|
||||||
|
}
|
||||||
blockBreakHelper.tick(isInputForcedDown(Input.CLICK_LEFT));
|
blockBreakHelper.tick(isInputForcedDown(Input.CLICK_LEFT));
|
||||||
|
blockPlaceHelper.tick(isInputForcedDown(Input.CLICK_RIGHT));
|
||||||
|
|
||||||
if (inControl()) {
|
if (inControl()) {
|
||||||
if (ctx.player().movementInput.getClass() != PlayerMovementInput.class) {
|
if (ctx.player().movementInput.getClass() != PlayerMovementInput.class) {
|
||||||
@@ -131,6 +108,7 @@ public final class InputOverrideHandler extends Behavior implements IInputOverri
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean inControl() {
|
private boolean inControl() {
|
||||||
|
// if we are not primary (a bot) we should set the movementinput even when idle (not pathing)
|
||||||
return baritone.getPathingBehavior().isPathing() || baritone != BaritoneAPI.getProvider().getPrimaryBaritone();
|
return baritone.getPathingBehavior().isPathing() || baritone != BaritoneAPI.getProvider().getPrimaryBaritone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ public final class PathRenderer implements Helper {
|
|||||||
public static void render(RenderEvent event, PathingBehavior behavior) {
|
public static void render(RenderEvent event, PathingBehavior behavior) {
|
||||||
float partialTicks = event.getPartialTicks();
|
float partialTicks = event.getPartialTicks();
|
||||||
Goal goal = behavior.getGoal();
|
Goal goal = behavior.getGoal();
|
||||||
|
if (mc.currentScreen instanceof GuiClickMeme) {
|
||||||
|
((GuiClickMeme) mc.currentScreen).onRender(partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().provider.getDimensionType().getId();
|
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().provider.getDimensionType().getId();
|
||||||
int currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().provider.getDimensionType().getId();
|
int currentRenderViewDimension = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world().provider.getDimensionType().getId();
|
||||||
@@ -102,9 +105,9 @@ public final class PathRenderer implements Helper {
|
|||||||
|
|
||||||
//long split = System.nanoTime();
|
//long split = System.nanoTime();
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
drawManySelectionBoxes(renderView, current.toBreak(), partialTicks, Baritone.settings().colorBlocksToBreak.get());
|
drawManySelectionBoxes(renderView, current.toBreak(), Baritone.settings().colorBlocksToBreak.get());
|
||||||
drawManySelectionBoxes(renderView, current.toPlace(), partialTicks, Baritone.settings().colorBlocksToPlace.get());
|
drawManySelectionBoxes(renderView, current.toPlace(), Baritone.settings().colorBlocksToPlace.get());
|
||||||
drawManySelectionBoxes(renderView, current.toWalkInto(), partialTicks, Baritone.settings().colorBlocksToWalkInto.get());
|
drawManySelectionBoxes(renderView, current.toWalkInto(), Baritone.settings().colorBlocksToWalkInto.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a path calculation currently running, render the path calculation process
|
// If there is a path calculation currently running, render the path calculation process
|
||||||
@@ -115,7 +118,7 @@ public final class PathRenderer implements Helper {
|
|||||||
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
currentlyRunning.pathToMostRecentNodeConsidered().ifPresent(mr -> {
|
||||||
|
|
||||||
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
drawPath(mr, 0, renderView, partialTicks, Baritone.settings().colorMostRecentConsidered.get(), Baritone.settings().fadePath.get(), 10, 20);
|
||||||
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), partialTicks, Baritone.settings().colorMostRecentConsidered.get());
|
drawManySelectionBoxes(renderView, Collections.singletonList(mr.getDest()), Baritone.settings().colorMostRecentConsidered.get());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
//long end = System.nanoTime();
|
//long end = System.nanoTime();
|
||||||
@@ -172,7 +175,7 @@ public final class PathRenderer implements Helper {
|
|||||||
}
|
}
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], alpha);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], alpha);
|
||||||
}
|
}
|
||||||
drawLine(player, x1, y1, z1, x2, y2, z2, partialTicks);
|
drawLine(player, x1, y1, z1, x2, y2, z2);
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
}
|
}
|
||||||
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
if (Baritone.settings().renderPathIgnoreDepth.get()) {
|
||||||
@@ -184,10 +187,10 @@ public final class PathRenderer implements Helper {
|
|||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawLine(Entity player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z, float partialTicks) {
|
public static void drawLine(Entity player, double bp1x, double bp1y, double bp1z, double bp2x, double bp2y, double bp2z) {
|
||||||
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
double d0 = mc.getRenderManager().viewerPosX;
|
||||||
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double d1 = mc.getRenderManager().viewerPosY;
|
||||||
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double d2 = mc.getRenderManager().viewerPosZ;
|
||||||
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||||
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
||||||
BUFFER.pos(bp2x + 0.5D - d0, bp2y + 0.5D - d1, bp2z + 0.5D - d2).endVertex();
|
BUFFER.pos(bp2x + 0.5D - d0, bp2y + 0.5D - d1, bp2z + 0.5D - d2).endVertex();
|
||||||
@@ -196,7 +199,7 @@ public final class PathRenderer implements Helper {
|
|||||||
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
BUFFER.pos(bp1x + 0.5D - d0, bp1y + 0.5D - d1, bp1z + 0.5D - d2).endVertex();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawManySelectionBoxes(Entity player, Collection<BlockPos> positions, float partialTicks, Color color) {
|
public static void drawManySelectionBoxes(Entity player, Collection<BlockPos> positions, Color color) {
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F);
|
||||||
@@ -210,10 +213,6 @@ public final class PathRenderer implements Helper {
|
|||||||
|
|
||||||
float expand = 0.002F;
|
float expand = 0.002F;
|
||||||
//BlockPos blockpos = movingObjectPositionIn.getBlockPos();
|
//BlockPos blockpos = movingObjectPositionIn.getBlockPos();
|
||||||
|
|
||||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
|
||||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
|
||||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
|
||||||
BlockStateInterface bsi = new BlockStateInterface(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext()); // TODO this assumes same dimension between primary baritone and render view? is this safe?
|
BlockStateInterface bsi = new BlockStateInterface(BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext()); // TODO this assumes same dimension between primary baritone and render view? is this safe?
|
||||||
positions.forEach(pos -> {
|
positions.forEach(pos -> {
|
||||||
IBlockState state = bsi.get0(pos);
|
IBlockState state = bsi.get0(pos);
|
||||||
@@ -223,7 +222,7 @@ public final class PathRenderer implements Helper {
|
|||||||
} else {
|
} else {
|
||||||
toDraw = state.getSelectedBoundingBox(player.world, pos);
|
toDraw = state.getSelectedBoundingBox(player.world, pos);
|
||||||
}
|
}
|
||||||
toDraw = toDraw.expand(expand, expand, expand).offset(-renderPosX, -renderPosY, -renderPosZ);
|
toDraw = toDraw.expand(expand, expand, expand).offset(-mc.getRenderManager().viewerPosX, -mc.getRenderManager().viewerPosY, -mc.getRenderManager().viewerPosZ);
|
||||||
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
BUFFER.begin(GL_LINE_STRIP, DefaultVertexFormats.POSITION);
|
||||||
BUFFER.pos(toDraw.minX, toDraw.minY, toDraw.minZ).endVertex();
|
BUFFER.pos(toDraw.minX, toDraw.minY, toDraw.minZ).endVertex();
|
||||||
BUFFER.pos(toDraw.maxX, toDraw.minY, toDraw.minZ).endVertex();
|
BUFFER.pos(toDraw.maxX, toDraw.minY, toDraw.minZ).endVertex();
|
||||||
@@ -260,10 +259,9 @@ public final class PathRenderer implements Helper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
|
public static void drawDankLitGoalBox(Entity player, Goal goal, float partialTicks, Color color) {
|
||||||
double renderPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
|
double renderPosX = mc.getRenderManager().viewerPosX;
|
||||||
double renderPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
|
double renderPosY = mc.getRenderManager().viewerPosY;
|
||||||
double renderPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
|
double renderPosZ = mc.getRenderManager().viewerPosZ;
|
||||||
|
|
||||||
double minX;
|
double minX;
|
||||||
double maxX;
|
double maxX;
|
||||||
double minZ;
|
double minZ;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import baritone.api.BaritoneAPI;
|
|||||||
import baritone.api.cache.IWorldData;
|
import baritone.api.cache.IWorldData;
|
||||||
import baritone.api.utils.IPlayerContext;
|
import baritone.api.utils.IPlayerContext;
|
||||||
import baritone.api.utils.IPlayerController;
|
import baritone.api.utils.IPlayerController;
|
||||||
|
import baritone.api.utils.RayTraceUtils;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
import net.minecraft.client.entity.EntityPlayerSP;
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
@@ -58,6 +59,6 @@ public enum PrimaryPlayerContext implements IPlayerContext, Helper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult objectMouseOver() {
|
public RayTraceResult objectMouseOver() {
|
||||||
return mc.objectMouseOver;
|
return RayTraceUtils.rayTraceTowards(player(), playerRotations(), playerController().getBlockReachDistance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,18 @@ package baritone.utils.player;
|
|||||||
|
|
||||||
import baritone.api.utils.IPlayerController;
|
import baritone.api.utils.IPlayerController;
|
||||||
import baritone.utils.Helper;
|
import baritone.utils.Helper;
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ClickType;
|
import net.minecraft.inventory.ClickType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.GameType;
|
import net.minecraft.world.GameType;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link IPlayerController} that chains to the primary player controller's methods
|
* Implementation of {@link IPlayerController} that chains to the primary player controller's methods
|
||||||
@@ -60,4 +66,10 @@ public enum PrimaryPlayerController implements IPlayerController, Helper {
|
|||||||
public GameType getGameType() {
|
public GameType getGameType() {
|
||||||
return mc.playerController.getCurrentGameType();
|
return mc.playerController.getCurrentGameType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumActionResult processRightClickBlock(EntityPlayerSP player, World world, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand) {
|
||||||
|
// primaryplayercontroller is always in a WorldClient so this is ok
|
||||||
|
return mc.playerController.processRightClickBlock(player, (WorldClient) world, pos, direction, vec, hand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user