Compare commits

...

353 Commits

Author SHA1 Message Date
Leijurv
7bb311687b v1.9.3 2023-04-13 14:03:51 -07:00
Leijurv
d1a55c43e1 v1.9.2 2023-03-14 18:26:48 -07:00
Leijurv
63e3dfc9b8 1.19.4 2023-03-14 18:20:27 -07:00
leijurv
6db376c02e Merge pull request #3876 from wagyourtail/1.19/1.19.4
1.19.4
2023-03-14 18:19:57 -07:00
Wagyourtail
a1e797ab53 rc3 2023-03-13 15:47:54 -07:00
Wagyourtail
fe64f1fd8a 1.19.4-rc1 2023-03-09 10:17:54 -07:00
leijurv
7a5c4f1f03 Merge pull request #3843 from wagyourtail/1.19/fix/1.19.3-fixdistnames
fix dist names to match previous versions
2023-02-18 16:08:45 -08:00
Wagyourtail
787644181a fix dist names to match previous versions 2023-02-18 16:59:39 -07:00
Leijurv
7b60943714 v1.9.1 2023-02-18 15:01:48 -08:00
leijurv
7879b6909a Merge pull request #3837 from ZacSharp/1.19.2-update
Merge 1.18.2 into 1.19.3
2023-02-18 15:00:01 -08:00
ZacSharp
9898e0da26 Merge branch '1.18.2' into 1.19.3 2023-02-12 23:50:54 +01:00
leijurv
5841bd4e36 Merge pull request #3825 from ZacSharp/1.18.2-update
Merge 1.17.1 into 1.18.2
2023-02-12 12:47:28 -08:00
ZacSharp
81e9865067 Merge branch '1.17.1' into 1.18.2 2023-02-04 01:05:31 +01:00
leijurv
f9d563b9e6 Merge pull request #3819 from ZacSharp/1.17.1-update
Merge 1.16.5 into 1.17.1
2023-02-03 14:58:02 -08:00
ZacSharp
3e3312f009 Use CarpetBlock rather than WoolCarpetBlock 2023-01-29 01:27:58 +01:00
ZacSharp
327fbc868e Merge branch '1.16.5' into 1.17.1 2023-01-29 01:25:17 +01:00
leijurv
6d5cfe4187 Merge pull request #3801 from ZacSharp/1.16.5-update
Merge master into 1.16.5
2023-01-27 23:33:57 -08:00
ZacSharp
d3e0da7c5e Merge branch '1.15.2' into 1.16.5 2023-01-27 22:36:53 +01:00
ZacSharp
38fbc127e6 Merge branch '1.14.4' into 1.15.2 2023-01-27 22:34:12 +01:00
ZacSharp
25ef38aaf2 Merge branch '1.13.2' into 1.14.4 2023-01-27 22:30:51 +01:00
ZacSharp
d05d5fd98e Merge branch 'master' into 1.13.2 2023-01-27 22:20:20 +01:00
leijurv
698d40d797 bump 2023-01-16 20:55:43 -08:00
Leijurv
2b6c59fa8a v1.2.17 2023-01-16 12:22:52 -08:00
leijurv
21bc830143 Merge pull request #3798 from ZacSharp/patch-12
Fix canWalkThrough caching
2023-01-16 12:20:11 -08:00
ZacSharp
432d42ade8 Fix #find results not being clickable 2023-01-15 20:22:58 +01:00
ZacSharp
aa9206381d Fix canWalkThrough caching 2023-01-15 14:53:04 +01:00
Leijurv
d6d9af65fb reformat 2023-01-15 01:04:15 -08:00
Leijurv
a3f70e7977 add fullypassable to precomputeddata 2023-01-15 00:56:30 -08:00
leijurv
0057f093db Merge pull request #3771 from ZacSharp/1.16.5-update
Merge master into 1.16.5
2023-01-13 11:19:14 -08:00
Leijurv
6bbdba7a21 bump 2023-01-13 11:17:57 -08:00
Leijurv
6a175379fb v1.2.16 2023-01-13 11:10:24 -08:00
leijurv
7677ed8240 Merge pull request #3744 from wagyourtail/1.19/1.19.3
1.19/1.19.3
2023-01-13 11:08:57 -08:00
leijurv
85c21fa8e3 add comment 2023-01-12 14:52:38 -08:00
leijurv
bc8c823045 Merge pull request #3775 from ZacSharp/pr/frostwalker
Allow pathing to use frostwalker
2023-01-12 14:51:35 -08:00
ZacSharp
9935da8a6f Add explanation and add extra check 2023-01-12 22:18:54 +01:00
ZacSharp
c39b6c3fe7 Don't grab state if we don't need it 2023-01-12 21:39:55 +01:00
leijurv
c47a6f92c5 Merge pull request #3786 from Entropy5/master
bugfix for odd height schematics
2023-01-12 12:03:51 -08:00
leijurv
778628da30 Merge pull request #3789 from Argentoz/patch-1
Fix world border check
2023-01-12 12:03:00 -08:00
leijurv
ba0ca0cc65 Merge pull request #3788 from ZacSharp/pr/detectBrokenLoadHook
Make the world cache work even when mods break our world load hook
2023-01-12 11:39:41 -08:00
leijurv
fba3828479 Merge pull request #3735 from ZacSharp/pr/breakNextToLava
Allow breaking next to some liquids
2023-01-12 10:08:09 -08:00
Argentoz
c8dd4f26f7 Fix :)
WTF
2023-01-12 15:02:54 +03:00
Entropy5
16a62625b3 this seems to work as well? 2023-01-12 04:29:31 +01:00
ZacSharp
de5f6d5fce Apply suggested reordering 2023-01-11 23:56:52 +01:00
Entropy5
98a87d099b zac suggestion 2023-01-11 04:36:15 +01:00
ZacSharp
a6f3c95684 Don't spam the log when in a replay 2023-01-10 18:58:17 +01:00
ZacSharp
75e39e7ef5 Log when doing things out of the ordinary 2023-01-10 18:56:33 +01:00
ZacSharp
77b2b26a7a Add fix for 1.19.3 here already 2023-01-10 18:55:46 +01:00
ZacSharp
1680eeb80d Handle mods breaking our world loading hook 2023-01-10 17:25:32 +01:00
Entropy5
9a9b4a1874 bugfix for odd height schematics 2023-01-10 05:56:30 +01:00
ZacSharp
0e1fee352f Merge branch '1.15.2' into 1.16.5 2023-01-10 01:40:36 +01:00
ZacSharp
1136494fc6 Merge branch '1.14.4' into 1.15.2 2023-01-10 01:35:22 +01:00
ZacSharp
9b3e5cb444 Merge branch '1.13.2' into 1.14.4 2023-01-10 01:26:48 +01:00
ZacSharp
f13dc16af5 Merge branch 'master' into 1.13.2 2023-01-10 01:18:45 +01:00
leijurv
145a944860 Merge pull request #3785 from Entropy5/master
buildonlyselection optimization
2023-01-08 19:03:49 -10:00
leijurv
dd127ff3e7 Merge pull request #3782 from ZacSharp/pr/updateWorkflows
Update workflows
2023-01-08 18:32:07 -10:00
Entropy5
b0fb474e1d buildinlayers ~ buildonlyselection lag fix for big schematics (skips layers more properly) 2023-01-09 02:33:10 +01:00
ZacSharp
a1a94ec0d1 Fix step name 2023-01-06 04:26:03 +01:00
ZacSharp
678f8bc77f Use Temurin JDK 2023-01-06 04:25:03 +01:00
ZacSharp
41968546d1 Update workflows 2023-01-06 04:09:56 +01:00
ZacSharp
b51b78f4e4 Merge branch 'master' into 1.13.2 2023-01-06 01:47:30 +01:00
ZacSharp
f76283ebfe Remove unused imports 2023-01-03 00:50:56 +01:00
leijurv
7ad1a2dac7 Merge pull request #3774 from wagyourtail/patch-2
fix jitpack.yml so 1.19 builds there again
2023-01-01 23:38:51 -10:00
ZacSharp
e59bf9ab97 Grab block only once 2022-12-30 16:09:45 +01:00
ZacSharp
b2f66241d5 Merge remote-tracking branch 'upstream/master' into pr/frostwalker 2022-12-30 15:57:17 +01:00
William Gray
fd55e455a1 Update jitpack.yml 2022-12-30 00:42:53 +00:00
William Gray
e7e25abc0b Update jitpack.yml 2022-12-30 00:39:29 +00:00
leijurv
cfdbc851a0 Merge pull request #3600 from Imeguras/master
Added the ability to use KmM as abreviatures
2022-12-24 00:14:04 -08:00
leijurv
6ccebdc978 Merge pull request #3703 from rycbar0/master
formula error
2022-12-24 00:12:47 -08:00
leijurv
4bc9884a95 Merge pull request #3731 from EvilCodeZ/1.19.1
Removed System.out.println.
2022-12-24 00:08:46 -08:00
leijurv
df53040339 Merge pull request #3757 from Warpten/feature/paths-with-spaces-are-stupid
Improve handling spaces in paths during proguard pass
2022-12-24 00:08:04 -08:00
leijurv
42dc5b14b0 Merge pull request #3755 from wagyourtail/allowbreakanaywaymine
allowBreakAnyway should let mining happen
2022-12-24 00:07:00 -08:00
leijurv
e2538abcb1 Merge pull request #3743 from ZacSharp/patch-11
Fix Registry.unregister
2022-12-24 00:05:42 -08:00
leijurv
1697293f12 Merge pull request #3479 from scorbett123/caching_performance_upgrade
Caching performance upgrade
2022-12-23 23:57:14 -08:00
Wagyourtail
0e35a3e62b fix #3756 by allowing to recompute worldData if null 2022-12-19 07:42:23 -07:00
rycbar0
d60e1e8a05 Merge branch 'cabaletta:master' into master 2022-12-19 10:34:57 +01:00
Wagyourtail
1112feff5b cache 2022-12-12 13:24:43 -07:00
Wagyourtail
967dc6cbd6 bump unimined version 2022-12-12 13:23:36 -07:00
Wagyourtail
2ce60fbb79 fix tweaker build, don't include schematica api 2022-12-12 13:12:14 -07:00
Wagyourtail
35b7c48430 some people are getting a null worldData bug. add a debug line to see if its here 2022-12-12 12:54:06 -07:00
Warpten
d157756d94 Improve handling spaces in paths during proguard pass 2022-12-12 01:08:49 +01:00
Wagyourtail
ea1914a248 missed a spot 2022-12-10 20:12:51 -07:00
Wagyourtail
85087ce04a smarter filter filtering 2022-12-10 19:25:57 -07:00
Wagyourtail
e09127eadf allowBreakAnyway should let mining happen 2022-12-10 16:35:51 -07:00
Wagyourtail
db842445f6 forge support 2022-12-08 12:31:12 -07:00
Wagyourtail
3a8d438d7c update to release 2022-12-07 22:58:20 -07:00
Wagyourtail
386caf5d1e add parchment back 2022-12-06 18:30:43 -07:00
Wagyourtail
f7f0c84407 fix proguard not seeing unsafe 2 2022-12-02 14:39:57 -07:00
Wagyourtail
75cd4600a0 fix proguard not seeing unsafe 2022-12-02 14:31:00 -07:00
Wagyourtail
e6642a2122 fix ci 2022-12-02 14:24:29 -07:00
Wagyourtail
e7252f5b3f remove the mixin from api 2022-12-02 14:23:16 -07:00
Wagyourtail
4168401aa1 fix items and #click 2022-12-02 14:09:47 -07:00
Wagyourtail
3e082b21d5 loottables broke & #click not working 2022-12-02 01:17:25 -07:00
Wagyourtail
85790c0b2f switch to unimined 2022-12-01 23:04:40 -07:00
ZacSharp
e1095962a1 Fix Registry.unregister 2022-11-28 23:07:30 +01:00
ZacSharp
eabd1150b0 Allow breaking next to some liquids 2022-11-22 15:15:33 +01:00
EvilCodeZ
c20d40f8dd Removed System.out.println. 2022-11-18 19:39:39 +01:00
Leijurv
4fa43ce201 Merge pull request #3707 from ZacSharp/1.19.2-update
Merge 1.18.2 into 1.19.1
2022-11-07 01:39:51 -08:00
ZacSharp
f51f835b11 Merge branch '1.18.2' into 1.19.1 2022-11-01 00:11:26 +01:00
Leijurv
93501248cd Merge pull request #3698 from ZacSharp/patch-10
Reliably clear keys when paused
2022-10-31 12:29:56 -07:00
Leijurv
3a945c8c10 Merge pull request #3697 from ZacSharp/pr/buildIgnoreProperties
 Add buildIgnoreProperties setting
2022-10-31 12:28:44 -07:00
Leijurv
54f6851dd9 Merge pull request #3688 from ZacSharp/1.18.2-update
Merge 1.17.1 into 1.18.2
2022-10-31 12:25:18 -07:00
rycbar0
3cef7a7911 formula error 2022-10-26 23:09:23 +02:00
ZacSharp
1cd2fb5b18 Reliably clear keys when paused 2022-10-24 22:49:12 +02:00
ZacSharp
ba3ca47f8c Add buildIgnoreProperties setting 2022-10-23 01:42:31 +02:00
ZacSharp
98763271a4 Update litematic version check 2022-10-13 23:36:38 +02:00
ZacSharp
063842edc4 Merge branch '1.17.1' into 1.18.2 2022-10-12 18:17:34 +02:00
Leijurv
2453a4a4f1 Merge pull request #3458 from ZacSharp/1.17.1-update
Merge 1.16.5 into 1.17.1
2022-10-11 14:12:58 -07:00
ZacSharp
5a8adc5344 Merge branch '1.16.5' into 1.17.1 2022-10-06 20:43:01 +02:00
Leijurv
8b94ac8fca Merge pull request #3640 from scorbett123/fixWaterJump
Fix for infinite loop in water
2022-10-04 13:04:04 -07:00
Leijurv
c1e12b8746 Merge pull request #3678 from rycbar0/1.16.5
Merging Master in 1.16.5
2022-10-04 13:02:41 -07:00
rycbar0
44c1438541 forgot to adjust version check 2022-10-04 19:38:16 +02:00
rycbar0
c2a857f4d6 merging main into 1.16.5 2022-10-04 03:41:38 +02:00
rycbar0
9d620f8137 merging main into 1.16.5 2022-10-04 03:35:49 +02:00
rycbar0
7c2327b743 Merge remote-tracking branch 'origin/master' into 1.16.5
# Conflicts:
#	scripts/proguard.pro
#	src/launch/resources/mixins.baritone.json
#	src/main/java/baritone/command/defaults/DefaultCommands.java
#	src/main/java/baritone/command/defaults/FindCommand.java
#	src/main/java/baritone/process/BuilderProcess.java
#	src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java
#	src/main/java/baritone/utils/schematic/format/defaults/LitematicaSchematic.java
#	src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java
#	src/schematica_api/java/fi/dy/masa/litematica/Litematica.java
#	src/schematica_api/java/fi/dy/masa/litematica/data/DataManager.java
#	src/schematica_api/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacement.java
#	src/schematica_api/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementManager.java
#	src/schematica_api/java/fi/dy/masa/litematica/schematic/placement/SchematicPlacementUnloaded.java
2022-10-04 03:18:30 +02:00
rycbar0
d91abd5e45 Litematica support for 1.16.5 2022-10-04 02:09:07 +02:00
scorbett123
4699b46744 Merge branch 'master' into caching_performance_upgrade 2022-10-03 21:25:23 +01:00
scorbett123
8f514bd782 Cleaner fix for water jump issue 2022-10-03 21:22:07 +01:00
Leijurv
69ffdb7665 Merge pull request #3672 from rycbar0/master
Litematica Support for bariton
2022-10-03 12:52:18 -07:00
rycbar0
f9c5386e7a final changes 2022-10-03 21:39:53 +02:00
Leijurv
ec2941bede Merge pull request #3597 from wagyourtail/1.19/1.19.2
1.19.2
2022-10-03 12:29:07 -07:00
Leijurv
55273b5340 Merge pull request #3579 from lucasarden/master
Stop backfill from filling while paused
2022-10-03 12:23:02 -07:00
Leijurv
5b37b68363 Merge pull request #3592 from wagyourtail/1.19/1.19
fix click menus for baritone control
2022-10-03 12:22:10 -07:00
Leijurv
04f5ca2647 Merge pull request #3642 from wagyourtail/1.16.5/removeschematica
remove schematica command because it doesn't work anyway on 1.13+
2022-10-03 12:21:38 -07:00
rycbar0
5cd1c9d15d Merge pull request #1 from rycbar0/LitematicaCommand
Adding a Litematica command to build loaded schematics.
2022-10-03 20:39:24 +02:00
rycbar0
b461b2af2f made a oopsie 2022-10-03 20:32:56 +02:00
rycbar0
3a5608566e auto formatting 2022-10-03 20:13:11 +02:00
rycbar0
fc65f22feb clean up and adding javadoc 2022-10-03 19:59:07 +02:00
rycbar0
f53bfa89a9 a fucking x and z mixup 2022-10-03 17:44:15 +02:00
rycbar0
fdfeeb2ffa need stronger pesticides, bugs keep multiplying 2022-10-03 02:35:25 +02:00
rycbar0
3e75cc7408 block mirroring and rotation 2022-10-01 22:59:47 +02:00
rycbar0
d1930e03e1 getCorrectedOrigin returns the correct origin 2022-10-01 22:51:36 +02:00
rycbar0
144a534bb3 debugging mirroring and rotating as well as refactoring 2022-10-01 17:14:05 +02:00
rycbar0
de1256cc80 remove spaghetti 2022-10-01 05:27:02 +02:00
rycbar0
76404c8af6 it works but its spaghetti 2022-10-01 02:01:46 +02:00
ZacSharp
fb814e912d Don't try parkouring out of water 2022-09-30 23:59:49 +02:00
ZacSharp
43ee86b4fe Don't try backplacing against water under carpet/lilypad 2022-09-30 22:41:09 +02:00
ZacSharp
eb697b7a17 Fix costs when assumeWalkOnWater stops us from relying on frostWalker 2022-09-30 22:40:23 +02:00
ZacSharp
3da5bbd267 Don't pillar from carpet/lilypad on water 2022-09-30 22:38:21 +02:00
ZacSharp
c14be17e53 Move this to a helper method and add missing cases 2022-09-30 22:27:32 +02:00
ZacSharp
45c0b38156 Fix jumping from packplaced blocks on water
Not having frostwalker means that we must have replaced the water with a throwaway, not that we are standing on water
2022-09-30 18:04:34 +02:00
rycbar0
025f6235f9 litematica command works and added schematic selection if more than 1 schematic is loaded
bug: if schematic origin isnt minimum corner schematic is built in the wrong place
2022-09-30 17:53:31 +02:00
rycbar0
4ba3c883e6 something is fishy with the getAllSchematicPlacements() methode but i want my progress saved 2022-09-30 13:32:31 +02:00
rycbar0
3a4168a661 Merge branch 'master' into LitematicaCommand 2022-09-30 00:42:17 +02:00
rycbar0
484b3326c7 auto-format all files I touched 2022-09-29 21:52:15 +02:00
rycbar0
e99fcbbe36 Change requests part two 2022-09-29 21:47:42 +02:00
rycbar0
7ba3de57d0 credits LitematicaBitArray 2022-09-29 20:20:38 +02:00
rycbar0
5ff274f040 Change requests part one 2022-09-29 19:58:05 +02:00
schmar03
293f5db172 LitematicaCommand added to build loaded schematics 2022-09-28 14:15:48 +02:00
schmar03
d928e705b9 LitematicaCommand added to build loaded schematics 2022-09-28 12:09:38 +02:00
rycbar0
7a48824ced codacy issue #2,#3 and #4 fix 2022-09-26 22:32:25 +02:00
rycbar0
8aa8918124 codacy issue #1 and #5 fix 2022-09-26 22:23:38 +02:00
rycbar0
a091c17b83 Added mixin to properly handle Long Arrays 2022-09-26 21:04:09 +02:00
rycbar0
52aa0d9b8a more cleanup 2022-09-26 20:04:57 +02:00
rycbar0
3d8eddc4e1 cleanup 2022-09-26 19:23:09 +02:00
rycbar0
295265c261 refactoring 2022-09-26 17:43:54 +02:00
rycbar0
376d6422ec refactoring 2022-09-26 16:18:43 +02:00
rycbar0
113e340474 version check added 2022-09-26 16:09:41 +02:00
rycbar0
c89d8b69e5 ref files removed 2022-09-26 16:08:37 +02:00
rycbar0
70303634f5 ref files added 2022-09-26 15:59:55 +02:00
rycbar0
325aa7201b bug fix 2022-09-26 02:51:06 +02:00
rycbar0
75a3fc699e Code clean up 2022-09-26 01:18:56 +02:00
rycbar0
3cd8ce8323 Multiple Sub-region support 2022-09-26 00:58:32 +02:00
rycbar0
240e81a9e0 Refactoring 2022-09-25 18:22:59 +02:00
rycbar0
40449400d3 State of Emerson 2022-09-25 16:55:08 +02:00
Leijurv
bf43fd1274 Merge pull request #3601 from scorbett123/patch-6
Update legitMineYLevel for 1.18 +
2022-09-24 14:59:57 -10:00
Leijurv
cd7c504c76 Merge pull request #3664 from ZacSharp/patch-9
Fix yet another cave air bug
2022-09-18 22:54:42 -10:00
ZacSharp
96ba589d4d Fix yet another cave air bug 2022-09-17 01:56:23 +02:00
ZacSharp
9ffe4f2c25 Fix parkour with frostwalker with/without throwaways
* Placing throwaways with allowPlace disabled
* Failing without throwaways
2022-09-01 13:14:33 +02:00
ZacSharp
af95f77134 Fix OOB and check for direction and include parkour 2022-09-01 13:14:24 +02:00
wagyourtail
8803c618b1 remove schematica command because it doesn't work anyway on 1.13+ since sechematica doesn't exist past 1.12.2 2022-08-31 18:20:51 -07:00
ZacSharp
78f1c45e13 Don't overshoot descends before using frostwalker 2022-08-31 23:39:09 +02:00
scorbett123
287addb9fd Fix for infinite loop in water 2022-08-30 18:46:58 +01:00
ZacSharp
cf47573298 Merge remote-tracking branch 'upstream/master' into pr/frostwalker 2022-08-30 00:18:07 +02:00
ZacSharp
96ba96ca69 Fix some more edge cases 2022-08-29 18:47:54 +02:00
ZacSharp
da998eb469 Complete frostwalker usage 2022-08-29 16:59:01 +02:00
ZacSharp
e75a4b95cc Mostly working usage of frostwalker
* Sometimes overshoots Descend-Traverse chains onto water
* Unwanted interactions with assumeWalkOnWater
2022-08-29 12:53:02 +02:00
scorbett123
d1a0f1e3ca Update legitMineYLevel for 1.18 +
Update the legit mine default setting to work at the correct diamond level in 1.18+.
2022-08-08 15:20:41 +02:00
Imeguras
344085f4ef Added the ability to use KmM as abreviatures
for example 1m is equals to 1 million  while 1K is 1000
2022-08-08 12:00:48 +01:00
Wagyourtail
52d077de49 1.19.2 2022-08-07 14:47:18 -06:00
Wagyourtail
b1f35e93dc fix click menus for baritone control, closes #3587 2022-08-03 20:17:10 -06:00
Leijurv
076326dcc3 Merge pull request #3478 from wagyourtail/1.19/1.19
1.19/1.19
2022-08-01 12:48:03 -07:00
wagyourtail
b1b8288d05 Merge branch '1.19.1' into 1.19/1.19 2022-07-28 13:07:03 -06:00
Wagyourtail
df62427fee forge 2022-07-28 12:37:30 -06:00
Wagyourtail
61b9762a22 1.19.1 2022-07-27 19:59:44 -06:00
Lucas Arden
d37a6a0b2d Added check for placed blocks in backfill 2022-07-26 14:21:32 -07:00
Lucas Arden
d7fc916d20 Added check for pathing 2022-07-24 21:37:45 -07:00
Wagyourtail
06be5f5372 1.19.1-rc2 2022-07-21 12:16:21 -06:00
Leijurv
80a4757242 baritone complies faster if the files are less bytes 2022-07-15 01:36:01 -07:00
Leijurv
658048ff2d fix snow and tweak others 2022-07-14 22:11:13 -07:00
Leijurv
0587223da8 better constants 2022-07-14 22:02:19 -07:00
Leijurv
2d1b81dc20 vastly increase cuteness by removing the optional boolean 2022-07-14 22:00:18 -07:00
Leijurv
0bd16fb81a bit literals are meh 2022-07-14 21:56:25 -07:00
Leijurv
0c1fec5d1e crucial performance optimization 2022-07-14 21:54:32 -07:00
Leijurv
ee16eb7fde funnier this way 2022-07-14 21:47:18 -07:00
Leijurv
5c9aeab6b4 add cmt 2022-07-14 21:44:42 -07:00
Leijurv
5c7cae9ab0 fix literally wrong comment that did not match subsequent code 2022-07-14 21:43:14 -07:00
Leijurv
93fa6cf875 introduce MAYBE and fix more allocation cases 2022-07-14 21:42:38 -07:00
Leijurv
5b7bee977b also don't construct an optional for slabs 2022-07-14 21:38:38 -07:00
Leijurv
8018dac396 fix default case that instantiated an optional for non stairs 2022-07-14 21:38:02 -07:00
Leijurv
85ab317c6c simplify, remove setting changed event, always construct new precomputeddata 2022-07-14 21:35:30 -07:00
scorbett123
6b0fb1721b These should be all the suggested changes for the caching of can walk through block states 2022-07-14 17:18:02 +01:00
scorbett123
fdcdcbb85f Switch to using an int[] for storing precomputed data, and also use lazy loading 2022-07-14 12:49:47 +01:00
Leijurv
4e2095d251 almost forgot 2022-07-09 22:15:20 -07:00
Leijurv
51275b3a65 make #paws be an alias for #pause 2022-07-09 22:06:39 -07:00
scorbett123
8d480cefb9 Switch to throwable and readd check for glass / stained glass 2022-07-06 14:45:54 +01:00
scorbett123
3e7f9039c4 Don't construct new optionals in movement helper 2022-07-06 14:38:33 +01:00
Leijurv
49828baae3 Merge pull request #3296 from ZacSharp/findImprovements
Find improvements
2022-07-05 15:32:02 -07:00
Leijurv
348b02e4f8 Merge pull request #3368 from ZacSharp/patch-5
Remove false information from `#help mine`
2022-07-05 15:28:05 -07:00
Leijurv
a73e1185dc Merge pull request #3533 from Echocage/SprintFix
Fix for a sprint bug that can cause death
2022-07-05 15:27:10 -07:00
Echocage
441dceb731 Narrowed scope and we now only call canSprintFromDescendInto when our next & next_next movements are both MovementDescends 2022-06-29 17:54:28 -05:00
Echocage
57c4f9e103 Undid previous change, updated to instead check the next and the next_next block 2022-06-27 18:38:54 -05:00
Echocage
2741fc2683 Swapped the order of checks within canSprintFromDescendInto 2022-06-27 15:06:27 -05:00
Wagyourtail
fcd20b10f1 WORKING TWEAKER!!! 2022-06-11 11:54:30 +00:00
Leijurv
82f184c848 Merge pull request #3488 from ZacSharp/1.18.2-update
Merge 1.17.1 into 1.18.2
2022-06-08 19:03:00 -07:00
Wagyourtail
fd43dace70 rework this again and fix dist 2022-06-08 10:16:09 -06:00
Wagyourtail
a475f522ef artifact_standard needs project artifact name 2022-06-08 10:01:55 -06:00
Wagyourtail
e6cc9b1131 oops 2022-06-08 09:35:49 -06:00
Wagyourtail
347027a8e0 handle this differently (grab archive name from root project) 2022-06-08 09:26:47 -06:00
scorbett123
868c023dbd Fix a couple of things I missed 2022-06-08 14:20:25 +01:00
scorbett123
e7c357ab7f Make precomputed data refresh every 200 ticks (10 seconds) 2022-06-08 14:14:14 +01:00
Wagyourtail
f204fbb08e froge support 2022-06-08 02:28:22 -06:00
scorbett123
9e1a5008ed Move caching functions into MovementHelper 2022-06-07 21:52:24 +01:00
Wagyourtail
606f9c55a8 1.19! 2022-06-07 12:07:12 -06:00
Wagyourtail
f2a11df616 prepare for release day 2022-06-07 05:13:56 -06:00
Wagyourtail
5773da36bd Merge remote-tracking branch 'zacsharp/1.17.1-update' into 1.19/1.19 2022-06-07 05:11:47 -06:00
Wagyourtail
86303ed495 Merge branch '1.12/beta-versioning' into 1.19/1.19 2022-06-07 04:52:05 -06:00
Wagyourtail
2b4da2a46c deep checkout so we actually get tag names in CI 2022-06-03 14:46:39 -06:00
Wagyourtail
f699be7973 so umm, it's not using right version number in CI... 2022-06-03 14:42:23 -06:00
Wagyourtail
ed381d6b33 fix CI not having access to git when run via gradle 2022-06-03 14:29:51 -06:00
Wagyourtail
1caa99fee3 oops 2022-06-03 14:26:27 -06:00
ZacSharp
4a042510d8 Merge branch '1.17.1' into 1.18.2 2022-06-03 22:26:24 +02:00
Wagyourtail
ffbe683e86 versioning with normal build 2022-06-03 14:24:17 -06:00
Wagyourtail
4dba5a4399 use git describe instead 2022-06-03 14:09:37 -06:00
Wagyourtail
8cfdcbdc9e rc.2 2022-06-03 13:47:09 -06:00
ZacSharp
59b3fe7c3a Merge branch '1.16.5' into 1.17.1 2022-06-03 19:05:47 +02:00
Wagyourtail
6e37221b3c rc.1 2022-06-02 13:37:51 -06:00
Leijurv
b54ddeadf4 Merge pull request #3387 from ZacSharp/1.16.5-update
Merge master into 1.16.5
2022-06-02 11:39:20 -07:00
Wagyourtail
caa88c5b60 DONT on tags 2022-06-01 16:28:53 -06:00
Wagyourtail
1b3139c99a oops 2022-06-01 16:21:21 -06:00
Wagyourtail
3d95f0ad65 auto-increment version number as well 2022-06-01 16:16:41 -06:00
Wagyourtail
0df45a89be don't do the other stuff 2022-06-01 15:51:25 -06:00
Wagyourtail
b0266cd14b do beta versioning on gh action builds 2022-06-01 15:49:41 -06:00
Wagyourtail
9bf40dd60b pre.5 2022-06-01 15:17:45 -06:00
scorbett123
a6557121a0 fix github actions compiling. 2022-05-31 15:08:52 +01:00
scorbett123
2dad6262cf Remove some benchmarking and fix loading of settings. 2022-05-31 14:56:23 +01:00
scorbett123
af1eb58bb8 Implement Leijurv's precomputed data idea 2022-05-31 14:43:58 +01:00
Wagyourtail
56b44496bf verify fabric/tweaker builds are valid 2022-05-31 03:03:43 -06:00
Wagyourtail
3df451677c use loom 11 to allow building 2022-05-31 02:42:17 -06:00
Wagyourtail
9e021d2875 1.19 2022-05-31 02:38:55 -06:00
Wagyourtail
db9ee98762 Merge remote-tracking branch 'wagyourtail/1.18.2/cached-chunk-oopsie' into rework-buildscript-117 2022-05-31 01:58:12 -06:00
ZacSharp
4e0a507ba0 Merge branch '1.15.2' into 1.16.5 2022-05-24 21:45:58 +02:00
ZacSharp
7d39aacd72 Merge branch '1.14.4' into 1.15.2 2022-05-24 21:42:46 +02:00
ZacSharp
a8ae8a6171 Merge branch '1.13.2' into 1.14.4 2022-05-24 21:39:14 +02:00
ZacSharp
9c99333759 Merge branch 'master' into 1.13.2 2022-05-24 21:35:43 +02:00
Leijurv
17a2aa42e9 Merge pull request #3463 from ZacSharp/patch-8
Deal with others replacing the chat gui
2022-05-23 13:47:22 -07:00
Leijurv
231f671400 Merge pull request #3433 from ZacSharp/patch-7
Fix "missing null"
2022-05-23 13:46:27 -07:00
Leijurv
ec6ffb0f53 Merge pull request #3413 from wagyourtail/1.16.5/backport3308
backport #3308 to 1.16.5
2022-05-23 13:45:27 -07:00
ZacSharp
221eba11dd Deal with others replacing the chat gui 2022-05-20 01:31:09 +02:00
ZacSharp
ad40a9225e Fix leaking incorrect positions
It was only cleared when the previous one was canceled, not when it was directly replaced by the next one.
2022-05-03 23:25:01 +02:00
ZacSharp
1544b09c82 Merge branch '1.15.2' into 1.16.5 2022-04-23 13:12:08 +02:00
ZacSharp
1d08b3e729 Merge branch '1.14.4' into 1.15.2 2022-04-23 13:07:22 +02:00
ZacSharp
8a150568ec Merge branch '1.13.2' into 1.14.4 2022-04-23 13:02:47 +02:00
ZacSharp
00b20b2158 Merge branch 'master' into 1.13.2 2022-04-23 13:00:16 +02:00
wagyourtail
25e8e1b5fe fix 2022-04-22 19:23:39 -07:00
wagyourtail
bf7c840ea3 backport 3308 2022-04-22 19:00:43 -07:00
Leijurv
78a5838aa1 Merge pull request #3392 from ZacSharp/fixMerge
Fix mistakes made while merging upwards
2022-04-19 16:34:55 -07:00
Leijurv
cbef05838d Merge pull request #3388 from scorbett123/make_eta_show_ticks
Improve output to user in eta command
2022-04-19 16:33:37 -07:00
Wagyourtail
d0d74b1591 freeze version numbers at known working 2022-04-16 04:02:45 -07:00
Wagyourtail
056107a356 fix checksums, this'll probably confuse someone.
I couldn't figure out how to fix it the other way...
2022-04-16 03:46:41 -07:00
Wagyourtail
93a16f356d cleanup. move tweaker classes 2022-04-16 03:22:53 -07:00
Wagyourtail
070083dc9b properly remap refmap for tweaker 2022-04-16 02:57:29 -07:00
ZacSharp
4dcf260059 Fix mistakes made while merging upwards 2022-04-14 19:22:38 +02:00
scorbett123
2cf973809a eta command should default to NaN not just not showing the eta as suggested by ZacSharp 2022-04-12 12:15:42 +01:00
scorbett123
65974e15ba Improve output to user in eta command 2022-04-11 18:36:48 +01:00
ZacSharp
e885d2c221 Merge branch '1.15.2' into 1.16.5 2022-04-11 18:26:03 +02:00
ZacSharp
fe61a404d6 Merge branch '1.14.4' into 1.15.2 2022-04-11 18:03:10 +02:00
ZacSharp
97ac4bbd4f Merge branch '1.13.2' into 1.14.4 2022-04-11 18:00:00 +02:00
ZacSharp
dd29b72295 Merge branch 'master' into 1.13.2 2022-04-11 17:49:10 +02:00
Leijurv
23fa65cee0 Merge pull request #3372 from ZacSharp/patch-6
Fix dynamic mixin dependency to 0.8.3
2022-04-05 14:39:36 -07:00
Wagyourtail
af646bd313 yeet change I forgot to yeet 2 commits ago 2022-04-04 20:45:17 -07:00
Wagyourtail
c3c88c50d1 jitpack.yml 2022-04-04 20:11:15 -07:00
Wagyourtail
16f93ce769 explicitly include mixin "properly", mavenpublish should work now 2022-04-04 20:10:25 -07:00
Wagyourtail
3cee66229a proper mappings per proguard run 2022-04-04 19:15:21 -07:00
Wagyourtail
88c00f2fec java 17 is lts, so use java 17 2022-04-04 18:53:29 -07:00
Wagyourtail
394b4fd5b8 proguard builds now 2022-04-04 18:38:23 -07:00
Wagyourtail
48b34bfbb8 some jank to sourcesets to get dev launching 2022-04-04 18:11:03 -07:00
wagyourtail
4b2d1fe6b0 fix an oopsie in chunk caches with dynamic world height 2022-04-04 14:18:25 -07:00
Wagyourtail
01c75db38a rework buildscript (part 1) 2022-04-02 21:36:18 -07:00
ZacSharp
adc88d1fb9 Fix dynamic mixin dependency to 0.8.3
Newer Mixin versions use a class file format Proguard can't handle.
2022-04-02 23:44:29 +02:00
ZacSharp
2908c7499c Fix syntax
That's why you shouldn't make changes on Github
2022-04-01 00:33:27 +02:00
ZacSharp
ef4c2bbc98 Remove false information from #help mine
Baritone no longer caches ores on Minecraft 1.13+
Metadata values were removed in Minecraft 1.13
lit_redstone_ore was merged into redstone_ore in Minecraft 1.13
2022-03-31 23:53:58 +02:00
Leijurv
dc6b32a154 Merge pull request #3356 from wagyourtail/forceAllowBreak
add `allowBreakAnyway` setting
2022-03-31 14:08:13 -07:00
Leijurv
76f593e4bb Merge pull request #3342 from PhlegethonAcheron/master
Added usage syntax to the documentation for buildValidSubstitutes and buildSubstitutes
2022-03-31 14:07:42 -07:00
Leijurv
15b991a48e Merge pull request #3309 from wagyourtail/patch-2
fix inner class attribute being stripped
2022-03-31 14:01:45 -07:00
Leijurv
f3c93855bb Merge pull request #3363 from stackmagic/build-fix-1.17
Build fix 1.17
2022-03-31 14:01:26 -07:00
Leijurv
f033230548 Merge pull request #3360 from ZacSharp/1.16.5-update
Merge master into 1.16.5
2022-03-31 13:59:48 -07:00
Leijurv
702d0790bc Merge pull request #3327 from scorbett123/fix-chunk-saving-crash
If context.player() returns none we don't want to use its position for pruning.
2022-03-31 13:58:11 -07:00
Patrick Huber
599aa42cd8 Build: set rootProject.name again (already present up until 1.16 and went missing afterwards) 2022-03-26 18:59:13 +01:00
Patrick Huber
95afaf3eac Build: print more details on error 2022-03-26 18:49:06 +01:00
Wagyourtail
2953e2c522 make codacy happy 2022-03-24 18:16:19 -07:00
Wagyourtail
bf450b7d68 rename to allowBreakAnyway 2022-03-24 17:34:31 -07:00
Wagyourtail
4e6b6d97ce add forceAllowBreak setting 2022-03-24 17:33:33 -07:00
ZacSharp
17b2245033 Merge branch '1.15.2' into 1.16.5 2022-03-24 18:27:50 +01:00
ZacSharp
7b7c49d7ad Merge branch '1.14.4' into 1.15.2 2022-03-22 22:16:06 +01:00
ZacSharp
1522d11df0 Merge branch '1.13.2' into 1.14.4 2022-03-21 23:15:22 +01:00
ZacSharp
7eecf69178 Merge branch 'master' into 1.13.2 2022-03-21 17:57:39 +01:00
PhlegethonAcheron
6aadd00e72 Added usage syntax to the documentation for buildValidSubstitutes and buildSubstitutes 2022-03-20 15:41:25 -04:00
scorbett123
e036f5360c If context.player() returns none we don't want to use its position for pruning. 2022-03-16 20:12:56 +00:00
Leijurv
384dfb5f46 Merge pull request #3325 from wagyourtail/1.17.1
move death event to work with `doImmediateRespawn` gamerule
2022-03-15 19:07:11 -07:00
Leijurv
8c2aae2ddc Merge pull request #3324 from wagyourtail/master
reimplement death and bed waypoints
2022-03-15 19:06:50 -07:00
Wagyourtail
89bd2a4a07 move death event to work with doImmediateRespawn gamerule 2022-03-15 18:44:39 -07:00
Wagyourtail
511941c714 reimplement death and bed waypoints 2022-03-15 18:39:19 -07:00
wagyourtail
e58220e2c4 fix inner class attribute being stripped 2022-03-08 19:45:05 -07:00
Leijurv
477e3a706b Merge pull request #3308 from wagyourtail/1.17.1
fix `<parameter1> is null`
2022-03-08 17:01:51 -08:00
Wagyourtail
9ba8949a2e fix <parameter1> is null (and sneak in some other changes) 2022-03-08 17:28:56 -07:00
Wagyourtail
9b7d3af03d remove duplicate 2022-03-08 17:28:56 -07:00
Leijurv
02711a73ed fix codacy 2022-03-08 15:14:00 -08:00
Leijurv
25d418e96b 1.15 is deprecated 2022-03-08 15:04:34 -08:00
Leijurv
10430f8142 bump to 1.18.2 2022-03-08 15:01:48 -08:00
Leijurv
8aba97b577 update for 1.8.3 2022-03-08 15:00:14 -08:00
Leijurv
8a0771e5f4 v1.8.3 2022-03-08 14:50:04 -08:00
Leijurv
9c6c977314 Merge pull request #3292 from wagyourtail/1.18.2
1.18.2
2022-03-08 14:47:42 -08:00
Leijurv
8fe5b2369a Merge pull request #3301 from wagyourtail/toolmaterial-fix
fix modded toolmaterials (1.12.2)
2022-03-08 14:45:45 -08:00
Wagyourtail
dc6c87b58d fix modded toolmaterials 2022-03-07 15:53:13 -07:00
ZacSharp
ef4e19002b Provide more information for #find
Always log something to chat so people don't think it's broken and make sure they know about the restriction to cached blocks.
2022-03-05 22:27:27 +01:00
ZacSharp
e6ee5fc6b8 Make positions from #find clickable 2022-03-05 21:42:27 +01:00
Wagyourtail
38c5388e00 forge updated (finally) 2022-03-01 16:36:09 -07:00
Wagyourtail
519a76a171 fix for 1.18.2 2022-02-28 15:29:37 -07:00
Leijurv
eefc98a68e Merge pull request #3269 from wagyourtail/1.17.1
fix amethyst bud stuck
2022-02-14 14:38:07 -08:00
Wagyourtail
d0dc8cf726 fix amethyst bud stuck 2022-02-14 15:35:34 -07:00
Leijurv
b19c935da1 Merge pull request #3256 from ehylo/master
Update Setup and Usage guides
2022-02-09 16:35:54 -08:00
ehylo
0ade37f14f Update Setup and Usage guides
Also fix 2 settings that just don't have a description for some reason, and add some information to the find command because that also for some reason did not have anything there. The descriptions I put may not be detailed enough so please let me know if things should change
2022-02-08 21:13:51 -08:00
Leijurv
91be4c4643 Merge pull request #3093 from ZacSharp/fixBlockOptionalMetaObfuscation
Fix chat error messages being obfuscated for block type arguments
2022-02-08 10:52:25 -08:00
Leijurv
d2b62e2d21 Merge pull request #3239 from scorbett123/world_border_checks
Add some world border checks
2022-02-08 10:49:00 -08:00
Leijurv
267961434c Merge pull request #3254 from wagyourtail/1.17.1
fix an array oob with dynamic worldheight
2022-02-08 10:46:01 -08:00
Leijurv
0bfe98d306 Merge pull request #3255 from wagyourtail/replaymod-newfix
replaymod replay crash fix 1.17+
2022-02-08 10:45:39 -08:00
Wagyourtail
bfa644e7a7 oops 2022-02-08 11:41:45 -07:00
Wagyourtail
0ef1558803 fix this in a "better" way 2022-02-08 02:09:29 -07:00
Wagyourtail
9dad1af960 move up null check to fix new data-driven caused crash with replaymod 2022-02-08 01:57:56 -07:00
Wagyourtail
407f4dbbae fix an array oob with dynamic worldheight 2022-02-08 01:36:32 -07:00
Leijurv
7052fe6225 put this on its own line 2022-02-07 22:03:31 -08:00
scorbett123
49357790f1 fix world border checks
Signed-off-by: scorbett123 <50634068+scorbett123@users.noreply.github.com>
2022-02-03 08:06:01 +00:00
Leijurv
694219e497 Merge pull request #3243 from wagyourtail/master
fix getting stuck on cauldrons (fixes #3099)
2022-02-02 21:10:47 -08:00
Leijurv
af240d38e0 Merge pull request #3242 from wagyourtail/1.17.1
fix getting stuck in powdered snow
2022-02-02 21:10:14 -08:00
Wagyourtail
9b70ace180 fix getting stuck on cauldrons (fixes #3099) 2022-02-02 22:04:15 -07:00
Wagyourtail
a3dbec62dc fix getting stuck in powdered snow 2022-02-02 21:47:45 -07:00
Leijurv
e0a53144db bump most recent jars 2022-02-02 16:10:14 -08:00
Leijurv
fe26168a07 v1.7.2 2022-02-02 15:54:39 -08:00
Leijurv
25de332492 mfw this also needs to be in master 2022-02-02 15:53:43 -08:00
Leijurv
2d0f10c79f link to branches 2022-02-02 15:53:24 -08:00
scorbett123
74ea803651 Add world border checks to MovementHelper 2022-02-02 20:36:36 +00:00
ZacSharp
21534d1c0b Fix chat error messages being obfuscated for block type arguments 2021-11-18 00:21:12 +01:00
ZacSharp
bb91dc98de Merge branch 'master' into 1.13.2 2021-10-20 03:20:41 +02:00
116 changed files with 2817 additions and 754 deletions

View File

@@ -13,33 +13,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build -Pmod_version="$(git describe --always --tags | cut -c2-)"
- name: Build (fabric) with Gradle
run: ./gradlew build -Pbaritone.fabric_build
- name: Build (forge) with Gradle
run: ./gradlew build -Pbaritone.forge_build -Ploom.platform=forge
- name: Archive Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: dist/
- name: Archive mapping.txt
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Mappings
path: build/tmp/proguard/mapping.txt
path: mapping/

View File

@@ -11,16 +11,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Executing tests
run: ./gradlew test

6
.gitignore vendored
View File

@@ -21,6 +21,9 @@ classes/
*.iws
/logs/
tweaker/logs/
common/logs/
# Eclipse Files
.classpath
.project
@@ -32,3 +35,6 @@ baritone_Client.launch
!/.idea/copyright/profiles_settings.xml
.vscode/launch.json
.architectury-transformer
mapping

View File

@@ -13,5 +13,3 @@ COPY . /code
WORKDIR /code
RUN ./gradlew build
RUN ./gradlew build -Pbaritone.forge_build -Ploom.platform=forge
RUN ./gradlew build -Pbaritone.fabric_build

View File

@@ -4,20 +4,20 @@
</p>
<p align="center">
<img src="https://img.shields.io/badge/MC-1.12.2-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.13.2-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.14.4-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.15.2-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.16.5-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.17.1-brightgreen.svg" alt="Minecraft"/>
<img src="https://img.shields.io/badge/MC-1.18.1-brightgreen.svg" alt="Minecraft"/>
<a href="https://github.com/cabaletta/baritone/tree/master"><img src="https://img.shields.io/badge/MC-1.12.2-brightgreen.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.13.2"><img src="https://img.shields.io/badge/MC-1.13.2-yellow.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.14.4"><img src="https://img.shields.io/badge/MC-1.14.4-yellow.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.15.2"><img src="https://img.shields.io/badge/MC-1.15.2-yellow.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.16.5"><img src="https://img.shields.io/badge/MC-1.16.5-brightgreen.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.17.1"><img src="https://img.shields.io/badge/MC-1.17.1-brightgreen.svg" alt="Minecraft"/></a>
<a href="https://github.com/cabaletta/baritone/tree/1.18.2"><img src="https://img.shields.io/badge/MC-1.18.2-brightgreen.svg" alt="Minecraft"/></a>
</p>
<p align="center">
<a href="https://travis-ci.com/cabaletta/baritone/"><img src="https://travis-ci.com/cabaletta/baritone.svg?branch=master" alt="Build Status"/></a>
<a href="https://github.com/cabaletta/baritone/releases/"><img src="https://img.shields.io/github/release/cabaletta/baritone.svg" alt="Release"/></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-LGPL--3.0%20with%20anime%20exception-green.svg" alt="License"/></a>
<a href="https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cabaletta/baritone&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/a73d037823b64a5faf597a18d71e3400" alt="Codacy Badge"/></a>
<a href="https://www.codacy.com/gh/cabaletta/baritone/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cabaletta/baritone&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/cadab857dab049438b6e28b3cfc5570e" alt="Codacy Badge"/></a>
<a href="https://github.com/cabaletta/baritone/blob/master/CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat" alt="Code of Conduct"/></a>
<a href="https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle"><img src="https://snyk.io/test/github/cabaletta/baritone/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities"/></a>
<a href="https://github.com/cabaletta/baritone/issues/"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions welcome"/></a>
@@ -50,17 +50,19 @@ A Minecraft pathfinder bot.
[**Baritone Discord Server**](http://discord.gg/s6fRBAUpmr)
Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. [Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa)
Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do.
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.15/baritone-api-forge-1.2.15.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
[Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa)
For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar.
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to
install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click
[here](https://github.com/cabaletta/baritone/releases/download/v1.2.17/baritone-api-forge-1.2.17.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge or Fabric 1.16.5, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.3) and get the `api-forge` or `api-fabric` jar. **For 1.16.5 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.6.3/baritone-api-fabric-1.6.3.jar)**.
If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.1) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.1/baritone-api-fabric-1.7.1.jar)**.
If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.2) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.2/baritone-api-fabric-1.7.2.jar)**.
If you need Forge or Fabric 1.18.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.1) and get the `api-forge` or `api-fabric` jar. **For 1.18.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.1/baritone-api-fabric-1.8.1.jar)**.
If you need Forge or Fabric 1.18.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.3) and get the `api-forge` or `api-fabric` jar. **For 1.18.2 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.3/baritone-api-fabric-1.8.3.jar)**. **For 1.18.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.3/baritone-api-forge-1.8.3.jar)**.
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).
@@ -95,7 +97,7 @@ jar.
Below is an example of basic usage for changing some settings, and then pathing to an X/Z goal.
```
```java
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;

View File

@@ -11,7 +11,7 @@ These releases are not always completely up to date with latest features, and ar
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.2 or 1.16.4 or 1.16.5 (LOL)
v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.5, v1.7.* is for 1.17.1, v1.8.* is for 1.18.1
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`.
@@ -22,15 +22,16 @@ The build is fully deterministic and reproducible, and you can verify Travis did
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
**The Forge release can simply be added as a Forge mod.**
**The Forge and Fabric releases can simply be added as a Forge/Fabric mods.**
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration.
- **Forge/Fabric API**: Same as API, but packaged for Forge/Fabric. This should be used where another mod has a Baritone integration.
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
- **Forge Standalone**: Same as Standalone, but packaged for Forge. This should be used when Baritone is your only Forge mod, or none of your other Forge mods integrate with Baritone.
- **Forge/Fabric Standalone**: Same as Standalone, but packaged for Forge/Fabric. This should be used when Baritone is your only Forge/Fabric mod, or none of your other Forge/Fabric mods integrate with Baritone.
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
- **Forge/Fabric Unoptimized**: Same as Unoptimized, but packaged for Forge/Fabric.
## Build it yourself
- Clone or download Baritone
@@ -42,13 +43,13 @@ If another one of your Forge mods has a Baritone integration, you want `baritone
## Command Line
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8.
If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8 for 1.12.2-1.16.5, JDK 16 for 1.17.1, and JDK 17 for 1.18.1.
To check which java you are using do
`java -version` in a command prompt or terminal.
If you are using anything above OpenJDK 8, it might not work because the Java distributions above JDK 8 using may not have the needed javax classes.
If you are using anything above OpenJDK 8 for 1.12.2-1.16.5, it might not work because the Java distributions above JDK 8 using may not have the needed javax classes.
Open JDK 8 download: https://openjdk.java.net/install/
Open JDK download: https://openjdk.java.net/install/
#### macOS guide
In order to get JDK 8, Try running the following command:
`% /usr/libexec/java_home -V`
@@ -84,6 +85,12 @@ For minecraft 1.15.2+, run the following instead to include the Forge jars:
$ gradlew build -Pbaritone.forge_build
```
Do this instead for Fabric jars:
```
$ gradlew build -Pbaritone.fabric_build
```
Running Baritone:
```

View File

@@ -32,13 +32,13 @@ Watch this [showcase video](https://youtu.be/CZkLXWo4Fg4)!
To toggle a boolean setting, just say its name in chat (for example saying `allowBreak` toggles whether Baritone will consider breaking blocks). For a numeric setting, say its name then the new value (like `primaryTimeoutMS 250`). It's case insensitive. To reset a setting to its default value, say `acceptableThrowawayItems reset`. To reset all settings, say `reset`. To see all settings that have been modified from their default values, say `modified`.
Some common examples:
Commands in Baritone:
- `thisway 1000` then `path` to go in the direction you're facing for a thousand blocks
- `goal x y z` or `goal x z` or `goal y`, then `path` to set a goal to a certain coordinate then path to it
- `goto x y z` or `goto x z` or `goto y` to go to a certain coordinate (in a single step, starts going immediately)
- `goal` to set the goal to your player's feet
- `goal clear` to clear the goal
- `cancel` or `stop` to stop everything
- `cancel` or `stop` to stop everything, `forcecancel` is also an option
- `goto portal` or `goto ender_chest` or `goto block_type` to go to a block. (in Impact, `.goto` is an alias for `.b goto` for the most part)
- `mine diamond_ore iron_ore` to mine diamond ore or iron ore (turn on the setting `legitMine` to only mine ores that it can actually see. It will explore randomly around y=11 until it finds them.) An amount of blocks can also be specified, for example, `mine 64 diamond_ore`.
- `click` to click your destination on the screen. Right click path to on top of the block, left click to path into it (either at foot level or eye level), and left click and drag to select an area (`#help sel` to see what you can do with that selection).
@@ -51,11 +51,19 @@ Some common examples:
- `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120).
- `explore x z` to explore the world from the origin of x,z. Leave out x and z to default to player feet. This will continually path towards the closest chunk to the origin that it's never seen before. `explorefilter filter.json` with optional invert can be used to load in a list of chunks to load.
- `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start.
- `come` tells Baritone to head towards your camera, useful when freecam doesn't move your player position.
- `blacklist` will stop baritone from going to the closest block so it won't attempt to get to it.
- `eta` to get information about the estimated time until the next segment and the goal, be aware that the ETA to your goal is really unprecise.
- `proc` to view miscellaneous information about the process currently controlling Baritone.
- `repack` to re-cache the chunks around you.
- `gc` to call `System.gc()` which may free up some memory.
- `render` to fix glitched chunk rendering without having to reload all of them.
- `reloadall` to reload Baritone's world cache or `saveall` to save Baritone's world cache.
- `find` to search through Baritone's cache and attempt to find the location of the block.
- `surface` or `top` to tell Baritone to head towards the closest surface-like area, this can be the surface or highest available air space.
- `version` to get the version of Baritone you're running
- `damn` daniel
For the rest of the commands, you can take a look at the code [here](https://baritone.leijurv.com/baritone/api/Settings.html).
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>. If you find HTML easier to read than Javadoc, you can look <a href="https://baritone.leijurv.com/baritone/api/Settings.html#field.detail">here</a>.
There are about a hundred settings, but here are some fun / interesting / important ones that you might want to look at changing in normal usage of Baritone. The documentation for each can be found at the above links.

View File

@@ -15,34 +15,89 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
plugins {
id 'java'
id 'dev.architectury.loom' version '0.10.0-SNAPSHOT'
id 'maven-publish'
allprojects {
apply plugin: 'java'
apply plugin: "xyz.wagyourtail.unimined"
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
def vers = 'git describe --always --tags --dirty'.execute().text.trim()
if (!vers.startsWith("v")) {
println "git doesn't appear to be installed!"
println "using version number: " + rootProject.mod_version
version = rootProject.mod_version
} else {
version = vers.substring(1)
}
group = rootProject.maven_group
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
repositories {
maven {
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'fabric-maven'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
name = "ldtteam"
url = "https://maven.parchmentmc.net/"
}
// for the newer version of launchwrapper
maven {
name = "multimc-maven"
url = "https://files.multimc.org/maven/"
metadataSources {
artifact()
}
}
mavenCentral()
}
dependencies {
minecraft "net.minecraft:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings "net.fabricmc:intermediary:${rootProject.minecraft_version}:v2"
mappings "net.minecraft:minecraft:${rootProject.minecraft_version}:client-mappings"
mappings "org.parchmentmc.data:parchment-1.19.2:2022.11.27@zip"
implementation "org.spongepowered:mixin:0.8.5"
implementation "org.ow2.asm:asm:9.3"
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:1.17.1+build.32:v2"
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
def targetVersion = 17
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
}
}
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
def compileType = project.hasProperty("baritone.fabric_build") ? "FABRIC" : project.hasProperty("baritone.forge_build") ? "FORGE" : "OFFICIAL"
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
compileJava {
options.encoding = "UTF-8" // allow emoji in comments :^)
minecraft {
runs.off = true
}
archivesBaseName = archivesBaseName + "-common"
sourceSets {
api {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
main {
compileClasspath += api.output
runtimeClasspath += api.output
}
test {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
@@ -54,63 +109,25 @@ sourceSets {
}
schematica_api {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
main {
compileClasspath += schematica_api.output
runtimeClasspath += schematica_api.output
}
}
loom {
if (compileType.equals("FORGE")) {
forge {
mixinConfig 'mixins.baritone.json'
}
}
mixin.defaultRefmapName = "mixins.baritone.refmap.json"
runs {
client {
source = sourceSets.launch
}
}
}
repositories {
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
name = "ldtteam"
url = "https://maven.parchmentmc.net/"
}
mavenCentral()
}
dependencies {
if (compileType.equals("FORGE")) {
forge "net.minecraftforge:forge:${project.forge_version}"
}
mappings loom.layered() {
officialMojangMappings()
//technically optional, but really helpful in dev:
// parchment("org.parchmentmc.data:parchment-1.17.1:2021.10.24@zip" as String)
}
minecraft "com.mojang:minecraft:${project.minecraft_version}"
if (!compileType.equals("FORGE")) {
modImplementation "net.fabricmc:fabric-loader:${project.fabric_version}"
}
// this makes it compile with the forge tweak stuff
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
implementation('net.minecraft:launchwrapper:1.12') {
exclude module: 'lwjgl'
exclude module: 'asm-debug-all'
}
testImplementation 'junit:junit:4.13.2'
}
implementation 'com.google.code.findbugs:jsr305:3.0.2'
jar {
from sourceSets.main.output, sourceSets.launch.output, sourceSets.api.output
}
testImplementation 'junit:junit:4.12'
remapJar {
targetNamespace = "named"
fallbackTargetNamespace = "intermediary"
}
javadoc {
@@ -119,72 +136,4 @@ javadoc {
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}
// skidded from fabric-example-mod (comments and all)
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 16
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = targetVersion
}
}
jar {
from sourceSets.launch.output, sourceSets.api.output
if (!getProject().hasProperty("baritone.forge_build")) {
exclude "**/BaritoneForgeModXD.class"
exclude "**/mods.toml"
}
preserveFileTimestamps = false
reproducibleFileOrder = true
if (getProject().hasProperty("baritone.fabric_build")) {
filesMatching("fabric.mod.json") {
expand "version": version
}
} else {
exclude("fabric.mod.json")
}
manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json',
"MixinConnector": "baritone.launch.BaritoneMixinConnector",
'Implementation-Title': 'Baritone',
'Implementation-Version': version,
)
}
}
if (compileType.equals("OFFICIAL")) {
remapJar {
toM.set "official"
}
}
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.0-beta2/proguard-7.2.0-beta2.zip'
extract 'proguard-7.2.0-beta2/lib/proguard.jar'
compType compileType
}
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
}

View File

@@ -16,10 +16,25 @@
*/
repositories {
mavenLocal()
maven {
name = 'WagYourMaven'
url = 'https://maven.wagyourtail.xyz/releases'
}
maven {
name = 'ForgeMaven'
url = 'https://maven.minecraftforge.net/'
}
maven {
name = 'FabricMaven'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
}
dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.3.4'
}

View File

@@ -18,6 +18,9 @@
package baritone.gradle.task;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.IOException;
@@ -40,50 +43,56 @@ class BaritoneGradleTask extends DefaultTask {
PROGUARD_API_CONFIG = "api.pro",
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
PROGUARD_EXPORT_PATH = "proguard_out.jar",
PROGUARD_MAPPING_DIR = "mapping",
ARTIFACT_STANDARD = "%s-%s.jar",
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
ARTIFACT_API = "%s-api-%s.jar",
ARTIFACT_STANDALONE = "%s-standalone-%s.jar",
ARTIFACT_FORGE_UNOPTIMIZED = "%s-unoptimized-forge-%s.jar",
ARTIFACT_FORGE_API = "%s-api-forge-%s.jar",
ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar",
ARTIFACT_FABRIC_UNOPTIMIZED = "%s-unoptimized-fabric-%s.jar",
ARTIFACT_FABRIC_API = "%s-api-fabric-%s.jar",
ARTIFACT_FABRIC_STANDALONE = "%s-standalone-fabric-%s.jar";
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
protected String artifactName, artifactVersion;
protected final Path
protected Path
artifactPath,
artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, // these are different for forge builds
proguardOut;
@Input
@Optional
protected String compType = null;
public String getCompType() {
return compType;
}
public void setCompType(String compType) {
this.compType = compType;
}
public BaritoneGradleTask() {
this.artifactName = getProject().getName();
this.artifactVersion = getProject().getVersion().toString();
this.artifactName = getProject().getRootProject().getProperties().get("archives_base_name").toString();
}
public void doFirst() {
if (compType != null) {
this.artifactVersion = compType + "-" + getProject().getVersion();
} else {
this.artifactVersion = getProject().getVersion().toString();
}
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
if (getProject().hasProperty("baritone.forge_build")) {
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_UNOPTIMIZED));
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_API));
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_STANDALONE));
} else if (getProject().hasProperty("baritone.fabric_build")) {
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_UNOPTIMIZED));
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_API));
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FABRIC_STANDALONE));
} else {
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
}
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
}
protected void verifyArtifacts() throws IllegalStateException {
if (!Files.exists(this.artifactPath)) {
throw new IllegalStateException("Artifact not found! Run build first!");
throw new IllegalStateException("Artifact not found! Run build first! Missing file: " + this.artifactPath);
}
}
@@ -99,7 +108,11 @@ class BaritoneGradleTask extends DefaultTask {
}
protected Path getRelativeFile(String file) {
return Paths.get(new File(new File(getProject().getBuildDir(), "../"), file).getAbsolutePath());
return Paths.get(new File(getProject().getBuildDir(), file).getAbsolutePath());
}
protected Path getRootRelativeFile(String file) {
return Paths.get(new File(getProject().getRootDir(), file).getAbsolutePath());
}
protected Path getTemporaryFile(String file) {
@@ -107,6 +120,10 @@ class BaritoneGradleTask extends DefaultTask {
}
protected Path getBuildFile(String file) {
return getRelativeFile("build/libs/" + file);
return getRelativeFile("libs/" + file);
}
protected String addCompTypeFirst(String string) {
return compType == null ? string : compType + "-" + string;
}
}

View File

@@ -21,7 +21,9 @@ import org.gradle.api.tasks.TaskAction;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.List;
@@ -39,15 +41,16 @@ public class CreateDistTask extends BaritoneGradleTask {
@TaskAction
protected void exec() throws Exception {
super.doFirst();
super.verifyArtifacts();
// Define the distribution file paths
Path api = getRelativeFile("dist/" + getFileName(artifactApiPath));
Path standalone = getRelativeFile("dist/" + getFileName(artifactStandalonePath));
Path unoptimized = getRelativeFile("dist/" + getFileName(artifactUnoptimizedPath));
Path api = getRootRelativeFile("dist/" + getFileName(artifactApiPath));
Path standalone = getRootRelativeFile("dist/" + getFileName(artifactStandalonePath));
Path unoptimized = getRootRelativeFile("dist/" + getFileName(artifactUnoptimizedPath));
// NIO will not automatically create directories
Path dir = getRelativeFile("dist/");
Path dir = getRootRelativeFile("dist/");
if (!Files.exists(dir)) {
Files.createDirectory(dir);
}
@@ -59,35 +62,21 @@ public class CreateDistTask extends BaritoneGradleTask {
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
// Calculate all checksums and format them like "shasum"
List<String> shasum = getAllDistJars().stream()
.filter(Files::exists)
List<String> shasum = Files.list(getRootRelativeFile("dist/"))
.filter(e -> e.getFileName().toString().endsWith(".jar"))
.map(path -> sha1(path) + " " + path.getFileName().toString())
.collect(Collectors.toList());
shasum.forEach(System.out::println);
// Write the checksums to a file
Files.write(getRelativeFile("dist/checksums.txt"), shasum);
Files.write(getRootRelativeFile("dist/checksums.txt"), shasum);
}
private static String getFileName(Path p) {
return p.getFileName().toString();
}
private List<Path> getAllDistJars() {
return Arrays.asList(
getRelativeFile("dist/" + formatVersion(ARTIFACT_API)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_API)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_API)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_STANDALONE)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FABRIC_UNOPTIMIZED)),
getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_UNOPTIMIZED))
);
}
private static synchronized String sha1(Path path) {
try {
if (SHA1_DIGEST == null) {

View File

@@ -26,8 +26,12 @@ import org.gradle.api.tasks.TaskCollection;
import org.gradle.api.tasks.compile.ForkOptions;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.internal.jvm.Jvm;
import xyz.wagyourtail.unimined.api.Constants;
import xyz.wagyourtail.unimined.api.minecraft.EnvType;
import xyz.wagyourtail.unimined.api.minecraft.MinecraftProvider;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -59,22 +63,11 @@ public class ProguardTask extends BaritoneGradleTask {
return extract;
}
@Input
private String compType;
public String getCompType() {
return compType;
}
private final File copyMcTargetDir = new File("./build/createMcIntermediaryJar").getAbsoluteFile();
private final File copyMcTargetJar = new File(copyMcTargetDir, "client.jar");
@TaskAction
protected void exec() throws Exception {
super.doFirst();
super.verifyArtifacts();
copyMcJar();
// "Haha brady why don't you make separate tasks"
processArtifact();
downloadProguard();
@@ -85,30 +78,14 @@ public class ProguardTask extends BaritoneGradleTask {
cleanup();
}
private boolean isMcJar(File f) {
return f.getName().startsWith(compType.equals("FORGE") ? "forge-" : "minecraft-") && f.getName().contains("minecraft-mapped");
MinecraftProvider<?, ?> provider = this.getProject().getExtensions().getByType(MinecraftProvider.class);
private File getMcJar() {
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdFallbackNamespace()).toFile();
}
private void copyMcJar() throws IOException {
File mcClientJar = this.getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles()
.stream()
.filter(this::isMcJar)
.map(f -> {
switch (compType) {
case "OFFICIAL":
return new File(f.getParentFile().getParentFile(), "minecraft-merged.jar");
case "FABRIC":
return new File(f.getParentFile(), "minecraft-intermediary.jar");
case "FORGE":
return new File(f.getParentFile(), "minecraft-srg.jar");
}
return null;
})
.findFirst()
.get();
if (!mcClientJar.exists()) throw new IOException("Failed to find minecraft! " + mcClientJar.getAbsolutePath());
if (!copyMcTargetDir.exists() && !copyMcTargetDir.mkdirs()) throw new IOException("Failed to create target for copyMcJar");
Files.copy(mcClientJar.toPath(), copyMcTargetJar.toPath(), REPLACE_EXISTING);
private boolean isMcJar(File f) {
return this.getProject().getConfigurations().getByName(Constants.MINECRAFT_COMBINED_PROVIDER).getFiles().contains(f);
}
private void processArtifact() throws Exception {
@@ -233,18 +210,26 @@ public class ProguardTask extends BaritoneGradleTask {
}
private void generateConfigs() throws Exception {
Files.copy(getRelativeFile(PROGUARD_CONFIG_TEMPLATE), getTemporaryFile(PROGUARD_CONFIG_DEST), REPLACE_EXISTING);
Files.copy(getRootRelativeFile(PROGUARD_CONFIG_TEMPLATE), getTemporaryFile(PROGUARD_CONFIG_DEST), REPLACE_EXISTING);
// Setup the template that will be used to derive the API and Standalone configs
List<String> template = Files.readAllLines(getTemporaryFile(PROGUARD_CONFIG_DEST));
template.add(0, "-injars " + this.artifactPath.toString());
template.add(1, "-outjars " + this.getTemporaryFile(PROGUARD_EXPORT_PATH));
template.add(0, "-injars '" + this.artifactPath.toString() + "'");
template.add(1, "-outjars '" + this.getTemporaryFile(PROGUARD_EXPORT_PATH) + "'");
template.add(2, "-libraryjars <java.home>/jmods/java.base.jmod(!**.jar;!module-info.class)");
template.add(3, "-libraryjars <java.home>/jmods/java.desktop.jmod(!**.jar;!module-info.class)");
template.add(4, "-libraryjars <java.home>/jmods/jdk.unsupported.jmod(!**.jar;!module-info.class)");
{
final Stream<File> libraries;
File mcJar;
try {
mcJar = getMcJar();
} catch (Exception e) {
throw new RuntimeException("Failed to find Minecraft jar", e);
}
{
// Discover all of the libraries that we will need to acquire from gradle
final Stream<File> dependencies = acquireDependencies()
@@ -252,39 +237,41 @@ public class ProguardTask extends BaritoneGradleTask {
.filter(f -> !f.toString().endsWith("-recomp.jar") && !f.getName().startsWith("nashorn") && !f.getName().startsWith("coremods"));
libraries = dependencies
.map(f -> isMcJar(f) ? copyMcTargetJar : f);
.map(f -> isMcJar(f) ? mcJar : f);
}
libraries.forEach(f -> {
template.add(2, "-libraryjars '" + f + "'");
});
}
Files.createDirectories(this.getRootRelativeFile(PROGUARD_MAPPING_DIR));
List<String> api = new ArrayList<>(template);
api.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + addCompTypeFirst("api.txt")));
// API config doesn't require any changes from the changes that we made to the template
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
Files.write(getTemporaryFile(compType+PROGUARD_API_CONFIG), api);
// For the Standalone config, don't keep the API package
List<String> standalone = new ArrayList<>(template);
standalone.removeIf(s -> s.contains("# this is the keep api"));
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
}
private File getSrgMcJar() {
return getProject().getTasks().findByName("copyMcJar").getOutputs().getFiles().getSingleFile();
standalone.add(2, "-printmapping " + new File(this.getRootRelativeFile(PROGUARD_MAPPING_DIR).toFile(), "mappings-" + addCompTypeFirst("standalone.txt")));
Files.write(getTemporaryFile(compType+PROGUARD_STANDALONE_CONFIG), standalone);
}
private Stream<File> acquireDependencies() {
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles()
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("main").getCompileClasspath().getFiles()
.stream()
.filter(File::isFile);
}
private void proguardApi() throws Exception {
runProguard(getTemporaryFile(PROGUARD_API_CONFIG));
runProguard(getTemporaryFile(compType+PROGUARD_API_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString());
}
private void proguardStandalone() throws Exception {
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
runProguard(getTemporaryFile(compType+PROGUARD_STANDALONE_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString());
}
@@ -301,20 +288,21 @@ public class ProguardTask extends BaritoneGradleTask {
public void setExtract(String extract) {
this.extract = extract;
}
public void setCompType(String compType) {
this.compType = compType;
}
private void runProguard(Path config) throws Exception {
// Delete the existing proguard output file. Proguard probably handles this already, but why not do it ourselves
if (Files.exists(this.proguardOut)) {
Files.delete(this.proguardOut);
}
Path proguardJar = getTemporaryFile(PROGUARD_JAR);
// Make paths relative to work directory; fixes spaces in path to config, @"" doesn't work
Path workingDirectory = getTemporaryFile("");
Path proguardJar = workingDirectory.relativize(getTemporaryFile(PROGUARD_JAR));
config = workingDirectory.relativize(config);
// Honestly, if you still have spaces in your path at this point, you're SOL.
Process p = new ProcessBuilder("java", "-jar", proguardJar.toString(), "@" + config.toString())
.directory(getTemporaryFile("").toFile()) // Set the working directory to the temporary folder]
.directory(workingDirectory.toFile()) // Set the working directory to the temporary folder]
.start();
// We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this

103
fabric/build.gradle Normal file
View File

@@ -0,0 +1,103 @@
/*
* 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 "7.0.0"
}
archivesBaseName = archivesBaseName + "-fabric"
minecraft {
fabric()
}
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 {
fabric "net.fabricmc:fabric-loader:${project.fabric_version}"
// 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
}
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
task proguard(type: ProguardTask) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "fabric"
}
task createDist(type: CreateDistTask, dependsOn: proguard) {
compType "fabric"
}
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

@@ -21,11 +21,11 @@
"entrypoints": {
},
"mixins": [
"mixins.baritone.json"
"mixins.baritone.json"
],
"depends": {
"fabricloader": ">=0.11.0",
"minecraft": "1.18.x"
"minecraft": "1.19.4"
}
}
}

122
forge/build.gradle Normal file
View File

@@ -0,0 +1,122 @@
/*
* 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 "7.0.0"
}
archivesBaseName = archivesBaseName + "-forge"
minecraft {
forge {
devFallbackNamespace = "intermediary"
mixinConfig = ["mixins.baritone.json"]
}
}
//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 {
forge "net.minecraftforge:forge:${rootProject.forge_version}"
// 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
}
}
processResources {
inputs.property "version", project.version
filesMatching("META-INF/mods.toml") {
expand "version": project.version
}
}
shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}
remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "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) {
url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip'
extract 'proguard-7.2.1/lib/proguard.jar'
compType "forge"
}
task createDist(type: CreateDistTask, dependsOn: proguard) {
compType "forge"
}
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.
}
}

18
forge/gradle.properties Normal file
View File

@@ -0,0 +1,18 @@
#
# 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

@@ -0,0 +1,22 @@
/*
* 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.minecraftforge.fml.common.Mod;
@Mod("baritoe")
public class BaritoneForgeModXD {
}

View File

@@ -15,7 +15,7 @@ issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional
# 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="${file.jarVersion}" #mandatory
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
@@ -31,3 +31,10 @@ description='''
A Minecraft pathfinder bot.
'''
[[dependencies.baritoe]]
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.19.4]"
ordering="NONE"
side="BOTH"

View File

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

View File

@@ -1,13 +1,9 @@
org.gradle.jvmargs=-Xmx2048M
org.gradle.jvmargs=-Xmx4G
mod_version=1.8.2
mod_version=1.9.3
maven_group=baritone
archives_base_name=baritone
minecraft_version=1.18
forge_version=1.18-38.0.10
fabric_version=0.12.5
# # un comment for forge debugging default (as opposed to fabric)
# baritone.forge_build=true
# loom.platform=forge
minecraft_version=1.19.4
forge_version=1.19.4-45.0.43
fabric_version=0.14.11

View File

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

4
jitpack.yml Normal file
View File

@@ -0,0 +1,4 @@
before_install:
- curl -s "https://get.sdkman.io" | bash
- sdk install java 17.0.5-tem
- sdk use java 17.0.5-tem

View File

@@ -1,5 +1,6 @@
-keepattributes Signature
-keepattributes *Annotation*
-keepattributes InnerClasses
-optimizationpasses 5
-verbose
@@ -27,6 +28,7 @@
-keep class baritone.api.IBaritoneProvider
-keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect
-keepname class baritone.api.utils.BlockOptionalMeta # this name is exposed to the user, so we need to keep it in all builds
# Keep any class or member annotated with @KeepName so we dont have to put everything in the script
-keep,allowobfuscation @interface baritone.KeepName
@@ -45,9 +47,10 @@
#try to keep usage of schematica in separate classes
-keep class baritone.utils.schematic.schematica.**
-keep class baritone.utils.schematic.litematica.**
#proguard doesnt like it when it cant find our fake schematica classes
-dontwarn baritone.utils.schematic.schematica.**
-dontwarn baritone.utils.schematic.litematica.**
# Keep - Applications. Keep all application classes, along with their 'main'
# methods.
@@ -336,6 +339,4 @@
public int length();
public java.lang.String substring(int);
public java.lang.String substring(int,int);
}
-printmapping mapping.txt
}

View File

@@ -17,24 +17,34 @@
pluginManagement {
repositories {
maven { url "https://maven.architectury.dev/" }
mavenLocal()
maven {
name = 'WagYourMaven'
url = 'https://maven.wagyourtail.xyz/snapshots'
}
maven {
name = 'ForgeMaven'
url = 'https://maven.minecraftforge.net/'
}
maven {
name = 'FabricMaven'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'forge'
url = 'https://files.minecraftforge.net/maven'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
maven {
url = 'https://www.dogforce-games.com/maven/'
}
maven {
url = 'https://libraries.minecraft.net/'
}
mavenCentral()
gradlePluginPortal() {
content {
excludeGroup "org.apache.logging.log4j"
}
}
}
}
}
rootProject.name = 'baritone'
include("tweaker")
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

@@ -23,9 +23,7 @@ import baritone.api.utils.TypeUtils;
import baritone.api.utils.gui.BaritoneToast;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Vec3i;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
@@ -35,8 +33,8 @@ import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
/**
* Baritone's settings. Settings apply to all Baritone instances.
@@ -50,6 +48,11 @@ public final class Settings {
*/
public final Setting<Boolean> allowBreak = new Setting<>(true);
/**
* Blocks that baritone will be allowed to break even with allowBreak set to false
*/
public final Setting<List<Block>> allowBreakAnyway = new Setting<>(new ArrayList<>());
/**
* Allow Baritone to sprint
*/
@@ -103,6 +106,13 @@ public final class Settings {
*/
public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D);
/**
* Don't allow breaking blocks next to liquids.
* <p>
* Enable if you have mods adding custom fluid physics.
*/
public final Setting<Boolean> strictLiquidCheck = new Setting<>(false);
/**
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
* Reliability: questionable.
@@ -112,6 +122,8 @@ public final class Settings {
/**
* Allow Baritone to assume it can walk on still water just like any other block.
* This functionality is assumed to be provided by a separate library that might have imported Baritone.
* <p>
* Note: This will prevent some usage of the frostwalker enchantment, like pillaring up from water.
*/
public final Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
@@ -192,7 +204,7 @@ public final class Settings {
* Blocks that Baritone is not allowed to break
*/
public final Setting<List<Block>> blocksToDisallowBreaking = new Setting<>(new ArrayList<>(
// Leave Empty by Default
// Leave Empty by Default
));
/**
@@ -232,6 +244,8 @@ public final class Settings {
* A mapping of blocks to blocks treated as correct in their position
* <p>
* If a schematic asks for a block on this mapping, all blocks on the mapped list will be accepted at that location as well
* <p>
* Syntax same as <a href="https://baritone.leijurv.com/baritone/api/Settings.html#buildSubstitutes">buildSubstitutes</a>
*/
public final Setting<Map<Block, List<Block>>> buildValidSubstitutes = new Setting<>(new HashMap<>());
@@ -239,6 +253,15 @@ public final class Settings {
* A mapping of blocks to blocks to be built instead
* <p>
* If a schematic asks for a block on this mapping, Baritone will place the first placeable block in the mapped list
* <p>
* Usage Syntax:
* <pre>
* sourceblockA->blockToSubstituteA1,blockToSubstituteA2,...blockToSubstituteAN,sourceBlockB->blockToSubstituteB1,blockToSubstituteB2,...blockToSubstituteBN,...sourceBlockX->blockToSubstituteX1,blockToSubstituteX2...blockToSubstituteXN
* </pre>
* Example:
* <pre>
* stone->cobblestone,andesite,oak_planks->birch_planks,acacia_planks,glass
* </pre>
*/
public final Setting<Map<Block, List<Block>>> buildSubstitutes = new Setting<>(new HashMap<>());
@@ -261,6 +284,12 @@ public final class Settings {
*/
public final Setting<Boolean> buildIgnoreDirection = new Setting<>(false);
/**
* A list of names of block properties the builder will ignore.
*/
public final Setting<List<String>> buildIgnoreProperties = new Setting<>(new ArrayList<>(Arrays.asList(
)));
/**
* If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block.
* <p>
@@ -388,6 +417,9 @@ public final class Settings {
*/
public final Setting<Double> mobSpawnerAvoidanceCoefficient = new Setting<>(2.0);
/**
* Distance to avoid mob spawners.
*/
public final Setting<Integer> mobSpawnerAvoidanceRadius = new Setting<>(16);
/**
@@ -397,6 +429,9 @@ public final class Settings {
*/
public final Setting<Double> mobAvoidanceCoefficient = new Setting<>(1.5);
/**
* Distance to avoid mobs.
*/
public final Setting<Integer> mobAvoidanceRadius = new Setting<>(8);
/**
@@ -547,6 +582,17 @@ public final class Settings {
*/
public final Setting<Long> slowPathTimeoutMS = new Setting<>(40000L);
/**
* allows baritone to save bed waypoints when interacting with beds
*/
public final Setting<Boolean> doBedWaypoints = new Setting<>(true);
/**
* allows baritone to save death waypoints
*/
public final Setting<Boolean> doDeathWaypoints = new Setting<>(true);
/**
* The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing.
*/
@@ -883,7 +929,7 @@ public final class Settings {
/**
* Only build the selected part of schematics
*/
public final Setting<Boolean> buildOnlySelection = new Setting<>(false);
public final Setting<Boolean> buildOnlySelection = new Setting<>(false);
/**
* How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely
@@ -1017,7 +1063,7 @@ public final class Settings {
/**
* What Y level to go to for legit strip mining
*/
public final Setting<Integer> legitMineYLevel = new Setting<>(11);
public final Setting<Integer> legitMineYLevel = new Setting<>(-59);
/**
* Magically see ores that are separated diagonally from existing ores. Basically like mining around the ores that it finds
@@ -1095,7 +1141,7 @@ public final class Settings {
* via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting
* {@link Setting#value};
*/
public final Setting<Consumer<Component>> logger = new Setting<>(Minecraft.getInstance().gui.getChat()::addMessage);
public final Setting<Consumer<Component>> logger = new Setting<>(msg -> Minecraft.getInstance().gui.getChat().addMessage(msg));
/**
* The function that is called when Baritone will send a desktop notification. This function can be added to

View File

@@ -19,11 +19,12 @@ package baritone.api.command.datatypes;
import baritone.api.command.exception.CommandException;
import baritone.api.command.helpers.TabCompleteHelper;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import java.util.stream.Stream;
public enum BlockById implements IDatatypeFor<Block> {
INSTANCE;
@@ -31,7 +32,7 @@ public enum BlockById implements IDatatypeFor<Block> {
public Block get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
Block block;
if ((block = Registry.BLOCK.getOptional(id).orElse(null)) == null) {
if ((block = BuiltInRegistries.BLOCK.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no block found by that id");
}
return block;
@@ -41,7 +42,7 @@ public enum BlockById implements IDatatypeFor<Block> {
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
return new TabCompleteHelper()
.append(
Registry.BLOCK.keySet()
BuiltInRegistries.BLOCK.keySet()
.stream()
.map(Object::toString)
)

View File

@@ -19,11 +19,12 @@ package baritone.api.command.datatypes;
import baritone.api.command.exception.CommandException;
import baritone.api.command.helpers.TabCompleteHelper;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import java.util.stream.Stream;
public enum EntityClassById implements IDatatypeFor<EntityType> {
INSTANCE;
@@ -31,7 +32,7 @@ public enum EntityClassById implements IDatatypeFor<EntityType> {
public EntityType get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
EntityType entity;
if ((entity = Registry.ENTITY_TYPE.getOptional(id).orElse(null)) == null) {
if ((entity = BuiltInRegistries.ENTITY_TYPE.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no entity found by that id");
}
return entity;
@@ -40,7 +41,7 @@ public enum EntityClassById implements IDatatypeFor<EntityType> {
@Override
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
return new TabCompleteHelper()
.append(Registry.ENTITY_TYPE.stream().map(Object::toString))
.append(BuiltInRegistries.ENTITY_TYPE.stream().map(Object::toString))
.filterPrefixNamespaced(ctx.getConsumer().getString())
.sortAlphabetically()
.stream();

View File

@@ -26,7 +26,8 @@ import java.util.stream.Stream;
public enum RelativeCoordinate implements IDatatypePost<Double, Double> {
INSTANCE;
private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)([k-k]?)|)$");
private static String ScalesAliasRegex = "[kKmM]";
private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(" + ScalesAliasRegex + "?)|)$");
@Override
public Double apply(IDatatypeContext ctx, Double origin) throws CommandException {
@@ -41,11 +42,15 @@ public enum RelativeCoordinate implements IDatatypePost<Double, Double> {
boolean isRelative = !matcher.group(1).isEmpty();
double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll("k", ""));
double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll(ScalesAliasRegex, ""));
if (matcher.group(2).contains("k")) {
if (matcher.group(2).toLowerCase().contains("k")) {
offset *= 1000;
}
if (matcher.group(2).toLowerCase().contains("m")) {
offset *= 1000000;
}
if (isRelative) {
return origin + offset;

View File

@@ -83,10 +83,10 @@ public enum RelativeFile implements IDatatypePost<File, File> {
boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator);
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
return Stream.of(Objects.requireNonNull(getCanonicalFileUnchecked(
useParent
? currentFile.getParentFile()
: currentFile
).listFiles()))
useParent
? currentFile.getParentFile()
: currentFile
).listFiles()))
.map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) +
(f.isDirectory() ? File.separator : ""))
.filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US)))

View File

@@ -21,15 +21,16 @@ import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.exception.CommandException;
import baritone.api.command.exception.CommandInvalidTypeException;
import baritone.api.utils.Helper;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.MutableComponent;
public class Paginator<E> implements Helper {
@@ -74,7 +75,7 @@ public class Paginator<E> implements Helper {
}
boolean hasPrevPage = commandPrefix != null && validPage(page - 1);
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
BaseComponent prevPageComponent = new TextComponent("<<");
MutableComponent prevPageComponent = Component.literal("<<");
if (hasPrevPage) {
prevPageComponent.setStyle(prevPageComponent.getStyle()
.withClickEvent(new ClickEvent(
@@ -83,26 +84,23 @@ public class Paginator<E> implements Helper {
))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click to view previous page")
Component.literal("Click to view previous page")
)));
} else {
prevPageComponent.setStyle(prevPageComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
}
BaseComponent nextPageComponent = new TextComponent(">>");
MutableComponent nextPageComponent = Component.literal(">>");
if (hasNextPage) {
nextPageComponent.setStyle(nextPageComponent.getStyle()
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format("%s %d", commandPrefix, page + 1)
))
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, String.format("%s %d", commandPrefix, page + 1)))
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click to view next page")
Component.literal("Click to view next page")
)));
} else {
nextPageComponent.setStyle(nextPageComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
}
BaseComponent pagerComponent = new TextComponent("");
MutableComponent pagerComponent = Component.literal("");
pagerComponent.setStyle(pagerComponent.getStyle().withColor(ChatFormatting.GRAY));
pagerComponent.append(prevPageComponent);
pagerComponent.append(" | ");

View File

@@ -84,7 +84,7 @@ public class Registry<V> {
* @param entry The entry to unregister.
*/
public void unregister(V entry) {
if (registered(entry)) {
if (!registered(entry)) {
return;
}
_entries.remove(entry);

View File

@@ -18,7 +18,7 @@
package baritone.api.event.events;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import org.joml.Matrix4f;
/**
* @author Brady

View File

@@ -19,8 +19,8 @@ package baritone.api.pathing.goals;
import baritone.api.utils.SettingsUtil;
import baritone.api.utils.interfaces.IGoalRenderPos;
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
import it.unimi.dsi.fastutil.doubles.DoubleIterator;
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
import net.minecraft.core.BlockPos;
public class GoalNear implements Goal, IGoalRenderPos {

View File

@@ -18,11 +18,12 @@
package baritone.api.pathing.goals;
import baritone.api.utils.SettingsUtil;
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
import it.unimi.dsi.fastutil.doubles.DoubleIterator;
import java.util.Arrays;
import it.unimi.dsi.fastutil.doubles.DoubleOpenHashSet;
import net.minecraft.core.BlockPos;
import java.util.Arrays;
/**
* Useful for automated combat (retreating specifically)
*

View File

@@ -65,8 +65,8 @@ public interface ActionCosts {
static double[] generateFallNBlocksCost() {
double[] costs = new double[257];
for (int i = 0; i < 257; i++) {
double[] costs = new double[4097];
for (int i = 0; i < 4097; i++) {
costs[i] = distanceToTicks(i);
}
return costs;

View File

@@ -57,6 +57,8 @@ public interface IBuilderProcess extends IBaritoneProcess {
void buildOpenSchematic();
void buildOpenLitematic(int i);
void pause();
boolean isPaused();

View File

@@ -18,10 +18,11 @@
package baritone.api.schematic;
import baritone.api.utils.BlockOptionalMeta;
import java.util.List;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import java.util.List;
public class FillSchematic extends AbstractSchematic {
private final BlockOptionalMeta bom;

View File

@@ -34,7 +34,7 @@ public class SubstituteSchematic extends AbstractSchematic {
private final Map<Block, List<Block>> substitutions;
private final Map<BlockState, Map<Block, BlockState>> blockStateCache = new HashMap<>();
public SubstituteSchematic(ISchematic schematic, Map<Block,List<Block>> substitutions) {
public SubstituteSchematic(ISchematic schematic, Map<Block, List<Block>> substitutions) {
super(schematic.widthX(), schematic.heightY(), schematic.lengthZ());
this.schematic = schematic;
this.substitutions = substitutions;
@@ -81,9 +81,10 @@ public class SubstituteSchematic extends AbstractSchematic {
} catch (IllegalArgumentException e) { //property does not exist for target block
}
}
blockStateCache.computeIfAbsent(state, s -> new HashMap<Block,BlockState>()).put(block, newState);
blockStateCache.computeIfAbsent(state, s -> new HashMap<Block, BlockState>()).put(block, newState);
return newState;
}
private <T extends Comparable<T>> BlockState copySingleProp(BlockState fromState, BlockState toState, Property<T> prop) {
return toState.setValue(prop, fromState.getValue(prop));
}

View File

@@ -20,21 +20,29 @@ package baritone.api.utils;
import baritone.api.utils.accessor.IItemStack;
import com.google.common.collect.ImmutableSet;
import io.netty.util.concurrent.ThreadPerTaskExecutor;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.*;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.packs.*;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.server.packs.resources.SimpleReloadableResourceManager;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.CustomSpawner;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.dimension.LevelStem;
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.LootTables;
@@ -42,9 +50,14 @@ 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 java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -56,7 +69,7 @@ public final class BlockOptionalMeta {
private final ImmutableSet<Integer> stateHashes;
private final ImmutableSet<Integer> stackHashes;
private static final Pattern pattern = Pattern.compile("^(.+?)(?::(\\d+))?$");
private static LootTables manager;
private static LootTables lootTables;
private static PredicateManager predicate = new PredicateManager();
private static Map<Block, List<Item>> drops = new HashMap<>();
@@ -142,21 +155,37 @@ public final class BlockOptionalMeta {
return null;
}
private static Method getVanillaServerPack;
private static VanillaPackResources getVanillaServerPack() {
if (getVanillaServerPack == null) {
getVanillaServerPack = Arrays.stream(ServerPacksSource.class.getDeclaredMethods()).filter(field -> field.getReturnType() == VanillaPackResources.class).findFirst().orElseThrow();
getVanillaServerPack.setAccessible(true);
}
try {
return (VanillaPackResources) getVanillaServerPack.invoke(null);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static LootTables getManager() {
if (manager == null) {
PackRepository rpl = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource());
rpl.reload();
PackResources thePack = rpl.getAvailablePacks().iterator().next().open();
ReloadableResourceManager resourceManager = new SimpleReloadableResourceManager(PackType.SERVER_DATA);
manager = new LootTables(predicate);
resourceManager.registerReloadListener(manager);
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.reload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), Collections.singletonList(thePack), CompletableFuture.completedFuture(Unit.INSTANCE)).get();
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 manager;
return lootTables;
}
public static PredicateManager getPredicateManager() {
@@ -170,20 +199,55 @@ public final class BlockOptionalMeta {
return Collections.emptyList();
} else {
List<Item> items = new ArrayList<>();
// the other overload for generate doesnt work in forge because forge adds code that requires a non null world
getManager().get(lootTableLocation).getRandomItems(
new LootContext.Builder((ServerLevel) null)
.withRandom(new Random())
.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),
try {
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();
}
return items;
}
});
}
private static class ServerLevelStub extends ServerLevel {
private static Minecraft client = Minecraft.getInstance();
private static Unsafe unsafe = getUnsafe();
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
public FeatureFlagSet enabledFeatures() {
assert client.level != null;
return client.level.enabledFeatures();
}
public static ServerLevelStub fastCreate() {
try {
return (ServerLevelStub) unsafe.allocateInstance(ServerLevelStub.class);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
public static Unsafe getUnsafe() {
try {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
return (Unsafe) theUnsafe.get(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -20,6 +20,7 @@ package baritone.api.utils;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@@ -28,7 +29,7 @@ public class BlockUtils {
private static transient Map<String, Block> resourceCache = new HashMap<>();
public static String blockToString(Block block) {
ResourceLocation loc = Registry.BLOCK.getKey(block);
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(block);
String name = loc.getPath(); // normally, only write the part after the minecraft:
if (!loc.getNamespace().equals("minecraft")) {
// Baritone is running on top of forge with mods installed, perhaps?
@@ -56,7 +57,7 @@ public class BlockUtils {
if (resourceCache.containsKey(name)) {
return null; // cached as null
}
block = Registry.BLOCK.getOptional(ResourceLocation.tryParse(name.contains(":") ? name : "minecraft:" + name)).orElse(null);
block = BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(name.contains(":") ? name : "minecraft:" + name)).orElse(null);
Map<String, Block> copy = new HashMap<>(resourceCache); // read only copy is safe, wont throw concurrentmodification
copy.put(name, block);
resourceCache = copy;

View File

@@ -21,9 +21,10 @@ import baritone.api.BaritoneAPI;
import baritone.api.utils.gui.BaritoneToast;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.MutableComponent;
import java.awt.*;
import java.util.Arrays;
import java.util.Calendar;
import java.util.stream.Stream;
@@ -51,11 +52,11 @@ public interface Helper {
// Inner text component
final Calendar now = Calendar.getInstance();
final boolean xd = now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) <= 3;
BaseComponent baritone = new TextComponent(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
MutableComponent baritone = Component.literal(xd ? "Baritoe" : BaritoneAPI.getSettings().shortBaritonePrefix.value ? "B" : "Baritone");
baritone.setStyle(baritone.getStyle().withColor(ChatFormatting.LIGHT_PURPLE));
// Outer brackets
BaseComponent prefix = new TextComponent("");
MutableComponent prefix = Component.literal("");
prefix.setStyle(baritone.getStyle().withColor(ChatFormatting.DARK_PURPLE));
prefix.append("[");
prefix.append(baritone);
@@ -81,7 +82,7 @@ public interface Helper {
* @param message The message to display in the popup
*/
default void logToast(String title, String message) {
logToast(new TextComponent(title), new TextComponent(message));
logToast(Component.literal(title), Component.literal(message));
}
/**
@@ -90,7 +91,7 @@ public interface Helper {
* @param message The message to display in the popup
*/
default void logToast(String message) {
logToast(Helper.getPrefix(), new TextComponent(message));
logToast(Helper.getPrefix(), Component.literal(message));
}
/**
@@ -158,9 +159,9 @@ public interface Helper {
* @param components The components to send
*/
default void logDirect(boolean logAsToast, Component... components) {
BaseComponent component = new TextComponent("");
MutableComponent component = Component.literal("");
component.append(getPrefix());
component.append(new TextComponent(" "));
component.append(Component.literal(" "));
Arrays.asList(components).forEach(component::append);
if (logAsToast) {
logToast(getPrefix(), component);
@@ -188,7 +189,7 @@ public interface Helper {
*/
default void logDirect(String message, ChatFormatting color, boolean logAsToast) {
Stream.of(message.split("\n")).forEach(line -> {
BaseComponent component = new TextComponent(line.replace("\t", " "));
MutableComponent component = Component.literal(line.replace("\t", " "));
component.setStyle(component.getStyle().withColor(color));
logDirect(logAsToast, component);
});

View File

@@ -23,6 +23,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
@@ -178,7 +179,7 @@ public class SettingsUtil {
/**
* This should always be the same as whether the setting can be parsed from or serialized to a string
*
* @param the setting
* @param setting The Setting
* @return true if the setting can not be set or read by the user
*/
public static boolean javaOnlySetting(Settings.Setting setting) {
@@ -252,8 +253,8 @@ public class SettingsUtil {
),
ITEM(
Item.class,
str -> Registry.ITEM.get(new ResourceLocation(str.trim())), // TODO this now returns AIR on failure instead of null, is that an issue?
item -> Registry.ITEM.getKey(item).toString()
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() {
@Override
@@ -300,7 +301,7 @@ public class SettingsUtil {
Parser keyParser = Parser.getParser(keyType);
Parser valueParser = Parser.getParser(valueType);
return ((Map<?,?>) value).entrySet().stream()
return ((Map<?, ?>) value).entrySet().stream()
.map(o -> keyParser.toString(context, o.getKey()) + "->" + valueParser.toString(context, o.getValue()))
.collect(Collectors.joining(","));
}

View File

@@ -18,6 +18,7 @@
package baritone.launch.mixins;
import baritone.utils.accessor.IChunkArray;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -27,24 +28,28 @@ import net.minecraft.world.level.chunk.LevelChunk;
@Mixin(targets = "net.minecraft.client.multiplayer.ClientChunkCache$Storage")
public abstract class MixinChunkArray implements IChunkArray {
@Final
@Shadow
private AtomicReferenceArray<LevelChunk> chunks;
AtomicReferenceArray<LevelChunk> chunks;
@Final
@Shadow
private int chunkRadius;
int chunkRadius;
@Final
@Shadow
private int viewRange;
@Shadow
private int viewCenterX;
int viewCenterX;
@Shadow
private int viewCenterZ;
int viewCenterZ;
@Shadow
private int chunkCount;
int chunkCount;
@Shadow
protected abstract boolean inRange(int x, int z);
abstract boolean inRange(int x, int z);
@Shadow
protected abstract int getIndex(int x, int z);
abstract int getIndex(int x, int z);
@Shadow
protected abstract void replace(int index, LevelChunk chunk);

View File

@@ -20,14 +20,19 @@ package baritone.launch.mixins;
import baritone.Baritone;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.ChatEvent;
import baritone.api.event.events.ChunkEvent;
import baritone.api.event.events.type.EventState;
import baritone.cache.CachedChunk;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.*;
import net.minecraft.world.level.ChunkPos;
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;
@@ -63,6 +68,25 @@ public class MixinClientPlayNetHandler {
}
}*/
@Shadow @Final private Minecraft minecraft;
@Inject(
method = "sendChat(Ljava/lang/String;)V",
at = @At("HEAD"),
cancellable = true
)
private void sendChatMessage(String string, CallbackInfo ci) {
ChatEvent event = new ChatEvent(string);
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(this.minecraft.player);
if (baritone == null) {
return;
}
baritone.getGameEventHandler().onSendChatMessage(event);
if (event.isCancelled()) {
ci.cancel();
}
}
@Inject(
method = "handleLevelChunkWithLight",
at = @At("RETURN")
@@ -175,7 +199,7 @@ public class MixinClientPlayNetHandler {
method = "handlePlayerCombatKill",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V"
target = "Lnet/minecraft/client/player/LocalPlayer;shouldShowDeathScreen()Z"
)
)
private void onPlayerDeath(ClientboundPlayerCombatKillPacket packetIn, CallbackInfo ci) {

View File

@@ -26,6 +26,7 @@ import baritone.api.event.events.type.EventState;
import baritone.behavior.LookBehavior;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Abilities;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -40,23 +41,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LocalPlayer.class)
public class MixinClientPlayerEntity {
@Inject(
method = "chat",
at = @At("HEAD"),
cancellable = true
)
private void sendChatMessage(String msg, CallbackInfo ci) {
ChatEvent event = new ChatEvent(msg);
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this);
if (baritone == null) {
return;
}
baritone.getGameEventHandler().onSendChatMessage(event);
if (event.isCancelled()) {
ci.cancel();
}
}
@Inject(
method = "tick",
at = @At(

View File

@@ -39,7 +39,7 @@ public abstract class MixinItemStack implements IItemStack {
private int baritoneHash;
@Shadow
protected abstract int getDamageValue();
public abstract int getDamageValue();
private void recalculateHash() {
baritoneHash = item == null ? -1 : item.hashCode() + getDamageValue();

View File

@@ -26,6 +26,7 @@ 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;
import net.minecraft.network.protocol.PacketFlow;
import org.spongepowered.asm.mixin.Final;
@@ -53,14 +54,14 @@ public class MixinNetworkManager {
method = "sendPacket",
at = @At("HEAD")
)
private void preDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>> futureListeners, CallbackInfo ci) {
private void preDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, CallbackInfo ci) {
if (this.receiving != PacketFlow.CLIENTBOUND) {
return;
}
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getConnection() == (Connection) (Object) this) {
ibaritone.getGameEventHandler().onSendPacket(new PacketEvent((Connection) (Object) this, EventState.PRE, inPacket));
ibaritone.getGameEventHandler().onSendPacket(new PacketEvent((Connection) (Object) this, EventState.PRE, packet));
}
}
}
@@ -69,14 +70,14 @@ public class MixinNetworkManager {
method = "sendPacket",
at = @At("RETURN")
)
private void postDispatchPacket(Packet<?> inPacket, final GenericFutureListener<? extends Future<? super Void>> futureListeners, CallbackInfo ci) {
private void postDispatchPacket(Packet<?> packet, PacketSendListener packetSendListener, CallbackInfo ci) {
if (this.receiving != PacketFlow.CLIENTBOUND) {
return;
}
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
if (ibaritone.getPlayerContext().player() != null && ibaritone.getPlayerContext().player().connection.getConnection() == (Connection) (Object) this) {
ibaritone.getGameEventHandler().onSendPacket(new PacketEvent((Connection) (Object) this, EventState.POST, inPacket));
ibaritone.getGameEventHandler().onSendPacket(new PacketEvent((Connection) (Object) this, EventState.POST, packet));
}
}
}

View File

@@ -17,12 +17,20 @@
package baritone.launch.mixins;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.ChatEvent;
import baritone.utils.accessor.IGuiScreen;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Style;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
import java.net.URI;
import net.minecraft.client.gui.screens.Screen;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Screen.class)
public abstract class MixinScreen implements IGuiScreen {
@@ -30,4 +38,20 @@ 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) {
ClickEvent clickEvent = style.getClickEvent();
if (clickEvent == null) {
return;
}
IBaritone baritone = BaritoneAPI.getProvider().getPrimaryBaritone();
if (baritone != null) {
baritone.getGameEventHandler().onSendChatMessage(new ChatEvent(clickEvent.getValue()));
}
cir.setReturnValue(true);
cir.cancel();
}
}

View File

@@ -21,11 +21,11 @@ import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;

View File

@@ -1,11 +1,11 @@
{
"required": true,
"package": "baritone.launch.mixins",
"refmap": "mixins.baritone.refmap.json",
"compatibilityLevel": "JAVA_17",
"verbose": false,
"injectors": {
"maxShiftBy": 2
"maxShiftBy": 2,
"defaultRequire": 1
},
"client": [
"MixinChunkArray",

View File

@@ -1,6 +0,0 @@
{
"pack": {
"description": "baritoe",
"pack_format": 5
}
}

View File

@@ -69,6 +69,7 @@ public class Baritone implements IBaritone {
private PathingBehavior pathingBehavior;
private LookBehavior lookBehavior;
private InventoryBehavior inventoryBehavior;
private WaypointBehavior waypointBehavior;
private InputOverrideHandler inputOverrideHandler;
private FollowProcess followProcess;
@@ -101,6 +102,7 @@ public class Baritone implements IBaritone {
lookBehavior = new LookBehavior(this);
inventoryBehavior = new InventoryBehavior(this);
inputOverrideHandler = new InputOverrideHandler(this);
waypointBehavior = new WaypointBehavior(this);
}
this.pathingControlManager = new PathingControlManager(this);

View File

@@ -18,7 +18,6 @@
package baritone.behavior;
import baritone.Baritone;
import baritone.api.BaritoneAPI;
import baritone.api.event.events.TickEvent;
import baritone.utils.ToolSet;
import net.minecraft.client.player.LocalPlayer;

View File

@@ -98,6 +98,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
baritone.getPathingControlManager().cancelEverything();
return;
}
expectedSegmentStart = pathStart();
baritone.getPathingControlManager().preTick();
tickPath();
@@ -237,11 +238,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
if (current != null) {
switch (event.getState()) {
case PRE:
lastAutoJump = mc.options.autoJump;
mc.options.autoJump = false;
lastAutoJump = mc.options.autoJump().get();
mc.options.autoJump().set(false);
break;
case POST:
mc.options.autoJump = lastAutoJump;
mc.options.autoJump().set(lastAutoJump);
break;
default:
break;

View File

@@ -0,0 +1,93 @@
/*
* 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.behavior;
import baritone.Baritone;
import baritone.api.cache.IWaypoint;
import baritone.api.cache.Waypoint;
import baritone.api.event.events.BlockInteractEvent;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Helper;
import baritone.utils.BlockStateInterface;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.BedBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BedPart;
import java.util.Set;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
public class WaypointBehavior extends Behavior {
public WaypointBehavior(Baritone baritone) {
super(baritone);
}
@Override
public void onBlockInteract(BlockInteractEvent event) {
if (!Baritone.settings().doBedWaypoints.value)
return;
if (event.getType() == BlockInteractEvent.Type.USE) {
BetterBlockPos pos = BetterBlockPos.from(event.getPos());
BlockState state = BlockStateInterface.get(ctx, pos);
if (state.getBlock() instanceof BedBlock) {
if (state.getValue(BedBlock.PART) == BedPart.FOOT) {
pos = pos.relative(state.getValue(BedBlock.FACING));
}
Set<IWaypoint> waypoints = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getByTag(IWaypoint.Tag.BED);
boolean exists = waypoints.stream().map(IWaypoint::getLocation).filter(pos::equals).findFirst().isPresent();
if (!exists) {
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, pos));
}
}
}
}
@Override
public void onPlayerDeath() {
if (!Baritone.settings().doDeathWaypoints.value)
return;
Waypoint deathWaypoint = new Waypoint("death", Waypoint.Tag.DEATH, ctx.playerFeet());
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(deathWaypoint);
MutableComponent component = Component.literal("Death position saved.");
component.setStyle(component.getStyle()
.withColor(ChatFormatting.WHITE)
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
Component.literal("Click to goto death")
))
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s goto %s @ %d",
FORCE_COMMAND_PREFIX,
"wp",
deathWaypoint.getTag().getName(),
deathWaypoint.getCreationTimestamp()
)
)));
Helper.HELPER.logDirect(component);
}
}

View File

@@ -43,7 +43,7 @@ public final class CachedRegion implements ICachedRegion {
/**
* Magic value to detect invalid cache files, or incompatible cache files saved in an old version of Baritone
*/
private static final int CACHED_REGION_MAGIC = 456022910;
private static final int CACHED_REGION_MAGIC = 456022911;
/**
* All of the chunks in this region: A 32x32 array of them.
@@ -166,7 +166,7 @@ public final class CachedRegion implements ICachedRegion {
out.writeShort(entry.getValue().size());
for (BlockPos pos : entry.getValue()) {
out.writeByte((byte) (pos.getZ() << 4 | pos.getX()));
out.writeByte((byte) (pos.getY()));
out.writeInt(pos.getY()-dimension.minY());
}
}
}
@@ -270,8 +270,8 @@ public final class CachedRegion implements ICachedRegion {
byte xz = in.readByte();
int X = xz & 0x0f;
int Z = (xz >>> 4) & 0x0f;
int Y = in.readByte() & 0xff;
locs.add(new BlockPos(X, Y, Z));
int Y = in.readInt();
locs.add(new BlockPos(X, Y+dimension.minY(), Z));
}
}
}

View File

@@ -211,7 +211,7 @@ public final class CachedWorld implements ICachedWorld, Helper {
private BlockPos guessPosition() {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
IWorldData data = ibaritone.getWorldProvider().getCurrentWorld();
if (data != null && data.getCachedWorld() == this) {
if (data != null && data.getCachedWorld() == this && ibaritone.getPlayerContext().player() != null) {
return ibaritone.getPlayerContext().playerFeet();
}
}

View File

@@ -31,6 +31,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.PalettedContainer;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.phys.Vec3;
import java.util.*;
@@ -82,7 +83,7 @@ public final class ChunkPacker {
Block block = state.getBlock();
if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(block)) {
String name = BlockUtils.blockToString(block);
specialBlocks.computeIfAbsent(name, b -> new ArrayList<>()).add(new BlockPos(x, y, z));
specialBlocks.computeIfAbsent(name, b -> new ArrayList<>()).add(new BlockPos(x, y+chunk.getMinBuildHeight(), z));
}
}
}
@@ -132,7 +133,7 @@ public final class ChunkPacker {
return PathingBlockType.AVOID;
}
if (x == 0 || x == 15 || z == 0 || z == 15) {
Vec3 flow = state.getFluidState().getFlow(chunk.getLevel(), new BlockPos(x + chunk.getPos().x << 4, y, z + chunk.getPos().z << 4));
Vec3 flow = state.getFluidState().getFlow(chunk.getLevel(), new BlockPos(x + (chunk.getPos().x << 4), y, z + (chunk.getPos().z << 4)));
if (flow.x != 0.0 || flow.z != 0.0) {
return PathingBlockType.WATER;
}
@@ -171,7 +172,7 @@ public final class ChunkPacker {
if (dimension.ultraWarm()) {
return Blocks.NETHERRACK.defaultBlockState();
}
if (dimension.createDragonFight()) {
if (dimension.effectsLocation().equals(BuiltinDimensionTypes.END_EFFECTS)) {
return Blocks.END_STONE.defaultBlockState();
}
default:

View File

@@ -21,12 +21,10 @@ import baritone.Baritone;
import baritone.api.cache.ICachedWorld;
import baritone.api.cache.IWaypointCollection;
import baritone.api.cache.IWorldData;
import java.io.IOException;
import java.nio.file.Path;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.dimension.DimensionType;
import java.nio.file.Path;
/**
* Data about a world, from baritone's point of view. Includes cached chunks, waypoints, and map data.
*

View File

@@ -45,9 +45,11 @@ public class WorldProvider implements IWorldProvider, Helper {
private static final Map<Path, WorldData> worldCache = new HashMap<>(); // this is how the bots have the same cached world
private WorldData currentWorld;
private Level mcWorld; // this let's us detect a broken load/unload hook
@Override
public final WorldData getCurrentWorld() {
detectAndHandleBrokenLoading();
return this.currentWorld;
}
@@ -76,16 +78,14 @@ public class WorldProvider implements IWorldProvider, Helper {
readme = directory;
} else { // Otherwise, the server must be remote...
String folderName;
if (mc.isConnectedToRealms()) {
folderName = "realms";
if (mc.getCurrentServer() != null) {
folderName = mc.isConnectedToRealms() ? "realms" : mc.getCurrentServer().ip;
} else {
if (mc.getCurrentServer() != null) {
folderName = mc.getCurrentServer().ip;
} else {
//replaymod causes null currentServerData and false singleplayer.
currentWorld = null;
return;
}
//replaymod causes null currentServer and false singleplayer.
System.out.println("World seems to be a replay. Not loading Baritone cache.");
currentWorld = null;
mcWorld = mc.level;
return;
}
if (SystemUtils.IS_OS_WINDOWS) {
folderName = folderName.replace(":", "_");
@@ -112,6 +112,7 @@ public class WorldProvider implements IWorldProvider, Helper {
synchronized (worldCache) {
this.currentWorld = worldCache.computeIfAbsent(dir, d -> new WorldData(d, world));
}
this.mcWorld = mc.level;
}
public final Path getDimDir(ResourceKey<Level> level, int height, Path directory) {
@@ -121,6 +122,7 @@ public class WorldProvider implements IWorldProvider, Helper {
public final void closeWorld() {
WorldData world = this.currentWorld;
this.currentWorld = null;
this.mcWorld = null;
if (world == null) {
return;
}
@@ -128,8 +130,25 @@ public class WorldProvider implements IWorldProvider, Helper {
}
public final void ifWorldLoaded(Consumer<WorldData> currentWorldConsumer) {
detectAndHandleBrokenLoading();
if (this.currentWorld != null) {
currentWorldConsumer.accept(this.currentWorld);
}
}
private final void detectAndHandleBrokenLoading() {
if (this.mcWorld != mc.level) {
if (this.currentWorld != null) {
System.out.println("mc.world unloaded unnoticed! Unloading Baritone cache now.");
closeWorld();
}
if (mc.level != null) {
System.out.println("mc.world loaded unnoticed! Loading Baritone cache now.");
initWorld(mc.level.dimension(), mc.level.dimensionType());
}
} else if (currentWorld == null && mc.level != null && (mc.hasSingleplayerServer() || mc.getCurrentServer() != null)) {
System.out.println("Retrying to load Baritone cache");
initWorld(mc.level.dimension(), mc.level.dimensionType());
}
}
}

View File

@@ -35,10 +35,8 @@ import baritone.command.argument.CommandArguments;
import baritone.command.manager.CommandManager;
import baritone.utils.accessor.IGuiScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.*;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Tuple;
import java.net.URI;
import java.net.URISyntaxException;
@@ -78,12 +76,12 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener
if (settings.echoCommands.value) {
String msg = command + rest;
String toDisplay = settings.censorRanCommands.value ? command + " ..." : msg;
BaseComponent component = new TextComponent(String.format("> %s", toDisplay));
MutableComponent component = Component.literal(String.format("> %s", toDisplay));
component.setStyle(component.getStyle()
.withColor(ChatFormatting.WHITE)
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click to rerun command")
Component.literal("Click to rerun command")
))
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,

View File

@@ -42,7 +42,8 @@ public final class DefaultCommands {
new VersionCommand(baritone),
new RepackCommand(baritone),
new BuildCommand(baritone),
new SchematicaCommand(baritone),
//new SchematicaCommand(baritone),
new LitematicaCommand(baritone),
new ComeCommand(baritone),
new AxisCommand(baritone),
new ForceCancelCommand(baritone),

View File

@@ -18,13 +18,13 @@
package baritone.command.defaults;
import baritone.api.IBaritone;
import baritone.api.pathing.calc.IPathingControlManager;
import baritone.api.process.IBaritoneProcess;
import baritone.api.behavior.IPathingBehavior;
import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.exception.CommandException;
import baritone.api.command.exception.CommandInvalidStateException;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.pathing.calc.IPathingControlManager;
import baritone.api.process.IBaritoneProcess;
import java.util.Arrays;
import java.util.List;
@@ -45,11 +45,17 @@ public class ETACommand extends Command {
throw new CommandInvalidStateException("No process in control");
}
IPathingBehavior pathingBehavior = baritone.getPathingBehavior();
double ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment().orElse(Double.NaN);
double ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal().orElse(Double.NaN);
logDirect(String.format(
"Next segment: %.2f\n" +
"Goal: %.2f",
pathingBehavior.ticksRemainingInSegment().orElse(-1.0),
pathingBehavior.estimatedTicksToGoal().orElse(-1.0)
"Next segment: %.1fs (%.0f ticks)\n" +
"Goal: %.1fs (%.0f ticks)",
ticksRemainingInSegment / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly
ticksRemainingInSegment,
ticksRemainingInGoal / 20,
ticksRemainingInGoal
));
}

View File

@@ -56,6 +56,7 @@ public class ExecutionControlCommands {
@Override
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
baritone.getInputOverrideHandler().clearAllKeys();
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
}
@@ -79,7 +80,7 @@ public class ExecutionControlCommands {
}
}
);
pauseCommand = new Command(baritone, "pause", "p") {
pauseCommand = new Command(baritone, "pause", "p", "paws") {
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMax(0);
@@ -112,7 +113,7 @@ public class ExecutionControlCommands {
);
}
};
resumeCommand = new Command(baritone, "resume", "r", "unpause") {
resumeCommand = new Command(baritone, "resume", "r", "unpause", "unpaws") {
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMax(0);

View File

@@ -22,13 +22,24 @@ import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.datatypes.BlockById;
import baritone.api.command.exception.CommandException;
import baritone.api.command.helpers.TabCompleteHelper;
import baritone.api.utils.BetterBlockPos;
import baritone.cache.CachedChunk;
import net.minecraft.core.Registry;
import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.level.block.Block;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.world.level.block.Block;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
public class FindCommand extends Command {
@@ -38,15 +49,16 @@ public class FindCommand extends Command {
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMin(1);
List<Block> toFind = new ArrayList<>();
while (args.hasAny()) {
toFind.add(args.getDatatypeFor(BlockById.INSTANCE));
}
BetterBlockPos origin = ctx.playerFeet();
toFind.stream()
Component[] components = toFind.stream()
.flatMap(block ->
ctx.worldData().getCachedWorld().getLocationsOf(
Registry.BLOCK.getKey(block).getPath(),
BuiltInRegistries.BLOCK.getKey(block).getPath(),
Integer.MAX_VALUE,
origin.x,
origin.y,
@@ -54,13 +66,39 @@ public class FindCommand extends Command {
).stream()
)
.map(BetterBlockPos::new)
.map(BetterBlockPos::toString)
.forEach(this::logDirect);
.map(this::positionToComponent)
.toArray(Component[]::new);
if (components.length > 0) {
Arrays.asList(components).forEach(this::logDirect);
} else {
logDirect("No positions known, are you sure the blocks are cached?");
}
}
private Component positionToComponent(BetterBlockPos pos) {
String positionText = String.format("%s %s %s", pos.x, pos.y, pos.z);
String command = String.format("%sgoal %s", FORCE_COMMAND_PREFIX, positionText);
MutableComponent baseComponent = Component.literal(pos.toString());
MutableComponent hoverComponent = Component.literal("Click to set goal to this position");
baseComponent.setStyle(baseComponent.getStyle()
.withColor(ChatFormatting.GRAY)
.withInsertion(positionText)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverComponent)));
return baseComponent;
}
@Override
public Stream<String> tabComplete(String label, IArgConsumer args) {
return args.tabCompleteDatatype(BlockById.INSTANCE);
public Stream<String> tabComplete(String label, IArgConsumer args) throws CommandException {
return new TabCompleteHelper()
.append(
CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.stream()
.map(BuiltInRegistries.BLOCK::getKey)
.map(Object::toString)
)
.filterPrefixNamespaced(args.getString())
.sortAlphabetically()
.stream();
}
@Override
@@ -71,10 +109,11 @@ public class FindCommand extends Command {
@Override
public List<String> getLongDesc() {
return Arrays.asList(
"",
"The find command searches through Baritone's cache and attempts to find the location of the block.",
"Tab completion will suggest only cached blocks and uncached blocks can not be found.",
"",
"Usage:",
"> "
"> find <block> [...] - Try finding the listed blocks"
);
}
}

View File

@@ -31,6 +31,7 @@ import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -84,7 +85,7 @@ public class FollowCommand extends Command {
} else {
logDirect("Following these types of entities:");
classes.stream()
.map(Registry.ENTITY_TYPE::getKey)
.map(BuiltInRegistries.ENTITY_TYPE::getKey)
.map(Objects::requireNonNull)
.map(ResourceLocation::toString)
.forEach(this::logDirect);

View File

@@ -25,16 +25,18 @@ import baritone.api.command.exception.CommandException;
import baritone.api.command.exception.CommandNotFoundException;
import baritone.api.command.helpers.Paginator;
import baritone.api.command.helpers.TabCompleteHelper;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.MutableComponent;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
@@ -58,17 +60,17 @@ public class HelpCommand extends Command {
command -> {
String names = String.join("/", command.getNames());
String name = command.getNames().get(0);
TextComponent shortDescComponent = new TextComponent(" - " + command.getShortDesc());
MutableComponent shortDescComponent = Component.literal(" - " + command.getShortDesc());
shortDescComponent.setStyle(shortDescComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
TextComponent namesComponent = new TextComponent(names);
MutableComponent namesComponent = Component.literal(names);
namesComponent.setStyle(namesComponent.getStyle().withColor(ChatFormatting.WHITE));
TextComponent hoverComponent = new TextComponent("");
MutableComponent hoverComponent = Component.literal("");
hoverComponent.setStyle(hoverComponent.getStyle().withColor(ChatFormatting.GRAY));
hoverComponent.append(namesComponent);
hoverComponent.append("\n" + command.getShortDesc());
hoverComponent.append("\n\nClick to view full help");
String clickCommand = FORCE_COMMAND_PREFIX + String.format("%s %s", label, command.getNames().get(0));
TextComponent component = new TextComponent(name);
MutableComponent component = Component.literal(name);
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
component.append(shortDescComponent);
component.setStyle(component.getStyle()
@@ -88,7 +90,7 @@ public class HelpCommand extends Command {
logDirect("");
command.getLongDesc().forEach(this::logDirect);
logDirect("");
BaseComponent returnComponent = new TextComponent("Click to return to the help menu");
MutableComponent returnComponent = Component.literal("Click to return to the help menu");
returnComponent.setStyle(returnComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + label

View File

@@ -0,0 +1,71 @@
/*
* 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.command.defaults;
import baritone.api.IBaritone;
import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.exception.CommandException;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public class LitematicaCommand extends Command {
public LitematicaCommand(IBaritone baritone) {
super(baritone, "litematica");
}
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
int schematic = 0;
if (args.hasAny()) {
args.requireMax(1);
if (args.is(Integer.class)) {
schematic = args.getAs(Integer.class) - 1;
}
}
try {
baritone.getBuilderProcess().buildOpenLitematic(schematic);
} catch (IndexOutOfBoundsException e) {
logDirect("Pleas provide a valid index.");
}
}
@Override
public Stream<String> tabComplete(String label, IArgConsumer args) {
return Stream.empty();
}
@Override
public String getShortDesc() {
return "Builds the loaded schematic";
}
@Override
public List<String> getLongDesc() {
return Arrays.asList(
"Build a schematic currently open in Litematica.",
"",
"Usage:",
"> litematica",
"> litematica <#>"
);
}
}

View File

@@ -65,14 +65,12 @@ public class MineCommand extends Command {
return Arrays.asList(
"The mine command allows you to tell Baritone to search for and mine individual blocks.",
"",
"The specified blocks can be ores (which are commonly cached), or any other block.",
"The specified blocks can be ores, or any other block.",
"",
"Also see the legitMine settings (see #set l legitMine).",
"",
"Usage:",
"> mine diamond_ore - Mines all diamonds it can find.",
"> mine redstone_ore lit_redstone_ore - Mines redstone ore.",
"> mine log:0 - Mines only oak logs."
"> mine diamond_ore - Mines all diamonds it can find."
);
}
}

View File

@@ -37,7 +37,7 @@ public class RenderCommand extends Command {
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMax(0);
BetterBlockPos origin = ctx.playerFeet();
int renderDistance = (mc.options.renderDistance + 1) * 16;
int renderDistance = (mc.options.renderDistance().get() + 1) * 16;
mc.levelRenderer.setBlocksDirty(
origin.x - renderDistance,
0,

View File

@@ -36,15 +36,9 @@ import baritone.api.selection.ISelectionManager;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.BlockOptionalMeta;
import baritone.api.utils.BlockOptionalMetaLookup;
import baritone.utils.IRenderer;
import baritone.utils.BlockStateInterface;
import baritone.utils.IRenderer;
import baritone.utils.schematic.StaticSchematic;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
@@ -52,6 +46,12 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
public class SelCommand extends Command {
private ISelectionManager manager = baritone.getSelectionManager();
@@ -193,7 +193,7 @@ public class SelCommand extends Command {
}
}
}
ISchematic schematic = new StaticSchematic(){{
ISchematic schematic = new StaticSchematic() {{
states = blockstates;
x = size.getX();
y = size.getY();

View File

@@ -28,16 +28,17 @@ import baritone.api.command.exception.CommandInvalidTypeException;
import baritone.api.command.helpers.Paginator;
import baritone.api.command.helpers.TabCompleteHelper;
import baritone.api.utils.SettingsUtil;
import java.awt.*;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.*;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
import static baritone.api.utils.SettingsUtil.*;
@@ -77,19 +78,19 @@ public class SetCommand extends Command {
: String.format("All %ssettings:", viewModified ? "modified " : "")
),
setting -> {
TextComponent typeComponent = new TextComponent(String.format(
MutableComponent typeComponent = Component.literal(String.format(
" (%s)",
settingTypeToString(setting)
));
typeComponent.getStyle().withColor(ChatFormatting.DARK_GRAY);
TextComponent hoverComponent = new TextComponent("");
hoverComponent.getStyle().withColor(ChatFormatting.GRAY);
typeComponent.setStyle(typeComponent.getStyle().withColor(ChatFormatting.DARK_GRAY));
MutableComponent hoverComponent = Component.literal("");
hoverComponent.setStyle(hoverComponent.getStyle().withColor(ChatFormatting.GRAY));
hoverComponent.append(setting.getName());
hoverComponent.append(String.format("\nType: %s", settingTypeToString(setting)));
hoverComponent.append(String.format("\n\nValue:\n%s", settingValueToString(setting)));
hoverComponent.append(String.format("\n\nDefault Value:\n%s", settingDefaultToString(setting)));
String commandSuggestion = Baritone.settings().prefix.value + String.format("set %s ", setting.getName());
TextComponent component = new TextComponent(setting.getName());
MutableComponent component = Component.literal(setting.getName());
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
component.append(typeComponent);
component.setStyle(component.getStyle()
@@ -146,7 +147,8 @@ public class SetCommand extends Command {
throw new CommandInvalidTypeException(args.consumed(), "a toggleable setting", "some other setting");
}
//noinspection unchecked
((Settings.Setting<Boolean>) setting).value ^= true;
Settings.Setting<Boolean> asBoolSetting = (Settings.Setting<Boolean>) setting;
asBoolSetting.value ^= true;
logDirect(String.format(
"Toggled setting %s to %s",
setting.getName(),
@@ -169,12 +171,12 @@ public class SetCommand extends Command {
settingValueToString(setting)
));
}
BaseComponent oldValueComponent = new TextComponent(String.format("Old value: %s", oldValue));
MutableComponent oldValueComponent = Component.literal(String.format("Old value: %s", oldValue));
oldValueComponent.setStyle(oldValueComponent.getStyle()
.withColor(ChatFormatting.GRAY)
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click to set the setting back to this value")
Component.literal("Click to set the setting back to this value")
))
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,

View File

@@ -20,8 +20,8 @@ package baritone.command.defaults;
import baritone.Baritone;
import baritone.api.IBaritone;
import baritone.api.cache.IWaypoint;
import baritone.api.cache.Waypoint;
import baritone.api.cache.IWorldData;
import baritone.api.cache.Waypoint;
import baritone.api.command.Command;
import baritone.api.command.argument.IArgConsumer;
import baritone.api.command.datatypes.ForWaypoints;
@@ -40,17 +40,17 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.MutableComponent;
import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX;
public class WaypointsCommand extends Command {
private Map<IWorldData,List<IWaypoint>> deletedWaypoints = new HashMap<>();
private Map<IWorldData, List<IWaypoint>> deletedWaypoints = new HashMap<>();
public WaypointsCommand(IBaritone baritone) {
super(baritone, "waypoints", "waypoint", "wp");
@@ -63,13 +63,13 @@ public class WaypointsCommand extends Command {
throw new CommandInvalidTypeException(args.consumed(), "an action");
}
BiFunction<IWaypoint, Action, Component> toComponent = (waypoint, _action) -> {
BaseComponent component = new TextComponent("");
BaseComponent tagComponent = new TextComponent(waypoint.getTag().name() + " ");
MutableComponent component = Component.literal("");
MutableComponent tagComponent = Component.literal(waypoint.getTag().name() + " ");
tagComponent.setStyle(tagComponent.getStyle().withColor(ChatFormatting.GRAY));
String name = waypoint.getName();
BaseComponent nameComponent = new TextComponent(!name.isEmpty() ? name : "<empty>");
MutableComponent nameComponent = Component.literal(!name.isEmpty() ? name : "<empty>");
nameComponent.setStyle(nameComponent.getStyle().withColor(!name.isEmpty() ? ChatFormatting.GRAY : ChatFormatting.DARK_GRAY));
BaseComponent timestamp = new TextComponent(" @ " + new Date(waypoint.getCreationTimestamp()));
MutableComponent timestamp = Component.literal(" @ " + new Date(waypoint.getCreationTimestamp()));
timestamp.setStyle(timestamp.getStyle().withColor(ChatFormatting.DARK_GRAY));
component.append(tagComponent);
component.append(nameComponent);
@@ -77,7 +77,7 @@ public class WaypointsCommand extends Command {
component.setStyle(component.getStyle()
.withHoverEvent(new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new TextComponent("Click to select")
Component.literal("Click to select")
))
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
@@ -143,7 +143,7 @@ public class WaypointsCommand extends Command {
args.requireMax(0);
IWaypoint waypoint = new Waypoint(name, tag, pos);
ForWaypoints.waypoints(this.baritone).addWaypoint(waypoint);
BaseComponent component = new TextComponent("Waypoint added: ");
MutableComponent component = Component.literal("Waypoint added: ");
component.setStyle(component.getStyle().withColor(ChatFormatting.GRAY));
component.append(toComponent.apply(waypoint, Action.INFO));
logDirect(component);
@@ -155,8 +155,8 @@ public class WaypointsCommand extends Command {
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
}
deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).addAll(Arrays.<IWaypoint>asList(waypoints));
TextComponent textComponent = new TextComponent(String.format("Cleared %d waypoints, click to restore them", waypoints.length));
textComponent.getStyle().withClickEvent(new ClickEvent(
MutableComponent textComponent = Component.literal(String.format("Cleared %d waypoints, click to restore them", waypoints.length));
textComponent.setStyle(textComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s restore @ %s",
@@ -164,7 +164,7 @@ public class WaypointsCommand extends Command {
label,
Stream.of(waypoints).map(wp -> Long.toString(wp.getCreationTimestamp())).collect(Collectors.joining(" "))
)
));
)));
logDirect(textComponent);
} else if (action == Action.RESTORE) {
List<IWaypoint> waypoints = new ArrayList<>();
@@ -236,7 +236,7 @@ public class WaypointsCommand extends Command {
if (action == Action.INFO) {
logDirect(transform.apply(waypoint));
logDirect(String.format("Position: %s", waypoint.getLocation()));
BaseComponent deleteComponent = new TextComponent("Click to delete this waypoint");
MutableComponent deleteComponent = Component.literal("Click to delete this waypoint");
deleteComponent.setStyle(deleteComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
@@ -247,7 +247,7 @@ public class WaypointsCommand extends Command {
waypoint.getCreationTimestamp()
)
)));
BaseComponent goalComponent = new TextComponent("Click to set goal to this waypoint");
MutableComponent goalComponent = Component.literal("Click to set goal to this waypoint");
goalComponent.setStyle(goalComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
@@ -258,8 +258,8 @@ public class WaypointsCommand extends Command {
waypoint.getCreationTimestamp()
)
)));
BaseComponent recreateComponent = new TextComponent("Click to show a command to recreate this waypoint");
recreateComponent.getStyle().withClickEvent(new ClickEvent(
MutableComponent recreateComponent = Component.literal("Click to show a command to recreate this waypoint");
recreateComponent.setStyle(recreateComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.SUGGEST_COMMAND,
String.format(
"%s%s save %s %s %s %s %s",
@@ -271,16 +271,16 @@ public class WaypointsCommand extends Command {
waypoint.getLocation().y,
waypoint.getLocation().z
)
));
BaseComponent backComponent = new TextComponent("Click to return to the waypoints list");
backComponent.getStyle().withClickEvent(new ClickEvent(
)));
MutableComponent backComponent = Component.literal("Click to return to the waypoints list");
backComponent.setStyle(backComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s list",
FORCE_COMMAND_PREFIX,
label
)
));
)));
logDirect(deleteComponent);
logDirect(goalComponent);
logDirect(recreateComponent);
@@ -288,8 +288,8 @@ public class WaypointsCommand extends Command {
} else if (action == Action.DELETE) {
ForWaypoints.waypoints(this.baritone).removeWaypoint(waypoint);
deletedWaypoints.computeIfAbsent(baritone.getWorldProvider().getCurrentWorld(), k -> new ArrayList<>()).add(waypoint);
TextComponent textComponent = new TextComponent("That waypoint has successfully been deleted, click to restore it");
textComponent.getStyle().withClickEvent(new ClickEvent(
MutableComponent textComponent = Component.literal("That waypoint has successfully been deleted, click to restore it");
textComponent.setStyle(textComponent.getStyle().withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
String.format(
"%s%s restore @ %s",
@@ -297,7 +297,7 @@ public class WaypointsCommand extends Command {
label,
waypoint.getCreationTimestamp()
)
));
)));
logDirect(textComponent);
} else if (action == Action.GOAL) {
Goal goal = new GoalBlock(waypoint.getLocation());

View File

@@ -21,19 +21,24 @@ import baritone.Baritone;
import baritone.api.IBaritone;
import baritone.api.pathing.movement.ActionCosts;
import baritone.cache.WorldData;
import baritone.pathing.precompute.PrecomputedData;
import baritone.utils.BlockStateInterface;
import baritone.utils.ToolSet;
import baritone.utils.pathing.BetterWorldBorder;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ItemStack;
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;
import java.util.ArrayList;
import java.util.List;
import static baritone.api.pathing.movement.ActionCosts.COST_INF;
/**
@@ -55,11 +60,13 @@ public class CalculationContext {
public final boolean canSprint;
protected final double placeBlockCost; // protected because you should call the function instead
public final boolean allowBreak;
public final List<Block> allowBreakAnyway;
public final boolean allowParkour;
public final boolean allowParkourPlace;
public final boolean allowJumpAt256;
public final boolean allowParkourAscend;
public final boolean assumeWalkOnWater;
public final int frostWalker;
public final boolean allowDiagonalDescend;
public final boolean allowDiagonalAscend;
public final boolean allowDownward;
@@ -72,11 +79,14 @@ public class CalculationContext {
public final double walkOnWaterOnePenalty;
public final BetterWorldBorder worldBorder;
public final PrecomputedData precomputedData;
public CalculationContext(IBaritone baritone) {
this(baritone, false);
}
public CalculationContext(IBaritone baritone, boolean forUseOnAnotherThread) {
this.precomputedData = new PrecomputedData();
this.safeForThreadedUse = forUseOnAnotherThread;
this.baritone = baritone;
LocalPlayer player = baritone.getPlayerContext().player();
@@ -89,11 +99,13 @@ public class CalculationContext {
this.canSprint = Baritone.settings().allowSprint.value && player.getFoodData().getFoodLevel() > 6;
this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value;
this.allowBreak = Baritone.settings().allowBreak.value;
this.allowBreakAnyway = new ArrayList<>(Baritone.settings().allowBreakAnyway.value);
this.allowParkour = Baritone.settings().allowParkour.value;
this.allowParkourPlace = Baritone.settings().allowParkourPlace.value;
this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value;
this.allowParkourAscend = Baritone.settings().allowParkourAscend.value;
this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value;
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;
@@ -143,14 +155,13 @@ public class CalculationContext {
return COST_INF;
}
if (!worldBorder.canPlaceAt(x, z)) {
// TODO perhaps MovementHelper.canPlaceAgainst could also use this?
return COST_INF;
}
return placeBlockCost;
}
public double breakCostMultiplierAt(int x, int y, int z, BlockState current) {
if (!allowBreak) {
if (!allowBreak && !allowBreakAnyway.contains(current.getBlock())) {
return COST_INF;
}
if (isPossiblyProtected(x, y, z)) {

View File

@@ -123,7 +123,7 @@ public abstract class Movement implements IMovement, MovementHelper {
public MovementStatus update() {
ctx.player().getAbilities().flying = false;
currentState = updateState(currentState);
if (MovementHelper.isLiquid(ctx, ctx.playerFeet())) {
if (MovementHelper.isLiquid(ctx, ctx.playerFeet()) && ctx.player().position().y < dest.y + 0.6) {
currentState.setInput(Input.JUMP, true);
}
if (ctx.player().isInWall()) {

View File

@@ -26,29 +26,35 @@ import baritone.api.utils.*;
import baritone.api.utils.Rotation;
import baritone.api.utils.input.Input;
import baritone.pathing.movement.MovementState.MovementTarget;
import baritone.pathing.precompute.Ternary;
import baritone.utils.BlockStateInterface;
import baritone.utils.ToolSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
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;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Half;
import net.minecraft.world.level.block.state.properties.SlabType;
import net.minecraft.world.level.block.state.properties.StairsShape;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
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 static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP;
import static baritone.pathing.precompute.Ternary.*;
/**
* Static helpers for cost calculation
@@ -58,6 +64,9 @@ import static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN_____S
public interface MovementHelper extends ActionCosts, Helper {
static boolean avoidBreaking(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
if (!bsi.worldBorder.canPlaceAt(x, z)) {
return true;
}
Block b = state.getBlock();
return Baritone.settings().blocksToDisallowBreaking.value.contains(b)
|| b == Blocks.ICE // ice becomes water, and water can mess up the path
@@ -83,6 +92,19 @@ public interface MovementHelper extends ActionCosts, Helper {
&& FallingBlock.isFree(bsi.get0(x, y - 1, z))) { // and if it would fall (i.e. it's unsupported)
return true; // dont break a block that is adjacent to unsupported gravel because it can cause really weird stuff
}
// only pure liquids for now
// waterlogged blocks can have closed bottom sides and such
if (block instanceof LiquidBlock) {
if (directlyAbove || Baritone.settings().strictLiquidCheck.value) {
return true;
}
int level = state.getValue(LiquidBlock.LEVEL);
if (level == 0) {
return true; // source blocks like to flow horizontally
}
// everything else will prefer flowing down
return !(bsi.get0(x, y - 1, z).getBlock() instanceof LiquidBlock); // assume everything is in a static state
}
return !state.getFluidState().isEmpty();
}
@@ -94,32 +116,88 @@ public interface MovementHelper extends ActionCosts, Helper {
return canWalkThrough(bsi, x, y, z, bsi.get0(x, y, z));
}
static boolean canWalkThrough(CalculationContext context, int x, int y, int z, BlockState state) {
return context.precomputedData.canWalkThrough(context.bsi, x, y, z, state);
}
static boolean canWalkThrough(CalculationContext context, int x, int y, int z) {
return context.precomputedData.canWalkThrough(context.bsi, x, y, z, context.get(x, y, z));
}
static boolean canWalkThrough(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
Block block = state.getBlock();
if (block instanceof AirBlock) { // early return for most common case
Ternary canWalkThrough = canWalkThroughBlockState(state);
if (canWalkThrough == YES) {
return true;
}
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.POINTED_DRIPSTONE || block == Blocks.AMETHYST_CLUSTER || block instanceof AzaleaBlock) {
if (canWalkThrough == NO) {
return false;
}
return canWalkThroughPosition(bsi, x, y, z, state);
}
static Ternary canWalkThroughBlockState(BlockState state) {
Block block = state.getBlock();
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) {
return NO;
}
if (block == Blocks.BIG_DRIPLEAF) {
return false;
return NO;
}
if (block == Blocks.POWDER_SNOW) {
return NO;
}
if (Baritone.settings().blocksToAvoid.value.contains(block)) {
return false;
return NO;
}
if (block instanceof DoorBlock || block instanceof FenceGateBlock) {
// Because there's no nice method in vanilla to check if a door is openable or not, we just have to assume
// that anything that isn't an iron door isn't openable, ignoring that some doors introduced in mods can't
// be opened by just interacting.
return block != Blocks.IRON_DOOR;
// TODO this assumes that all doors in all mods are openable
if (block == Blocks.IRON_DOOR) {
return NO;
}
return YES;
}
if (block instanceof WoolCarpetBlock) {
return canWalkOn(bsi, x, y - 1, z);
if (block instanceof CarpetBlock) {
return MAYBE;
}
if (block instanceof SnowLayerBlock) {
// we've already checked doors and fence gates
// so the only remaining dynamic isPassables are snow and trapdoor
// snow layers cached as the top layer of a packed chunk have no metadata, we can't make a decision based on their depth here
// it would otherwise make long distance pathing through snowy biomes impossible
return MAYBE;
}
FluidState fluidState = state.getFluidState();
if (!fluidState.isEmpty()) {
if (fluidState.getType().getAmount(fluidState) != 8) {
return NO;
} else {
return MAYBE;
}
}
if (block instanceof CauldronBlock) {
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;
}
}
static boolean canWalkThroughPosition(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
Block block = state.getBlock();
if (block instanceof CarpetBlock) {
return canWalkOn(bsi, x, y - 1, z);
}
if (block instanceof SnowLayerBlock) {
// if they're cached as a top block, we don't know their metadata
// default to true (mostly because it would otherwise make long distance pathing through snowy biomes impossible)
if (!bsi.worldContainsLoadedChunk(x, z)) {
@@ -134,52 +212,33 @@ public interface MovementHelper extends ActionCosts, Helper {
return canWalkOn(bsi, x, y - 1, z);
}
if (isFlowing(x, y, z, state, bsi)) {
return false; // Don't walk through flowing liquids
}
FluidState fluidState = state.getFluidState();
if (fluidState.getType() instanceof WaterFluid) {
if (!fluidState.isEmpty()) {
if (isFlowing(x, y, z, state, bsi)) {
return false;
}
// Everything after this point has to be a special case as it relies on the water not being flowing, which means a special case is needed.
if (Baritone.settings().assumeWalkOnWater.value) {
return false;
}
BlockState up = bsi.get0(x, y + 1, z);
if (!up.getFluidState().isEmpty() || up.getBlock() instanceof WaterlilyBlock) {
return false;
}
return true;
return fluidState.getType() instanceof WaterFluid;
}
// 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
}
/**
* canWalkThrough but also won't impede movement at all. so not including doors or fence gates (we'd have to right click),
* not including water, and not including ladders or vines or cobwebs (they slow us down)
*
* @param context Calculation context to provide block state lookup
* @param x The block's x position
* @param y The block's y position
* @param z The block's z position
* @return Whether or not the block at the specified position
*/
static boolean fullyPassable(CalculationContext context, int x, int y, int z) {
return fullyPassable(
context.bsi.access,
context.bsi.isPassableBlockPos.set(x, y, z),
context.bsi.get0(x, y, z)
);
}
static boolean fullyPassable(IPlayerContext ctx, BlockPos pos) {
return fullyPassable(ctx.world(), pos, ctx.world().getBlockState(pos));
}
static boolean fullyPassable(BlockGetter access, BlockPos pos, BlockState state) {
static Ternary fullyPassableBlockState(BlockState state) {
Block block = state.getBlock();
if (block instanceof AirBlock) { // early return for most common case
return true;
return YES;
}
// exceptions - blocks that are isPassable true, but we can't actually jump through
if (block instanceof BaseFireBlock
@@ -197,10 +256,49 @@ public interface MovementHelper extends ActionCosts, Helper {
|| block instanceof EndPortalBlock
|| block instanceof SkullBlock
|| block instanceof ShulkerBoxBlock) {
return false;
return NO;
}
// door, fence gate, liquid, trapdoor have been accounted for, nothing else uses the world or pos parameters
return state.isPathfindable(access, pos, PathComputationType.LAND);
// at least in 1.12.2 vanilla, that is.....
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;
}
}
/**
* canWalkThrough but also won't impede movement at all. so not including doors or fence gates (we'd have to right click),
* not including water, and not including ladders or vines or cobwebs (they slow us down)
*/
static boolean fullyPassable(CalculationContext context, int x, int y, int z) {
return fullyPassable(context, x, y, z, context.get(x, y, z));
}
static boolean fullyPassable(CalculationContext context, int x, int y, int z, BlockState state) {
return context.precomputedData.fullyPassable(context.bsi, x, y, z, state);
}
static boolean fullyPassable(IPlayerContext ctx, BlockPos pos) {
BlockState state = ctx.world().getBlockState(pos);
Ternary fullyPassable = fullyPassableBlockState(state);
if (fullyPassable == YES) {
return true;
}
if (fullyPassable == NO) {
return false;
}
return fullyPassablePosition(new BlockStateInterface(ctx), pos.getX(), pos.getY(), pos.getZ(), state); // meh
}
static boolean fullyPassablePosition(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
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) {
@@ -288,6 +386,7 @@ public interface MovementHelper extends ActionCosts, Helper {
return !state.getFluidState().isEmpty()
|| block == Blocks.MAGMA_BLOCK
|| block == Blocks.CACTUS
|| block == Blocks.SWEET_BERRY_BUSH
|| block instanceof BaseFireBlock
|| block == Blocks.END_PORTAL
|| block == Blocks.COBWEB
@@ -298,6 +397,8 @@ public interface MovementHelper extends ActionCosts, Helper {
* Can I walk on this block without anything weird happening like me falling
* through? Includes water because we know that we automatically jump on
* water
* <p>
* If changing something in this function remember to also change it in precomputed data
*
* @param bsi Block state provider
* @param x The block's x position
@@ -307,36 +408,68 @@ public interface MovementHelper extends ActionCosts, Helper {
* @return Whether or not the specified block can be walked on
*/
static boolean canWalkOn(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
Block block = state.getBlock();
if (block instanceof AirBlock || block == Blocks.MAGMA_BLOCK || block == Blocks.BUBBLE_COLUMN || block == Blocks.HONEY_BLOCK) {
// early return for most common case (air)
// plus magma, which is a normal cube but it hurts you
Ternary canWalkOn = canWalkOnBlockState(state);
if (canWalkOn == YES) {
return true;
}
if (canWalkOn == NO) {
return false;
}
if (isBlockNormalCube(state)) {
return true;
return canWalkOnPosition(bsi, x, y, z, state);
}
static Ternary canWalkOnBlockState(BlockState state) {
Block block = state.getBlock();
if (isBlockNormalCube(state) && block != Blocks.MAGMA_BLOCK && block != Blocks.BUBBLE_COLUMN && block != Blocks.HONEY_BLOCK) {
return YES;
}
if (block instanceof AzaleaBlock) {
return true;
return YES;
}
if (block == Blocks.LADDER || (block == Blocks.VINE && Baritone.settings().allowVines.value)) { // TODO reconsider this
return true;
return YES;
}
if (block == Blocks.FARMLAND || block == Blocks.DIRT_PATH) {
return true;
return YES;
}
if (block == Blocks.ENDER_CHEST || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST) {
return true;
return YES;
}
if (block == Blocks.GLASS || block instanceof StainedGlassBlock) {
return YES;
}
if (block instanceof StairBlock) {
return YES;
}
if (isWater(state)) {
return MAYBE;
}
if (MovementHelper.isLava(state) && Baritone.settings().assumeWalkOnLava.value) {
return MAYBE;
}
if (block instanceof SlabBlock) {
if (!Baritone.settings().allowWalkOnBottomSlab.value) {
if (state.getValue(SlabBlock.TYPE) != SlabType.BOTTOM) {
return YES;
}
return NO;
}
return YES;
}
return NO;
}
static boolean canWalkOnPosition(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
Block block = state.getBlock();
if (isWater(state)) {
// since this is called literally millions of times per second, the benefit of not allocating millions of useless "pos.up()"
// BlockPos s that we'd just garbage collect immediately is actually noticeable. I don't even think its a decrease in readability
BlockState upState = bsi.get0(x, y + 1, z);
Block up = upState.getBlock();
if (up == Blocks.LILY_PAD || up instanceof WoolCarpetBlock) {
if (up == Blocks.LILY_PAD || up instanceof CarpetBlock) {
return true;
}
if (isFlowing(x, y, z, state, bsi) || upState.getFluidState().getType() == Fluids.FLOWING_WATER) {
if (MovementHelper.isFlowing(x, y, z, state, bsi) || upState.getFluidState().getType() == Fluids.FLOWING_WATER) {
// the only scenario in which we can walk on flowing water is if it's under still water with jesus off
return isWater(upState) && !Baritone.settings().assumeWalkOnWater.value;
}
@@ -344,19 +477,20 @@ public interface MovementHelper extends ActionCosts, Helper {
// if assumeWalkOnWater is off, we can only walk on water if there is water above it
return isWater(upState) ^ Baritone.settings().assumeWalkOnWater.value;
}
if (Baritone.settings().assumeWalkOnLava.value && isLava(state) && !isFlowing(x, y, z, state, bsi)) {
if (MovementHelper.isLava(state) && !MovementHelper.isFlowing(x, y, z, state, bsi) && Baritone.settings().assumeWalkOnLava.value) { // if we get here it means that assumeWalkOnLava must be true, so put it last
return true;
}
if (block == Blocks.GLASS || block instanceof StainedGlassBlock) {
return true;
}
if (block instanceof SlabBlock) {
if (!Baritone.settings().allowWalkOnBottomSlab.value) {
return state.getValue(SlabBlock.TYPE) != SlabType.BOTTOM;
}
return true;
}
return block instanceof StairBlock;
return false; // If we don't recognise it then we want to just return false to be safe.
}
static boolean canWalkOn(CalculationContext context, int x, int y, int z, BlockState state) {
return context.precomputedData.canWalkOn(context.bsi, x, y, z, state);
}
static boolean canWalkOn(CalculationContext context, int x, int y, int z) {
return canWalkOn(context, x, y, z, context.get(x, y, z));
}
static boolean canWalkOn(IPlayerContext ctx, BetterBlockPos pos, BlockState state) {
@@ -375,6 +509,61 @@ public interface MovementHelper extends ActionCosts, Helper {
return canWalkOn(bsi, x, y, z, bsi.get0(x, y, z));
}
static boolean canUseFrostWalker(CalculationContext context, BlockState state) {
return context.frostWalker != 0
&& state.getMaterial() == Material.WATER
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
}
static boolean canUseFrostWalker(IPlayerContext ctx, BlockPos pos) {
BlockState state = BlockStateInterface.get(ctx, pos);
return EnchantmentHelper.hasFrostWalker(ctx.player())
&& state.getMaterial() == Material.WATER
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
}
/**
* If movements make us stand/walk on this block, will it have a top to walk on?
*/
static boolean mustBeSolidToWalkOn(CalculationContext context, int x, int y, int z, BlockState state) {
Block block = state.getBlock();
if (block == Blocks.LADDER || block == Blocks.VINE) {
return false;
}
if (!state.getFluidState().isEmpty()) {
// used for frostwalker so only includes blocks where we are still on ground when leaving them to any side
if (block instanceof SlabBlock) {
if (state.getValue(SlabBlock.TYPE) != SlabType.BOTTOM) {
return true;
}
} else if (block instanceof StairBlock) {
if (state.getValue(StairBlock.HALF) == Half.TOP) {
return true;
}
StairsShape shape = state.getValue(StairBlock.SHAPE);
if (shape == StairsShape.INNER_LEFT || shape == StairsShape.INNER_RIGHT) {
return true;
}
} else if (block instanceof TrapDoorBlock) {
if (!state.getValue(TrapDoorBlock.OPEN) && state.getValue(TrapDoorBlock.HALF) == Half.TOP) {
return true;
}
} else if (block == Blocks.SCAFFOLDING) {
return true;
} else if (block instanceof LeavesBlock) {
return true;
}
if (context.assumeWalkOnWater) {
return false;
}
Block blockAbove = context.getBlock(x, y + 1, z);
if (blockAbove instanceof LiquidBlock) {
return false;
}
}
return true;
}
static boolean canPlaceAgainst(BlockStateInterface bsi, int x, int y, int z) {
return canPlaceAgainst(bsi, x, y, z, bsi.get0(x, y, z));
}
@@ -388,6 +577,9 @@ public interface MovementHelper extends ActionCosts, Helper {
}
static boolean canPlaceAgainst(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
if (!bsi.worldBorder.canPlaceAt(x, z)) {
return false;
}
// can we look at the center of a side face of this block and likely be able to place?
// (thats how this check is used)
// therefore dont include weird things that we technically could place against (like carpet) but practically can't
@@ -400,7 +592,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static double getMiningDurationTicks(CalculationContext context, int x, int y, int z, BlockState state, boolean includeFalling) {
Block block = state.getBlock();
if (!canWalkThrough(context.bsi, x, y, z, state)) {
if (!canWalkThrough(context, x, y, z, state)) {
if (!state.getFluidState().isEmpty()) {
return COST_INF;
}
@@ -532,7 +724,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean isBlockNormalCube(BlockState state) {
Block block = state.getBlock();
if (block instanceof BambooBlock
if (block instanceof BambooStalkBlock
|| block instanceof MovingPistonBlock
|| block instanceof ScaffoldingBlock
|| block instanceof ShulkerBoxBlock
@@ -609,7 +801,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean isTransparent(Block b) {
return b == Blocks.AIR ||
return b instanceof AirBlock ||
b == Blocks.LAVA ||
b == Blocks.WATER;
}

View File

@@ -67,7 +67,7 @@ public class MovementAscend extends Movement {
public static double cost(CalculationContext context, int x, int y, int z, int destX, int destZ) {
BlockState toPlace = context.get(destX, y, destZ);
double additionalPlacementCost = 0;
if (!MovementHelper.canWalkOn(context.bsi, destX, y, destZ, toPlace)) {
if (!MovementHelper.canWalkOn(context, destX, y, destZ, toPlace)) {
additionalPlacementCost = context.costOfPlacingAt(destX, y, destZ, toPlace);
if (additionalPlacementCost >= COST_INF) {
return COST_INF;
@@ -93,7 +93,7 @@ public class MovementAscend extends Movement {
}
}
BlockState srcUp2 = context.get(x, y + 2, z); // used lower down anyway
if (context.get(x, y + 3, z).getBlock() instanceof FallingBlock && (MovementHelper.canWalkThrough(context.bsi, x, y + 1, z) || !(srcUp2.getBlock() instanceof FallingBlock))) {//it would fall on us and possibly suffocate us
if (context.get(x, y + 3, z).getBlock() instanceof FallingBlock && (MovementHelper.canWalkThrough(context, x, y + 1, z) || !(srcUp2.getBlock() instanceof FallingBlock))) {//it would fall on us and possibly suffocate us
// HOWEVER, we assume that we're standing in the start position
// that means that src and src.up(1) are both air
// maybe they aren't now, but they will be by the time this starts

View File

@@ -42,6 +42,7 @@ import net.minecraft.world.phys.Vec3;
public class MovementDescend extends Movement {
private int numTicks = 0;
public boolean forceSafeMode = false;
public MovementDescend(IBaritone baritone, BetterBlockPos start, BetterBlockPos end) {
super(baritone, start, end, new BetterBlockPos[]{end.above(2), end.above(), end}, end.below());
@@ -51,6 +52,14 @@ public class MovementDescend extends Movement {
public void reset() {
super.reset();
numTicks = 0;
forceSafeMode = false;
}
/**
* Called by PathExecutor if needing safeMode can only be detected with knowledge about the next movement
*/
public void forceSafeMode() {
forceSafeMode = true;
}
@Override
@@ -100,7 +109,7 @@ public class MovementDescend extends Movement {
//C, D, etc determine the length of the fall
BlockState below = context.get(destX, y - 2, destZ);
if (!MovementHelper.canWalkOn(context.bsi, destX, y - 2, destZ, below)) {
if (!MovementHelper.canWalkOn(context, destX, y - 2, destZ, below)) {
dynamicFallCost(context, x, y, z, destX, destZ, totalCost, below, res);
return;
}
@@ -108,6 +117,9 @@ public class MovementDescend extends Movement {
if (destDown.getBlock() == Blocks.LADDER || destDown.getBlock() == Blocks.VINE) {
return;
}
if (MovementHelper.canUseFrostWalker(context, destDown)) { // no need to check assumeWalkOnWater
return; // the water will freeze when we try to walk into it
}
// we walk half the block plus 0.3 to get to the edge, then we walk the other 0.2 while simultaneously falling (math.max because of how it's in parallel)
double walk = WALK_OFF_BLOCK_COST;
@@ -129,7 +141,7 @@ public class MovementDescend extends Movement {
// and potentially replace the water we're going to fall into
return false;
}
if (!MovementHelper.canWalkThrough(context.bsi, destX, y - 2, destZ, below)) {
if (!MovementHelper.canWalkThrough(context, destX, y - 2, destZ, below)) {
return false;
}
double costSoFar = 0;
@@ -145,7 +157,7 @@ public class MovementDescend extends Movement {
int unprotectedFallHeight = fallHeight - (y - effectiveStartHeight); // equal to fallHeight - y + effectiveFallHeight, which is equal to -newY + effectiveFallHeight, which is equal to effectiveFallHeight - newY
double tentativeCost = WALK_OFF_BLOCK_COST + FALL_N_BLOCKS_COST[unprotectedFallHeight] + frontBreak + costSoFar;
if (MovementHelper.isWater(ontoBlock)) {
if (!MovementHelper.canWalkThrough(context.bsi, destX, newY, destZ, ontoBlock)) {
if (!MovementHelper.canWalkThrough(context, destX, newY, destZ, ontoBlock)) {
return false;
}
if (context.assumeWalkOnWater) {
@@ -154,7 +166,7 @@ public class MovementDescend extends Movement {
if (MovementHelper.isFlowing(destX, newY, destZ, ontoBlock, context.bsi)) {
return false; // TODO flowing check required here?
}
if (!MovementHelper.canWalkOn(context.bsi, destX, newY - 1, destZ)) {
if (!MovementHelper.canWalkOn(context, destX, newY - 1, destZ)) {
// we could punch right through the water into something else
return false;
}
@@ -173,10 +185,10 @@ public class MovementDescend extends Movement {
effectiveStartHeight = newY;
continue;
}
if (MovementHelper.canWalkThrough(context.bsi, destX, newY, destZ, ontoBlock)) {
if (MovementHelper.canWalkThrough(context, destX, newY, destZ, ontoBlock)) {
continue;
}
if (!MovementHelper.canWalkOn(context.bsi, destX, newY, destZ, ontoBlock)) {
if (!MovementHelper.canWalkOn(context, destX, newY, destZ, ontoBlock)) {
return false;
}
if (MovementHelper.isBottomSlab(ontoBlock)) {
@@ -247,6 +259,9 @@ public class MovementDescend extends Movement {
}
public boolean safeMode() {
if (forceSafeMode) {
return true;
}
// (dest - src) + dest is offset 1 more in the same direction
// so it's the block we'd need to worry about running into if we decide to sprint straight through this descend
BlockPos into = dest.subtract(src.below()).offset(dest);

View File

@@ -59,7 +59,7 @@ public class MovementDiagonal extends Movement {
@Override
protected boolean safeToCancel(MovementState state) {
//too simple. backfill does not work after cornering with this
//return MovementHelper.canWalkOn(ctx, ctx.playerFeet().down());
//return context.precomputedData.canWalkOn(ctx, ctx.playerFeet().down());
LocalPlayer player = ctx.player();
double offset = 0.25;
double x = player.position().x;
@@ -109,40 +109,49 @@ public class MovementDiagonal extends Movement {
}
public static void cost(CalculationContext context, int x, int y, int z, int destX, int destZ, MutableMoveResult res) {
if (!MovementHelper.canWalkThrough(context.bsi, destX, y + 1, destZ)) {
if (!MovementHelper.canWalkThrough(context, destX, y + 1, destZ)) {
return;
}
BlockState destInto = context.get(destX, y, destZ);
BlockState fromDown;
boolean ascend = false;
BlockState destWalkOn;
boolean descend = false;
if (!MovementHelper.canWalkThrough(context.bsi, destX, y, destZ, destInto)) {
boolean frostWalker = false;
if (!MovementHelper.canWalkThrough(context, destX, y, destZ, destInto)) {
ascend = true;
if (!context.allowDiagonalAscend || !MovementHelper.canWalkThrough(context.bsi, x, y + 2, z) || !MovementHelper.canWalkOn(context.bsi, destX, y, destZ, destInto) || !MovementHelper.canWalkThrough(context.bsi, destX, y + 2, destZ)) {
if (!context.allowDiagonalAscend || !MovementHelper.canWalkThrough(context, x, y + 2, z) || !MovementHelper.canWalkOn(context, destX, y, destZ, destInto) || !MovementHelper.canWalkThrough(context, destX, y + 2, destZ)) {
return;
}
destWalkOn = destInto;
fromDown = context.get(x, y - 1, z);
} else {
destWalkOn = context.get(destX, y - 1, destZ);
if (!MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, destWalkOn)) {
fromDown = context.get(x, y - 1, z);
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y - 1, z, fromDown);
frostWalker = standingOnABlock && MovementHelper.canUseFrostWalker(context, destWalkOn);
if (!frostWalker && !MovementHelper.canWalkOn(context, destX, y - 1, destZ, destWalkOn)) {
descend = true;
if (!context.allowDiagonalDescend || !MovementHelper.canWalkOn(context.bsi, destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context.bsi, destX, y - 1, destZ, destWalkOn)) {
if (!context.allowDiagonalDescend || !MovementHelper.canWalkOn(context, destX, y - 2, destZ) || !MovementHelper.canWalkThrough(context, destX, y - 1, destZ, destWalkOn)) {
return;
}
}
frostWalker &= !context.assumeWalkOnWater; // do this after checking for descends because jesus can't prevent the water from freezing, it just prevents us from relying on the water freezing
}
double multiplier = WALK_ONE_BLOCK_COST;
// For either possible soul sand, that affects half of our walking
if (destWalkOn.getBlock() == Blocks.SOUL_SAND) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} else if (frostWalker) {
// frostwalker lets us walk on water without the penalty
} else if (destWalkOn.getBlock() == Blocks.WATER) {
multiplier += context.walkOnWaterOnePenalty * SQRT_2;
}
Block fromDown = context.get(x, y - 1, z).getBlock();
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
Block fromDownBlock = fromDown.getBlock();
if (fromDownBlock == Blocks.LADDER || fromDownBlock == Blocks.VINE) {
return;
}
if (fromDown == Blocks.SOUL_SAND) {
if (fromDownBlock == Blocks.SOUL_SAND) {
multiplier += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
}
BlockState cuttingOver1 = context.get(x, y - 1, destZ);
@@ -169,17 +178,17 @@ public class MovementDiagonal extends Movement {
BlockState pb0 = context.get(x, y, destZ);
BlockState pb2 = context.get(destX, y, z);
if (ascend) {
boolean ATop = MovementHelper.canWalkThrough(context.bsi, x, y + 2, destZ);
boolean AMid = MovementHelper.canWalkThrough(context.bsi, x, y + 1, destZ);
boolean ALow = MovementHelper.canWalkThrough(context.bsi, x, y, destZ, pb0);
boolean BTop = MovementHelper.canWalkThrough(context.bsi, destX, y + 2, z);
boolean BMid = MovementHelper.canWalkThrough(context.bsi, destX, y + 1, z);
boolean BLow = MovementHelper.canWalkThrough(context.bsi, destX, y, z, pb2);
boolean ATop = MovementHelper.canWalkThrough(context, x, y + 2, destZ);
boolean AMid = MovementHelper.canWalkThrough(context, x, y + 1, destZ);
boolean ALow = MovementHelper.canWalkThrough(context, x, y, destZ, pb0);
boolean BTop = MovementHelper.canWalkThrough(context, destX, y + 2, z);
boolean BMid = MovementHelper.canWalkThrough(context, destX, y + 1, z);
boolean BLow = MovementHelper.canWalkThrough(context, destX, y, z, pb2);
if ((!(ATop && AMid && ALow) && !(BTop && BMid && BLow)) // no option
|| MovementHelper.avoidWalkingInto(pb0) // bad
|| MovementHelper.avoidWalkingInto(pb2) // bad
|| (ATop && AMid && MovementHelper.canWalkOn(context.bsi, x, y, destZ, pb0)) // we could just ascend
|| (BTop && BMid && MovementHelper.canWalkOn(context.bsi, destX, y, z, pb2)) // we could just ascend
|| (ATop && AMid && MovementHelper.canWalkOn(context, x, y, destZ, pb0)) // we could just ascend
|| (BTop && BMid && MovementHelper.canWalkOn(context, destX, y, z, pb2)) // we could just ascend
|| (!ATop && AMid && ALow) // head bonk A
|| (!BTop && BMid && BLow)) { // head bonk B
return;

View File

@@ -58,7 +58,7 @@ public class MovementDownward extends Movement {
if (!context.allowDownward) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(context.bsi, x, y - 2, z)) {
if (!MovementHelper.canWalkOn(context, x, y - 2, z)) {
return COST_INF;
}
BlockState down = context.get(x, y - 1, z);

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;
@@ -27,16 +28,16 @@ import baritone.pathing.movement.MovementHelper;
import baritone.pathing.movement.MovementState;
import baritone.utils.BlockStateInterface;
import baritone.utils.pathing.MutableMoveResult;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.WaterFluid;
import java.util.HashSet;
import java.util.Set;
public class MovementParkour extends Movement {
private static final BetterBlockPos[] EMPTY = new BetterBlockPos[]{};
@@ -74,7 +75,7 @@ public class MovementParkour extends Movement {
return;
}
BlockState adj = context.get(x + xDiff, y - 1, z + zDiff);
if (MovementHelper.canWalkOn(context.bsi, x + xDiff, y - 1, z + zDiff, adj)) { // don't parkour if we could just traverse (for now)
if (MovementHelper.canWalkOn(context, x + xDiff, y - 1, z + zDiff, adj)) { // don't parkour if we could just traverse (for now)
// second most common case -- we could just traverse not parkour
return;
}
@@ -91,9 +92,16 @@ public class MovementParkour extends Movement {
return;
}
BlockState standingOn = context.get(x, y - 1, z);
if (standingOn.getBlock() == Blocks.VINE || standingOn.getBlock() == Blocks.LADDER || standingOn.getBlock() instanceof StairBlock || MovementHelper.isBottomSlab(standingOn) || standingOn.getFluidState().getType() != Fluids.EMPTY) {
if (standingOn.getBlock() == Blocks.VINE || standingOn.getBlock() == Blocks.LADDER || standingOn.getBlock() instanceof StairBlock || MovementHelper.isBottomSlab(standingOn)) {
return;
}
// we can't jump from (frozen) water with assumeWalkOnWater because we can't be sure it will be frozen
if (context.assumeWalkOnWater && !standingOn.getFluidState().isEmpty()) {
return;
}
if (!context.get(x, y, z).getFluidState().isEmpty()) {
return; // can't jump out of water
}
int maxJump;
if (standingOn.getBlock() == Blocks.SOUL_SAND) {
maxJump = 2; // 1 block gap
@@ -104,13 +112,13 @@ public class MovementParkour extends Movement {
maxJump = 3;
}
}
// check parkour jumps from smallest to largest for obstacles/walls and landing positions
int verifiedMaxJump = 1; // i - 1 (when i = 2)
for (int i = 2; i <= maxJump; i++) {
int destX = x + xDiff * i;
int destZ = z + zDiff * i;
// check head/feet
if (!MovementHelper.fullyPassable(context, destX, y + 1, destZ)) {
break;
@@ -118,11 +126,11 @@ public class MovementParkour extends Movement {
if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) {
break;
}
// check for ascend landing position
BlockState destInto = context.bsi.get0(destX, y, destZ);
if (!MovementHelper.fullyPassable(context.bsi.access, context.bsi.isPassableBlockPos.set(destX, y, destZ), destInto)) {
if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context.bsi, destX, y, destZ, destInto) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) {
if (!MovementHelper.fullyPassable(context, destX, y, destZ, destInto)) {
if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context, destX, y, destZ, destInto) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) {
res.x = destX;
res.y = y + 1;
res.z = destZ;
@@ -131,11 +139,14 @@ public class MovementParkour extends Movement {
}
break;
}
// check for flat landing position
BlockState landingOn = context.bsi.get0(destX, y - 1, destZ);
// farmland needs to be canWalkOn otherwise farm can never work at all, but we want to specifically disallow ending a jump on farmland haha
if (landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, landingOn)) {
// frostwalker works here because we can't jump from possibly unfrozen water
if ((landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context, destX, y - 1, destZ, landingOn))
|| (Math.min(16, context.frostWalker + 2) >= i && MovementHelper.canUseFrostWalker(context, landingOn))
) {
if (checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) {
res.x = destX;
res.y = y;
@@ -145,14 +156,14 @@ public class MovementParkour extends Movement {
}
break;
}
if (!MovementHelper.fullyPassable(context, destX, y + 3, destZ)) {
break;
}
verifiedMaxJump = i;
}
// parkour place starts here
if (!context.allowParkourPlace) {
return;
@@ -265,7 +276,12 @@ public class MovementParkour extends Movement {
}
} else if (!ctx.playerFeet().equals(src)) {
if (ctx.playerFeet().equals(src.relative(direction)) || ctx.player().position().y - src.y > 0.0001) {
if (!MovementHelper.canWalkOn(ctx, dest.below()) && !ctx.player().isOnGround() && MovementHelper.attemptToPlaceABlock(state, baritone, dest.below(), true, false) == PlaceResult.READY_TO_PLACE) {
if (Baritone.settings().allowPlace.value // see PR #3775
&& ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway()
&& !MovementHelper.canWalkOn(ctx, dest.below())
&& !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
state.setInput(Input.CLICK_RIGHT, true);
}

View File

@@ -35,6 +35,7 @@ import net.minecraft.core.BlockPos;
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;
@@ -42,6 +43,7 @@ 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;
import java.util.Set;
public class MovementPillar extends Movement {
@@ -105,6 +107,10 @@ public class MovementPillar extends Movement {
// if we're standing on water and assumeWalkOnWater is false, we must have ascended to here, or sneak backplaced, so it is possible to pillar again
return COST_INF;
}
if ((from == Blocks.LILY_PAD || from instanceof CarpetBlock) && !fromDown.getFluidState().isEmpty()) {
// to ascend here we'd have to break the block we are standing on
return COST_INF;
}
double hardness = MovementHelper.getMiningDurationTicks(context, x, y + 2, z, toBreak, true);
if (hardness >= COST_INF) {
return COST_INF;
@@ -124,7 +130,7 @@ public class MovementPillar extends Movement {
}
}
// this is commented because it may have had a purpose, but it's very unclear what it was. it's from the minebot era.
//if (!MovementHelper.canWalkOn(chkPos, check) || MovementHelper.canWalkThrough(chkPos, check)) {//if the block above where we want to break is not a full block, don't do it
//if (!MovementHelper.canWalkOn(context, chkPos, check) || MovementHelper.canWalkThrough(context, chkPos, check)) {//if the block above where we want to break is not a full block, don't do it
// TODO why does canWalkThrough mean this action is COST_INF?
// FallingBlock makes sense, and !canWalkOn deals with weird cases like if it were lava
// but I don't understand why canWalkThrough makes it impossible

View File

@@ -35,14 +35,15 @@ import net.minecraft.core.BlockPos;
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.DoorBlock;
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.level.material.WaterFluid;
import net.minecraft.world.phys.Vec3;
import java.util.Optional;
import java.util.Set;
@@ -70,16 +71,18 @@ public class MovementTraverse extends Movement {
@Override
protected Set<BetterBlockPos> calculateValidPositions() {
return ImmutableSet.of(src, dest);
return ImmutableSet.of(src, dest); // src.above means that we don't get caught in an infinite loop in water
}
public static double cost(CalculationContext context, int x, int y, int z, int destX, int destZ) {
BlockState pb0 = context.get(destX, y + 1, destZ);
BlockState pb1 = context.get(destX, y, destZ);
BlockState destOn = context.get(destX, y - 1, destZ);
BlockState down = context.get(x, y - 1, z);
Block srcDown = down.getBlock();
if (MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, destOn)) {//this is a walk, not a bridge
BlockState srcDown = context.get(x, y - 1, z);
Block srcDownBlock = srcDown.getBlock();
boolean standingOnABlock = MovementHelper.mustBeSolidToWalkOn(context, x, y - 1, z, srcDown);
boolean frostWalker = standingOnABlock && !context.assumeWalkOnWater && MovementHelper.canUseFrostWalker(context, destOn);
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;
if (MovementHelper.isWater(pb0) || MovementHelper.isWater(pb1)) {
@@ -88,10 +91,12 @@ public class MovementTraverse extends Movement {
} else {
if (destOn.getBlock() == Blocks.SOUL_SAND) {
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
} else if (frostWalker) {
// with frostwalker we can walk on water without the penalty, if we are sure we won't be using jesus
} else if (destOn.getBlock() == Blocks.WATER) {
WC += context.walkOnWaterOnePenalty;
}
if (srcDown == Blocks.SOUL_SAND) {
if (srcDownBlock == Blocks.SOUL_SAND) {
WC += (WALK_ONE_OVER_SOUL_SAND_COST - WALK_ONE_BLOCK_COST) / 2;
}
}
@@ -109,13 +114,13 @@ public class MovementTraverse extends Movement {
}
return WC;
}
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
hardness1 *= 5;
hardness2 *= 5;
}
return WC + hardness1 + hardness2;
} else {//this is a bridge, so we need to place a block
if (srcDown == Blocks.LADDER || srcDown == Blocks.VINE) {
if (srcDownBlock == Blocks.LADDER || srcDownBlock == Blocks.VINE) {
return COST_INF;
}
if (MovementHelper.isReplaceable(destX, y - 1, destZ, destOn, context.bsi)) {
@@ -146,12 +151,16 @@ public class MovementTraverse extends Movement {
}
}
// now that we've checked all possible directions to side place, we actually need to backplace
if (srcDown == Blocks.SOUL_SAND || (srcDown instanceof SlabBlock && down.getValue(SlabBlock.TYPE) != SlabType.DOUBLE)) {
if (srcDownBlock == Blocks.SOUL_SAND || (srcDownBlock instanceof SlabBlock && srcDown.getValue(SlabBlock.TYPE) != SlabType.DOUBLE)) {
return COST_INF; // can't sneak and backplace against soul sand or half slabs (regardless of whether it's top half or bottom half) =/
}
if (down.getFluidState().getType() instanceof WaterFluid) {
if (!standingOnABlock) { // standing on water / swimming
return COST_INF; // this is obviously impossible
}
Block blockSrc = context.getBlock(x, y, z);
if ((blockSrc == Blocks.LILY_PAD || blockSrc instanceof CarpetBlock) && !srcDown.getFluidState().isEmpty()) {
return COST_INF; // we can stand on these but can't place against them
}
WC = WC * (SNEAK_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST);//since we are sneak backplacing, we are sneaking lol
return WC + placeCost + hardness1 + hardness2;
}
@@ -232,11 +241,12 @@ public class MovementTraverse extends Movement {
}
}
boolean isTheBridgeBlockThere = MovementHelper.canWalkOn(ctx, positionToPlace) || ladder;
boolean isTheBridgeBlockThere = MovementHelper.canWalkOn(ctx, positionToPlace) || ladder || MovementHelper.canUseFrostWalker(ctx, positionToPlace);
BlockPos feet = ctx.playerFeet();
if (feet.getY() != dest.getY() && !ladder) {
logDebug("Wrong Y coordinate");
if (feet.getY() < dest.getY()) {
System.out.println("In movement traverse");
return state.setInput(Input.JUMP, true);
}
return state;

View File

@@ -71,8 +71,8 @@ public class PathExecutor implements IPathExecutor, Helper {
private HashSet<BlockPos> toPlace = new HashSet<>();
private HashSet<BlockPos> toWalkInto = new HashSet<>();
private PathingBehavior behavior;
private IPlayerContext ctx;
private final PathingBehavior behavior;
private final IPlayerContext ctx;
private boolean sprintNextTick;
@@ -348,7 +348,7 @@ public class PathExecutor implements IPathExecutor, Helper {
behavior.baritone.getInputOverrideHandler().setInputForceState(Input.SPRINT, false);
// first and foremost, if allowSprint is off, or if we don't have enough hunger, don't try and sprint
if (!new CalculationContext(behavior.baritone).canSprint) {
if (!new CalculationContext(behavior.baritone, false).canSprint) {
return false;
}
IMovement current = path.movements().get(pathPosition);
@@ -378,6 +378,26 @@ public class PathExecutor implements IPathExecutor, Helper {
// however, descend and ascend don't request sprinting, because they don't know the context of what movement comes after it
if (current instanceof MovementDescend) {
if (pathPosition < path.length() - 2) {
// keep this out of onTick, even if that means a tick of delay before it has an effect
IMovement next = path.movements().get(pathPosition + 1);
if (MovementHelper.canUseFrostWalker(ctx, next.getDest().below())) {
// frostwalker only works if you cross the edge of the block on ground so in some cases we may not overshoot
// Since MovementDescend can't know the next movement we have to tell it
if (next instanceof MovementTraverse || next instanceof MovementParkour) {
boolean couldPlaceInstead = Baritone.settings().allowPlace.value && behavior.baritone.getInventoryBehavior().hasGenericThrowaway() && next instanceof MovementParkour; // traverse doesn't react fast enough
// this is true if the next movement does not ascend or descends and goes into the same cardinal direction (N-NE-E-SE-S-SW-W-NW) as the descend
// in that case current.getDirection() is e.g. (0, -1, 1) and next.getDirection() is e.g. (0, 0, 3) so the cross product of (0, 0, 1) and (0, 0, 3) is taken, which is (0, 0, 0) because the vectors are colinear (don't form a plane)
// since movements in exactly the opposite direction (e.g. descend (0, -1, 1) and traverse (0, 0, -1)) would also pass this check we also have to rule out that case
// we can do that by adding the directions because traverse is always 1 long like descend and parkour can't jump through current.getSrc().down()
boolean sameFlatDirection = !current.getDirection().above().offset(next.getDirection()).equals(BlockPos.ZERO)
&& current.getDirection().above().cross(next.getDirection()).equals(BlockPos.ZERO); // here's why you learn maths in school
if (sameFlatDirection && !couldPlaceInstead) {
((MovementDescend) current).forceSafeMode();
}
}
}
}
if (((MovementDescend) current).safeMode() && !((MovementDescend) current).skipToAscend()) {
logDebug("Sprinting would be unsafe");
return false;
@@ -395,11 +415,20 @@ public class PathExecutor implements IPathExecutor, Helper {
return true;
}
if (canSprintFromDescendInto(ctx, current, next)) {
if (next instanceof MovementDescend && pathPosition < path.length() - 3) {
IMovement next_next = path.movements().get(pathPosition + 2);
if (next_next instanceof MovementDescend && !canSprintFromDescendInto(ctx, next, next_next)) {
return false;
}
}
if (ctx.playerFeet().equals(current.getDest())) {
pathPosition++;
onChangeInPathPosition();
onTick();
}
return true;
}
//logDebug("Turning off sprinting " + movement + " " + next + " " + movement.getDirection() + " " + next.getDirection().down() + " " + next.getDirection().down().equals(movement.getDirection()));

View File

@@ -0,0 +1,117 @@
/*
* 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.precompute;
import baritone.pathing.movement.MovementHelper;
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 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;
private int fillData(int id, BlockState state) {
int blockData = 0;
Ternary canWalkOnState = MovementHelper.canWalkOnBlockState(state);
if (canWalkOnState == YES) {
blockData |= CAN_WALK_ON_MASK;
}
if (canWalkOnState == MAYBE) {
blockData |= CAN_WALK_ON_SPECIAL_MASK;
}
Ternary canWalkThroughState = MovementHelper.canWalkThroughBlockState(state);
if (canWalkThroughState == YES) {
blockData |= CAN_WALK_THROUGH_MASK;
}
if (canWalkThroughState == MAYBE) {
blockData |= CAN_WALK_THROUGH_SPECIAL_MASK;
}
Ternary fullyPassableState = MovementHelper.fullyPassableBlockState(state);
if (fullyPassableState == YES) {
blockData |= FULLY_PASSABLE_MASK;
}
if (fullyPassableState == MAYBE) {
blockData |= FULLY_PASSABLE_SPECIAL_MASK;
}
blockData |= COMPLETED_MASK;
data[id] = blockData; // in theory, this is thread "safe" because every thread should compute the exact same int to write?
return blockData;
}
public boolean canWalkOn(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
int id = Block.BLOCK_STATE_REGISTRY.getId(state);
int blockData = data[id];
if ((blockData & COMPLETED_MASK) == 0) { // we need to fill in the data
blockData = fillData(id, state);
}
if ((blockData & CAN_WALK_ON_SPECIAL_MASK) != 0) {
return MovementHelper.canWalkOnPosition(bsi, x, y, z, state);
} else {
return (blockData & CAN_WALK_ON_MASK) != 0;
}
}
public boolean canWalkThrough(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
int id = Block.BLOCK_STATE_REGISTRY.getId(state);
int blockData = data[id];
if ((blockData & COMPLETED_MASK) == 0) { // we need to fill in the data
blockData = fillData(id, state);
}
if ((blockData & CAN_WALK_THROUGH_SPECIAL_MASK) != 0) {
return MovementHelper.canWalkThroughPosition(bsi, x, y, z, state);
} else {
return (blockData & CAN_WALK_THROUGH_MASK) != 0;
}
}
public boolean fullyPassable(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
int id = Block.BLOCK_STATE_REGISTRY.getId(state);
int blockData = data[id];
if ((blockData & COMPLETED_MASK) == 0) { // we need to fill in the data
blockData = fillData(id, state);
}
if ((blockData & FULLY_PASSABLE_SPECIAL_MASK) != 0) {
return MovementHelper.fullyPassablePosition(bsi, x, y, z, state);
} else {
return (blockData & FULLY_PASSABLE_MASK) != 0;
}
}
}

View File

@@ -0,0 +1,22 @@
/*
* 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.precompute;
public enum Ternary {
YES, MAYBE, NO
}

View File

@@ -54,12 +54,12 @@ public final class BackfillProcess extends BaritoneProcessHelper {
Baritone.settings().backfill.value = false;
return false;
}
amIBreakingABlockHMMMMMMM();
for (BlockPos pos : new ArrayList<>(blocksToReplace.keySet())) {
if (ctx.world().getChunk(pos) instanceof EmptyLevelChunk) {
if (ctx.world().getChunk(pos) instanceof EmptyLevelChunk || ctx.world().getBlockState(pos).getBlock() != Blocks.AIR) {
blocksToReplace.remove(pos);
}
}
amIBreakingABlockHMMMMMMM();
baritone.getInputOverrideHandler().clearAllKeys();
return !toFillIn().isEmpty();
@@ -91,7 +91,7 @@ public final class BackfillProcess extends BaritoneProcessHelper {
}
private void amIBreakingABlockHMMMMMMM() {
if (!ctx.getSelectedBlock().isPresent()) {
if (!ctx.getSelectedBlock().isPresent() || !baritone.getPathingBehavior().isPathing()) {
return;
}
blocksToReplace.put(ctx.getSelectedBlock().get(), ctx.world().getBlockState(ctx.getSelectedBlock().get()));

View File

@@ -26,9 +26,9 @@ import baritone.api.process.IBuilderProcess;
import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import baritone.api.schematic.FillSchematic;
import baritone.api.schematic.SubstituteSchematic;
import baritone.api.schematic.ISchematic;
import baritone.api.schematic.IStaticSchematic;
import baritone.api.schematic.SubstituteSchematic;
import baritone.api.schematic.format.ISchematicFormat;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.RayTraceUtils;
@@ -44,6 +44,8 @@ import baritone.utils.PathingCommandContext;
import baritone.utils.schematic.MapArtSchematic;
import baritone.utils.schematic.SelectionSchematic;
import baritone.utils.schematic.SchematicSystem;
import baritone.utils.schematic.format.defaults.LitematicaSchematic;
import baritone.utils.schematic.litematica.LitematicaHelper;
import baritone.utils.schematic.schematica.SchematicaHelper;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -51,6 +53,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.nbt.NbtIo;
import net.minecraft.util.Tuple;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.item.BlockItem;
@@ -65,10 +68,13 @@ import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.VoxelShape;
import java.io.File;
import java.io.FileInputStream;
import java.nio.file.Files;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static baritone.api.pathing.movement.ActionCosts.COST_INF;
@@ -85,6 +91,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
private int layer;
private int numRepeats;
private List<BlockState> approxPlaceable;
public int stopAtHeight = 0;
public BuilderProcess(Baritone baritone) {
super(baritone);
@@ -95,6 +102,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
this.name = name;
this.schematic = schematic;
this.realSchematic = null;
boolean buildingSelectionSchematic = schematic instanceof SelectionSchematic;
if (!Baritone.settings().buildSubstitutes.value.isEmpty()) {
this.schematic = new SubstituteSchematic(this.schematic, Baritone.settings().buildSubstitutes.value);
}
@@ -113,8 +121,28 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
this.origin = new Vec3i(x, y, z);
this.paused = false;
this.layer = Baritone.settings().startAtLayer.value;
this.stopAtHeight = schematic.heightY();
if (Baritone.settings().buildOnlySelection.value && buildingSelectionSchematic) { // currently redundant but safer maybe
if (baritone.getSelectionManager().getSelections().length == 0) {
logDirect("Poor little kitten forgot to set a selection while BuildOnlySelection is true");
this.stopAtHeight = 0;
} else if (Baritone.settings().buildInLayers.value) {
OptionalInt minim = Stream.of(baritone.getSelectionManager().getSelections()).mapToInt(sel -> sel.min().y).min();
OptionalInt maxim = Stream.of(baritone.getSelectionManager().getSelections()).mapToInt(sel -> sel.max().y).max();
if (minim.isPresent() && maxim.isPresent()) {
int startAtHeight = Baritone.settings().layerOrder.value ? y + schematic.heightY() - maxim.getAsInt() : minim.getAsInt() - y;
this.stopAtHeight = (Baritone.settings().layerOrder.value ? y + schematic.heightY() - minim.getAsInt() : maxim.getAsInt() - y) + 1;
this.layer = Math.max(this.layer, startAtHeight / Baritone.settings().layerHeight.value); // startAtLayer or startAtHeight, whichever is highest
logDebug(String.format("Schematic starts at y=%s with height %s", y, schematic.heightY()));
logDebug(String.format("Selection starts at y=%s and ends at y=%s", minim.getAsInt(), maxim.getAsInt()));
logDebug(String.format("Considering relevant height %s - %s", startAtHeight, this.stopAtHeight));
}
}
}
this.numRepeats = 0;
this.observedCompleted = new LongOpenHashSet();
this.incorrectPositions = null;
}
public void resume() {
@@ -182,6 +210,28 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
}
@Override
public void buildOpenLitematic(int i) {
if (LitematicaHelper.isLitematicaPresent()) {
//if java.lang.NoSuchMethodError is thrown see comment in SchematicPlacementManager
if (LitematicaHelper.hasLoadedSchematic()) {
String name = LitematicaHelper.getName(i);
try {
LitematicaSchematic schematic1 = new LitematicaSchematic(NbtIo.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath())), false);
Vec3i correctedOrigin = LitematicaHelper.getCorrectedOrigin(schematic1, i);
LitematicaSchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i);
build(name, schematic2, correctedOrigin);
} catch (Exception e) {
logDirect("Schematic File could not be loaded.");
}
} else {
logDirect("No schematic currently loaded");
}
} else {
logDirect("Litematica is not present");
}
}
public void clearArea(BlockPos corner1, BlockPos corner2) {
BlockPos origin = new BlockPos(Math.min(corner1.getX(), corner2.getX()), Math.min(corner1.getY(), corner2.getY()), Math.min(corner1.getZ(), corner2.getZ()));
int widthX = Math.abs(corner1.getX() - corner2.getX()) + 1;
@@ -445,7 +495,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
BuilderCalculationContext bcc = new BuilderCalculationContext();
if (!recalc(bcc)) {
if (Baritone.settings().buildInLayers.value && layer * Baritone.settings().layerHeight.value < realSchematic.heightY()) {
if (Baritone.settings().buildInLayers.value && layer * Baritone.settings().layerHeight.value < stopAtHeight) {
logDirect("Starting layer " + layer);
layer++;
return onTick(calcFailed, isSafeToCancel, recursions + 1);
@@ -624,7 +674,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
// this is not in render distance
if (!observedCompleted.contains(BetterBlockPos.longHash(blockX, blockY, blockZ))
&& !Baritone.settings().buildSkipBlocks.value.contains(schematic.desiredState(x, y, z, current, this.approxPlaceable).getBlock())) {
&& !Baritone.settings().buildSkipBlocks.value.contains(schematic.desiredState(x, y, z, current, this.approxPlaceable).getBlock())) {
// and we've never seen this position be correct
// therefore mark as incorrect
incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ));
@@ -847,7 +897,18 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
continue;
}
// <toxic cloud>
result.add(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockPlaceContext(new UseOnContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {})));
BlockState itemState = ((BlockItem) stack.getItem())
.getBlock()
.getStateForPlacement(
new BlockPlaceContext(
new UseOnContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {}
)
);
if (itemState != null) {
result.add(itemState);
} else {
result.add(Blocks.AIR.defaultBlockState());
}
// </toxic cloud>
}
return result;
@@ -861,14 +922,21 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
TrapDoorBlock.OPEN, TrapDoorBlock.HALF
);
private boolean sameWithoutOrientation(BlockState first, BlockState second) {
private boolean sameBlockstate(BlockState first, BlockState second) {
if (first.getBlock() != second.getBlock()) {
return false;
}
boolean ignoreDirection = Baritone.settings().buildIgnoreDirection.value;
List<String> ignoredProps = Baritone.settings().buildIgnoreProperties.value;
if (!ignoreDirection && ignoredProps.isEmpty()) {
return first.equals(second); // early return if no properties are being ignored
}
ImmutableMap<Property<?>, Comparable<?>> map1 = first.getValues();
ImmutableMap<Property<?>, Comparable<?>> map2 = second.getValues();
for (Property<?> prop : map1.keySet()) {
if (map1.get(prop) != map2.get(prop) && !orientationProps.contains(prop)) {
if (map1.get(prop) != map2.get(prop)
&& !(ignoreDirection && orientationProps.contains(prop))
&& !ignoredProps.contains(prop.getName())) {
return false;
}
}
@@ -900,7 +968,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (current.equals(desired)) {
return true;
}
return Baritone.settings().buildIgnoreDirection.value && sameWithoutOrientation(current, desired);
return sameBlockstate(current, desired);
}
public class BuilderCalculationContext extends CalculationContext {
@@ -967,12 +1035,12 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
@Override
public double breakCostMultiplierAt(int x, int y, int z, BlockState current) {
if (!allowBreak || isPossiblyProtected(x, y, z)) {
if ((!allowBreak && !allowBreakAnyway.contains(current.getBlock())) || isPossiblyProtected(x, y, z)) {
return COST_INF;
}
BlockState sch = getSchematic(x, y, z, current);
if (sch != null && !Baritone.settings().buildSkipBlocks.value.contains(sch.getBlock())) {
if (sch.getBlock() == Blocks.AIR) {
if (sch.getBlock() instanceof AirBlock) {
// it should be air
// regardless of current contents, we can break it
return 1;

View File

@@ -24,6 +24,7 @@ import baritone.api.pathing.goals.GoalComposite;
import baritone.api.process.IFarmProcess;
import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.RayTraceUtils;
import baritone.api.utils.Rotation;
import baritone.api.utils.RotationUtils;
@@ -306,7 +307,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
ItemEntity ei = (ItemEntity) entity;
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
// +0.1 because of farmland's 0.9375 dummy height lol
goalz.add(new GoalBlock(new BlockPos(entity.position().x, entity.position().y + 0.1, entity.position().z)));
goalz.add(new GoalBlock(new BetterBlockPos(entity.position().x, entity.position().y + 0.1, entity.position().z)));
}
}
}

View File

@@ -25,6 +25,7 @@ import baritone.api.pathing.goals.GoalXZ;
import baritone.api.process.IFollowProcess;
import baritone.api.process.PathingCommand;
import baritone.api.process.PathingCommandType;
import baritone.api.utils.BetterBlockPos;
import baritone.utils.BaritoneProcessHelper;
import java.util.List;
import java.util.function.Predicate;
@@ -59,7 +60,7 @@ public final class FollowProcess extends BaritoneProcessHelper implements IFollo
pos = following.blockPosition();
} else {
GoalXZ g = GoalXZ.fromDirection(following.position(), Baritone.settings().followOffsetDirection.value, Baritone.settings().followOffsetDistance.value);
pos = new BlockPos(g.getX(), following.position().y, g.getZ());
pos = new BetterBlockPos(g.getX(), following.position().y, g.getZ());
}
return new GoalNear(pos, Baritone.settings().followRadius.value);
}

View File

@@ -30,13 +30,14 @@ import baritone.api.utils.input.Input;
import baritone.pathing.movement.CalculationContext;
import baritone.pathing.movement.MovementHelper;
import baritone.utils.BaritoneProcessHelper;
import java.util.*;
import net.minecraft.core.BlockPos;
import net.minecraft.world.inventory.InventoryMenu;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import java.util.*;
public final class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBlockProcess {
private BlockOptionalMeta gettingTo;

View File

@@ -40,6 +40,7 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FallingBlock;
import net.minecraft.world.level.block.state.BlockState;
import java.util.*;
import java.util.stream.Collectors;
@@ -102,11 +103,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
return null;
}
}
if (!Baritone.settings().allowBreak.value) {
logDirect("Unable to mine when allowBreak is false!");
cancel();
return null;
}
updateLoucaSystem();
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value;
List<BlockPos> curr = new ArrayList<>(knownOreLocations);
@@ -115,7 +112,10 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
Baritone.getExecutor().execute(() -> rescan(curr, context));
}
if (Baritone.settings().legitMine.value) {
addNearby();
if (!addNearby()) {
cancel();
return null;
}
}
Optional<BlockPos> shaft = curr.stream()
.filter(pos -> pos.getX() == ctx.playerFeet().getX() && pos.getZ() == ctx.playerFeet().getZ())
@@ -177,6 +177,11 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
private PathingCommand updateGoal() {
BlockOptionalMetaLookup filter = filterFilter();
if (filter == null) {
return null;
}
boolean legit = Baritone.settings().legitMine.value;
List<BlockPos> locs = knownOreLocations;
if (!locs.isEmpty()) {
@@ -211,6 +216,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
public boolean isInGoal(int x, int y, int z) {
return false;
}
@Override
public double heuristic() {
return Double.NEGATIVE_INFINITY;
@@ -221,6 +227,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
private void rescan(List<BlockPos> already, CalculationContext context) {
BlockOptionalMetaLookup filter = filterFilter();
if (filter == null) {
return;
}
@@ -370,11 +377,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
return prune(ctx, locs, filter, max, blacklist, dropped);
}
private void addNearby() {
private boolean addNearby() {
List<BlockPos> dropped = droppedItemsScan();
knownOreLocations.addAll(dropped);
BlockPos playerFeet = ctx.playerFeet();
BlockStateInterface bsi = new BlockStateInterface(ctx);
BlockOptionalMetaLookup filter = filterFilter();
if (filter == null) {
return false;
}
int searchDist = 10;
double fakedBlockReachDistance = 20; // at least 10 * sqrt(3) with some extra space to account for positioning within the block
for (int x = playerFeet.getX() - searchDist; x <= playerFeet.getX() + searchDist; x++) {
@@ -392,6 +406,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
}
}
knownOreLocations = prune(new CalculationContext(baritone), knownOreLocations, filter, ORE_LOCATIONS_COUNT, blacklist, dropped);
return true;
}
private static List<BlockPos> prune(CalculationContext ctx, List<BlockPos> locs2, BlockOptionalMetaLookup filter, int max, List<BlockPos> blacklist, List<BlockPos> dropped) {
@@ -467,10 +482,8 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
@Override
public void mine(int quantity, BlockOptionalMetaLookup filter) {
this.filter = filter;
if (filter != null && !Baritone.settings().allowBreak.value) {
logDirect("Unable to mine when allowBreak is false!");
this.mine(quantity, (BlockOptionalMetaLookup) null);
return;
if (this.filterFilter() == null) {
this.filter = null;
}
this.desiredQuantity = quantity;
this.knownOreLocations = new ArrayList<>();
@@ -482,4 +495,22 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
rescan(new ArrayList<>(), new CalculationContext(baritone));
}
}
private BlockOptionalMetaLookup filterFilter() {
if (this.filter == null) {
return null;
}
if (!Baritone.settings().allowBreak.value) {
BlockOptionalMetaLookup f = new BlockOptionalMetaLookup(this.filter.blocks()
.stream()
.filter(e -> Baritone.settings().allowBreakAnyway.value.contains(e.getBlock()))
.toArray(BlockOptionalMeta[]::new));
if (f.blocks().isEmpty()) {
logDirect("Unable to mine when allowBreak is false and target block is not in allowBreakAnyway!");
return null;
}
return f;
}
return filter;
}
}

View File

@@ -22,6 +22,7 @@ import baritone.api.utils.IPlayerContext;
import baritone.cache.CachedRegion;
import baritone.cache.WorldData;
import baritone.utils.accessor.IClientChunkProvider;
import baritone.utils.pathing.BetterWorldBorder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientChunkCache;
import net.minecraft.core.BlockPos;
@@ -43,9 +44,10 @@ public class BlockStateInterface {
private final ClientChunkCache provider;
private final WorldData worldData;
protected final BlockGetter world;
protected final Level world;
public final BlockPos.MutableBlockPos isPassableBlockPos;
public final BlockGetter access;
public final BetterWorldBorder worldBorder;
private LevelChunk prev = null;
private CachedRegion prevCached = null;
@@ -64,6 +66,7 @@ public class BlockStateInterface {
public BlockStateInterface(Level world, WorldData worldData, boolean copyLoadedChunks) {
this.world = world;
this.worldBorder = new BetterWorldBorder(world.getWorldBorder());
this.worldData = worldData;
if (copyLoadedChunks) {
this.provider = ((IClientChunkProvider) world.getChunkSource()).createThreadSafeCopy();
@@ -97,9 +100,9 @@ public class BlockStateInterface {
}
public BlockState get0(int x, int y, int z) { // Mickey resigned
y -= worldData.dimension.minY();
y -= world.dimensionType().minY();
// Invalid vertical position
if (y < 0 || y >= worldData.dimension.height()) {
if (y < 0 || y >= world.dimensionType().height()) {
return AIR;
}

View File

@@ -24,21 +24,23 @@ import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Helper;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector4f;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.BaseComponent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix4f;
import org.joml.Vector4f;
import java.awt.*;
import java.util.Collections;
@@ -53,7 +55,7 @@ public class GuiClick extends Screen implements Helper {
private BlockPos currentMouseOver;
public GuiClick() {
super(new TextComponent("CLICK"));
super(Component.literal("CLICK"));
}
@Override
@@ -79,6 +81,7 @@ public class GuiClick extends Screen implements Helper {
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();
System.out.println("currentMouseOver = " + currentMouseOver);
}
}
}
@@ -90,13 +93,13 @@ public class GuiClick extends Screen implements Helper {
if (clickStart != null && !clickStart.equals(currentMouseOver)) {
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections();
BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver));
BaseComponent component = new TextComponent("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
component.getStyle()
MutableComponent component = Component.literal("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel");
component.setStyle(component.getStyle()
.withColor(ChatFormatting.WHITE)
.withClickEvent(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
FORCE_COMMAND_PREFIX + "help sel"
));
)));
Helper.HELPER.logDirect(component);
clickStart = null;
} else {
@@ -117,8 +120,8 @@ public class GuiClick extends Screen implements Helper {
}
public void onRender(PoseStack modelViewStack, Matrix4f projectionMatrix) {
this.projectionViewMatrix = projectionMatrix.copy();
this.projectionViewMatrix.multiply(modelViewStack.last().pose());
this.projectionViewMatrix = new Matrix4f(projectionMatrix);
this.projectionViewMatrix.mul(modelViewStack.last().pose());
this.projectionViewMatrix.invert();
if (currentMouseOver != null) {
@@ -131,7 +134,7 @@ public class GuiClick extends Screen implements Helper {
//TODO: check
IRenderer.glColor(Color.RED, 0.4F);
RenderSystem.lineWidth(Baritone.settings().pathRenderLineWidthPixels.value);
RenderSystem.disableTexture();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.depthMask(false);
RenderSystem.disableDepthTest();
BetterBlockPos a = new BetterBlockPos(currentMouseOver);
@@ -140,7 +143,6 @@ public class GuiClick extends Screen implements Helper {
RenderSystem.enableDepthTest();
RenderSystem.depthMask(true);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}
}
@@ -157,12 +159,13 @@ public class GuiClick extends Screen implements Helper {
y = y * 2 - 1;
Vector4f pos = new Vector4f((float) x, (float) y, (float) z, 1.0F);
pos.transform(this.projectionViewMatrix);
projectionViewMatrix.transform(pos);
if (pos.w() == 0) {
return null;
}
pos.perspectiveDivide();
pos.mul(1/pos.w());
return new Vec3(pos.x(), pos.y(), pos.z());
}
}

View File

@@ -23,9 +23,11 @@ import baritone.api.utils.Helper;
import baritone.utils.accessor.IEntityRenderManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f;
import java.awt.*;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.world.phys.AABB;
import org.joml.Matrix4f;
import static org.lwjgl.opengl.GL11.*;
@@ -48,10 +50,10 @@ public interface IRenderer {
static void startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) {
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.blendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);
glColor(color, alpha);
RenderSystem.lineWidth(lineWidth);
RenderSystem.disableTexture();
RenderSystem.depthMask(false);
if (ignoreDepth) {
@@ -69,7 +71,6 @@ public interface IRenderer {
}
RenderSystem.depthMask(true);
RenderSystem.enableTexture();
RenderSystem.disableBlend();
}

View File

@@ -30,7 +30,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f;
import java.awt.*;
import java.util.Collection;
import java.util.Collections;
@@ -45,6 +44,7 @@ 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.joml.Matrix4f;
import static org.lwjgl.opengl.GL11.*;
@@ -229,8 +229,7 @@ public final class PathRenderer implements IRenderer, Helper {
if (!settings.renderGoalAnimated.value) {
// y = 1 causes rendering issues when the player is at the same y as the top of a block for some reason
y = 0.999F;
}
else {
} else {
y = Mth.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2));
}
if (goal instanceof IGoalRenderPos) {
@@ -271,9 +270,9 @@ public final class PathRenderer implements IRenderer, Helper {
stack,
mc.renderBuffers().bufferSource(),
TEXTURE_BEACON_BEAM,
partialTicks,
settings.renderGoalAnimated.value ? partialTicks : 0,
1.0F,
player.level.getGameTime(),
settings.renderGoalAnimated.value ? player.level.getGameTime() : 0,
0,
256,
color.getColorComponents(null),

View File

@@ -28,7 +28,7 @@ public class PlayerMovementInput extends net.minecraft.client.player.Input {
}
@Override
public void tick(boolean p_225607_1_) {
public void tick(boolean p_225607_1_, float f) {
this.leftImpulse = 0.0F;
this.forwardImpulse = 0.0F;

View File

@@ -18,19 +18,20 @@
package baritone.utils;
import baritone.Baritone;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.DiggerItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.TieredItem;
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.Map;
import java.util.function.Function;
/**
* A cached list of the best tools on the hotbar for any block
*
@@ -75,13 +76,20 @@ public class ToolSet {
}
/**
* Evaluate the material cost of a possible tool. Will return 1 for tools, -1 for other
* Evaluate the material cost of a possible tool. The priority matches the
* harvest level order; there is a chance for multiple at the same with modded tools
* but in that case we don't really care.
*
* @param itemStack a possibly empty ItemStack
* @return Either 1 or -1
* @return values from 0 up
*/
private int getMaterialCost(ItemStack itemStack) {
return itemStack.getItem() instanceof DiggerItem ? 1 : -1;
if (itemStack.getItem() instanceof TieredItem) {
TieredItem tool = (TieredItem) itemStack.getItem();
return tool.getTier().getLevel();
} else {
return -1;
}
}
public boolean hasSilkTouch(ItemStack stack) {
@@ -120,7 +128,7 @@ public class ToolSet {
if (!Baritone.settings().useSwordToMine.value && itemStack.getItem() instanceof SwordItem) {
continue;
}
if (Baritone.settings().itemSaver.value && (itemStack.getDamageValue() + Baritone.settings().itemSaverThreshold.value) >= itemStack.getMaxDamage() && itemStack.getMaxDamage() > 1) {
continue;
}

View File

@@ -73,7 +73,7 @@ public class Avoidance {
if (mobCoeff != 1.0D) {
ctx.entitiesStream()
.filter(entity -> entity instanceof Mob)
.filter(entity -> (!(entity instanceof Spider)) || ctx.player().getBrightness() < 0.5)
.filter(entity -> (!(entity instanceof Spider)) || ctx.player().getLightLevelDependentMagicValue() < 0.5)
.filter(entity -> !(entity instanceof ZombifiedPiglin) || ((ZombifiedPiglin) entity).getLastHurtByMob() != null)
.filter(entity -> !(entity instanceof EnderMan) || ((EnderMan) entity).isCreepy())
.forEach(entity -> res.add(new Avoidance(entity.blockPosition(), mobCoeff, Baritone.settings().mobAvoidanceRadius.value)));

Some files were not shown because too many files have changed in this diff Show More