Compare commits

..

67 Commits

Author SHA1 Message Date
leijurv
a9f40fb0e5 Merge pull request #4885 from Skylandia/tripwire-support
Allow pathing through tripwires
2025-10-16 11:12:38 -07:00
Skylandia
521303b9e4 allow the user to ignore tripwires on the path 2025-10-08 15:35:02 +13:00
leijurv
d196c649e3 Merge pull request #4752 from Murat65536/bridging-improvements
Bridging Improvements
2025-09-11 15:30:24 -07:00
Murat65536
a56f3cfd86 Clarify yaw distance comment 2025-09-10 21:06:26 -04:00
Murat65536
714e7afce1 More minor formatting changes. 2025-08-30 17:48:19 -04:00
Murat65536
037912871c Adjust order. 2025-08-30 08:21:58 -04:00
Murat65536
ce81d36479 Convert to ternary operators. 2025-08-28 21:44:05 -04:00
Murat65536
f9ae7029c3 Formatting change. 2025-08-28 08:57:49 -04:00
Murat65536
61c0a097bb Add 45 degree intervals to yaw change. 2025-08-28 08:22:17 -04:00
ZacSharp
2a3c22424f Update SETUP.md 2025-08-27 01:28:42 +02:00
ZacSharp
bd14ede064 Update README.md 2025-08-27 01:24:15 +02:00
Murat65536
a2a6769742 Round yaw to 45 degrees when bridging. 2025-08-23 20:25:16 -04:00
leijurv
44909d3140 Merge pull request #4764 from rfresh2/precomputed-data-optimize
reduce PrecomputedData memory usage
2025-08-18 21:21:16 -07:00
rfresh2
b666c92267 use requested style 2025-08-18 14:46:09 -07:00
Murat65536
0eb0e6709a Condense more. 2025-08-17 20:12:22 -04:00
Murat65536
9714fa4fd4 Condense logic into huge lambda. 2025-08-17 20:04:55 -04:00
Murat65536
f1e5c44b85 Replace messy Vec2 with a cleaner record class. Also, remove a messy switch case. 2025-08-17 19:52:14 -04:00
leijurv
ade898d5c6 Merge pull request #4839 from AverWasTaken/patch-1
Remove Elytra from future features
2025-08-16 21:20:18 -07:00
Murat65536
7b5ba80f67 Change to Vec2. 2025-08-06 15:38:53 -04:00
aver
69d91a62be Remove Elytra from future features 2025-08-05 16:44:14 -07:00
Murat65536
102960446d Fix bug. 2025-07-31 18:17:35 -04:00
Murat65536
2ba448c30d Merge remote-tracking branch 'origin/bridging-improvements' into bridging-improvements 2025-07-25 16:41:53 -04:00
Murat65536
9d33858687 Small change. 2025-07-25 16:41:38 -04:00
Murat Bayraktar
1c4c3f3eb6 Merge branch 'cabaletta:1.19.4' into bridging-improvements 2025-07-23 22:02:24 -04:00
leijurv
c1aa2012b9 Merge pull request #4740 from Murat65536/safewalk-update
Let external safewalk handle being safe.
2025-07-24 02:01:55 +02:00
Murat Bayraktar
9c84fa54c6 Merge branch 'cabaletta:1.19.4' into bridging-improvements 2025-07-23 19:31:44 -04:00
leijurv
95212d6339 Merge pull request #4742 from Murat65536/magma-block-detection
Magma block detection
2025-07-23 20:58:03 +02:00
leijurv
e3160f50de format 2025-07-23 11:57:53 -07:00
Murat65536
1a3d302e46 Clean up. 2025-07-23 00:49:45 -04:00
Murat65536
8ee7a1e39d Small change. 2025-07-23 00:29:03 -04:00
Murat65536
c8dcbeb6f8 Format. 2025-07-22 11:34:56 -04:00
Murat65536
65d0d860dd Reformatting, appeasing leijurv, and fixing stupid mistake. 2025-07-22 01:51:42 -04:00
Murat65536
65182fa2dc Remove movement change. 2025-07-20 18:40:25 -04:00
Murat Bayraktar
8168d1f889 Merge branch 'cabaletta:1.19.4' into safewalk-update 2025-07-20 18:24:01 -04:00
Murat65536
5d8136b02e Simplify. 2025-07-13 10:09:16 -04:00
Murat65536
191155315b Keep original player movement. 2025-07-06 20:25:02 -04:00
Murat Bayraktar
a30e3ce8e3 Merge branch 'cabaletta:1.19.4' into bridging-improvements 2025-07-06 19:44:20 -04:00
Murat65536
83afa1126e Fix. 2025-07-02 16:08:14 -04:00
Murat Bayraktar
7be4d646d9 Merge branch 'cabaletta:1.19.4' into magma-block-detection 2025-06-24 16:37:12 -04:00
leijurv
4d27d56ff5 Merge pull request #4639 from babbaj/fix-packer
fix chuckpacker y bug
2025-06-04 15:15:10 -07:00
Murat65536
72fb0a0d28 Add default to switch case. 2025-05-23 22:04:13 -04:00
Murat65536
cbfb329b94 Add direction-independent movement. 2025-05-23 18:31:34 -04:00
rfresh2
8f8ce30091 reduce PrecomputedData memory usage 2025-05-21 23:54:10 -07:00
leijurv
89b0fd74dd some readme updates, yes i intentionally linked to the baritone discord server three times 2025-05-14 15:48:46 -07:00
Murat65536
053b88d7cd Make cost calculation use settings in CalculationContext. 2025-05-14 15:13:12 -04:00
Murat Bayraktar
091500b002 Merge branch 'cabaletta:1.19.4' into safewalk-update 2025-05-14 19:08:45 +00:00
Murat Bayraktar
8d790ebe74 Merge branch 'cabaletta:1.19.4' into magma-block-detection 2025-05-14 19:07:56 +00:00
Murat65536
1078270eb3 Clean up. 2025-05-13 21:46:37 -04:00
ZacSharp
de0b1f271e Update quick download links 2025-05-13 23:33:25 +02:00
ZacSharp
5ffd3fcf20 Update setup information 2025-05-13 23:29:54 +02:00
ZacSharp
773d753c60 Update quick download links 2025-05-13 21:31:56 +02:00
ZacSharp
647daf23aa v1.9.5
previous commit was mistaken v1.9.4 already exists
2025-05-13 19:35:28 +02:00
ZacSharp
01379f5474 v1.9.4 2025-05-13 19:32:29 +02:00
Murat65536
0378096340 Make Baritone not look forward while bridging. 2025-05-11 18:12:11 -04:00
Murat Bayraktar
21954f74a9 Merge branch 'cabaletta:1.19.4' into magma-block-detection 2025-05-10 15:24:44 +00:00
Murat65536
6dd5d843d5 Make magma blocks disallowed if setting is turned off. 2025-05-10 08:53:26 -04:00
Murat65536
f4b51586e8 Add setting that controls sneaking on magma blocks. 2025-05-09 22:02:22 -04:00
Murat65536
267d677d79 Make MovementDiagonal not account sprint cost reduction on sneak. 2025-05-09 21:09:56 -04:00
Murat65536
0815697d30 Make MovementPillar literally always sneak because why not. 2025-05-09 20:41:19 -04:00
Murat65536
f504d26dfd Add magma block functionality to MovementParkour. 2025-05-09 20:15:36 -04:00
Murat65536
373757a63a Implement MovementFall magma block detection. 2025-05-09 18:53:03 -04:00
Murat65536
7317a5c9c4 Fix ascend. 2025-05-08 20:33:27 -04:00
Murat65536
8eebeb9772 Magma block detection for MovementDiagonal. 2025-05-08 18:51:37 -04:00
Murat65536
292f13d05e Small change. 2025-05-08 18:24:54 -04:00
Murat65536
974a3416d8 Integrate some magma block avoidance functionality. 2025-05-08 18:10:34 -04:00
Murat65536
7568939dfd Let external safewalk handle being safe. 2025-05-06 21:44:59 -04:00
Babbaj
6cc5420b95 fix chuckpacker y bug 2025-02-09 02:20:47 -05:00
78 changed files with 761 additions and 895 deletions

View File

@@ -17,10 +17,10 @@ jobs:
with:
fetch-depth: 0
- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '17'
distribution: 'temurin'
cache: gradle

View File

@@ -12,10 +12,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '17'
distribution: 'temurin'
- name: Grant execute permission for gradlew

View File

@@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt update -y
RUN apt install \
openjdk-21-jdk \
openjdk-17-jdk \
git \
--assume-yes

View File

@@ -49,4 +49,3 @@ See <a href="https://github.com/cabaletta/baritone/issues">issues</a> for more.
Things it may not ever have, from most likely to least likely =(
- Boats
- Horses (2x3 path instead of 1x2)
- Elytra

View File

@@ -59,25 +59,29 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s
**Quick download links:**
| Forge | Fabric |
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [1.12.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.2.19/baritone-api-forge-1.2.19.jar) | |
| [1.16.5 Forge](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-forge-1.6.5.jar) | [1.16.5 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-fabric-1.6.5.jar) |
| [1.17.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-forge-1.7.3.jar) | [1.17.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-fabric-1.7.3.jar) |
| [1.18.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.8.6/baritone-api-forge-1.8.6.jar) | [1.18.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.8.6/baritone-api-fabric-1.8.6.jar) |
| [1.19.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-forge-1.9.4.jar) | [1.19.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-fabric-1.9.4.jar) |
| [1.19.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-forge-1.9.1.jar) | [1.19.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-fabric-1.9.1.jar) |
| [1.19.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-forge-1.9.3.jar) | [1.19.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-fabric-1.9.3.jar) |
| [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-forge-1.10.1.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-fabric-1.10.1.jar) |
| [1.20.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) |
| [1.20.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-forge-1.10.2.jar) | [1.20.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.2/baritone-api-fabric-1.10.2.jar) |
| [1.21.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-forge-1.11.1.jar) | [1.21.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-fabric-1.11.1.jar) |
| Forge | Fabric | NeoForge |
|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| [1.12.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.2.19/baritone-api-forge-1.2.19.jar) | | |
| [1.16.5 Forge](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-forge-1.6.5.jar) | [1.16.5 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.6.5/baritone-api-fabric-1.6.5.jar) | |
| [1.17.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-forge-1.7.3.jar) | [1.17.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-fabric-1.7.3.jar) | |
| [1.18.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.8.6/baritone-api-forge-1.8.6.jar) | [1.18.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.8.6/baritone-api-fabric-1.8.6.jar) | |
| [1.19.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-forge-1.9.4.jar) | [1.19.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-fabric-1.9.4.jar) | |
| [1.19.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-forge-1.9.1.jar) | [1.19.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-fabric-1.9.1.jar) | |
| [1.19.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.5/baritone-api-forge-1.9.5.jar) | [1.19.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.5/baritone-api-fabric-1.9.5.jar) | |
| [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.3/baritone-api-forge-1.10.3.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.3/baritone-api-fabric-1.10.3.jar) | |
| [1.20.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-forge-1.10.4.jar) | [1.20.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-fabric-1.10.4.jar) | [1.20.3 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-neoforge-1.10.4.jar) |
| [1.20.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-forge-1.10.4.jar) | [1.20.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-fabric-1.10.4.jar) | [1.20.4 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.10.4/baritone-api-neoforge-1.10.4.jar) |
| [1.21.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.11.2/baritone-api-forge-1.11.2.jar) | [1.21.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.11.2/baritone-api-fabric-1.11.2.jar) | [1.21.1 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.11.2/baritone-api-neoforge-1.11.2.jar) |
| [1.21.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-forge-1.11.1.jar) | [1.21.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-fabric-1.11.1.jar) | [1.21.3 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.11.1/baritone-api-neoforge-1.11.1.jar) |
| [1.21.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.13.1/baritone-api-forge-1.13.1.jar) | [1.21.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.13.1/baritone-api-fabric-1.13.1.jar) | [1.21.4 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.13.1/baritone-api-neoforge-1.13.1.jar) |
| [1.21.5 Forge](https://github.com/cabaletta/baritone/releases/download/v1.14.0/baritone-api-forge-1.14.0.jar) | [1.21.5 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.14.0/baritone-api-fabric-1.14.0.jar) | [1.21.5 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.14.0/baritone-api-neoforge-1.14.0.jar) |
| [1.21.6 Forge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-forge-1.15.0.jar) | [1.21.6 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-fabric-1.15.0.jar) | [1.21.6 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-neoforge-1.15.0.jar) |
| [1.21.7 Forge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-forge-1.15.0.jar) | [1.21.7 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-fabric-1.15.0.jar) | [1.21.7 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-neoforge-1.15.0.jar) |
| [1.21.8 Forge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-forge-1.15.0.jar) | [1.21.8 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-fabric-1.15.0.jar) | [1.21.8 NeoForge](https://github.com/cabaletta/baritone/releases/download/v1.15.0/baritone-api-neoforge-1.15.0.jar) |
**Message for 2b2t players looking for 1.19/1.20 Baritone** If you like, please try the beta for Baritone Elytra for 2b2t, find it in #announcements of [the Baritone discord](http://discord.gg/s6fRBAUpmr). It supports 1.19.4 and 1.20.1, Forge or Fabric. If you have to see it to believe it, watch [this YouTube video](https://youtu.be/NnSlQi-68eQ).
**How to immediately get started:** Type `#goto 1000 500` in chat to go to x=1000 z=500. Type `#mine diamond_ore` to mine diamond ore. Type `#stop` to stop. For more, read [the usage page](USAGE.md) and/or watch this [tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa). Also try `#elytra` for Elytra flying in the Nether using fireworks ([trailer](https://youtu.be/4bGGPo8yiHo), [usage](https://youtu.be/NnSlQi-68eQ)). For help, join the [Baritone Discord Server](http://discord.gg/s6fRBAUpmr).
**How to immediately get started:** Type `#goto 1000 500` in chat to go to x=1000 z=500. Type `#mine diamond_ore` to mine diamond ore. Type `#stop` to stop. For more, read [the usage page](USAGE.md) and/or watch this [tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa). Also try `#elytra` for Elytra flying in the Nether using fireworks.
For other versions of Minecraft or more complicated situations or for development, see [Installation & setup](SETUP.md). Also consider just installing [Impact](https://impactclient.net/), which comes with Baritone and is easier to install than wrangling with version JSONs and zips. For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#6313 on Baritone which I recommend.
For other versions of Minecraft or more complicated situations or for development, see [Installation & setup](SETUP.md). For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#6313 on Baritone which I recommend. For help, join the [Baritone Discord Server](http://discord.gg/s6fRBAUpmr).
This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/),
the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 onwards. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).

View File

@@ -1,6 +1,6 @@
# Installation
The easiest way to install Baritone is to install it as Forge/Neoforge/Fabric mod, but if you know how you can also use with a custom `version.json`
The easiest way to install Baritone is to install it as Forge/Neoforge/Fabric mod, but if you know how you can also use it with a custom `version.json`
(Examples: [1.14.4](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1), [1.15.2](https://www.dropbox.com/s/8rx6f0kts9hvd4f/1.15.2-Baritone.zip?dl=1), [1.16.5](https://www.dropbox.com/s/i6f292o2i7o9acp/1.16.5-Baritone.zip?dl=1)).
Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
@@ -10,10 +10,10 @@ Releases are made rarely and are not always up to date with the latest features
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
The mapping between major Minecraft versions and major Baritone versions is as follows
| Minecraft version | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | 1.19 | 1.20 | 1.21 |
|-------------------|------|------|------|------|------|------|------|------|-------|-------|
| Baritone version | v1.2 | v1.3 | v1.4 | v1.5 | v1.6 | v1.7 | v1.8 | v1.9 | v1.10 | v1.11 |
The mapping between Minecraft versions and major Baritone versions is as follows
| Minecraft version | 1.12 | 1.13 | 1.14 | 1.15 | 1.16 | 1.17 | 1.18 | 1.19 | 1.20 | 1.21 | 1.21.4 | 1.21.5 | 1.21.6 - 1.21.8 |
|-------------------|------|------|------|------|------|------|------|------|-------|-------|--------|--------|------------------|
| Baritone version | v1.2 | v1.3 | v1.4 | v1.5 | v1.6 | v1.7 | v1.8 | v1.9 | v1.10 | v1.11 | v1.13 | v1.14 | v1.15 |
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by that public keys of `checksums.txt`.
@@ -56,7 +56,7 @@ The recommended Java versions by Minecraft version are
| 1.12.2 - 1.16.5 | 8 |
| 1.17.1 | 16 |
| 1.18.2 - 1.20.4 | 17 |
| 1.20.5 - 1.21.4 | 21 |
| 1.20.5 - 1.21.8 | 21 |
Download java: https://adoptium.net/

View File

@@ -38,7 +38,7 @@ allprojects {
group = rootProject.maven_group
sourceCompatibility = targetCompatibility = JavaVersion.toVersion(project.java_version)
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(sourceCompatibility.majorVersion.toInteger()))
@@ -82,8 +82,6 @@ allprojects {
compileOnly "org.ow2.asm:asm:${project.asm_version}"
implementation "dev.babbaj:nether-pathfinder:${project.nether_pathfinder_version}"
implementation 'com.google.code.findbugs:jsr305:3.0.2'
}
unimined.minecraft(sourceSets.main, true) {
@@ -92,9 +90,7 @@ allprojects {
mappings {
intermediary()
mojmap()
parchment("1.20.6", "2024.05.01")
devFallbackNamespace "official"
parchment("2023.06.26")
}
}

View File

@@ -40,5 +40,5 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.2.9'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.0.5'
}

View File

@@ -78,7 +78,7 @@ components.java {
}
task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.2.1"
compType "fabric"
}

View File

@@ -1,3 +1,4 @@
{
"schemaVersion": 1,
"id": "baritone",
@@ -11,7 +12,7 @@
"contact": {
"homepage": "https://github.com/cabaletta/baritone",
"sources": "https://github.com/cabaletta/baritone",
"issues": "https://github.com/cabaletta/baritone/issues"
"issues": "https://github.com/cabaletta/baritone/issues"
},
"license": "LGPL-3.0",
@@ -25,8 +26,8 @@
],
"depends": {
"fabricloader": ">=0.14.22",
"minecraft": ["1.21","1.21.1"]
"fabricloader": ">=0.11.0",
"minecraft": "1.19.4"
},
"custom": {
"modmenu": {

View File

@@ -25,7 +25,11 @@ plugins {
archivesBaseName = archivesBaseName + "-forge"
unimined.minecraft {
minecraftForge {
mappings {
devFallbackNamespace "intermediary"
}
forge {
loader project.forge_version
mixinConfig ["mixins.baritone.json"]
}
@@ -95,7 +99,7 @@ components.java {
}
task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.2.1"
compType "forge"
}

View File

@@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[48,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="https://raw.githubusercontent.com/cabaletta/baritone/1.16.2/LICENSE"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional
@@ -35,6 +35,6 @@ A Minecraft pathfinder bot.
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.21, 1.21.1]"
versionRange="[1.19.4]"
ordering="NONE"
side="BOTH"

View File

@@ -1,24 +1,20 @@
org.gradle.jvmargs=-Xmx4G
available_loaders=fabric,forge,neoforge,tweaker
mod_version=1.11.2
mod_version=1.9.5
maven_group=baritone
archives_base_name=baritone
java_version=21
java_version=17
minecraft_version=1.21
minecraft_version=1.19.4
forge_version=51.0.16
forge_version=45.0.43
neoforge_version=20-beta
fabric_version=0.15.11
fabric_version=0.14.11
nether_pathfinder_version=1.4.1
// These dependencies are used for common and tweaker
// while mod loaders usually ship their own version
mixin_version=0.8.5
asm_version=9.7
asm_version=9.3

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -1,130 +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/>.
*/
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
plugins {
id "com.github.johnrengelman.shadow" version "8.0.0"
}
archivesBaseName = archivesBaseName + "-neoforge"
unimined.minecraft {
neoForged {
loader project.neoforge_version
mixinConfig ["mixins.baritone.json"]
}
minecraftRemapper.config {
// neoforge adds 1 conflict, where 2 interfaces have a method with the same name on yarn/mojmap,
// but the method has different names in the intermediary mappings.
// this is a conflict because they have a class that extends both interfaces.
// this shouldn't be a problem as long as named mappings don't make the name of those 2 methods different.
ignoreConflicts(true)
}
}
//loom {
// forge {
// mixinConfig 'mixins.baritone.json'
// }
//}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
}
dependencies {
// because of multiple sourcesets `common project(":")` doesn't work
for (sourceSet in rootProject.sourceSets) {
if (sourceSet == rootProject.sourceSets.test) continue
if (sourceSet == rootProject.sourceSets.schematica_api) continue
common sourceSet.output
shadowCommon sourceSet.output
}
shadowCommon "dev.babbaj:nether-pathfinder:${project.nether_pathfinder_version}"
}
processResources {
inputs.property "version", project.version
filesMatching("META-INF/neoforge.mods.toml") {
expand "version": project.version
}
}
shadowJar {
configurations = [project.configurations.shadowCommon]
archiveClassifier.set "dev-shadow"
}
remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set null
}
jar {
archiveClassifier.set "dev"
manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json',
"MixinConnector": "baritone.launch.BaritoneMixinConnector",
'Implementation-Title': 'Baritone',
'Implementation-Version': version,
)
}
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
compType "neoforge"
}
task createDist(type: CreateDistTask, dependsOn: proguard) {
compType "neoforge"
}
build.finalizedBy(createDist)
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -1,18 +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/>.
#
loom.platform=forge

View File

@@ -1,25 +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;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.common.Mod;
@Mod(value = "baritoe", dist = Dist.CLIENT)
public class BaritoneForgeModXD {
}

View File

@@ -1,40 +0,0 @@
# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[1,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="https://raw.githubusercontent.com/cabaletta/baritone/1.16.2/LICENSE"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="baritoe" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${version}" #mandatory
# A display name for the mod
displayName="Baritone" #mandatory
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="https://github.com/cabaletta/baritone" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
credits="Hat Gamers" #optional
# A text field displayed in the mod UI
authors="leijurv, Brady" #optional
# The description text for the mod (multi line!) (#mandatory)
description='''
A Minecraft pathfinder bot.
'''
[[dependencies.baritoe]]
modId="minecraft"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.21,1.21.1]"
ordering="NONE"
side="BOTH"

View File

@@ -1,6 +0,0 @@
{
"pack": {
"description": "null",
"pack_format": 8
}
}

View File

@@ -42,6 +42,9 @@ pluginManagement {
rootProject.name = 'baritone'
include("tweaker")
for (platform in available_loaders.split(",")) {
if (System.getProperty("Baritone.enabled_platforms") == null) {
System.setProperty("Baritone.enabled_platforms", "fabric,forge")
}
for (platform in System.getProperty("Baritone.enabled_platforms").split(",")) {
include(platform)
}

View File

@@ -237,9 +237,9 @@ public final class Settings {
/**
* Blocks that Baritone will attempt to avoid (Used in avoidance)
*/
public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>(
// Leave Empty by Default
));
public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>(List.of(
Blocks.TRIPWIRE
)));
/**
* Blocks that Baritone is not allowed to break
@@ -1550,6 +1550,11 @@ public final class Settings {
*/
public final Setting<Boolean> elytraChatSpam = new Setting<>(false);
/**
* Sneak when magma blocks are under feet
*/
public final Setting<Boolean> allowWalkOnMagmaBlocks = new Setting<>(false);
/**
* A map of lowercase setting field names to their respective setting
*/

View File

@@ -30,7 +30,7 @@ public enum BlockById implements IDatatypeFor<Block> {
@Override
public Block get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = ResourceLocation.parse(ctx.getConsumer().getString());
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
Block block;
if ((block = BuiltInRegistries.BLOCK.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no block found by that id");

View File

@@ -30,7 +30,7 @@ public enum EntityClassById implements IDatatypeFor<EntityType> {
@Override
public EntityType get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = ResourceLocation.parse(ctx.getConsumer().getString());
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
EntityType entity;
if ((entity = BuiltInRegistries.ENTITY_TYPE.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no entity found by that id");

View File

@@ -77,7 +77,7 @@ public enum ForBlockOptionalMeta implements IDatatypeFor<BlockOptionalMeta> {
properties = parts[1];
}
Block block = BuiltInRegistries.BLOCK.getOptional(ResourceLocation.parse(blockId)).orElse(null);
Block block = BuiltInRegistries.BLOCK.getOptional(new ResourceLocation(blockId)).orElse(null);
if (block == null) {
// This block doesn't exist so there's no properties to complete.
return Stream.empty();

View File

@@ -30,7 +30,7 @@ public enum ItemById implements IDatatypeFor<Item> {
@Override
public Item get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = ResourceLocation.parse(ctx.getConsumer().getString());
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
Item item;
if ((item = BuiltInRegistries.ITEM.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("No item found by that id");

View File

@@ -18,38 +18,25 @@
package baritone.api.utils;
import baritone.api.utils.accessor.IItemStack;
import baritone.api.utils.accessor.ILootTable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import net.minecraft.Util;
import io.netty.util.concurrent.ThreadPerTaskExecutor;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.Commands;
import net.minecraft.core.LayeredRegistryAccess;
import net.minecraft.core.RegistryAccess;
import net.minecraft.resources.RegistryDataLoader;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerRegistries;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.VanillaPackResources;
import net.minecraft.server.packs.repository.BuiltInPackSource;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.*;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.CloseableResourceManager;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.world.RandomSequences;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.CustomSpawner;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
@@ -60,18 +47,24 @@ import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.level.storage.loot.PredicateManager;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import sun.misc.Unsafe;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.regex.Matcher;
@@ -85,8 +78,10 @@ public final class BlockOptionalMeta {
private final Block block;
private final String propertiesDescription; // exists so toString() can return something more useful than a list of all blockstates
private final Set<BlockState> blockstates;
private final ImmutableSet<Integer> stateHashes;
private final ImmutableSet<Integer> stackHashes;
private final Set<Integer> stateHashes;
private final Set<Integer> stackHashes;
private static LootTables lootTables;
private static PredicateManager predicate = new PredicateManager();
private static Map<Block, List<Item>> drops = new HashMap<>();
public BlockOptionalMeta(@Nonnull Block block) {
@@ -229,21 +224,44 @@ public final class BlockOptionalMeta {
return null;
}
public static LootTables getManager() {
if (lootTables == null) {
MultiPackResourceManager resources = new MultiPackResourceManager(PackType.SERVER_DATA, List.of(getVanillaServerPack()));
ReloadableResourceManager resourceManager = new ReloadableResourceManager(PackType.SERVER_DATA);
lootTables = new LootTables(predicate);
resourceManager.registerReloadListener(lootTables);
try {
resourceManager.createReload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), CompletableFuture.completedFuture(Unit.INSTANCE), resources.listPacks().toList()).done().get();
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
return lootTables;
}
public static PredicateManager getPredicateManager() {
return predicate;
}
private static synchronized List<Item> drops(Block b) {
return drops.computeIfAbsent(b, block -> {
ResourceLocation lootTableLocation = block.getLootTable().location();
if (lootTableLocation.equals(BuiltInLootTables.EMPTY.location())) {
ResourceLocation lootTableLocation = block.getLootTable();
if (lootTableLocation == BuiltInLootTables.EMPTY) {
return Collections.emptyList();
} else {
List<Item> items = new ArrayList<>();
try {
ServerLevel lv2 = ServerLevelStub.fastCreate();
LootParams.Builder lv5 = new LootParams.Builder(lv2)
.withParameter(LootContextParams.ORIGIN, Vec3.ZERO)
.withParameter(LootContextParams.BLOCK_STATE, b.defaultBlockState())
.withParameter(LootContextParams.TOOL, new ItemStack(Items.NETHERITE_PICKAXE, 1));
getDrops(block, lv5).stream().map(ItemStack::getItem).forEach(items::add);
getManager().get(lootTableLocation).getRandomItems(
new LootContext.Builder(ServerLevelStub.fastCreate())
.withRandom(RandomSource.create())
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
.withParameter(LootContextParams.BLOCK_STATE, block.defaultBlockState())
.create(LootContextParamSets.BLOCK),
stack -> items.add(stack.getItem())
);
} catch (Exception e) {
e.printStackTrace();
}
@@ -252,25 +270,11 @@ public final class BlockOptionalMeta {
});
}
private static List<ItemStack> getDrops(Block state, LootParams.Builder params) {
ResourceKey<LootTable> lv = state.getLootTable();
if (lv == BuiltInLootTables.EMPTY) {
return Collections.emptyList();
} else {
LootParams lv2 = params.withParameter(LootContextParams.BLOCK_STATE, state.defaultBlockState()).create(LootContextParamSets.BLOCK);
ServerLevelStub lv3 = (ServerLevelStub) lv2.getLevel();
LootTable lv4 = lv3.holder().getLootTable(lv);
return((ILootTable) lv4).invokeGetRandomItems(new LootContext.Builder(lv2).withOptionalRandomSeed(1).create(null));
}
}
public static class ServerLevelStub extends ServerLevel {
private static class ServerLevelStub extends ServerLevel {
private static Minecraft client = Minecraft.getInstance();
private static Unsafe unsafe = getUnsafe();
private static CompletableFuture<RegistryAccess> registryAccess = load();
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$10, @Nullable RandomSequences $$11) {
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10, $$11);
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$10) {
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10);
}
@Override
@@ -287,15 +291,6 @@ public final class BlockOptionalMeta {
}
}
@Override
public RegistryAccess registryAccess() {
return registryAccess.join();
}
public ReloadableServerRegistries.Holder holder() {
return new ReloadableServerRegistries.Holder(registryAccess().freeze());
}
public static Unsafe getUnsafe() {
try {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
@@ -306,45 +301,5 @@ public final class BlockOptionalMeta {
}
}
public static CompletableFuture<RegistryAccess> load() {
PackRepository packRepository = Minecraft.getInstance().getResourcePackRepository();
CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(
PackType.SERVER_DATA,
List.of(packRepository.getPack(BuiltInPackSource.VANILLA_ID).open())
);
LayeredRegistryAccess<RegistryLayer> layeredRegistryAccess = loadAndReplaceLayer(
closeableResourceManager, RegistryLayer.createRegistryAccess(), RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES
);
return ReloadableServerResources.loadResources(
closeableResourceManager,
layeredRegistryAccess,
FeatureFlags.VANILLA_SET,
Commands.CommandSelection.INTEGRATED,
2,
Runnable::run,
Minecraft.getInstance()
).thenApply(reloadableServerResources -> reloadableServerResources.fullRegistries().get());
}
private static LayeredRegistryAccess<RegistryLayer> loadAndReplaceLayer(
ResourceManager resourceManager,
LayeredRegistryAccess<RegistryLayer> registryAccess,
RegistryLayer registryLayer,
List<RegistryDataLoader.RegistryData<?>> registryData
) {
RegistryAccess.Frozen frozen = loadLayer(resourceManager, registryAccess, registryLayer, registryData);
return registryAccess.replaceFrom(registryLayer, frozen);
}
private static RegistryAccess.Frozen loadLayer(
ResourceManager resourceManager,
LayeredRegistryAccess<RegistryLayer> registryAccess,
RegistryLayer registryLayer,
List<RegistryDataLoader.RegistryData<?>> registryData
) {
RegistryAccess.Frozen frozen = registryAccess.getAccessForLoading(registryLayer);
return RegistryDataLoader.load(resourceManager, frozen, registryData);
}
}
}

View File

@@ -59,7 +59,7 @@ public final class RayTraceUtils {
direction.y * blockReachDistance,
direction.z * blockReachDistance
);
return entity.level().clip(new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity));
return entity.level.clip(new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity));
}
public static Vec3 inferSneakingEyePosition(Entity entity) {

View File

@@ -159,6 +159,26 @@ public class Rotation {
return newYaw;
}
/**
* Gets the distance between a starting yaw and an offset yaw.
* Distance can be negative if the offset yaw is behind of the starting yaw.
*
* @param yaw The initial yaw
* @param offsetYaw The offset yaw
* @return The distance between the yaws
*/
public static float yawDistanceFromOffset(float yaw, float offsetYaw) {
if ((yaw > 0 ^ offsetYaw > 0) && ((yaw > 90 || yaw < -90) ^ (offsetYaw > 90 || offsetYaw < -90))) {
if (yaw < 0) {
return 360 + (yaw - offsetYaw);
} else {
return 360 - (yaw - offsetYaw);
}
} else {
return yaw - offsetYaw;
}
}
@Override
public String toString() {
return "Yaw: " + yaw + ", Pitch: " + pitch;

View File

@@ -283,7 +283,7 @@ public final class RotationUtils {
if (((BlockHitResult) result).getBlockPos().equals(pos)) {
return Optional.of(rotation);
}
if (entity.level().getBlockState(pos).getBlock() instanceof BaseFireBlock && ((BlockHitResult) result).getBlockPos().equals(pos.below())) {
if (entity.level.getBlockState(pos).getBlock() instanceof BaseFireBlock && ((BlockHitResult) result).getBlockPos().equals(pos.below())) {
return Optional.of(rotation);
}
}
@@ -292,6 +292,6 @@ public final class RotationUtils {
@Deprecated
public static Optional<Rotation> reachableCenter(Entity entity, BlockPos pos, double blockReachDistance, boolean wouldSneak) {
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.level(), pos), blockReachDistance, wouldSneak);
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.level, pos), blockReachDistance, wouldSneak);
}
}

View File

@@ -246,7 +246,7 @@ public class SettingsUtil {
),
ITEM(
Item.class,
str -> BuiltInRegistries.ITEM.get(ResourceLocation.parse(str.trim())), // TODO this now returns AIR on failure instead of null, is that an issue?
str -> BuiltInRegistries.ITEM.get(new ResourceLocation(str.trim())), // TODO this now returns AIR on failure instead of null, is that an issue?
item -> BuiltInRegistries.ITEM.getKey(item).toString()
),
LIST() {

View File

@@ -1,28 +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.api.utils.accessor;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
public interface ILootTable {
ObjectArrayList<ItemStack> invokeGetRandomItems(LootContext context);
}

View File

@@ -20,7 +20,6 @@ package baritone.api.utils.gui;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.toasts.Toast;
import net.minecraft.client.gui.components.toasts.ToastComponent;
import net.minecraft.network.chat.Component;
@@ -39,7 +38,7 @@ public class BaritoneToast implements Toast {
this.totalShowTime = totalShowTime;
}
public Visibility render(GuiGraphics gui, ToastComponent toastGui, long delta) {
public Visibility render(PoseStack matrixStack, ToastComponent toastGui, long delta) {
if (this.newDisplay) {
this.firstDrawTime = delta;
this.newDisplay = false;
@@ -47,13 +46,15 @@ public class BaritoneToast implements Toast {
//TODO: check
gui.blit(ResourceLocation.parse("textures/gui/toasts.png"), 0, 0, 0, 32, 160, 32);
toastGui.getMinecraft().getTextureManager().bindForSetup(new ResourceLocation("textures/gui/toasts.png"));
//GlStateManager._color4f(1.0F, 1.0F, 1.0F, 255.0F);
toastGui.blit(matrixStack, 0, 0, 0, 32, 160, 32);
if (this.subtitle == null) {
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 12, -11534256);
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 12, -11534256);
} else {
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 7, -11534256);
gui.drawString(toastGui.getMinecraft().font, this.subtitle, 18, 18, -16777216);
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 7, -11534256);
toastGui.getMinecraft().font.draw(matrixStack, this.subtitle, 18, 18, -16777216);
}
return delta - this.firstDrawTime < totalShowTime ? Visibility.SHOW : Visibility.HIDE;

View File

@@ -27,16 +27,15 @@ import baritone.api.event.events.type.EventState;
import baritone.api.utils.Pair;
import baritone.cache.CachedChunk;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.CommonListenerCookie;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.game.*;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Final;
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.CallbackInfo;
@@ -49,7 +48,7 @@ import java.util.List;
* @since 8/3/2018
*/
@Mixin(ClientPacketListener.class)
public abstract class MixinClientPlayNetHandler extends ClientCommonPacketListenerImpl {
public class MixinClientPlayNetHandler {
// unused lol
/*@Inject(
@@ -75,9 +74,9 @@ public abstract class MixinClientPlayNetHandler extends ClientCommonPacketListen
}
}*/
protected MixinClientPlayNetHandler(final Minecraft arg, final Connection arg2, final CommonListenerCookie arg3) {
super(arg, arg2, arg3);
}
@Shadow
@Final
private Minecraft minecraft;
@Inject(
method = "sendChat(Ljava/lang/String;)V",
@@ -125,7 +124,7 @@ public abstract class MixinClientPlayNetHandler extends ClientCommonPacketListen
LocalPlayer player = ibaritone.getPlayerContext().player();
if (player != null && player.connection == (ClientPacketListener) (Object) this) {
ibaritone.getGameEventHandler().onChunkEvent(
new ChunkEvent(EventState.PRE, ChunkEvent.Type.UNLOAD, packet.pos().x, packet.pos().z)
new ChunkEvent(EventState.PRE, ChunkEvent.Type.UNLOAD, packet.getX(), packet.getZ())
);
}
}
@@ -140,7 +139,7 @@ public abstract class MixinClientPlayNetHandler extends ClientCommonPacketListen
LocalPlayer player = ibaritone.getPlayerContext().player();
if (player != null && player.connection == (ClientPacketListener) (Object) this) {
ibaritone.getGameEventHandler().onChunkEvent(
new ChunkEvent(EventState.POST, ChunkEvent.Type.UNLOAD, packet.pos().x, packet.pos().z)
new ChunkEvent(EventState.POST, ChunkEvent.Type.UNLOAD, packet.getX(), packet.getZ())
);
}
}

View File

@@ -27,37 +27,17 @@ import net.minecraft.client.KeyMapping;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.entity.player.Abilities;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
/**
* @author Brady
* @since 8/1/2018
*/
@Mixin(LocalPlayer.class)
public class MixinClientPlayerEntity {
@Unique
private static final MethodHandle MAY_FLY = baritone$resolveMayFly();
@Unique
private static MethodHandle baritone$resolveMayFly() {
try {
var lookup = MethodHandles.publicLookup();
return lookup.findVirtual(LocalPlayer.class, "mayFly", MethodType.methodType(boolean.class));
} catch (NoSuchMethodException e) {
return null;
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
@Inject(
method = "tick",
@@ -81,7 +61,6 @@ public class MixinClientPlayerEntity {
target = "net/minecraft/world/entity/player/Abilities.mayfly:Z"
)
)
@Group(name = "mayFly", min = 1, max = 1)
private boolean isAllowFlying(Abilities capabilities) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this);
if (baritone == null) {
@@ -90,22 +69,6 @@ public class MixinClientPlayerEntity {
return !baritone.getPathingBehavior().isPathing() && capabilities.mayfly;
}
@Redirect(
method = "aiStep",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/player/LocalPlayer;mayFly()Z"
)
)
@Group(name = "mayFly", min = 1, max = 1)
private boolean onMayFlyNeoforge(LocalPlayer instance) throws Throwable {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this);
if (baritone == null) {
return (boolean) MAY_FLY.invokeExact(instance);
}
return !baritone.getPathingBehavior().isPathing() && (boolean) MAY_FLY.invokeExact(instance);
}
@Redirect(
method = "aiStep",
at = @At(

View File

@@ -50,7 +50,7 @@ public abstract class MixinFireworkRocketEntity extends Entity implements IFirew
@Override
public LivingEntity getBoostedEntity() {
if (this.isAttachedToEntity() && this.attachedToEntity == null) { // isAttachedToEntity checks if the optional is present
final Entity entity = this.level().getEntity(this.entityData.get(DATA_ATTACHED_TO_TARGET).getAsInt());
final Entity entity = this.level.getEntity(this.entityData.get(DATA_ATTACHED_TO_TARGET).getAsInt());
if (entity instanceof LivingEntity) {
this.attachedToEntity = (LivingEntity) entity;
}

View File

@@ -0,0 +1,74 @@
/*
* 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.api.utils.BlockOptionalMeta;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.level.storage.loot.PredicateManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(LootContext.Builder.class)
public class MixinLootContext {
@Redirect(
method = "create",
at = @At(
value = "INVOKE",
target = "net/minecraft/server/level/ServerLevel.getServer()Lnet/minecraft/server/MinecraftServer;"
)
)
private MinecraftServer getServer(ServerLevel world) {
if (world == null) {
return null;
}
return world.getServer();
}
@Redirect(
method = "create",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/MinecraftServer;getLootTables()Lnet/minecraft/world/level/storage/loot/LootTables;"
)
)
private LootTables getLootTableManager(MinecraftServer server) {
if (server == null) {
return BlockOptionalMeta.getManager();
}
return server.getLootTables();
}
@Redirect(
method = "create",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/MinecraftServer;getPredicateManager()Lnet/minecraft/world/level/storage/loot/PredicateManager;"
)
)
private PredicateManager getLootPredicateManager(MinecraftServer server) {
if (server == null) {
return BlockOptionalMeta.getPredicateManager();
}
return server.getPredicateManager();
}
}

View File

@@ -1,46 +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.api.utils.BlockOptionalMeta;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ReloadableServerRegistries;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.storage.loot.LootContext;
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.Redirect;
@Mixin(LootContext.Builder.class)
public abstract class MixinLootContextBuilder {
@Shadow public abstract ServerLevel getLevel();
@Redirect(method = "create", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;reloadableRegistries()Lnet/minecraft/server/ReloadableServerRegistries$Holder;"))
private ReloadableServerRegistries.Holder create(MinecraftServer instance) {
if (instance != null) {
return instance.reloadableRegistries();
}
if (getLevel() instanceof BlockOptionalMeta.ServerLevelStub sls) {
return sls.holder();
}
return null;
}
}

View File

@@ -1,34 +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.api.utils.accessor.ILootTable;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootTable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(LootTable.class)
public abstract class MixinLootTable implements ILootTable {
@Invoker
public abstract ObjectArrayList<ItemStack> invokeGetRandomItems(LootContext context);
}

View File

@@ -24,7 +24,6 @@ import baritone.api.event.events.TickEvent;
import baritone.api.event.events.WorldEvent;
import baritone.api.event.events.type.EventState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.ReceivingLevelScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
@@ -131,7 +130,7 @@ public class MixinMinecraft {
method = "setLevel",
at = @At("HEAD")
)
private void preLoadWorld(ClientLevel world, ReceivingLevelScreen.Reason arg2, CallbackInfo ci) {
private void preLoadWorld(ClientLevel world, CallbackInfo ci) {
// If we're unloading the world but one doesn't exist, ignore it
if (this.level == null && world == null) {
return;
@@ -151,7 +150,7 @@ public class MixinMinecraft {
method = "setLevel",
at = @At("RETURN")
)
private void postLoadWorld(ClientLevel world, ReceivingLevelScreen.Reason arg2, CallbackInfo ci) {
private void postLoadWorld(ClientLevel world, CallbackInfo ci) {
// still fire event for both null, as that means we've just finished exiting a world
// mc.world changing is only the primary baritone
@@ -168,25 +167,12 @@ public class MixinMinecraft {
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;"
),
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;showDebugScreen()Z"
),
to = @At(
value = "CONSTANT",
args = "stringValue=Keybindings"
)
target = "Lnet/minecraft/client/gui/screens/Screen;passEvents:Z"
)
)
private Screen passEvents(Minecraft instance) {
private boolean passEvents(Screen screen) {
// allow user input is only the primary baritone
if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) {
return null;
}
return instance.screen;
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.passEvents;
}
// TODO

View File

@@ -23,6 +23,8 @@ import baritone.api.event.events.PacketEvent;
import baritone.api.event.events.type.EventState;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.Connection;
import net.minecraft.network.PacketSendListener;
import net.minecraft.network.protocol.Packet;
@@ -52,7 +54,7 @@ public class MixinNetworkManager {
method = "sendPacket",
at = @At("HEAD")
)
private void preDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, boolean flush, CallbackInfo ci) {
private void preDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, CallbackInfo ci) {
if (this.receiving != PacketFlow.CLIENTBOUND) {
return;
}
@@ -68,7 +70,7 @@ public class MixinNetworkManager {
method = "sendPacket",
at = @At("RETURN")
)
private void postDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, boolean flush, CallbackInfo ci) {
private void postDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, CallbackInfo ci) {
if (this.receiving != PacketFlow.CLIENTBOUND) {
return;
}

View File

@@ -37,6 +37,11 @@ import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
@Mixin(Screen.class)
public abstract class MixinScreen implements IGuiScreen {
@Override
@Invoker("openLink")
public abstract void openLinkInvoker(URI url);
//TODO: switch to enum extention with mixin 9.0 or whenever Mumfrey gets around to it
@Inject(at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", remap = false, ordinal = 1), method = "handleComponentClicked", cancellable = true)
public void handleCustomClickEvent(Style style, CallbackInfoReturnable<Boolean> cir) {

View File

@@ -22,7 +22,6 @@ import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
@@ -42,13 +41,12 @@ public class MixinWorldRenderer {
@Inject(
method = "renderLevel",
at = @At("RETURN")
at = @At("RETURN"),
locals = LocalCapture.CAPTURE_FAILSOFT
)
private void onStartHand(final DeltaTracker deltaTracker, final boolean bl, final Camera camera, final GameRenderer gameRenderer, final LightTexture lightTexture, final Matrix4f matrix4f, final Matrix4f matrix4f2, final CallbackInfo ci) {
private void onStartHand(PoseStack matrixStackIn, float partialTicks, long finishTimeNano, boolean drawBlockOutline, Camera activeRenderInfoIn, GameRenderer gameRendererIn, LightTexture lightmapIn, Matrix4f projectionIn, CallbackInfo ci) {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
PoseStack poseStack = new PoseStack();
poseStack.mulPose(matrix4f);
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(deltaTracker.getGameTimeDeltaPartialTick(false), poseStack, matrix4f2));
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks, matrixStackIn, projectionIn));
}
}
}
}

View File

@@ -18,8 +18,7 @@
"MixinFireworkRocketEntity",
"MixinItemStack",
"MixinLivingEntity",
"MixinLootContextBuilder",
"MixinLootTable",
"MixinLootContext",
"MixinMinecraft",
"MixinNetworkManager",
"MixinPalettedContainer",
@@ -27,7 +26,5 @@
"MixinPlayerController",
"MixinScreen",
"MixinWorldRenderer"
],
"mixins": [
]
}

View File

@@ -423,7 +423,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
public BetterBlockPos pathStart() { // TODO move to a helper or util class
BetterBlockPos feet = ctx.playerFeet();
if (!MovementHelper.canWalkOn(ctx, feet.below())) {
if (ctx.player().onGround()) {
if (ctx.player().isOnGround()) {
double playerX = ctx.player().position().x;
double playerZ = ctx.player().position().z;
ArrayList<BetterBlockPos> closest = new ArrayList<>();

View File

@@ -78,7 +78,7 @@ public final class ChunkPacker {
for (int x = 0; x < 16; x++) {
int index = CachedChunk.getPositionIndex(x, y, z);
BlockState state = bsc.get(x, y1, z);
boolean[] bits = getPathingBlockType(state, chunk, x, y, z).getBits();
boolean[] bits = getPathingBlockType(state, chunk, x, y + chunk.getMinBuildHeight(), z).getBits();
bitSet.set(index, bits[0]);
bitSet.set(index + 1, bits[1]);
Block block = state.getBlock();

View File

@@ -162,26 +162,26 @@ public enum FasterWorldScanner implements IWorldScanner {
}
private List<BlockPos> collectChunkSections(BlockOptionalMetaLookup lookup, LevelChunk chunk, long chunkX, long chunkZ, int playerSection) {
// iterate over sections relative to player
List<BlockPos> blocks = new ArrayList<>();
int chunkY = chunk.getMinBuildHeight();
LevelChunkSection[] sections = chunk.getSections();
int l = sections.length;
int i = playerSection - 1;
int j = playerSection;
for (; i >= 0 || j < l; ++j, --i) {
if (j < l) {
visitSection(lookup, sections[j], blocks, chunkX, chunkY + j * 16, chunkZ);
visitSection(lookup, sections[j], blocks, chunkX, chunkZ);
}
if (i >= 0) {
visitSection(lookup, sections[i], blocks, chunkX, chunkY + i * 16, chunkZ);
visitSection(lookup, sections[i], blocks, chunkX, chunkZ);
}
}
return blocks;
}
private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection section, List<BlockPos> blocks, long chunkX, int sectionY, long chunkZ) {
private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection section, List<BlockPos> blocks, long chunkX, long chunkZ) {
if (section == null || section.hasOnlyAir()) {
return;
}
@@ -192,6 +192,7 @@ public enum FasterWorldScanner implements IWorldScanner {
return;
}
int yOffset = section.bottomBlockY();
Palette<BlockState> palette = ((IPalettedContainer<BlockState>) sectionContainer).getPalette();
if (palette instanceof SingleValuePalette) {
@@ -203,7 +204,7 @@ public enum FasterWorldScanner implements IWorldScanner {
for (int z = 0; z < 16; ++z) {
blocks.add(new BlockPos(
(int) chunkX + x,
sectionY + y,
yOffset + y,
(int) chunkZ + z
));
}
@@ -232,7 +233,7 @@ public enum FasterWorldScanner implements IWorldScanner {
//noinspection DuplicateExpressions
blocks.add(new BlockPos(
(int) chunkX + ((idx & 255) & 15),
sectionY + (idx >> 8),
yOffset + (idx >> 8),
(int) chunkZ + ((idx & 255) >> 4)
));
}

View File

@@ -140,7 +140,7 @@ public class WorldProvider implements IWorldProvider {
String folderName;
final ServerData serverData = ctx.minecraft().getCurrentServer();
if (serverData != null) {
folderName = serverData.isRealm() ? "realms" : serverData.ip;
folderName = ctx.minecraft().isConnectedToRealms() ? "realms" : serverData.ip;
} else {
//replaymod causes null currentServer and false singleplayer.
System.out.println("World seems to be a replay. Not loading Baritone cache.");

View File

@@ -35,7 +35,6 @@ import baritone.command.argument.CommandArguments;
import baritone.command.manager.CommandManager;
import baritone.utils.accessor.IGuiScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.network.chat.*;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Tuple;
@@ -98,8 +97,8 @@ public class ExampleBaritoneControl extends Behavior implements Helper {
return false;
} else if (msg.trim().equalsIgnoreCase("orderpizza")) {
try {
Util.getPlatform().openUri("https://www.dominos.com/en/pages/order/");
} catch (Exception ignored) {}
((IGuiScreen) ctx.minecraft().screen).openLinkInvoker(new URI("https://www.dominos.com/en/pages/order/"));
} catch (NullPointerException | URISyntaxException ignored) {}
return false;
}
if (msg.isEmpty()) {

View File

@@ -42,7 +42,6 @@ import baritone.api.utils.BlockOptionalMetaLookup;
import baritone.utils.BlockStateInterface;
import baritone.utils.IRenderer;
import baritone.utils.schematic.StaticSchematic;
import com.mojang.blaze3d.vertex.BufferBuilder;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
@@ -76,9 +75,9 @@ public class SelCommand extends Command {
float opacity = Baritone.settings().selectionOpacity.value;
float lineWidth = Baritone.settings().selectionLineWidth.value;
boolean ignoreDepth = Baritone.settings().renderSelectionIgnoreDepth.value;
BufferBuilder bufferBuilder = IRenderer.startLines(color, opacity, lineWidth, ignoreDepth);
IRenderer.emitAABB(bufferBuilder, event.getModelViewStack(), new AABB(pos1));
IRenderer.endLines(bufferBuilder, ignoreDepth);
IRenderer.startLines(color, opacity, lineWidth, ignoreDepth);
IRenderer.emitAABB(event.getModelViewStack(), new AABB(pos1, pos1.offset(1, 1, 1)));
IRenderer.endLines(ignoreDepth);
}
});
}

View File

@@ -27,14 +27,11 @@ import baritone.utils.ToolSet;
import baritone.utils.pathing.BetterWorldBorder;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.*;
import net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
@@ -82,6 +79,7 @@ public class CalculationContext {
public double backtrackCostFavoringCoefficient;
public double jumpPenalty;
public final double walkOnWaterOnePenalty;
public final boolean allowWalkOnMagmaBlocks;
public final BetterWorldBorder worldBorder;
public final PrecomputedData precomputedData;
@@ -111,48 +109,24 @@ public class CalculationContext {
this.allowParkourAscend = Baritone.settings().allowParkourAscend.value;
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
this.allowFallIntoLava = false; // Super secret internal setting for ElytraBehavior
// todo: technically there can now be datapack enchants that replace blocks with any other at any range
int frostWalkerLevel = 0;
for (EquipmentSlot slot : EquipmentSlot.values()) {
ItemEnchantments itemEnchantments = baritone.getPlayerContext()
.player()
.getItemBySlot(slot)
.getEnchantments();
for (Holder<Enchantment> enchant : itemEnchantments.keySet()) {
if (enchant.is(Enchantments.FROST_WALKER)) {
frostWalkerLevel = itemEnchantments.getLevel(enchant);
}
}
}
this.frostWalker = frostWalkerLevel;
this.frostWalker = EnchantmentHelper.getEnchantmentLevel(Enchantments.FROST_WALKER, baritone.getPlayerContext().player());
this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value;
this.allowDiagonalAscend = Baritone.settings().allowDiagonalAscend.value;
this.allowDownward = Baritone.settings().allowDownward.value;
this.minFallHeight = 3; // Minimum fall height used by MovementFall
this.maxFallHeightNoWater = Baritone.settings().maxFallHeightNoWater.value;
this.maxFallHeightBucket = Baritone.settings().maxFallHeightBucket.value;
float waterSpeedMultiplier = 1.0f;
OUTER: for (EquipmentSlot slot : EquipmentSlot.values()) {
ItemEnchantments itemEnchantments = baritone.getPlayerContext()
.player()
.getItemBySlot(slot)
.getEnchantments();
for (Holder<Enchantment> enchant : itemEnchantments.keySet()) {
List<EnchantmentAttributeEffect> effects = enchant.value()
.getEffects(EnchantmentEffectComponents.ATTRIBUTES);
for (EnchantmentAttributeEffect effect : effects) {
if (effect.attribute().is(Attributes.WATER_MOVEMENT_EFFICIENCY.unwrapKey().get())) {
waterSpeedMultiplier = effect.amount().calculate(itemEnchantments.getLevel(enchant));
break OUTER;
}
}
}
int depth = EnchantmentHelper.getDepthStrider(player);
if (depth > 3) {
depth = 3;
}
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - waterSpeedMultiplier) + ActionCosts.WALK_ONE_BLOCK_COST * waterSpeedMultiplier;
float mult = depth / 3.0F;
this.waterWalkSpeed = ActionCosts.WALK_ONE_IN_WATER_COST * (1 - mult) + ActionCosts.WALK_ONE_BLOCK_COST * mult;
this.breakBlockAdditionalCost = Baritone.settings().blockBreakAdditionalPenalty.value;
this.backtrackCostFavoringCoefficient = Baritone.settings().backtrackCostFavoringCoefficient.value;
this.jumpPenalty = Baritone.settings().jumpPenalty.value;
this.walkOnWaterOnePenalty = Baritone.settings().walkOnWaterOnePenalty.value;
this.allowWalkOnMagmaBlocks = Baritone.settings().allowWalkOnMagmaBlocks.value;
// why cache these things here, why not let the movements just get directly from settings?
// because if some movements are calculated one way and others are calculated another way,
// then you get a wildly inconsistent path that isn't optimal for either scenario.

View File

@@ -31,11 +31,8 @@ import baritone.utils.BlockStateInterface;
import baritone.utils.ToolSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import net.minecraft.util.Mth;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.piston.MovingPistonBlock;
import net.minecraft.world.level.block.state.BlockState;
@@ -47,15 +44,16 @@ import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.WaterFluid;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import java.util.List;
import java.util.Optional;
import java.util.*;
import static baritone.api.utils.RotationUtils.DEG_TO_RAD_F;
import static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP;
import static baritone.pathing.precompute.Ternary.*;
@@ -143,7 +141,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block instanceof AirBlock) {
return YES;
}
if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH || block == Blocks.POINTED_DRIPSTONE || block instanceof AmethystClusterBlock || block instanceof AzaleaBlock) {
if (block instanceof BaseFireBlock || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH || block == Blocks.POINTED_DRIPSTONE || block instanceof AmethystClusterBlock || block instanceof AzaleaBlock) {
return NO;
}
if (block == Blocks.BIG_DRIPLEAF) {
@@ -181,10 +179,15 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block instanceof CauldronBlock) {
return NO;
}
if (state.isPathfindable(PathComputationType.LAND)) {
return YES;
} else {
return NO;
try { // A dodgy catch-all at the end, for most blocks with default behaviour this will work, however where blocks are special this will error out, and we can handle it when we have this information
if (state.isPathfindable(null, null, PathComputationType.LAND)) {
return YES;
} else {
return NO;
}
} catch (Throwable exception) {
System.out.println("The block " + state.getBlock().getName().getString() + " requires a special case due to the exception " + exception.getMessage());
return MAYBE;
}
}
@@ -227,7 +230,10 @@ public interface MovementHelper extends ActionCosts, Helper {
return fluidState.getType() instanceof WaterFluid;
}
return state.isPathfindable(PathComputationType.LAND);
// every block that overrides isPassable with anything more complicated than a "return true;" or "return false;"
// has already been accounted for above
// therefore it's safe to not construct a blockpos from our x, y, z ints and instead just pass null
return state.isPathfindable(bsi.access, BlockPos.ZERO, PathComputationType.LAND); // workaround for future compatibility =P
}
static Ternary fullyPassableBlockState(BlockState state) {
@@ -255,10 +261,16 @@ public interface MovementHelper extends ActionCosts, Helper {
}
// door, fence gate, liquid, trapdoor have been accounted for, nothing else uses the world or pos parameters
// at least in 1.12.2 vanilla, that is.....
if (state.isPathfindable(PathComputationType.LAND)) {
return YES;
} else {
return NO;
try { // A dodgy catch-all at the end, for most blocks with default behaviour this will work, however where blocks are special this will error out, and we can handle it when we have this information
if (state.isPathfindable(null, null, PathComputationType.LAND)) {
return YES;
} else {
return NO;
}
} catch (Throwable exception) {
// see PR #1087 for why
System.out.println("The block " + state.getBlock().getName().getString() + " requires a special case due to the exception " + exception.getMessage());
return MAYBE;
}
}
@@ -283,14 +295,11 @@ public interface MovementHelper extends ActionCosts, Helper {
if (fullyPassable == NO) {
return false;
}
return state.isPathfindable(PathComputationType.LAND);
return fullyPassablePosition(new BlockStateInterface(ctx), pos.getX(), pos.getY(), pos.getZ(), state); // meh
}
/**
* params retained for backwards compatibility
*/
static boolean fullyPassablePosition(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
return state.isPathfindable(PathComputationType.LAND);
return state.isPathfindable(bsi.access, bsi.isPassableBlockPos.set(x, y, z), PathComputationType.LAND);
}
static boolean isReplaceable(int x, int y, int z, BlockState state, BlockStateInterface bsi) {
@@ -319,7 +328,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block == Blocks.LARGE_FERN || block == Blocks.TALL_GRASS) {
return true;
}
return state.canBeReplaced();
return state.getMaterial().isReplaceable();
}
@Deprecated
@@ -376,7 +385,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean avoidWalkingInto(BlockState state) {
Block block = state.getBlock();
return !state.getFluidState().isEmpty()
|| block == Blocks.MAGMA_BLOCK
|| (block == Blocks.MAGMA_BLOCK && !Baritone.settings().allowWalkOnMagmaBlocks.value)
|| block == Blocks.CACTUS
|| block == Blocks.SWEET_BERRY_BUSH
|| block instanceof BaseFireBlock
@@ -412,7 +421,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static Ternary canWalkOnBlockState(BlockState state) {
Block block = state.getBlock();
if (isBlockNormalCube(state) && block != Blocks.MAGMA_BLOCK && block != Blocks.BUBBLE_COLUMN && block != Blocks.HONEY_BLOCK) {
if (isBlockNormalCube(state) && (block != Blocks.MAGMA_BLOCK || Baritone.settings().allowWalkOnMagmaBlocks.value) && block != Blocks.BUBBLE_COLUMN && block != Blocks.HONEY_BLOCK) {
return YES;
}
if (block instanceof AzaleaBlock) {
@@ -503,28 +512,15 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean canUseFrostWalker(CalculationContext context, BlockState state) {
return context.frostWalker != 0
&& state == FrostedIceBlock.meltsInto()
&& state.getValue(LiquidBlock.LEVEL) == 0;
&& state.getMaterial() == Material.WATER
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
}
static boolean canUseFrostWalker(IPlayerContext ctx, BlockPos pos) {
boolean hasFrostWalker = false;
OUTER: for (EquipmentSlot slot : EquipmentSlot.values()) {
ItemEnchantments itemEnchantments = ctx
.player()
.getItemBySlot(slot)
.getEnchantments();
for (Holder<Enchantment> enchant : itemEnchantments.keySet()) {
if (enchant.is(Enchantments.FROST_WALKER)) {
hasFrostWalker = true;
break OUTER;
}
}
}
BlockState state = BlockStateInterface.get(ctx, pos);
return hasFrostWalker
&& state == FrostedIceBlock.meltsInto()
&& state.getValue(LiquidBlock.LEVEL) == 0;
return EnchantmentHelper.hasFrostWalker(ctx.player())
&& state.getMaterial() == Material.WATER
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
}
/**
@@ -663,6 +659,43 @@ public interface MovementHelper extends ActionCosts, Helper {
)).setInput(Input.MOVE_FORWARD, true);
}
static void moveTowardsWithoutRotation(IPlayerContext ctx, MovementState state, float idealYaw) {
MovementOption.getOptions(
Mth.sin(ctx.playerRotations().getYaw() * DEG_TO_RAD_F),
Mth.cos(ctx.playerRotations().getYaw() * DEG_TO_RAD_F),
Baritone.settings().allowSprint.value
).min(Comparator.comparing(option -> option.distanceToSq(
Mth.sin(idealYaw * DEG_TO_RAD_F),
Mth.cos(idealYaw * DEG_TO_RAD_F)
))).ifPresent(selection -> selection.setInputs(state));
}
static void moveTowardsWithoutRotation(IPlayerContext ctx, MovementState state, BlockPos dest) {
float idealYaw = RotationUtils.calcRotationFromVec3d(
ctx.playerHead(),
VecUtils.getBlockPosCenter(dest),
ctx.playerRotations()
).getYaw();
moveTowardsWithoutRotation(ctx, state, idealYaw);
}
static void moveTowardsWithSlightRotation(IPlayerContext ctx, MovementState state, BlockPos dest) {
float idealYaw = RotationUtils.calcRotationFromVec3d(
ctx.playerHead(),
VecUtils.getBlockPosCenter(dest),
ctx.playerRotations()
).getYaw();
float distance = Rotation.yawDistanceFromOffset(ctx.playerRotations().getYaw(), idealYaw) % 45f;
float newYaw = distance > 0f ?
distance > 22.5f ? distance - 45f : distance :
distance < -22.5f ? distance + 45f : distance;
state.setTarget(new MovementTarget(new Rotation(
ctx.playerRotations().getYaw() - newYaw,
ctx.playerRotations().getPitch()
), true));
moveTowardsWithoutRotation(ctx, state, idealYaw);
}
/**
* Returns whether or not the specified block is
* water, regardless of whether or not it is flowing.
@@ -782,7 +815,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (ctx.getSelectedBlock().isPresent()) {
BlockPos selectedBlock = ctx.getSelectedBlock().get();
Direction side = ((BlockHitResult) ctx.objectMouseOver()).getDirection();
// only way for selectedBlock.equals(placeAt) to be true is if it's replacable
// only way for selectedBlock.equals(placeAt) to be true is if it's replaceable
if (selectedBlock.equals(placeAt) || (MovementHelper.canPlaceAgainst(ctx, selectedBlock) && selectedBlock.relative(side).equals(placeAt))) {
if (wouldSneak) {
state.setInput(Input.SNEAK, true);
@@ -811,4 +844,16 @@ public interface MovementHelper extends ActionCosts, Helper {
b == Blocks.LAVA ||
b == Blocks.WATER;
}
static List<BetterBlockPos> steppingOnBlocks(IPlayerContext ctx) {
List<BetterBlockPos> blocks = new ArrayList<>();
for (byte x = -1; x <= 1; x++) {
for (byte z = -1; z <= 1; z++) {
if (ctx.player().getBoundingBox().intersects(Vec3.atLowerCornerOf(ctx.player().blockPosition()).add(x, 0, z), Vec3.atLowerCornerOf(ctx.player().blockPosition()).add(x + 1, 1, z + 1))) {
blocks.add(new BetterBlockPos(ctx.player().getBlockX() + x, ctx.player().getBlockY() - 1, ctx.player().getBlockZ() + z));
}
}
}
return blocks;
}
}

View File

@@ -0,0 +1,57 @@
/*
* 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.pathing.movement;
import baritone.api.utils.input.Input;
import net.minecraft.util.Mth;
import java.util.stream.Stream;
public record MovementOption(Input input1, Input input2, float motionX, float motionZ) {
private static final float SPRINT_MULTIPLIER = 1.3f;
public MovementOption(Input input1, float motionX, float motionZ) {
this(input1, null, motionX, motionZ);
}
public void setInputs(MovementState movementState) {
if (input1 != null) {
movementState.setInput(input1, true);
}
if (input2 != null) {
movementState.setInput(input2, true);
}
}
public float distanceToSq(float otherX, float otherZ) {
return Mth.abs(motionX() - otherX) + Mth.abs(motionZ() - otherZ);
}
public static Stream<MovementOption> getOptions(float motionX, float motionZ, boolean canSprint) {
return Stream.of(
new MovementOption(Input.MOVE_FORWARD, canSprint ? motionX * SPRINT_MULTIPLIER : motionX, canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ),
new MovementOption(Input.MOVE_BACK, -motionX, -motionZ),
new MovementOption(Input.MOVE_LEFT, -motionZ, motionX),
new MovementOption(Input.MOVE_RIGHT, motionZ, -motionX),
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_LEFT, (canSprint ? motionX * SPRINT_MULTIPLIER : motionX) - motionZ, (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ) + motionX),
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_RIGHT, (canSprint ? motionX * SPRINT_MULTIPLIER : motionX) + motionZ, (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ) - motionX),
new MovementOption(Input.MOVE_BACK, Input.MOVE_LEFT, -motionX - motionZ, -motionZ + motionX),
new MovementOption(Input.MOVE_BACK, Input.MOVE_RIGHT, -motionX + motionZ, -motionZ - motionX)
);
}
}

View File

@@ -131,8 +131,10 @@ public class MovementAscend extends Movement {
}
} else {
// jumpingFromBottomSlab must be false
if (toPlace.getBlock() == Blocks.SOUL_SAND) {
if (toPlace.is(Blocks.SOUL_SAND)) {
walk = WALK_ONE_OVER_SOUL_SAND_COST;
} else if (toPlace.is(Blocks.MAGMA_BLOCK)) {
walk = SNEAK_ONE_BLOCK_COST;
} else {
walk = Math.max(JUMP_ONE_BLOCK_COST, WALK_ONE_BLOCK_COST);
}
@@ -188,6 +190,9 @@ public class MovementAscend extends Movement {
return state;
}
MovementHelper.moveTowards(ctx, state, dest);
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && jumpingOnto.is(Blocks.MAGMA_BLOCK));
if (MovementHelper.isBottomSlab(jumpingOnto) && !MovementHelper.isBottomSlab(BlockStateInterface.get(ctx, src.below()))) {
return state; // don't jump while walking from a non double slab into a bottom slab
}

View File

@@ -17,6 +17,7 @@
package baritone.pathing.movement.movements;
import baritone.Baritone;
import baritone.api.IBaritone;
import baritone.api.pathing.movement.MovementStatus;
import baritone.api.utils.BetterBlockPos;
@@ -255,6 +256,9 @@ public class MovementDescend extends Movement {
double x = ctx.player().position().x - (src.getX() + 0.5);
double z = ctx.player().position().z - (src.getZ() + 0.5);
double fromStart = Math.sqrt(x * x + z * z);
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && ctx.world().getBlockState(ctx.player().blockPosition().below()).is(Blocks.MAGMA_BLOCK));
if (!playerFeet.equals(dest) || ab > 0.25) {
if (numTicks++ < 20 && fromStart < 1.25) {
MovementHelper.moveTowards(ctx, state, fakeDest);

View File

@@ -118,6 +118,7 @@ public class MovementDiagonal extends Movement {
BlockState destWalkOn;
boolean descend = false;
boolean frostWalker = false;
boolean sneaking = false;
if (!MovementHelper.canWalkThrough(context, destX, y, destZ, destInto)) {
ascend = true;
if (!context.allowDiagonalAscend || !MovementHelper.canWalkThrough(context, x, y + 2, z) || !MovementHelper.canWalkOn(context, destX, y, destZ, destInto) || !MovementHelper.canWalkThrough(context, destX, y + 2, destZ)) {
@@ -140,8 +141,11 @@ public class MovementDiagonal extends Movement {
}
double multiplier = WALK_ONE_BLOCK_COST;
// For either possible soul sand, that affects half of our walking
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
if (destWalkOn.is(Blocks.SOUL_SAND)) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} else if (context.allowWalkOnMagmaBlocks && destWalkOn.is(Blocks.MAGMA_BLOCK)) {
multiplier += (SNEAK_ONE_BLOCK_COST - WALK_ONE_BLOCK_COST) / 2;
sneaking = true;
} else if (frostWalker) {
// frostwalker lets us walk on water without the penalty
} else if (destWalkOn.getBlock() == Blocks.WATER) {
@@ -153,13 +157,16 @@ public class MovementDiagonal extends Movement {
}
if (fromDownBlock == Blocks.SOUL_SAND) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} else if (context.allowWalkOnMagmaBlocks && fromDownBlock.equals(Blocks.MAGMA_BLOCK)) {
multiplier += (SNEAK_ONE_BLOCK_COST - WALK_ONE_BLOCK_COST) / 2;
sneaking = true;
}
BlockState cuttingOver1 = context.get(x, y - 1, destZ);
if (cuttingOver1.getBlock() == Blocks.MAGMA_BLOCK || MovementHelper.isLava(cuttingOver1)) {
if ((!context.allowWalkOnMagmaBlocks && cuttingOver1.is(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver1)) {
return;
}
BlockState cuttingOver2 = context.get(destX, y - 1, z);
if (cuttingOver2.getBlock() == Blocks.MAGMA_BLOCK || MovementHelper.isLava(cuttingOver2)) {
if ((!context.allowWalkOnMagmaBlocks && cuttingOver1.is(Blocks.MAGMA_BLOCK)) || MovementHelper.isLava(cuttingOver2)) {
return;
}
boolean water = false;
@@ -234,7 +241,7 @@ public class MovementDiagonal extends Movement {
}
} else {
// only can sprint if not edging around
if (context.canSprint && !water) {
if (context.canSprint && !water && !sneaking) {
// If we aren't edging around anything, and we aren't in water
// We can sprint =D
// Don't check for soul sand, since we can sprint on that too
@@ -270,6 +277,7 @@ public class MovementDiagonal extends Movement {
if (sprint()) {
state.setInput(Input.SPRINT, true);
}
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> ctx.world().getBlockState(block).is(Blocks.MAGMA_BLOCK)));
MovementHelper.moveTowards(ctx, state, dest);
return state;
}

View File

@@ -94,13 +94,18 @@ public class MovementFall extends Movement {
Rotation targetRotation = null;
BlockState destState = ctx.world().getBlockState(dest);
Block destBlock = destState.getBlock();
if (ctx.world().getBlockState(dest.below()).is(Blocks.MAGMA_BLOCK) && MovementHelper.steppingOnBlocks(ctx).stream().allMatch(block -> MovementHelper.canWalkThrough(ctx, block))) {
state.setInput(Input.SNEAK, true);
}
boolean isWater = destState.getFluidState().getType() instanceof WaterFluid;
if (!isWater && willPlaceBucket() && !playerFeet.equals(dest)) {
if (!Inventory.isHotbarSlot(ctx.player().getInventory().findSlotMatchingItem(STACK_BUCKET_WATER)) || ctx.world().dimension() == Level.NETHER) {
return state.setStatus(MovementStatus.UNREACHABLE);
}
if (ctx.player().position().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().onGround()) {
if (ctx.player().position().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().isOnGround()) {
ctx.player().getInventory().selected = ctx.player().getInventory().findSlotMatchingItem(STACK_BUCKET_WATER);
targetRotation = new Rotation(toDest.getYaw(), 90.0F);
@@ -135,7 +140,7 @@ public class MovementFall extends Movement {
}
Vec3 destCenter = VecUtils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder)
if (Math.abs(ctx.player().position().x + ctx.player().getDeltaMovement().x - destCenter.x) > 0.1 || Math.abs(ctx.player().position().z + ctx.player().getDeltaMovement().z - destCenter.z) > 0.1) {
if (!ctx.player().onGround() && Math.abs(ctx.player().getDeltaMovement().y) > 0.4) {
if (!ctx.player().isOnGround() && Math.abs(ctx.player().getDeltaMovement().y) > 0.4) {
state.setInput(Input.SNEAK, true);
}
state.setInput(Input.MOVE_FORWARD, true);
@@ -147,7 +152,7 @@ public class MovementFall extends Movement {
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().position().x)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().position().z));
if (dist < 0.6) {
state.setInput(Input.MOVE_FORWARD, true);
} else if (!ctx.player().onGround()) {
} else if (!ctx.player().isOnGround()) {
state.setInput(Input.SNEAK, false);
}
}

View File

@@ -102,14 +102,14 @@ public class MovementParkour extends Movement {
return; // can't jump out of water
}
int maxJump;
if (standingOn.getBlock() == Blocks.SOUL_SAND) {
if (context.allowWalkOnMagmaBlocks && standingOn.is(Blocks.MAGMA_BLOCK)) {
maxJump = 2;
} else if (standingOn.getBlock() == Blocks.SOUL_SAND) {
maxJump = 2; // 1 block gap
} else if (context.canSprint) {
maxJump = 4;
} else {
if (context.canSprint) {
maxJump = 4;
} else {
maxJump = 3;
}
maxJump = 3;
}
// check parkour jumps from smallest to largest for obstacles/walls and landing positions
@@ -262,6 +262,10 @@ public class MovementParkour extends Movement {
if (dist >= 4 || ascend) {
state.setInput(Input.SPRINT, true);
}
if (Baritone.settings().allowWalkOnMagmaBlocks.value && ctx.world().getBlockState(ctx.playerFeet().below()).is(Blocks.MAGMA_BLOCK)) {
state.setInput(Input.SNEAK, true);
}
MovementHelper.moveTowards(ctx, state, dest);
if (ctx.playerFeet().equals(dest)) {
Block d = BlockStateInterface.getBlock(ctx, dest);
@@ -278,7 +282,7 @@ public class MovementParkour extends Movement {
if (Baritone.settings().allowPlace.value // see PR #3775
&& ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway()
&& !MovementHelper.canWalkOn(ctx, dest.below())
&& !ctx.player().onGround()
&& !ctx.player().isOnGround()
&& MovementHelper.attemptToPlaceABlock(state, baritone, dest.below(), true, false) == PlaceResult.READY_TO_PLACE
) {
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory

View File

@@ -32,7 +32,14 @@ import baritone.pathing.movement.MovementState;
import baritone.utils.BlockStateInterface;
import com.google.common.collect.ImmutableSet;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.AirBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.CarpetBlock;
import net.minecraft.world.level.block.FallingBlock;
import net.minecraft.world.level.block.FenceGateBlock;
import net.minecraft.world.level.block.LadderBlock;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.phys.Vec3;
@@ -222,8 +229,7 @@ public class MovementPillar extends Movement {
return state.setStatus(MovementStatus.UNREACHABLE);
}
state.setInput(Input.SNEAK, ctx.player().position().y > dest.getY() || ctx.player().position().y < src.getY() + 0.2D); // delay placement by 1 tick for ncp compatibility
state.setInput(Input.SNEAK, true);
// since (lower down) we only right click once player.isSneaking, and that happens the tick after we request to sneak
double diffX = ctx.player().position().x - (dest.getX() + 0.5);
@@ -249,7 +255,7 @@ public class MovementPillar extends Movement {
BlockState frState = BlockStateInterface.get(ctx, src);
Block fr = frState.getBlock();
// TODO: Evaluate usage of getMaterial().isReplaceable()
if (!(fr instanceof AirBlock || frState.canBeReplaced())) {
if (!(fr instanceof AirBlock || frState.getMaterial().isReplaceable())) {
RotationUtils.reachable(ctx, src, ctx.playerController().getBlockReachDistance())
.map(rot -> new MovementState.MovementTarget(rot, true))
.ifPresent(state::setTarget);

View File

@@ -85,6 +85,7 @@ public class MovementTraverse extends Movement {
if (frostWalker || MovementHelper.canWalkOn(context, destX, y - 1, destZ, destOn)) { //this is a walk, not a bridge
double WC = WALK_ONE_BLOCK_COST;
boolean water = false;
boolean sneaking = false;
if (MovementHelper.isWater(pb0) || MovementHelper.isWater(pb1)) {
WC = context.waterWalkSpeed;
water = true;
@@ -98,6 +99,9 @@ public class MovementTraverse extends Movement {
}
if (srcDownBlock == Blocks.SOUL_SAND) {
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} else if (context.allowWalkOnMagmaBlocks && srcDownBlock.equals(Blocks.MAGMA_BLOCK)) {
sneaking = true;
WC += (SNEAK_ONE_BLOCK_COST - WALK_ONE_BLOCK_COST) / 2;
}
}
double hardness1 = MovementHelper.getMiningDurationTicks(context, destX, y, destZ, pb1, false);
@@ -106,7 +110,7 @@ public class MovementTraverse extends Movement {
}
double hardness2 = MovementHelper.getMiningDurationTicks(context, destX, y + 1, destZ, pb0, true); // only include falling on the upper block to break
if (hardness1 == 0 && hardness2 == 0) {
if (!water && context.canSprint) {
if (!water && !sneaking && context.canSprint) {
// If there's nothing in the way, and this isn't water, and we aren't sneak placing
// We can sprint =D
// Don't check for soul sand, since we can sprint on that too
@@ -213,12 +217,12 @@ public class MovementTraverse extends Movement {
.setInput(Input.SPRINT, true);
}
//sneak may have been set to true in the PREPPING state while mining an adjacent block
state.setInput(Input.SNEAK, false);
Block fd = BlockStateInterface.get(ctx, src.below()).getBlock();
boolean ladder = fd == Blocks.LADDER || fd == Blocks.VINE;
//sneak may have been set to true in the PREPPING state while mining an adjacent block, but we still want it to be true if the player is about to go on magma
state.setInput(Input.SNEAK, Baritone.settings().allowWalkOnMagmaBlocks.value && MovementHelper.steppingOnBlocks(ctx).stream().anyMatch(block -> ctx.world().getBlockState(block).is(Blocks.MAGMA_BLOCK)));
if (pb0.getBlock() instanceof DoorBlock || pb1.getBlock() instanceof DoorBlock) {
boolean notPassable = pb0.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, src, dest) || pb1.getBlock() instanceof DoorBlock && !MovementHelper.isDoorPassable(ctx, dest, src);
boolean canOpen = !(Blocks.IRON_DOOR.equals(pb0.getBlock()) || Blocks.IRON_DOOR.equals(pb1.getBlock()));
@@ -261,7 +265,7 @@ public class MovementTraverse extends Movement {
}
Block low = BlockStateInterface.get(ctx, src).getBlock();
Block high = BlockStateInterface.get(ctx, src.above()).getBlock();
if (ctx.player().position().y > src.y + 0.1D && !ctx.player().onGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
if (ctx.player().position().y > src.y + 0.1D && !ctx.player().isOnGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
// hitting W could cause us to climb the ladder instead of going forward
// wait until we're on the ground
return state;
@@ -296,7 +300,7 @@ public class MovementTraverse extends Movement {
}
}
double dist1 = Math.max(Math.abs(ctx.player().position().x - (dest.getX() + 0.5D)), Math.abs(ctx.player().position().z - (dest.getZ() + 0.5D)));
PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.below(), false, true);
PlaceResult p = MovementHelper.attemptToPlaceABlock(state, baritone, dest.below(), false, !Baritone.settings().assumeSafeWalk.value);
if ((p == PlaceResult.READY_TO_PLACE || dist1 < 0.6) && !Baritone.settings().assumeSafeWalk.value) {
state.setInput(Input.SNEAK, true);
}
@@ -352,9 +356,8 @@ public class MovementTraverse extends Movement {
}
return state;
}
MovementHelper.moveTowards(ctx, state, positionsToBreak[0]);
MovementHelper.moveTowardsWithSlightRotation(ctx, state, dest);
return state;
// TODO MovementManager.moveTowardsBlock(to); // move towards not look at because if we are bridging for a couple blocks in a row, it is faster if we dont spin around and walk forwards then spin around and place backwards for every block
}
}

View File

@@ -272,7 +272,7 @@ public class PathExecutor implements IPathExecutor, Helper {
if (!current.isPresent()) {
return false;
}
if (!ctx.player().onGround()) {
if (!ctx.player().isOnGround()) {
return false;
}
if (!MovementHelper.canWalkOn(ctx, ctx.playerFeet().below())) {
@@ -321,7 +321,7 @@ public class PathExecutor implements IPathExecutor, Helper {
* @return Whether or not it was possible to snap to the current player feet
*/
public boolean snipsnapifpossible() {
if (!ctx.player().onGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
if (!ctx.player().isOnGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
// if we're falling in the air, and not in water, don't splice
return false;
} else {

View File

@@ -22,46 +22,45 @@ import baritone.utils.BlockStateInterface;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import static baritone.pathing.precompute.Ternary.MAYBE;
import static baritone.pathing.precompute.Ternary.YES;
public class PrecomputedData {
private final int[] data = new int[Block.BLOCK_STATE_REGISTRY.size()];
private final byte[] data = new byte[Block.BLOCK_STATE_REGISTRY.size()];
private static final int COMPLETED_MASK = 1 << 0;
private static final int CAN_WALK_ON_MASK = 1 << 1;
private static final int CAN_WALK_ON_SPECIAL_MASK = 1 << 2;
private static final int CAN_WALK_THROUGH_MASK = 1 << 3;
private static final int CAN_WALK_THROUGH_SPECIAL_MASK = 1 << 4;
private static final int FULLY_PASSABLE_MASK = 1 << 5;
private static final int FULLY_PASSABLE_SPECIAL_MASK = 1 << 6;
/**
* byte layout
*
* 7 6 5 4 3 2 1 0
* | | | | | | | |
* unused canWalkOn maybe canWalkThrough maybe fullyPassable maybe completed
*/
private static final byte COMPLETED_MASK = (byte) 1 << 0;
private static final byte FULLY_PASSABLE_MAYBE_MASK = (byte) 1 << 1;
private static final byte FULLY_PASSABLE_MASK = (byte) 1 << 2;
private static final byte CAN_WALK_THROUGH_MAYBE_MASK = (byte) 1 << 3;
private static final byte CAN_WALK_THROUGH_MASK = (byte) 1 << 4;
private static final byte CAN_WALK_ON_MAYBE_MASK = (byte) 1 << 5;
private static final byte CAN_WALK_ON_MASK = (byte) 1 << 6;
private int fillData(int id, BlockState state) {
int blockData = 0;
byte blockData = 0;
Ternary canWalkOnState = MovementHelper.canWalkOnBlockState(state);
if (canWalkOnState == YES) {
blockData |= CAN_WALK_ON_MASK;
}
if (canWalkOnState == MAYBE) {
blockData |= CAN_WALK_ON_SPECIAL_MASK;
switch (canWalkOnState) {
case YES -> blockData |= CAN_WALK_ON_MASK;
case MAYBE -> blockData |= CAN_WALK_ON_MAYBE_MASK;
}
Ternary canWalkThroughState = MovementHelper.canWalkThroughBlockState(state);
if (canWalkThroughState == YES) {
blockData |= CAN_WALK_THROUGH_MASK;
}
if (canWalkThroughState == MAYBE) {
blockData |= CAN_WALK_THROUGH_SPECIAL_MASK;
switch (canWalkThroughState) {
case YES -> blockData |= CAN_WALK_THROUGH_MASK;
case MAYBE -> blockData |= CAN_WALK_THROUGH_MAYBE_MASK;
}
Ternary fullyPassableState = MovementHelper.fullyPassableBlockState(state);
if (fullyPassableState == YES) {
blockData |= FULLY_PASSABLE_MASK;
}
if (fullyPassableState == MAYBE) {
blockData |= FULLY_PASSABLE_SPECIAL_MASK;
switch (fullyPassableState) {
case YES -> blockData |= FULLY_PASSABLE_MASK;
case MAYBE -> blockData |= FULLY_PASSABLE_MAYBE_MASK;
}
blockData |= COMPLETED_MASK;
@@ -78,7 +77,7 @@ public class PrecomputedData {
blockData = fillData(id, state);
}
if ((blockData & CAN_WALK_ON_SPECIAL_MASK) != 0) {
if ((blockData & CAN_WALK_ON_MAYBE_MASK) != 0) {
return MovementHelper.canWalkOnPosition(bsi, x, y, z, state);
} else {
return (blockData & CAN_WALK_ON_MASK) != 0;
@@ -93,7 +92,7 @@ public class PrecomputedData {
blockData = fillData(id, state);
}
if ((blockData & CAN_WALK_THROUGH_SPECIAL_MASK) != 0) {
if ((blockData & CAN_WALK_THROUGH_MAYBE_MASK) != 0) {
return MovementHelper.canWalkThroughPosition(bsi, x, y, z, state);
} else {
return (blockData & CAN_WALK_THROUGH_MASK) != 0;
@@ -108,7 +107,7 @@ public class PrecomputedData {
blockData = fillData(id, state);
}
if ((blockData & FULLY_PASSABLE_SPECIAL_MASK) != 0) {
if ((blockData & FULLY_PASSABLE_MAYBE_MASK) != 0) {
return MovementHelper.fullyPassablePosition(bsi, x, y, z, state);
} else {
return (blockData & FULLY_PASSABLE_MASK) != 0;

View File

@@ -46,6 +46,7 @@ import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.SchematicSystem;
import baritone.utils.schematic.litematica.LitematicaHelper;
import baritone.utils.schematic.schematica.SchematicaHelper;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import net.minecraft.core.BlockPos;
@@ -544,7 +545,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
if (toBreak.isPresent() && isSafeToCancel && ctx.player().onGround()) {
if (toBreak.isPresent() && isSafeToCancel && ctx.player().isOnGround()) {
// we'd like to pause to break this block
// only change look direction if it's safe (don't want to fuck up an in progress parkour for example
Rotation rot = toBreak.get().getB();
@@ -564,7 +565,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
List<BlockState> desirableOnHotbar = new ArrayList<>();
Optional<Placement> toPlace = searchForPlacables(bcc, desirableOnHotbar);
if (toPlace.isPresent() && isSafeToCancel && ctx.player().onGround() && ticks <= 0) {
if (toPlace.isPresent() && isSafeToCancel && ctx.player().isOnGround() && ticks <= 0) {
Rotation rot = toPlace.get().rot;
baritone.getLookBehavior().updateTarget(rot, true);
ctx.player().getInventory().selected = toPlace.get().hotbarSelection;
@@ -1049,8 +1050,8 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (!ignoreDirection && ignoredProps.isEmpty()) {
return first.equals(second); // early return if no properties are being ignored
}
Map<Property<?>, Comparable<?>> map1 = first.getValues();
Map<Property<?>, Comparable<?>> map2 = second.getValues();
ImmutableMap<Property<?>, Comparable<?>> map1 = first.getValues();
ImmutableMap<Property<?>, Comparable<?>> map2 = second.getValues();
for (Property<?> prop : map1.keySet()) {
if (map1.get(prop) != map2.get(prop)
&& !(ignoreDirection && ORIENTATION_PROPS.contains(prop))

View File

@@ -204,7 +204,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
}
if (this.state == State.FLYING || this.state == State.START_FLYING) {
this.state = ctx.player().onGround() && Baritone.settings().elytraAutoJump.value
this.state = ctx.player().isOnGround() && Baritone.settings().elytraAutoJump.value
? State.LOCATE_JUMP
: State.START_FLYING;
}
@@ -322,7 +322,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
}
private void pathTo0(BlockPos destination, boolean appendDestination) {
if (ctx.player() == null || ctx.player().level().dimension() != Level.NETHER) {
if (ctx.player() == null || ctx.player().level.dimension() != Level.NETHER) {
return;
}
this.onLostControl();
@@ -360,7 +360,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
private boolean shouldLandForSafety() {
ItemStack chest = ctx.player().getItemBySlot(EquipmentSlot.CHEST);
if (chest.getItem() != Items.ELYTRA || chest.getMaxDamage() - chest.getDamageValue() < Baritone.settings().elytraMinimumDurability.value) {
if (chest.getItem() != Items.ELYTRA || chest.getItem().getMaxDamage() - chest.getDamageValue() < Baritone.settings().elytraMinimumDurability.value) {
// elytrabehavior replaces when durability <= minimumDurability, so if durability < minimumDurability then we can reasonably assume that the elytra will soon be broken without replacement
return true;
}

View File

@@ -260,7 +260,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
}
if (state.getBlock() instanceof BonemealableBlock) {
BonemealableBlock ig = (BonemealableBlock) state.getBlock();
if (ig.isValidBonemealTarget(ctx.world(), pos, state) && ig.isBonemealSuccess(ctx.world(), ctx.world().random, pos, state)) {
if (ig.isValidBonemealTarget(ctx.world(), pos, state, true) && ig.isBonemealSuccess(ctx.world(), ctx.world().random, pos, state)) {
bonemealable.add(pos);
}
}
@@ -376,7 +376,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
}
}
for (Entity entity : ctx.entities()) {
if (entity instanceof ItemEntity && entity.onGround()) {
if (entity instanceof ItemEntity && entity.isOnGround()) {
ItemEntity ei = (ItemEntity) entity;
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
// +0.1 because of farmland's 0.9375 dummy height lol

View File

@@ -120,7 +120,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
.filter(pos -> !(BlockStateInterface.get(ctx, pos).getBlock() instanceof AirBlock)) // after breaking a block, it takes mineGoalUpdateInterval ticks for it to actually update this list =(
.min(Comparator.comparingDouble(ctx.playerFeet().above()::distSqr));
baritone.getInputOverrideHandler().clearAllKeys();
if (shaft.isPresent() && ctx.player().onGround()) {
if (shaft.isPresent() && ctx.player().isOnGround()) {
BlockPos pos = shaft.get();
BlockState state = baritone.bsi.get0(pos);
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {

View File

@@ -25,18 +25,15 @@ import baritone.api.event.events.*;
import baritone.api.pathing.goals.GoalBlock;
import baritone.api.utils.*;
import baritone.api.utils.input.Input;
import baritone.pathing.movement.MovementHelper;
import baritone.process.ElytraProcess;
import baritone.utils.BlockStateInterface;
import baritone.utils.IRenderer;
import baritone.utils.PathRenderer;
import baritone.utils.accessor.IFireworkRocketEntity;
import com.mojang.blaze3d.vertex.BufferBuilder;
import it.unimi.dsi.fastutil.floats.FloatArrayList;
import it.unimi.dsi.fastutil.floats.FloatIterator;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.core.component.DataComponents;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
import net.minecraft.util.Mth;
@@ -46,13 +43,11 @@ import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.component.Fireworks;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.block.AirBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkSource;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
@@ -425,28 +420,28 @@ public final class ElytraBehavior implements Helper {
PathRenderer.drawGoal(event.getModelViewStack(), ctx, new GoalBlock(this.aimPos), event.getPartialTicks(), Color.GREEN);
}
if (!this.clearLines.isEmpty() && settings.elytraRenderRaytraces.value) {
BufferBuilder bufferBuilder = IRenderer.startLines(Color.GREEN, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
IRenderer.startLines(Color.GREEN, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
for (Pair<Vec3, Vec3> line : this.clearLines) {
IRenderer.emitLine(bufferBuilder, event.getModelViewStack(), line.first(), line.second());
IRenderer.emitLine(event.getModelViewStack(), line.first(), line.second());
}
IRenderer.endLines(bufferBuilder, settings.renderPathIgnoreDepth.value);
IRenderer.endLines(settings.renderPathIgnoreDepth.value);
}
if (!this.blockedLines.isEmpty() && Baritone.settings().elytraRenderRaytraces.value) {
BufferBuilder bufferBuilder = IRenderer.startLines(Color.BLUE, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
IRenderer.startLines(Color.BLUE, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
for (Pair<Vec3, Vec3> line : this.blockedLines) {
IRenderer.emitLine(bufferBuilder, event.getModelViewStack(), line.first(), line.second());
IRenderer.emitLine(event.getModelViewStack(), line.first(), line.second());
}
IRenderer.endLines(bufferBuilder, settings.renderPathIgnoreDepth.value);
IRenderer.endLines(settings.renderPathIgnoreDepth.value);
}
if (this.simulationLine != null && Baritone.settings().elytraRenderSimulation.value) {
BufferBuilder bufferBuilder = IRenderer.startLines(new Color(0x36CCDC), settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
IRenderer.startLines(new Color(0x36CCDC), settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
final Vec3 offset = ctx.player().getPosition(event.getPartialTicks());
for (int i = 0; i < this.simulationLine.size() - 1; i++) {
final Vec3 src = this.simulationLine.get(i).add(offset);
final Vec3 dst = this.simulationLine.get(i + 1).add(offset);
IRenderer.emitLine(bufferBuilder, event.getModelViewStack(), src, dst);
IRenderer.emitLine(event.getModelViewStack(), src, dst);
}
IRenderer.endLines(bufferBuilder, settings.renderPathIgnoreDepth.value);
IRenderer.endLines(settings.renderPathIgnoreDepth.value);
}
}
@@ -925,8 +920,9 @@ public final class ElytraBehavior implements Helper {
if (itemStack.getItem() != Items.FIREWORK_ROCKET) {
return false;
}
Fireworks fw = itemStack.get(DataComponents.FIREWORKS);
return fw != null && fw.explosions().isEmpty();
// If it has NBT data, make sure it won't cause us to explode.
final CompoundTag compound = itemStack.getTagElement("Fireworks");
return compound == null || !compound.getAllKeys().contains("Explosions");
}
private static boolean isBoostingFireworks(final ItemStack itemStack) {
@@ -934,9 +930,11 @@ public final class ElytraBehavior implements Helper {
}
private static OptionalInt getFireworkBoost(final ItemStack itemStack) {
Fireworks fw = itemStack.get(DataComponents.FIREWORKS);
if (fw != null && fw.explosions().isEmpty()) {
return OptionalInt.of(fw.flightDuration());
if (isFireworks(itemStack)) {
final CompoundTag compound = itemStack.getTagElement("Fireworks");
if (compound != null && compound.getAllKeys().contains("Flight")) {
return OptionalInt.of(compound.getByte("Flight"));
}
}
return OptionalInt.empty();
}
@@ -1266,8 +1264,8 @@ public final class ElytraBehavior implements Helper {
private boolean passable(int x, int y, int z, boolean ignoreLava) {
if (ignoreLava) {
final BlockState state = this.bsi.get0(x, y, z);
return state.getBlock() instanceof AirBlock || MovementHelper.isLava(state);
final Material mat = this.bsi.get0(x, y, z).getMaterial();
return mat == Material.AIR || mat == Material.LAVA;
} else {
return !this.boi.get0(x, y, z);
}
@@ -1292,7 +1290,7 @@ public final class ElytraBehavior implements Helper {
NonNullList<ItemStack> invy = ctx.player().getInventory().items;
for (int i = 0; i < invy.size(); i++) {
ItemStack slot = invy.get(i);
if (slot.getItem() == Items.ELYTRA && (slot.getMaxDamage() - slot.getDamageValue()) > Baritone.settings().elytraMinimumDurability.value) {
if (slot.getItem() == Items.ELYTRA && (slot.getItem().getMaxDamage() - slot.getDamageValue()) > Baritone.settings().elytraMinimumDurability.value) {
return i;
}
}
@@ -1306,7 +1304,7 @@ public final class ElytraBehavior implements Helper {
ItemStack chest = ctx.player().getItemBySlot(EquipmentSlot.CHEST);
if (chest.getItem() != Items.ELYTRA
|| chest.getMaxDamage() - chest.getDamageValue() > Baritone.settings().elytraMinimumDurability.value) {
|| chest.getItem().getMaxDamage() - chest.getDamageValue() > Baritone.settings().elytraMinimumDurability.value) {
return;
}

View File

@@ -37,7 +37,7 @@ public class Selection implements ISelection {
max.z - min.z + 1
);
this.aabb = new AABB(min.x, min.y, min.z, max.x + 1, max.y + 1, max.z + 1);
this.aabb = new AABB(this.min, this.max.offset(1, 1, 1));
}
@Override

View File

@@ -5,7 +5,6 @@ import baritone.api.event.events.RenderEvent;
import baritone.api.event.listener.AbstractGameEventListener;
import baritone.api.selection.ISelection;
import baritone.utils.IRenderer;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.world.phys.AABB;
@@ -29,27 +28,27 @@ public class SelectionRenderer implements IRenderer, AbstractGameEventListener {
return;
}
BufferBuilder bufferBuilder = IRenderer.startLines(settings.colorSelection.value, opacity, lineWidth, ignoreDepth);
IRenderer.startLines(settings.colorSelection.value, opacity, lineWidth, ignoreDepth);
for (ISelection selection : selections) {
IRenderer.emitAABB(bufferBuilder, stack, selection.aabb(), SELECTION_BOX_EXPANSION);
IRenderer.emitAABB(stack, selection.aabb(), SELECTION_BOX_EXPANSION);
}
if (settings.renderSelectionCorners.value) {
IRenderer.glColor(settings.colorSelectionPos1.value, opacity);
for (ISelection selection : selections) {
IRenderer.emitAABB(bufferBuilder, stack, new AABB(selection.pos1()));
IRenderer.emitAABB(stack, new AABB(selection.pos1(), selection.pos1().offset(1, 1, 1)));
}
IRenderer.glColor(settings.colorSelectionPos2.value, opacity);
for (ISelection selection : selections) {
IRenderer.emitAABB(bufferBuilder, stack, new AABB(selection.pos2()));
IRenderer.emitAABB(stack, new AABB(selection.pos2(), selection.pos2().offset(1, 1, 1)));
}
}
IRenderer.endLines(bufferBuilder, ignoreDepth);
IRenderer.endLines(ignoreDepth);
}
@Override

View File

@@ -30,9 +30,9 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.status.ChunkStatus;
/**
* Wraps get for chuck caching capability

View File

@@ -22,10 +22,8 @@ import baritone.api.BaritoneAPI;
import baritone.api.pathing.goals.GoalBlock;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Helper;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.GameRenderer;
@@ -64,7 +62,7 @@ public class GuiClick extends Screen implements Helper {
}
@Override
public void render(GuiGraphics stack, int mouseX, int mouseY, float partialTicks) {
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) {
double mx = mc.mouseHandler.xpos();
double my = mc.mouseHandler.ypos();
@@ -77,7 +75,7 @@ public class GuiClick extends Screen implements Helper {
if (near != null && far != null) {
Vec3 viewerPos = new Vec3(PathRenderer.posX(), PathRenderer.posY(), PathRenderer.posZ());
LocalPlayer player = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().player();
HitResult result = player.level().clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
HitResult result = player.level.clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
if (result != null && result.getType() == HitResult.Type.BLOCK) {
currentMouseOver = ((BlockHitResult) result).getBlockPos();
}
@@ -127,11 +125,11 @@ public class GuiClick extends Screen implements Helper {
// drawSingleSelectionBox WHEN?
PathRenderer.drawManySelectionBoxes(modelViewStack, e, Collections.singletonList(currentMouseOver), Color.CYAN);
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
BufferBuilder bufferBuilder = IRenderer.startLines(Color.RED, Baritone.settings().pathRenderLineWidthPixels.value, true);
IRenderer.startLines(Color.RED, Baritone.settings().pathRenderLineWidthPixels.value, true);
BetterBlockPos a = new BetterBlockPos(currentMouseOver);
BetterBlockPos b = new BetterBlockPos(clickStart);
IRenderer.emitAABB(bufferBuilder, modelViewStack, new AABB(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z), Math.max(a.x, b.x) + 1, Math.max(a.y, b.y) + 1, Math.max(a.z, b.z) + 1));
IRenderer.endLines(bufferBuilder, true);
IRenderer.emitAABB(modelViewStack, new AABB(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.min(a.z, b.z), Math.max(a.x, b.x) + 1, Math.max(a.y, b.y) + 1, Math.max(a.z, b.z) + 1));
IRenderer.endLines(true);
}
}
}

View File

@@ -28,12 +28,15 @@ import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
import java.awt.*;
public interface IRenderer {
Tesselator tessellator = Tesselator.getInstance();
BufferBuilder buffer = tessellator.getBuilder();
IEntityRenderManager renderManager = (IEntityRenderManager) Minecraft.getInstance().getEntityRenderDispatcher();
TextureManager textureManager = Minecraft.getInstance().getTextureManager();
Settings settings = BaritoneAPI.getSettings();
@@ -48,7 +51,7 @@ public interface IRenderer {
IRenderer.color[3] = alpha;
}
static BufferBuilder startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) {
static void startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) {
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.blendFuncSeparate(
@@ -66,19 +69,15 @@ public interface IRenderer {
RenderSystem.disableDepthTest();
}
RenderSystem.setShader(GameRenderer::getRendertypeLinesShader);
return tessellator.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL);
buffer.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL);
}
static BufferBuilder startLines(Color color, float lineWidth, boolean ignoreDepth) {
return startLines(color, .4f, lineWidth, ignoreDepth);
static void startLines(Color color, float lineWidth, boolean ignoreDepth) {
startLines(color, .4f, lineWidth, ignoreDepth);
}
static void endLines(BufferBuilder bufferBuilder, boolean ignoredDepth) {
MeshData meshData = bufferBuilder.build();
if (meshData != null) {
BufferUploader.drawWithShader(meshData);
}
static void endLines(boolean ignoredDepth) {
tessellator.end();
if (ignoredDepth) {
RenderSystem.enableDepthTest();
}
@@ -88,7 +87,7 @@ public interface IRenderer {
RenderSystem.disableBlend();
}
static void emitLine(BufferBuilder bufferBuilder, PoseStack stack, double x1, double y1, double z1, double x2, double y2, double z2) {
static void emitLine(PoseStack stack, double x1, double y1, double z1, double x2, double y2, double z2) {
final double dx = x2 - x1;
final double dy = y2 - y1;
final double dz = z2 - z1;
@@ -98,59 +97,60 @@ public interface IRenderer {
final float ny = (float) (dy * invMag);
final float nz = (float) (dz * invMag);
emitLine(bufferBuilder, stack, x1, y1, z1, x2, y2, z2, nx, ny, nz);
emitLine(stack, x1, y1, z1, x2, y2, z2, nx, ny, nz);
}
static void emitLine(BufferBuilder bufferBuilder, PoseStack stack,
static void emitLine(PoseStack stack,
double x1, double y1, double z1,
double x2, double y2, double z2,
double nx, double ny, double nz) {
emitLine(bufferBuilder, stack,
emitLine(stack,
(float) x1, (float) y1, (float) z1,
(float) x2, (float) y2, (float) z2,
(float) nx, (float) ny, (float) nz
);
}
static void emitLine(BufferBuilder bufferBuilder, PoseStack stack,
static void emitLine(PoseStack stack,
float x1, float y1, float z1,
float x2, float y2, float z2,
float nx, float ny, float nz) {
PoseStack.Pose pose = stack.last();
final Matrix4f matrix4f = stack.last().pose();
final Matrix3f normal = stack.last().normal();
bufferBuilder.addVertex(pose, x1, y1, z1).setColor(color[0], color[1], color[2], color[3]).setNormal(pose, nx, ny, nz);
bufferBuilder.addVertex(pose, x2, y2, z2).setColor(color[0], color[1], color[2], color[3]).setNormal(pose, nx, ny, nz);
buffer.vertex(matrix4f, x1, y1, z1).color(color[0], color[1], color[2], color[3]).normal(normal, nx, ny, nz).endVertex();
buffer.vertex(matrix4f, x2, y2, z2).color(color[0], color[1], color[2], color[3]).normal(normal, nx, ny, nz).endVertex();
}
static void emitAABB(BufferBuilder bufferBuilder, PoseStack stack, AABB aabb) {
static void emitAABB(PoseStack stack, AABB aabb) {
AABB toDraw = aabb.move(-renderManager.renderPosX(), -renderManager.renderPosY(), -renderManager.renderPosZ());
// bottom
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.minY, toDraw.minZ, 1.0, 0.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.minY, toDraw.maxZ, 0.0, 0.0, 1.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.minY, toDraw.maxZ, -1.0, 0.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.minY, toDraw.minZ, 0.0, 0.0, -1.0);
emitLine(stack, toDraw.minX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.minY, toDraw.minZ, 1.0, 0.0, 0.0);
emitLine(stack, toDraw.maxX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.minY, toDraw.maxZ, 0.0, 0.0, 1.0);
emitLine(stack, toDraw.maxX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.minY, toDraw.maxZ, -1.0, 0.0, 0.0);
emitLine(stack, toDraw.minX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.minY, toDraw.minZ, 0.0, 0.0, -1.0);
// top
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.maxY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.minZ, 1.0, 0.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.maxY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.maxZ, 0.0, 0.0, 1.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.maxY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.maxZ, -1.0, 0.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.maxY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.minZ, 0.0, 0.0, -1.0);
emitLine(stack, toDraw.minX, toDraw.maxY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.minZ, 1.0, 0.0, 0.0);
emitLine(stack, toDraw.maxX, toDraw.maxY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.maxZ, 0.0, 0.0, 1.0);
emitLine(stack, toDraw.maxX, toDraw.maxY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.maxZ, -1.0, 0.0, 0.0);
emitLine(stack, toDraw.minX, toDraw.maxY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.minZ, 0.0, 0.0, -1.0);
// corners
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.minY, toDraw.minZ, toDraw.minX, toDraw.maxY, toDraw.minZ, 0.0, 1.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.minZ, 0.0, 1.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.maxX, toDraw.minY, toDraw.maxZ, toDraw.maxX, toDraw.maxY, toDraw.maxZ, 0.0, 1.0, 0.0);
emitLine(bufferBuilder, stack, toDraw.minX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.maxZ, 0.0, 1.0, 0.0);
emitLine(stack, toDraw.minX, toDraw.minY, toDraw.minZ, toDraw.minX, toDraw.maxY, toDraw.minZ, 0.0, 1.0, 0.0);
emitLine(stack, toDraw.maxX, toDraw.minY, toDraw.minZ, toDraw.maxX, toDraw.maxY, toDraw.minZ, 0.0, 1.0, 0.0);
emitLine(stack, toDraw.maxX, toDraw.minY, toDraw.maxZ, toDraw.maxX, toDraw.maxY, toDraw.maxZ, 0.0, 1.0, 0.0);
emitLine(stack, toDraw.minX, toDraw.minY, toDraw.maxZ, toDraw.minX, toDraw.maxY, toDraw.maxZ, 0.0, 1.0, 0.0);
}
static void emitAABB(BufferBuilder bufferBuilder, PoseStack stack, AABB aabb, double expand) {
emitAABB(bufferBuilder, stack, aabb.inflate(expand, expand, expand));
static void emitAABB(PoseStack stack, AABB aabb, double expand) {
emitAABB(stack, aabb.inflate(expand, expand, expand));
}
static void emitLine(BufferBuilder bufferBuilder, PoseStack stack, Vec3 start, Vec3 end) {
static void emitLine(PoseStack stack, Vec3 start, Vec3 end) {
double vpX = renderManager.renderPosX();
double vpY = renderManager.renderPosY();
double vpZ = renderManager.renderPosZ();
emitLine(bufferBuilder, stack, start.x - vpX, start.y - vpY, start.z - vpZ, end.x - vpX, end.y - vpY, end.z - vpZ);
emitLine(stack, start.x - vpX, start.y - vpY, start.z - vpZ, end.x - vpX, end.y - vpY, end.z - vpZ);
}
}

View File

@@ -26,7 +26,6 @@ import baritone.api.utils.interfaces.IGoalRenderPos;
import baritone.behavior.PathingBehavior;
import baritone.pathing.path.PathExecutor;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.blockentity.BeaconRenderer;
import net.minecraft.core.BlockPos;
@@ -38,7 +37,6 @@ import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.Arrays;
@@ -52,7 +50,7 @@ import java.util.List;
*/
public final class PathRenderer implements IRenderer {
private static final ResourceLocation TEXTURE_BEACON_BEAM = ResourceLocation.parse("textures/entity/beacon_beam.png");
private static final ResourceLocation TEXTURE_BEACON_BEAM = new ResourceLocation("textures/entity/beacon_beam.png");
private PathRenderer() {}
@@ -135,7 +133,7 @@ public final class PathRenderer implements IRenderer {
}
public static void drawPath(PoseStack stack, List<BetterBlockPos> positions, int startIndex, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0, double offset) {
BufferBuilder bufferBuilder = IRenderer.startLines(color, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
IRenderer.startLines(color, settings.pathRenderLineWidthPixels.value, settings.renderPathIgnoreDepth.value);
int fadeStart = fadeStart0 + startIndex;
int fadeEnd = fadeEnd0 + startIndex;
@@ -169,13 +167,13 @@ public final class PathRenderer implements IRenderer {
IRenderer.glColor(color, alpha);
}
emitPathLine(bufferBuilder, stack, start.x, start.y, start.z, end.x, end.y, end.z, offset);
emitPathLine(stack, start.x, start.y, start.z, end.x, end.y, end.z, offset);
}
IRenderer.endLines(bufferBuilder, settings.renderPathIgnoreDepth.value);
IRenderer.endLines(settings.renderPathIgnoreDepth.value);
}
private static void emitPathLine(BufferBuilder bufferBuilder, PoseStack stack, double x1, double y1, double z1, double x2, double y2, double z2, double offset) {
private static void emitPathLine(PoseStack stack, double x1, double y1, double z1, double x2, double y2, double z2, double offset) {
final double extraOffset = offset + 0.03D;
double vpX = posX();
@@ -183,20 +181,20 @@ public final class PathRenderer implements IRenderer {
double vpZ = posZ();
boolean renderPathAsFrickinThingy = !settings.renderPathAsLine.value;
IRenderer.emitLine(bufferBuilder, stack,
IRenderer.emitLine(stack,
x1 + offset - vpX, y1 + offset - vpY, z1 + offset - vpZ,
x2 + offset - vpX, y2 + offset - vpY, z2 + offset - vpZ
);
if (renderPathAsFrickinThingy) {
IRenderer.emitLine(bufferBuilder, stack,
IRenderer.emitLine(stack,
x2 + offset - vpX, y2 + offset - vpY, z2 + offset - vpZ,
x2 + offset - vpX, y2 + extraOffset - vpY, z2 + offset - vpZ
);
IRenderer.emitLine(bufferBuilder, stack,
IRenderer.emitLine(stack,
x2 + offset - vpX, y2 + extraOffset - vpY, z2 + offset - vpZ,
x1 + offset - vpX, y1 + extraOffset - vpY, z1 + offset - vpZ
);
IRenderer.emitLine(bufferBuilder, stack,
IRenderer.emitLine(stack,
x1 + offset - vpX, y1 + extraOffset - vpY, z1 + offset - vpZ,
x1 + offset - vpX, y1 + offset - vpY, z1 + offset - vpZ
);
@@ -204,30 +202,27 @@ public final class PathRenderer implements IRenderer {
}
public static void drawManySelectionBoxes(PoseStack stack, Entity player, Collection<BlockPos> positions, Color color) {
BufferBuilder bufferBuilder = IRenderer.startLines(color, settings.pathRenderLineWidthPixels.value, settings.renderSelectionBoxesIgnoreDepth.value);
IRenderer.startLines(color, settings.pathRenderLineWidthPixels.value, settings.renderSelectionBoxesIgnoreDepth.value);
//BlockPos blockpos = movingObjectPositionIn.getBlockPos();
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 -> {
BlockState state = bsi.get0(pos);
VoxelShape shape = state.getShape(player.level(), pos);
VoxelShape shape = state.getShape(player.level, pos);
AABB toDraw = shape.isEmpty() ? Shapes.block().bounds() : shape.bounds();
toDraw = toDraw.move(pos);
IRenderer.emitAABB(bufferBuilder, stack, toDraw, .002D);
IRenderer.emitAABB(stack, toDraw, .002D);
});
IRenderer.endLines(bufferBuilder, settings.renderSelectionBoxesIgnoreDepth.value);
IRenderer.endLines(settings.renderSelectionBoxesIgnoreDepth.value);
}
public static void drawGoal(PoseStack stack, IPlayerContext ctx, Goal goal, float partialTicks, Color color) {
drawGoal(null, stack, ctx, goal, partialTicks, color, true);
drawGoal(stack, ctx, goal, partialTicks, color, true);
}
private static void drawGoal(@Nullable BufferBuilder bufferBuilder, PoseStack stack, IPlayerContext ctx, Goal goal, float partialTicks, Color color, boolean setupRender) {
if (!setupRender && bufferBuilder == null) {
throw new RuntimeException("BufferBuilder must not be null if setupRender is false");
}
private static void drawGoal(PoseStack stack, IPlayerContext ctx, Goal goal, float partialTicks, Color color, boolean setupRender) {
double renderPosX = posX();
double renderPosY = posY();
double renderPosZ = posZ();
@@ -259,7 +254,7 @@ public final class PathRenderer implements IRenderer {
y2 -= 0.5;
maxY--;
}
drawDankLitGoalBox(bufferBuilder, stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
drawDankLitGoalBox(stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
} else if (goal instanceof GoalXZ) {
GoalXZ goalPos = (GoalXZ) goal;
minY = ctx.world().getMinBuildHeight();
@@ -285,7 +280,7 @@ public final class PathRenderer implements IRenderer {
settings.renderGoalAnimated.value ? ctx.world().getGameTime() : 0,
(int) minY,
(int) maxY,
color.getRGB(),
color.getColorComponents(null),
// Arguments filled by the private method lol
0.2F,
@@ -309,19 +304,19 @@ public final class PathRenderer implements IRenderer {
y2 = 0;
minY -= renderPosY;
maxY -= renderPosY;
drawDankLitGoalBox(bufferBuilder, stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
drawDankLitGoalBox(stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
} else if (goal instanceof GoalComposite) {
// Simple way to determine if goals can be batched, without having some sort of GoalRenderer
boolean batch = Arrays.stream(((GoalComposite) goal).goals()).allMatch(IGoalRenderPos.class::isInstance);
BufferBuilder buf = bufferBuilder;
if (batch) {
buf = IRenderer.startLines(color, settings.goalRenderLineWidthPixels.value, settings.renderGoalIgnoreDepth.value);
IRenderer.startLines(color, settings.goalRenderLineWidthPixels.value, settings.renderGoalIgnoreDepth.value);
}
for (Goal g : ((GoalComposite) goal).goals()) {
drawGoal(buf, stack, ctx, g, partialTicks, color, !batch);
drawGoal(stack, ctx, g, partialTicks, color, !batch);
}
if (batch) {
IRenderer.endLines(buf, settings.renderGoalIgnoreDepth.value);
IRenderer.endLines(settings.renderGoalIgnoreDepth.value);
}
} else if (goal instanceof GoalInverted) {
drawGoal(stack, ctx, ((GoalInverted) goal).origin, partialTicks, settings.colorInvertedGoalBox.value);
@@ -335,37 +330,37 @@ public final class PathRenderer implements IRenderer {
maxY = minY + 2;
y1 = 1 + y + goalpos.level - renderPosY;
y2 = 1 - y + goalpos.level - renderPosY;
drawDankLitGoalBox(bufferBuilder, stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
drawDankLitGoalBox(stack, color, minX, maxX, minZ, maxZ, minY, maxY, y1, y2, setupRender);
}
}
private static void drawDankLitGoalBox(BufferBuilder bufferBuilder, PoseStack stack, Color colorIn, double minX, double maxX, double minZ, double maxZ, double minY, double maxY, double y1, double y2, boolean setupRender) {
private static void drawDankLitGoalBox(PoseStack stack, Color colorIn, double minX, double maxX, double minZ, double maxZ, double minY, double maxY, double y1, double y2, boolean setupRender) {
if (setupRender) {
bufferBuilder = IRenderer.startLines(colorIn, settings.goalRenderLineWidthPixels.value, settings.renderGoalIgnoreDepth.value);
IRenderer.startLines(colorIn, settings.goalRenderLineWidthPixels.value, settings.renderGoalIgnoreDepth.value);
}
renderHorizontalQuad(bufferBuilder, stack, minX, maxX, minZ, maxZ, y1);
renderHorizontalQuad(bufferBuilder, stack, minX, maxX, minZ, maxZ, y2);
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y1);
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y2);
for (double y = minY; y < maxY; y += 16) {
double max = Math.min(maxY, y + 16);
IRenderer.emitLine(bufferBuilder, stack, minX, y, minZ, minX, max, minZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(bufferBuilder, stack, maxX, y, minZ, maxX, max, minZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(bufferBuilder, stack, maxX, y, maxZ, maxX, max, maxZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(bufferBuilder, stack, minX, y, maxZ, minX, max, maxZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(stack, minX, y, minZ, minX, max, minZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(stack, maxX, y, minZ, maxX, max, minZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(stack, maxX, y, maxZ, maxX, max, maxZ, 0.0, 1.0, 0.0);
IRenderer.emitLine(stack, minX, y, maxZ, minX, max, maxZ, 0.0, 1.0, 0.0);
}
if (setupRender) {
IRenderer.endLines(bufferBuilder, settings.renderGoalIgnoreDepth.value);
IRenderer.endLines(settings.renderGoalIgnoreDepth.value);
}
}
private static void renderHorizontalQuad(BufferBuilder bufferBuilder, PoseStack stack, double minX, double maxX, double minZ, double maxZ, double y) {
private static void renderHorizontalQuad(PoseStack stack, double minX, double maxX, double minZ, double maxZ, double y) {
if (y != 0) {
IRenderer.emitLine(bufferBuilder, stack, minX, y, minZ, maxX, y, minZ, 1.0, 0.0, 0.0);
IRenderer.emitLine(bufferBuilder, stack, maxX, y, minZ, maxX, y, maxZ, 0.0, 0.0, 1.0);
IRenderer.emitLine(bufferBuilder, stack, maxX, y, maxZ, minX, y, maxZ, -1.0, 0.0, 0.0);
IRenderer.emitLine(bufferBuilder, stack, minX, y, maxZ, minX, y, minZ, 0.0, 0.0, -1.0);
IRenderer.emitLine(stack, minX, y, minZ, maxX, y, minZ, 1.0, 0.0, 0.0);
IRenderer.emitLine(stack, maxX, y, minZ, maxX, y, maxZ, 0.0, 0.0, 1.0);
IRenderer.emitLine(stack, maxX, y, maxZ, minX, y, maxZ, -1.0, 0.0, 0.0);
IRenderer.emitLine(stack, minX, y, maxZ, minX, y, minZ, 0.0, 0.0, -1.0);
}
}
}

View File

@@ -19,19 +19,16 @@ package baritone.utils;
import baritone.Baritone;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.Holder;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.TieredItem;
import net.minecraft.world.item.enchantment.*;
import net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@@ -89,22 +86,14 @@ public class ToolSet {
private int getMaterialCost(ItemStack itemStack) {
if (itemStack.getItem() instanceof TieredItem) {
TieredItem tool = (TieredItem) itemStack.getItem();
return (int) tool.getTier().getAttackDamageBonus();
return tool.getTier().getLevel();
} else {
return -1;
}
}
public boolean hasSilkTouch(ItemStack stack) {
ItemEnchantments enchantments = stack.getEnchantments();
for (Holder<Enchantment> enchant : enchantments.keySet()) {
// silk touch enchantment is still special cased as affecting block drops
// not possible to add custom attribute via datapack
if (enchant.is(Enchantments.SILK_TOUCH) && enchantments.getLevel(enchant) > 0) {
return true;
}
}
return false;
return EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0;
}
/**
@@ -201,15 +190,9 @@ public class ToolSet {
float speed = item.getDestroySpeed(state);
if (speed > 1) {
final ItemEnchantments itemEnchantments = item.getEnchantments();
OUTER: for (Holder<Enchantment> enchant : itemEnchantments.keySet()) {
List<EnchantmentAttributeEffect> effects = enchant.value().getEffects(EnchantmentEffectComponents.ATTRIBUTES);
for (EnchantmentAttributeEffect e : effects) {
if (e.attribute().is(Attributes.MINING_EFFICIENCY.unwrapKey().get())) {
speed += e.amount().calculate(itemEnchantments.getLevel(enchant));
break OUTER;
}
}
int effLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BLOCK_EFFICIENCY, item);
if (effLevel > 0 && !item.isEmpty()) {
speed += effLevel * effLevel + 1;
}
}

View File

@@ -23,7 +23,6 @@ import baritone.utils.schematic.format.defaults.LitematicaSchematic;
import baritone.utils.schematic.format.defaults.MCEditSchematic;
import baritone.utils.schematic.format.defaults.SpongeSchematic;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtAccounter;
import net.minecraft.nbt.NbtIo;
import org.apache.commons.io.FilenameUtils;
@@ -47,7 +46,7 @@ public enum DefaultSchematicFormats implements ISchematicFormat {
MCEDIT("schematic") {
@Override
public IStaticSchematic parse(InputStream input) throws IOException {
return new MCEditSchematic(NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap()));
return new MCEditSchematic(NbtIo.readCompressed(input));
}
},
@@ -59,7 +58,7 @@ public enum DefaultSchematicFormats implements ISchematicFormat {
SPONGE("schem") {
@Override
public IStaticSchematic parse(InputStream input) throws IOException {
CompoundTag nbt = NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap());
CompoundTag nbt = NbtIo.readCompressed(input);
int version = nbt.getInt("Version");
switch (version) {
case 1:
@@ -77,15 +76,13 @@ public enum DefaultSchematicFormats implements ISchematicFormat {
LITEMATICA("litematic") {
@Override
public IStaticSchematic parse(InputStream input) throws IOException {
CompoundTag nbt = NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap());
CompoundTag nbt = NbtIo.readCompressed(input);
int version = nbt.getInt("Version");
switch (version) {
case 4: //1.12
case 5: //1.13-1.17
throw new UnsupportedOperationException("This litematic Version is too old.");
case 6: //1.18-1.20
throw new UnsupportedOperationException("This litematic Version is too old.");
case 7: //1.21+
case 6: //1.18+
return new LitematicaSchematic(nbt);
default:
throw new UnsupportedOperationException("Unsuported Version of a Litematica Schematic");

View File

@@ -81,7 +81,7 @@ public final class LitematicaSchematic extends CompositeSchematic implements ISt
BlockState[] blockList = new BlockState[blockStatePalette.size()];
for (int i = 0; i < blockStatePalette.size(); i++) {
Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.parse((((CompoundTag) blockStatePalette.get(i)).getString("Name"))));
Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation((((CompoundTag) blockStatePalette.get(i)).getString("Name"))));
CompoundTag properties = ((CompoundTag) blockStatePalette.get(i)).getCompound("Properties");
blockList[i] = getBlockState(block, properties);
@@ -273,4 +273,4 @@ public final class LitematicaSchematic extends CompositeSchematic implements ISt
return this.arraySize;
}
}
}
}

View File

@@ -130,7 +130,7 @@ public final class SpongeSchematic extends StaticSchematic {
String location = m.group("location");
String properties = m.group("properties");
ResourceLocation resourceLocation = ResourceLocation.parse(location);
ResourceLocation resourceLocation = new ResourceLocation(location);
Map<String, String> propertiesMap = new HashMap<>();
if (properties != null) {
for (String property : properties.split(",")) {

View File

@@ -95,7 +95,7 @@ jar {
}
task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.2.1"
}
task createDist(type: CreateDistTask, dependsOn: proguard)

View File

@@ -0,0 +1,105 @@
/*
* 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;
import com.google.common.base.Strings;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.Agent;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
import net.minecraft.launchwrapper.Launch;
import java.io.File;
import java.lang.reflect.Field;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Based on GradleStart from ForgeGradle 2.3
*
* @author Brady
* @since 3/11/2019
*/
public class LaunchTesting {
public static void main(String[] args) {
Map<String, String> arguments = new HashMap<>();
hackNatives();
arguments.put("version", "BaritownedDeveloperEnvironment");
arguments.put("assetIndex", System.getenv("assetIndex"));
arguments.put("assetsDir", System.getenv().getOrDefault("assetDirectory", "assets"));
arguments.put("accessToken", "FML");
arguments.put("userProperties", "{}");
arguments.put("tweakClass", System.getenv("tweakClass"));
String password = System.getenv("password");
if (password != null && !password.isEmpty()) {
attemptLogin(arguments, System.getenv("username"), System.getenv("password"));
}
List<String> argsArray = new ArrayList<>();
arguments.forEach((k, v) -> {
argsArray.add("--" + k);
argsArray.add(v);
});
Launch.main(argsArray.toArray(new String[0]));
}
private static void hackNatives() {
String paths = System.getProperty("java.library.path");
String nativesDir = System.getenv().get("nativesDirectory");
if (Strings.isNullOrEmpty(paths))
paths = nativesDir;
else
paths += File.pathSeparator + nativesDir;
System.setProperty("java.library.path", paths);
// hack the classloader now.
try {
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
} catch (Throwable ignored) {}
}
private static void attemptLogin(Map<String, String> argMap, String username, String password) {
YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) (new YggdrasilAuthenticationService(Proxy.NO_PROXY, "1")).createUserAuthentication(Agent.MINECRAFT);
auth.setUsername(username);
auth.setPassword(password);
try {
auth.logIn();
} catch (AuthenticationException var4) {
throw new RuntimeException(var4);
}
argMap.put("accessToken", auth.getAuthenticatedToken());
argMap.put("uuid", auth.getSelectedProfile().getId().toString().replace("-", ""));
argMap.put("username", auth.getSelectedProfile().getName());
argMap.put("userType", auth.getUserType().getName());
argMap.put("userProperties", (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(auth.getUserProperties()));
}
}