Compare commits

...

968 Commits

Author SHA1 Message Date
Leijurv
1a4635df16 v1.3.3 2019-07-11 12:47:44 -07:00
Leijurv
1390af20b6 fix parkour and multithread farm 2019-07-11 12:46:24 -07:00
Leijurv
1427cf57a8 randomlooking 2019-07-11 11:56:44 -07:00
Leijurv
d70243b4c0 leijurv would never do this 2019-07-11 11:08:45 -07:00
Leijurv
8f63dd4ba6 Merge branch 'master' into 1.13.2 2019-07-11 10:51:29 -07:00
Leijurv
01658286af detect allowbreak false 2019-07-11 10:41:24 -07:00
Leijurv
aa90c8b7cd address encapsulation conccerns 2019-07-10 22:18:11 -07:00
Leijurv
eba1011fd6 remove scuff 2019-07-09 23:47:42 -07:00
Brady
96a424c25a Merge pull request #445 from SylveonBottle/patch-1
Speed up production
2019-07-09 14:23:37 -05:00
Leijurv
f4dd100345 fix indexof 2019-07-08 23:16:26 -07:00
Brady
c7e1c917c3 Fix Baritone thinking it can walk through wall-placed skulls
Fixes #485
2019-07-08 19:21:09 -05:00
Leijurv
cd4205c361 v1.2.7 2019-07-07 12:07:00 -07:00
Leijurv
b81bcf8c6d fix path start in diagonal and downward 2019-07-07 11:44:56 -07:00
Leijurv
4259764b70 thank you off by one errors very cool 2019-07-07 11:12:32 -07:00
Leijurv
8f761f7dff better skip ahead 2019-07-07 11:03:43 -07:00
Leijurv
cbbaf2aa2f unscuff 2019-07-06 20:38:59 -07:00
Leijurv
dd9b84646a disgraceful 2019-07-06 17:07:16 -07:00
Leijurv
94131fd705 too many newlines 2019-07-05 21:19:18 -07:00
Leijurv
6d8914e6c9 spell it out even more 2019-07-04 15:52:09 -07:00
Leijurv
63ee687cee shill EVEN harder 2019-07-03 23:47:47 -07:00
Leijurv
ab779dc850 increase shilling 2019-07-02 22:13:17 -07:00
Leijurv
c2f35ae46f dawn of the final month 2019-07-01 10:21:58 -07:00
Leijurv
199e0e5ed3 better comparison 2019-06-30 21:55:32 -07:00
Leijurv
a8155b4b0b privatize 2019-06-29 11:56:02 -07:00
Leijurv
fdd78cf110 codcacy wants these to be combined 2019-06-28 22:17:31 -07:00
Leijurv
afff6395d1 codcacy wants a default 2019-06-27 21:02:44 -07:00
Leijurv
4d3d48e962 crucial documentation oversight 2019-06-26 23:58:22 -07:00
Leijurv
36290e4e53 crucial encapsulation improvement 2019-06-25 22:54:24 -07:00
Leijurv
fd6923dd28 ok i forgot falling into water 2019-06-24 20:38:17 -07:00
Leijurv
9c64067d49 vastly improve resilience to lagbacks, fixes #446 2019-06-24 17:53:25 -07:00
Leijurv
f4d2ea7923 fix path canceling at edge of loaded chunks hopefully 2019-06-24 10:43:49 -07:00
Leijurv
ce3d3bb244 literally no reason to have this 2019-06-23 22:49:33 -07:00
Leijurv
fa71e7d84f reduce stupidity 2019-06-22 21:11:09 -07:00
Leijurv
b0115b8b4c Merge pull request #447 from babbaj/master
daily commit
2019-06-21 23:59:32 -07:00
Babbaj
3902b2db3b increase line count and improve readability 2019-06-21 23:01:37 -04:00
SylveonBottle
4ff61f96df wow times infinity 2019-06-21 03:59:10 -05:00
Leijurv
f998dce614 wow wow 2019-06-20 23:48:02 -07:00
Leijurv
2b9084d2f3 wow 2019-06-19 20:41:21 -07:00
Leijurv
b3605546ac golly another missing slash wow 2019-06-18 23:15:47 -07:00
Leijurv
96097ab726 this counts as a commit 2019-06-17 22:44:38 -07:00
Leijurv
be142d79bc link to the code 2019-06-16 23:06:57 -07:00
Leijurv
0fd241a9ba crucial performance optimization 2019-06-15 11:04:05 -07:00
Leijurv
7b192f17e8 privatize 2019-06-14 21:42:11 -07:00
Leijurv
cc015846d2 explain 2019-06-13 23:13:40 -07:00
Leijurv
e785bd13f5 sanity check 2019-06-12 16:41:05 -07:00
Leijurv
eb6c0a39ea codacy wants this 2019-06-11 23:46:04 -07:00
Leijurv
86525f98ec fix scuffed jumping, fixes #426 2019-06-10 23:12:37 -07:00
Leijurv
125facfbb6 Merge branch 'master' into 1.13.2 2019-06-10 11:50:14 -07:00
Leijurv
94bf703dde this counts as a commit 2019-06-09 23:56:54 -07:00
Leijurv
14bb0a0a80 alt text 2019-06-08 23:13:27 -07:00
Leijurv
1ee6e04f00 this counts as a commit 2019-06-07 21:29:31 -07:00
Brady
ee6796d5e2 crucial performance optimization (pt. 2) 2019-06-07 03:52:46 -05:00
Brady
81d7f3c319 crucial performance optimization 2019-06-07 03:19:23 -05:00
Leijurv
9822962d98 it is tbh 2019-06-06 23:55:12 -07:00
Brady
ce606f826b consistency 2019-06-06 19:05:13 -05:00
Brady
4c4bc8058b Some clean ups 2019-06-06 04:15:43 -05:00
Leijurv
f0210f7c5f add an additional underscore 2019-06-05 22:12:28 -07:00
Leijurv
aef84eceb8 fix a rare crash when the view is occluded by falling sand, fixes #443 2019-06-05 14:26:26 -07:00
Leijurv
a6ea9ed3a6 👶 2019-06-05 12:47:18 -07:00
Leijurv
0815e3c195 thank u intellij very cool suggestion 2019-06-05 12:08:19 -07:00
Leijurv
a1c03eb601 another tool selection fix 2019-06-05 12:04:09 -07:00
Leijurv
1e43563cc3 fix weird backfill behavior 2019-06-04 20:55:31 -07:00
Leijurv
63f3f9123a Merge pull request #409 from babbaj/master
use ImmutableSet
2019-06-03 22:17:14 -07:00
Leijurv
4860d3bd18 Merge pull request #439 from ImpcatDevelopment/delete-user-defined-waypoints
Added the command delete. Allows you to remove a user defined waypoint.
2019-06-03 22:09:08 -07:00
0x22
7fa6593bdc Added the command delete. Allows you to remove a user defined waypoint. Fixes #334 2019-06-04 01:04:13 -04:00
Leijurv
e1dd580df8 fix improper singleplayer check after quitting singleplayer 2019-06-03 15:27:24 -07:00
Leijurv
f19e63d6e9 mc version support is important 2019-06-03 13:43:32 -07:00
Leijurv
130873d91d 1.13.2 2019-06-02 21:33:10 -07:00
Leijurv
9611cb9057 1.13.2 is supported 2019-06-01 17:54:16 -07:00
Leijurv
023aa78d8b yay 2019-06-01 15:36:52 -07:00
Leijurv
39a231eae0 crucial performance optimization 2019-06-01 10:56:24 -07:00
Leijurv
aca6922be0 there is no actual integration 2019-05-31 23:01:16 -07:00
Leijurv
1a52537d0c badges 2019-05-30 20:49:04 -08:00
Leijurv
479b4e3349 releases download count 2019-05-29 10:45:59 -07:00
Leijurv
a1e2b018a2 very good suggestion 2019-05-28 14:17:54 -07:00
Leijurv
aa0f664cda just for debugging purposes 😉 2019-05-27 22:48:06 -07:00
Brady
2e2f4aee1b critical performance enhancement 2019-05-27 02:31:28 -05:00
Leijurv
18474d872c unused 2019-05-26 12:14:08 -07:00
Leijurv
44327c009a Merge pull request #427 from babbaj/master
yet another meaningless commit
2019-05-25 14:30:10 -07:00
Babbaj
de554655a5 yet another meaningless commit 2019-05-25 17:27:06 -04:00
Babbaj
bd0c7b9391 yet another meaningless commit 2019-05-25 17:25:23 -04:00
Babbaj
8d32db5206 Merge branch 'master' of https://github.com/cabaletta/baritone 2019-05-25 17:23:47 -04:00
Leijurv
a6954aa719 bye 2 2019-05-24 10:36:01 -07:00
Leijurv
b4d203ab99 bye 2019-05-23 20:47:22 -08:00
Leijurv
bb924ad83f thank you intellij very cool 2019-05-22 23:41:02 -07:00
Leijurv
79da32cc60 unused 2019-05-21 15:07:05 -07:00
Leijurv
c7fe9c3171 finalize 2019-05-20 22:37:51 -07:00
Leijurv
d70da4f37d finalize these 2019-05-19 21:53:09 -08:00
Leijurv
ccc1b04e81 crucial spacing 2019-05-18 17:11:16 -07:00
Leijurv
352e428890 explicitly set serialized name post obf 2019-05-17 22:21:40 -08:00
Leijurv
4679e12588 better usage 2019-05-16 15:20:52 -07:00
Leijurv
16b74ff53c v1.3.2 2019-05-16 14:57:26 -07:00
Leijurv
9297e98ac3 Merge branch 'master' into 1.13.2 2019-05-16 14:55:37 -07:00
Leijurv
6861bfd4e6 relative goals 2019-05-16 11:50:48 -07:00
Leijurv
0dd4834e18 add explanation 2019-05-15 21:55:01 -08:00
Leijurv
da58988f01 build in layers order 2019-05-14 16:03:11 -07:00
Leijurv
b2f3880722 add todo 2019-05-13 20:13:22 -08:00
Leijurv
0293a76702 less yikes 2019-05-12 23:25:50 -07:00
Leijurv
6a13e94c4f warning 2019-05-11 21:13:46 -07:00
Leijurv
79d448e5f4 add crucial explanation 2019-05-10 23:55:50 -07:00
Leijurv
264b3db63c this counts as a commit 2019-05-09 15:20:37 -07:00
Brady
c8cd4b5f28 Merge pull request #410 from SuperOP535/patch-2
Automatic CRLF -> LF normalization
2019-05-09 11:49:05 -05:00
Leijurv
c9e81897a5 im blind lol thanks babj 2019-05-08 11:51:48 -07:00
Leijurv
c738007538 epic label 2019-05-07 21:40:03 -08:00
Leijurv
da8bf6b1b3 fix a potential concurrency issue 2019-05-06 14:07:46 -07:00
Leijurv
1501d721e7 build repeat vector 2019-05-06 14:01:01 -07:00
Leijurv
482d874af2 this counts as a commit 2019-05-05 23:57:56 -07:00
Leijurv
7dcd7384f1 allow overshooting traverse 2019-05-04 15:01:11 -07:00
Leijurv
2a5ef35794 move this down to the other render settings 2019-05-03 11:44:37 -07:00
Leijurv
0f09a46540 javadoc 2019-05-02 23:03:15 -07:00
Leijurv
a6d4708ccf Merge pull request #412 from EvilSourcerer/master
render dank lit boxes for goalYLevel
2019-05-02 23:02:25 -07:00
evilsourcerer
77303b4a62 render boxes for goalYLevel 2019-05-03 01:48:37 -04:00
Leijurv
0ffbb0c151 quiet 2019-05-02 11:47:35 -07:00
Leijurv
b521d7bee1 fix dummy merge typo 2019-05-02 11:42:49 -07:00
Leijurv
4e96c5e5ee Merge branch 'master' into 1.13.2 2019-05-01 23:12:19 -07:00
Leijurv
e05010c9d2 fix weird oscillation when mining large veins 2019-05-01 23:07:20 -07:00
Leijurv
d0a1c241a4 replace liquid source blocks in builder 2019-05-01 14:03:36 -07:00
Leijurv
4ea8f23fc7 fix typo crash, fixes #406 2019-05-01 12:22:47 -07:00
Leijurv
ec819220b7 Merge branch 'master' into 1.13.2 2019-05-01 12:15:31 -07:00
Leijurv
54da0d24a3 dont mine blocks that update falling blocks, fixes #395 2019-05-01 11:16:24 -07:00
Leijurv
58ebd5f9a6 split this out into its own function 2019-05-01 11:01:00 -07:00
Leijurv
d60a0bee9e move this behind the toolset cache for performance 2019-05-01 10:48:17 -07:00
Leijurv
e9e26c981a fine babj 2019-05-01 10:37:23 -07:00
SuperOP535
5f12f04e87 Automatic CRLF -> LF normalization 2019-05-01 14:05:47 +02:00
Leijurv
7b7be32ca7 also break passable blocks at foot level like mushrooms, fixes #407 2019-04-30 23:24:08 -07:00
Leijurv
a14166b1e2 overhaul to usage 2019-04-30 16:56:29 -07:00
Leijurv
166eb97c3f make right click on arrival time out after 1 second 2019-04-30 16:52:27 -07:00
Leijurv
920ce745c2 fix some scuff from minebot 2019-04-29 23:08:17 -07:00
Leijurv
c931cde3ae fix error stacktrace on startup 2019-04-29 16:43:47 -07:00
Leijurv
f7a577e163 break from above 2019-04-29 16:02:44 -07:00
Leijurv
9bf3a041d4 might as well privatize 2019-04-29 14:59:25 -07:00
Leijurv
85eb7d8043 remember beyond render distance what is completed 2019-04-29 14:55:14 -07:00
Leijurv
b338dcc9de add path splice option 2019-04-29 11:46:21 -07:00
Leijurv
7d9b8ee4f3 that was too high tbh lol 2019-04-28 21:38:10 -07:00
Babbaj
0f61aaafb8 use ImmutableSet 2019-04-28 21:27:11 -04:00
Leijurv
0927e0e017 fix performance issues with explore 2019-04-27 16:16:36 -07:00
Leijurv
783a7cedc3 can combine distances 2019-04-27 16:03:58 -07:00
Leijurv
b1ee23ad50 taxicab only 2019-04-27 16:01:58 -07:00
Leijurv
9118e0b368 one byte savings means faster load times 2019-04-26 23:17:18 -07:00
Leijurv
5a0ccac0a1 maintain y while exploring 2019-04-25 13:40:33 -07:00
Leijurv
c8419dc362 i am rarted 2019-04-25 12:45:53 -07:00
Leijurv
9127ba2fce make explore a little less dummy 2019-04-25 12:18:25 -07:00
Leijurv
36858ca219 small cleanup 2019-04-25 11:22:11 -07:00
Leijurv
30469e2de2 pause mining for falling blocks, fixes #157 2019-04-25 11:10:18 -07:00
Leijurv
79c433b14d reduce suffocation from falling blocks above ore 2019-04-25 10:49:54 -07:00
Leijurv
bc419cfd1a fix loophole with falling blocks above ore 2019-04-24 22:10:41 -08:00
Leijurv
09fbf675ec fix build repeat 2019-04-23 17:42:13 -07:00
Leijurv
2ee119fc64 v1.2.6 2019-04-22 20:41:27 -07:00
Leijurv
83265fcb54 add blocks to avoid breaking, fixes #368 2019-04-22 19:52:04 -07:00
Leijurv
e8b4f4d2b6 make the completion check a setting 2019-04-22 15:33:40 -07:00
Leijurv
714c6773c3 explain what invert means 2019-04-22 14:51:07 -07:00
Leijurv
2fac594315 say if its inverted 2019-04-22 14:36:12 -07:00
Leijurv
4bec49de5b filter explored chunks with json 2019-04-22 14:34:31 -07:00
Leijurv
4eaa6e20c3 thanks for the tip cda 2019-04-22 09:46:26 -07:00
Leijurv
315cc26525 Merge branch 'backfill-2' 2019-04-21 21:42:11 -08:00
Brady
794a761243 Remove redundant Arrays.asList call 2019-04-21 17:05:33 -05:00
Leijurv
5da14fcb3f fix 2019-04-20 15:35:11 -07:00
Brady
1047d4ade9 Babbaj doesn't know how to convert imperative shitcode into a regex
and leijurv doesn't know how to verify that the regex reflects the original behavior
im literally raging
2019-04-20 17:26:41 -05:00
Brady
0b8fa3ffe3 Fix the scuffed usage of LinkedList and ArrayList for list setting types 2019-04-20 17:10:35 -05:00
Leijurv
498e4e2d6c replant nether wart setting 2019-04-20 11:03:59 -07:00
Leijurv
850c414e8f Merge pull request #393 from CDAGaming/pr_changes
[Change] Add Block Avoidance Settings
2019-04-20 11:03:39 -07:00
cdagaming
d5a8ed5cb1 [Change] More Suggested changes 2019-04-20 12:32:35 -05:00
cdagaming
dd8406c39a [Fix] Remove unused Settings 2019-04-20 12:13:28 -05:00
cdagaming
13469053b9 [Change] Suggested Changes 2019-04-20 12:11:46 -05:00
cdagaming
c4c85b4f49 [Change] Add Block Avoidance Settings
Fixes #392
2019-04-20 12:04:07 -05:00
Leijurv
af0c3bbd5c just one is not good enough tbh 2019-04-19 21:02:58 -07:00
Leijurv
2fcf9ace64 exploration chunk offset 2019-04-19 15:10:16 -07:00
Leijurv
47e1c67bd8 fix that null exception 2019-04-19 14:20:00 -07:00
Leijurv
7e3aa6efdd Merge branch 'master' into backfill-2 2019-04-19 10:59:21 -07:00
Leijurv
7a2f26ef62 replace scuffed ternary with commented if 2019-04-18 10:36:20 -07:00
Leijurv
b64154e3b3 meme for cached blocks that arent packed yet 2019-04-17 23:25:55 -07:00
Leijurv
26256e7155 mine is now MUCH more epic 2019-04-17 22:17:09 -07:00
Leijurv
6599736e00 fix that reference 2019-04-17 20:23:36 -07:00
Leijurv
343bb20bd8 fix weird cache behavior at chunk edge 2019-04-17 20:02:02 -07:00
Leijurv
518fa1c74d reformat all files 2019-04-17 19:49:04 -07:00
Leijurv
0b72a8b4b3 fix overshoot 2019-04-17 19:46:25 -07:00
Leijurv
c013d1e0d9 fix various toxic clouds 2019-04-17 18:10:47 -07:00
Leijurv
fe51220e3c this might help 2019-04-16 23:19:55 -07:00
Leijurv
44d757347b fix unable to move while paused 2019-04-16 22:43:33 -07:00
Brady
3d3a5f420e Fix unsafe creation of potentially invalid ResourceLocation 2019-04-16 20:15:51 -05:00
Leijurv
c136182e17 add option to manually blacklist closest 2019-04-16 18:04:43 -07:00
Leijurv
a1a9b4e6b9 allow spaces 2019-04-16 10:25:32 -07:00
Leijurv
f49df63183 that can never be null 2019-04-16 10:20:23 -07:00
Leijurv
96414b37f3 whoops this was fixed monthhs ago 2019-04-15 18:14:20 -07:00
Leijurv
544168ff45 Merge branch 'farm' 2019-04-15 17:28:13 -07:00
Leijurv
e0a618a791 epic farm 2019-04-15 17:12:20 -07:00
Leijurv
3333797144 fix region pruning 2019-04-14 10:06:50 -07:00
Leijurv
9c9c9d4387 fix region pruning 2019-04-14 10:06:37 -07:00
Leijurv
82d09a536d v1.3.1 2019-04-13 19:21:44 -07:00
Leijurv
6e49adea33 i WUV impact 2019-04-13 19:10:13 -07:00
Leijurv
f7f003c0f9 farm 2019-04-13 19:05:54 -07:00
Leijurv
236d02cb47 add a way to pause builder 2019-04-13 08:36:14 -07:00
Leijurv
f85afdbc70 Merge branch 'master' into 1.13.2 2019-04-12 21:57:01 -07:00
Leijurv
6e97fe2210 dont crash when exiting a world 2019-04-12 21:48:02 -07:00
Leijurv
6741666c24 Merge branch 'master' into backfill-2 2019-04-12 17:43:01 -07:00
Leijurv
fcadf68c90 cool tunnel feature and various fixes 2019-04-12 17:42:50 -07:00
Leijurv
65cd6a92d3 allow saving enumfacing value 2019-04-11 16:42:04 -07:00
Leijurv
a09bb0d538 build repeat option 2019-04-11 16:36:20 -07:00
Leijurv
2bf475d840 build in layers test 2019-04-11 15:17:26 -07:00
Leijurv
76cdaaace6 add todo 2019-04-10 23:45:52 -07:00
Leijurv
ce59ef559f backport important world scanner fixes 2019-04-09 19:35:43 -07:00
Leijurv
563028a5b3 fix invalid player move packet, and a bunch of things in world scanner 2019-04-09 19:30:48 -07:00
Leijurv
d5c317b88b Merge branch 'master' into 1.13.2 2019-04-09 18:17:53 -07:00
Leijurv
fc3f183dce actually don't render the boxes if renderpath is false 2019-04-09 08:45:30 -07:00
Leijurv
6b6eea2d8c add renderSelectionBoxes, fixes #378 2019-04-08 20:32:47 -08:00
Leijurv
e54652941b codacy 2019-04-07 17:44:23 -07:00
Leijurv
867c01ff86 crucial performance optimization 2019-04-06 21:50:22 -08:00
Leijurv
87a9e67ba8 dont reassign arg 2019-04-05 11:59:28 -07:00
Leijurv
bf076f6246 privatize 2019-04-04 20:51:02 -08:00
Leijurv
75b54dfaec nullpointer is confusing 2019-04-03 23:19:32 -07:00
Leijurv
71a2219b07 move fields to the top 2019-04-02 21:40:33 -08:00
Leijurv
ccc3de2d7c dawn of the 8th month 2019-04-01 23:30:33 -07:00
Leijurv
af11e64cec combine nested 2019-03-31 20:22:17 -08:00
Leijurv
2c3dc5d6b1 add plea 2019-03-30 23:23:12 -07:00
Leijurv
71482cc984 explain for brainlets 2019-03-29 23:10:19 -07:00
Leijurv
3329db1dae these show the exact same info; remove one 2019-03-28 23:01:14 -07:00
Leijurv
926e2d5620 add resuming to builder, fixes #371 2019-03-27 17:32:02 -07:00
Leijurv
d2de8828e7 did this 2019-03-26 23:01:07 -07:00
Leijurv
9fcae6560e better feature branch example 2019-03-25 21:03:19 -08:00
Leijurv
2e8fdd43ee no flowing 2019-03-24 13:53:19 -07:00
Leijurv
27e39c8083 update badges 2019-03-24 13:50:50 -07:00
Leijurv
a8f373d568 fine; assumewalkonlava 2019-03-24 13:07:08 -07:00
Leijurv
c59ec9da10 blank space 2019-03-23 22:17:40 -08:00
Leijurv
71491a7922 blank space 2019-03-23 22:17:40 -08:00
Leijurv
3a675836da Merge pull request #370 from babbaj/patch-1
use runAutoTest
2019-03-23 13:03:19 -07:00
babbaj
7e0fc81246 use runAutoTest 2019-03-23 15:55:16 -04:00
Leijurv
f970f932c7 great 2019-03-23 10:52:03 -07:00
Leijurv
52d2741f52 and lets try making it fail delibrately 2019-03-23 10:31:36 -07:00
Leijurv
7bc6765cac rart 2019-03-23 10:13:14 -07:00
Leijurv
85b2aea6e9 where is this writing??? 2019-03-23 09:52:49 -07:00
Leijurv
c6ba5481d9 one final attempt 2019-03-22 22:33:40 -07:00
Leijurv
81f47d5632 forgot file name lollll 2019-03-22 22:19:13 -07:00
Leijurv
9b1440ed2c that needs to be allowed 2019-03-22 22:07:12 -07:00
Leijurv
2a8dcee028 write to a file to indicate success 2019-03-22 22:05:27 -07:00
Leijurv
277ba3643c Merge branch 'master' into 1.13.2 2019-03-22 21:24:43 -07:00
Leijurv
170c2d35c2 perhaps updating debian will help 2019-03-22 21:17:20 -07:00
Leijurv
e5fbaf60f3 shutdownminecraftapplet 2019-03-22 21:04:35 -07:00
Leijurv
bc49b2d5ba add allowDownward, fixes #369 2019-03-22 15:50:23 -07:00
Leijurv
f58b6b41cb second attempt at backfill 2019-03-22 15:45:34 -07:00
Leijurv
ac1ac50158 add some builder commands to usage 2019-03-22 14:36:21 -07:00
Leijurv
d4103a924d add two new awesome badges 2019-03-21 16:58:31 -07:00
Leijurv
0deb854e1b v1.3.0 2019-03-21 16:40:18 -07:00
Leijurv
8268e3ec1b Merge branch 'master' into 1.13.2 2019-03-21 15:51:36 -07:00
Leijurv
bd64f73842 fix disconnect on arrival not firing for custom goal process 2019-03-21 15:44:20 -07:00
Leijurv
cac653ddd9 little cleanup 2019-03-20 23:06:14 -07:00
Leijurv
04ff365890 what about if i delete two (2) empty lines 2019-03-20 23:03:06 -07:00
Leijurv
54ed6ce5a5 crucial code formatting 2019-03-20 22:55:40 -07:00
Brady
32ac46c8a9 Update PULL_REQUEST_TEMPLATE.md 2019-03-19 21:26:58 -05:00
Brady
7ab2cd2a45 Update ISSUE_TEMPLATE.md 2019-03-19 21:26:47 -05:00
Brady
a07fae6cdd Update Code of Conduct to include templates 2019-03-19 21:25:58 -05:00
babbaj
3f6af51713 Create PULL_REQUEST_TEMPLATE.md 2019-03-19 21:23:05 -05:00
babbaj
8c4e778506 Create ISSUE_TEMPLATE.md 2019-03-19 21:23:05 -05:00
Leijurv
65902d556e v1.2.5 2019-03-19 18:22:22 -07:00
Leijurv
af91da6a28 Merge branch 'master' into 1.13.2 2019-03-19 18:12:26 -07:00
Leijurv
aada9731a6 more resiliency to invalid cache files 2019-03-19 18:10:53 -07:00
Leijurv
9a15a65ad5 not needed anymore 2019-03-19 13:59:56 -07:00
Leijurv
49658078b9 trapdoors cant be passed vertically in either state, thanks plutie 2019-03-18 22:38:06 -07:00
Leijurv
bcd097c6cb we can cancel calc even if not safe to cancel pathing 2019-03-17 22:40:11 -08:00
Leijurv
cfec67f1f9 wording 2019-03-16 23:23:20 -07:00
Leijurv
0cbe9f81c8 Merge branch 'master' into 1.13.2 2019-03-15 16:58:23 -07:00
Leijurv
42afd2dd54 maybe proper exit code 2019-03-15 16:49:36 -07:00
Leijurv
aaaf0f8839 hey so what if we didnt do that 2019-03-15 16:40:15 -07:00
Leijurv
315929f31c hey so what if we didnt do that 2019-03-15 16:39:59 -07:00
Leijurv
358aa80280 docker time 2019-03-15 16:22:51 -07:00
Leijurv
1dd9e11994 documentation resigned 2019-03-15 16:19:07 -07:00
Leijurv
5a8f02c944 unscuff everything 2019-03-15 16:11:14 -07:00
Leijurv
f248a5b677 make runClient work 2019-03-15 15:32:51 -07:00
Leijurv
ee83471bf6 fix being unable to place or pick up water buckets 2019-03-15 14:26:38 -07:00
Leijurv
610fe6439f fix getting permanently stuck on vines 2019-03-15 14:25:43 -07:00
Leijurv
e4a49c5529 fix launchtesting not found on runClient 2019-03-15 14:00:11 -07:00
Leijurv
449b44ba50 line 2019-03-14 16:32:14 -07:00
Leijurv
a00eec402e i love retina wtf 2019-03-14 16:32:04 -07:00
Leijurv
717779f742 air is stupid 2019-03-14 16:06:32 -07:00
Leijurv
bd1dcff385 allow ties for closest to explore to 2019-03-14 14:52:51 -07:00
Leijurv
6f843bd24d Merge branch 'master' into 1.13.2 2019-03-13 20:09:08 -07:00
Leijurv
226ede7ba2 crucial 2019-03-13 19:23:28 -07:00
Leijurv
89fb5cecd5 v1.2.4 2019-03-13 18:15:21 -07:00
Leijurv
d79fbea433 scuffed air 2019-03-13 18:08:15 -07:00
Leijurv
a75317cc2c workaround some scuff 2019-03-13 09:17:25 -07:00
Leijurv
ee6df270ce relative coordinates 2019-03-13 08:50:04 -07:00
Leijurv
e09541151f update clients 2019-03-12 23:29:08 -07:00
Leijurv
74e0552be0 unscuff water, thanks wwe 2019-03-12 23:10:06 -07:00
Leijurv
4d22c10ddb unscuff water, thanks wwe 2019-03-12 23:08:06 -07:00
Leijurv
1ea92a6092 😎 2019-03-12 22:49:23 -07:00
Leijurv
909ab553eb small cleanup 2019-03-12 22:08:17 -07:00
Leijurv
866408aece rename 2019-03-12 19:17:50 -07:00
Leijurv
2215f170df Merge branch 'builder' 2019-03-12 19:16:40 -07:00
Leijurv
a5601fd89a nutty 2019-03-12 18:59:20 -07:00
Leijurv
fa8f2632f5 dont jump while breaking 2019-03-12 18:58:35 -07:00
Leijurv
66eba84d06 consistent spacing 2019-03-12 18:54:36 -07:00
Leijurv
92e39b5d1d its over its done 2019-03-12 18:45:54 -07:00
Leijurv
0ddc47f473 i am rarted 2019-03-12 18:21:29 -07:00
Leijurv
ddfeca6947 unproject click cursed 2019-03-12 18:00:30 -07:00
Leijurv
6bd2e90cfd crash when pathing near shulker boxes 2019-03-12 17:18:58 -07:00
Leijurv
82505ddb01 online mode via env 2019-03-12 17:18:52 -07:00
Leijurv
2790d1d308 Merge branch 'master' into 1.13.2 2019-03-12 16:19:06 -07:00
Leijurv
52d8d271f1 fix a meme with a path ending in water 2019-03-12 16:18:48 -07:00
Leijurv
11e503a022 many fixes 2019-03-12 16:17:43 -07:00
Leijurv
b240e8420a whoops 2019-03-12 15:53:00 -07:00
Leijurv
25024b58de fix a bunch of scuff 2019-03-12 15:52:40 -07:00
Leijurv
6fe49380ba pwned 2019-03-12 15:42:25 -07:00
Leijurv
1f2e267e3d fix a bunch of scuff 2019-03-12 15:41:58 -07:00
Leijurv
4cf6783622 fix the tests 2019-03-12 09:38:05 -07:00
Brady
82d77a7bac Update MixinGradle to 0.6.2
Includes fix ensuring that the SRGs are generated prior to Mixin annotation processing
2019-03-12 01:43:03 -05:00
Leijurv
ba31d209c9 except what if it compiled 2019-03-11 23:29:39 -07:00
Leijurv
7974d9135b Merge branch 'master' into builder 2019-03-11 23:26:05 -07:00
Brady
841a927033 Merge remote-tracking branch 'origin/master' into 1.13.2 2019-03-12 01:09:11 -05:00
Brady
5a16561954 Working 1.13.2 development environment
Including a couple bugfixes to bad 1.13.2 code!!!
2019-03-12 01:05:39 -05:00
Leijurv
a5a795a22c lower case ok 2019-03-11 22:21:35 -07:00
Leijurv
416b5b66d2 break fewer beds 2019-03-11 20:57:46 -07:00
Leijurv
88e41f37b1 explain whats happening 2019-03-11 20:08:52 -07:00
Leijurv
7cfa837604 blacklistClosestOnFailure 2019-03-11 20:06:19 -07:00
Leijurv
6b7aca3081 force revalidate on control change 2019-03-11 19:23:41 -07:00
Leijurv
580af2ab06 processes tied in priority 2019-03-11 18:24:31 -07:00
Leijurv
d144d30890 crucial clarification 2019-03-10 23:43:00 -07:00
Leijurv
ecac546c6d actually trolling is fine 2019-03-09 23:15:03 -08:00
Brady
e2cc51908b Notch builds 2019-03-08 23:18:00 -06:00
Brady
1390e04435 Add versions in parenthesis for todos to fix stuff 2019-03-08 15:14:52 -06:00
Brady
84d961cbab Fix usages of Setting#get() 2019-03-08 15:12:55 -06:00
Brady
87b9d3915c Fix compiler errors
unproject needs to be resolved
2019-03-08 15:03:58 -06:00
Brady
c38d17563d Resolve merge conflicts
oh my god I should've updated my local branch before doing this
2019-03-08 14:44:49 -06:00
Brady
0c2af85ac0 Update to 1.13.2
Still need to setup method of launching, and Mixin support for ModLauncher
2019-03-08 14:30:43 -06:00
Leijurv
76297e8176 add click to usage 2019-03-08 08:43:28 -08:00
Leijurv
d90f391b5e 7 lmao 2019-03-07 18:18:31 -08:00
Leijurv
d80ae57964 disconnect on arrival 2019-03-06 22:44:57 -08:00
Leijurv
74d7483b3c explore 2019-03-05 12:26:52 -08:00
Leijurv
b3c580e657 teensy javadoc 2019-03-04 21:49:21 -08:00
Leijurv
8050b69f2f no more .get 😎 2019-03-04 21:30:04 -08:00
Leijurv
459720c348 eh actually lets do the whole render distance! 2019-03-04 21:21:02 -08:00
Leijurv
a73f5c1359 crapton of performance improvements 2019-03-04 21:20:13 -08:00
Leijurv
71cb0f6d36 fix a weird way of getting stuck on a ladder 2019-03-04 21:00:41 -08:00
Leijurv
0d15225b1d dont construct one unlesss we need to 2019-03-04 21:00:30 -08:00
Leijurv
826f3788d0 performance improvement and no allocation promise 2019-03-04 20:39:22 -08:00
Leijurv
2133ab39b7 better cache, needs more testing 2019-03-04 19:44:36 -08:00
Leijurv
558c14a375 little cleanup 2019-03-04 13:11:36 -08:00
Leijurv
882ac41291 player coords 2019-03-04 11:28:41 -08:00
Leijurv
66c7a3f513 this is really bad 2019-03-03 21:29:31 -08:00
Leijurv
5904441a7e ❤️ code of conduct 2019-03-02 22:40:42 -08:00
Leijurv
c465228531 consistency with the previously existing anime policy 2019-03-02 21:44:20 -08:00
Leijurv
81b22019dd Create CODE_OF_CONDUCT.md 2019-03-02 21:43:18 -08:00
Leijurv
3e47d485f9 emphasize and clarify lol 2019-03-01 12:11:47 -08:00
Leijurv
701bc772a8 update impcat badge 2019-03-01 11:22:21 -08:00
Leijurv
3ae05b7348 worldedit 2019-02-28 15:26:09 -08:00
Leijurv
2e186019f5 Merge branch 'master' into builder 2019-02-28 12:32:29 -08:00
Leijurv
4c6f321cff clarify 2019-02-28 12:12:16 -08:00
Leijurv
c72eb3e195 v1.2.3 2019-02-28 09:47:47 -08:00
Leijurv
a4237bf1f9 tentative fix to descend, needs testing 2019-02-27 23:04:43 -08:00
Leijurv
e767e34b92 well that was stupid, thanks thesmarttheorist 2019-02-27 22:15:54 -08:00
Leijurv
8ac82ebe2a v1.2.2 2019-02-27 17:48:57 -08:00
Leijurv
0ed6ccab71 update some documentation 2019-02-27 15:46:28 -08:00
Leijurv
bf25d7328e revalidate on goal update too 2019-02-27 12:23:05 -08:00
Leijurv
a47b0c0581 rendering cleanup, fixes #317 2019-02-27 12:00:39 -08:00
Leijurv
596849c7e6 i am rarted 2019-02-26 19:51:20 -08:00
Leijurv
76914b7859 awesome 2019-02-26 19:50:35 -08:00
Leijurv
3dbbe053d7 teensy change 2019-02-26 19:45:20 -08:00
Brady
c474cdb1f8 Working clicking goals 2019-02-26 21:41:08 -06:00
Leijurv
3de02cbf21 brady save me idk how to gl 2019-02-26 18:34:11 -08:00
Brady
26fefc70f0 Better update the badges 2019-02-26 17:29:50 -06:00
Brady
4086c9f4b5 Implement secondary license conditioning
Sorry fellas, no anime in this town.
2019-02-26 17:25:30 -06:00
Leijurv
c947c77853 goodbye mc.objectMouseOver 2019-02-26 15:07:01 -08:00
Leijurv
9be44c0371 placement without unepic right click 2019-02-26 14:57:44 -08:00
Leijurv
5412fa6cfd cursed flowing 2019-02-25 20:35:06 -08:00
Leijurv
6e7320b954 v1.2.1 2019-02-25 18:07:55 -08:00
Leijurv
fbb2d37634 allow placing against replacable blocks 2019-02-25 18:01:11 -08:00
Leijurv
7afe16fc10 dont reset every tick 2019-02-25 16:26:17 -08:00
Leijurv
b19f241d81 override for the first tick 2019-02-25 15:06:55 -08:00
Leijurv
583ce80003 not reliable enough with jesus to jump from water over a gap 2019-02-24 13:57:33 -08:00
Leijurv
195c33407e cant walk through heads 2019-02-24 13:43:53 -08:00
Leijurv
600c5b77ad v1.2.0 2019-02-23 20:43:29 -08:00
Leijurv
f1084fab76 come 2019-02-23 20:33:00 -08:00
Brady
bd65e32407 Fix the failing build 2019-02-23 17:04:14 -06:00
Leijurv
e4416f424a interesting 2019-02-23 14:13:27 -08:00
Leijurv
73ec110b22 not every player is a baritone 2019-02-23 14:03:47 -08:00
Brady
0bce801a3f Minor javadoc changes 2019-02-23 14:32:10 -06:00
Brady
e8e00e8dfb CRLF -> LF
It was inconsistent across the board
2019-02-23 12:27:24 -06:00
Leijurv
cc4335e48e better links 2019-02-22 23:32:23 -08:00
Leijurv
5427911da3 only api in javadoc i guess 2019-02-22 23:29:08 -08:00
Brady
c808d5a42d Small build.gradle cleanup and README update 2019-02-22 18:12:04 -06:00
Leijurv
3b46dbd6a1 appease codacy 2019-02-22 14:05:29 -08:00
Leijurv
e63b2f1bf1 unused arg 2019-02-22 13:58:03 -08:00
Leijurv
d32e822057 settings overhaul 2019-02-22 12:13:19 -08:00
Leijurv
2b672998e1 fix two weird ways of getting stuck 2019-02-21 14:24:23 -08:00
Leijurv
e18dc7c7e7 Merge branch 'master' into builder 2019-02-21 11:28:13 -08:00
Leijurv
16dcd2f44d blocks on top of chests, fixes #299 2019-02-21 11:25:03 -08:00
Leijurv
eb9f755b54 disable rendercachedchunks in singleplayer, fixes #331 2019-02-21 10:03:03 -08:00
Leijurv
29a9e6e1d1 fine, forward alias to thisway 2019-02-21 09:45:01 -08:00
Leijurv
1f52f706ed should fix anticheatcompat off on forge 2019-02-20 23:41:29 -08:00
Leijurv
bf12763a10 fix a bunch of bugs with placement 2019-02-20 08:08:52 -08:00
Leijurv
963641a818 trim big schematics 2019-02-19 22:50:03 -08:00
Leijurv
3e94d92fbd Merge branch 'master' into builder 2019-02-19 22:33:19 -08:00
Leijurv
a72040f83d imagine breaking the build 2019-02-19 19:52:11 -08:00
Leijurv
84d8f826ff fine lol, fixes #340 2019-02-19 19:41:26 -08:00
Brady
70d216b29f Fix renderGoalXZBeacon path rendering incorrect color 2019-02-19 21:00:14 -06:00
Leijurv
66356d5334 hmm 2019-02-19 18:27:05 -08:00
Leijurv
d9625dfe78 no longer needed crab rave 2019-02-19 18:24:12 -08:00
Leijurv
6d847577d8 somehow missed those 2019-02-19 18:22:59 -08:00
Leijurv
8fd687f9d7 more usage help 2019-02-19 15:04:18 -08:00
Leijurv
f7a9380b9d v1.1.6 2019-02-19 14:53:43 -08:00
Leijurv
5617c595b2 public init 2019-02-19 14:43:48 -08:00
Leijurv
8770524679 fix weird angle forcing behavior, fixes #341 2019-02-19 14:29:08 -08:00
Leijurv
a8ddb2fcf1 also disallow while breaking 2019-02-19 13:28:58 -08:00
Leijurv
76c4ca9ba6 fix path reliability after lateral movement 2019-02-19 12:55:58 -08:00
Leijurv
ed2b0f0bb9 fix jump before place ascend 2019-02-19 12:44:29 -08:00
Leijurv
6702b44b3e reformatted and fixed stuck on break fall 2019-02-19 12:43:44 -08:00
Leijurv
c486d8241e continue 2019-02-19 07:53:36 -08:00
Leijurv
d2bb8c374e explain 2019-02-18 21:18:37 -08:00
Leijurv
530cecea5b it flows better this way 2019-02-17 21:41:54 -08:00
Leijurv
266e2dada9 cleanup 2019-02-16 20:49:38 -08:00
Leijurv
ce73d34627 Merge branch 'master' into builder 2019-02-16 20:49:07 -08:00
Leijurv
11af0a7aac v1.1.5 2019-02-15 21:36:34 -08:00
Leijurv
46c2d8f7c7 unneeded 2019-02-15 21:35:52 -08:00
Leijurv
38127011fb Merge pull request #336 from babbaj/master
Fix potential problems
2019-02-14 14:48:48 -08:00
Leijurv
89b5ce4b63 properly detect failure 2019-02-14 14:47:38 -08:00
babbaj
4fe9c180d5 Fix potential problems 2019-02-14 07:03:22 -05:00
Leijurv
f094e83e4d codacy 2019-02-13 22:41:18 -08:00
Leijurv
5b6c9fc348 blacklist unreachable gettoblocks 2019-02-13 22:39:43 -08:00
Leijurv
3f1ee100bf only sprint ascends that are followed in the same direction 2019-02-13 22:39:34 -08:00
Leijurv
41b1106c72 sprint in water for real 2019-02-13 21:20:06 -08:00
Leijurv
b27d95a615 proper fall overshooting 2019-02-13 21:11:13 -08:00
Leijurv
5b8a83853d add setting to sprint in water 2019-02-13 19:23:16 -08:00
Leijurv
d0548b2715 add a warning 2019-02-13 18:39:26 -08:00
Leijurv
bffeb9c862 forgot one extra check 2019-02-13 18:38:46 -08:00
Leijurv
dbd760fbcb some polish on ascend sprinting 2019-02-13 18:26:30 -08:00
Leijurv
a84b3bfc7a sprint through ascends whenever possible, fixes #149 2019-02-13 16:55:08 -08:00
Leijurv
e8d3bf509c clarify 2019-02-13 16:33:27 -08:00
Leijurv
b2583773d5 discard next segment properly 2019-02-13 16:30:53 -08:00
Leijurv
9ecd24c755 remove toxic cloud 2019-02-13 16:30:41 -08:00
Leijurv
f1bacd6210 fix cancellation of unusable segments 2019-02-13 16:22:49 -08:00
Leijurv
a21ec54d4f stop breaking block when you let go of left click lol 2019-02-13 14:05:14 -08:00
Leijurv
0b4efb24ae momentous occasion: turning that crap off 2019-02-13 13:57:33 -08:00
Leijurv
c473914d05 fix flashing backwards, fixes #265 2019-02-13 13:54:50 -08:00
Leijurv
90a1fa8337 lol 2019-02-12 22:06:13 -08:00
Leijurv
99cb7f5142 crucial performance optimization 2019-02-12 21:36:53 -08:00
Leijurv
4026b850f8 dont spam debug chat 2019-02-12 18:34:58 -08:00
Leijurv
aac7ebf6dd avoid creating callbackinfo at all costs 2019-02-12 18:32:03 -08:00
Leijurv
8d481ba394 lol 2019-02-12 09:58:44 -08:00
Leijurv
24fa75c24e did someone say more badges 2019-02-11 22:26:49 -08:00
Leijurv
cf38d593b8 thanks leafeon 2019-02-11 22:20:59 -08:00
Leijurv
36f608c63c add epic gamer address 2019-02-11 19:21:08 -08:00
Leijurv
1d88564a72 clarify this setting since its got a similar name 2019-02-10 16:50:54 -08:00
Leijurv
503f2fb197 direct link to the top of the detail section since its not sorted alphabetically 2019-02-10 16:46:37 -08:00
Leijurv
bb000c4e3f include diagonals, and better settings 2019-02-10 16:44:09 -08:00
Leijurv
4868ed7560 explain whats going on 2019-02-10 15:12:52 -08:00
Leijurv
7017e9e2ea crucial performance optimization 2019-02-10 15:10:44 -08:00
Leijurv
a18eb90702 address glaring inconsistency 2019-02-10 13:49:28 -08:00
Leijurv
9d1d4fe0d9 typo 2019-02-10 10:44:04 -08:00
Leijurv
1a430dc2cf explain 2019-02-09 17:38:42 -08:00
Leijurv
e37a09a1c8 makes mining faster, fixes #330 2019-02-08 12:08:34 -08:00
Leijurv
d0d8b12fb8 add clickCancel, fixes #326 2019-02-07 17:18:14 -08:00
Leijurv
9a29f9ce57 better behavior on arrival and failure 2019-02-07 16:39:15 -08:00
Leijurv
42513e4b56 better check 2019-02-07 16:12:34 -08:00
Leijurv
67fa91abe8 fixes to descend, and goto coords 2019-02-07 15:55:39 -08:00
Leijurv
d8348ad292 Merge branch 'master' into builder 2019-02-07 14:11:26 -08:00
Leijurv
6faa7344aa properly discard orphan path segments 2019-02-07 14:11:18 -08:00
Leijurv
299540725e a start on inventory movement 2019-02-07 13:59:37 -08:00
Leijurv
0ef08142fd trim spaces from schematic name 2019-02-07 13:12:44 -08:00
Leijurv
c0761c0eef be more tolerant of alternate movement inputs 2019-02-07 10:46:32 -08:00
Leijurv
8694d926c4 remove unneeded printouts 2019-02-07 10:45:51 -08:00
Leijurv
46f8829951 v1.1.4 2019-02-07 09:16:19 -08:00
Leijurv
4c4bce3561 define origin 2019-02-06 22:10:52 -08:00
Leijurv
68e8717b5c Merge branch 'master' into builder 2019-02-06 21:05:14 -08:00
Leijurv
b484e6fa3f literally disable the entire thing 2019-02-06 21:00:53 -08:00
Leijurv
aa8773a67e fixes to sprinting through descend and diagonal 2019-02-06 20:54:07 -08:00
Leijurv
a822d3ef05 horrifying placement 2019-02-06 16:22:40 -08:00
Leijurv
311cf81e8a Merge branch 'master' into builder 2019-02-06 12:54:03 -08:00
Leijurv
bf9ee918f3 5 artifacts and documentation 2019-02-06 12:50:42 -08:00
Leijurv
92ba76e7a1 since all settings are individually final, the class should be too 2019-02-06 10:23:01 -08:00
Leijurv
3326339263 lol that wasnt even right 2019-02-05 22:17:28 -08:00
Leijurv
52cafbc7aa add a little version thingy 2019-02-05 21:49:09 -08:00
Leijurv
efb316de14 codacy 2019-02-05 18:11:33 -08:00
Leijurv
3cf944398f 😭 2019-02-05 14:03:32 -08:00
Leijurv
d2bfd47039 how to check 2019-02-05 12:41:30 -08:00
Leijurv
920cb6556b a bit more 2019-02-05 12:38:39 -08:00
Leijurv
cd3ae2a7f5 documentation overhaul 2019-02-05 12:34:29 -08:00
Leijurv
b12fedb2d9 help 2019-02-05 11:08:12 -08:00
Leijurv
1cae7ad6b1 v1.1.3 2019-02-05 09:55:29 -08:00
Leijurv
7dd881aa9a latest forge works yay 2019-02-05 09:54:17 -08:00
Leijurv
c7ad235110 v1.1.2 2019-02-05 09:38:33 -08:00
Leijurv
a989547976 add proper setting for suppressing clicks 2019-02-05 09:37:42 -08:00
Leijurv
fa75880626 v1.1.1 2019-02-05 08:25:30 -08:00
Leijurv
529895f970 was only needed for freecam anyway 2019-02-05 08:25:14 -08:00
Leijurv
3d5de440fd what a mess 2019-02-04 21:30:58 -08:00
Leijurv
568bb1b0e8 some forge info 2019-02-04 21:23:19 -08:00
Leijurv
b9ae8306dd v1.1.0 2019-02-04 20:11:55 -08:00
Leijurv
4aededff46 allow prefix and non prefix control at the same time 2019-02-04 19:57:01 -08:00
Leijurv
ed8f9863e3 spacing 3 2019-02-04 19:37:36 -08:00
Leijurv
e85de55c8f spacing 2 2019-02-04 19:36:16 -08:00
Leijurv
adbf927270 spacing 2019-02-04 19:35:22 -08:00
Leijurv
dfe171a5c2 forge 2019-02-04 19:34:44 -08:00
Leijurv
b55e449398 extra line 2019-02-04 19:01:50 -08:00
Leijurv
62b11c0a8a i'm legitimately sorry 2019-02-04 19:01:01 -08:00
Leijurv
90cb11f55e this is needed 2019-02-04 18:19:51 -08:00
Leijurv
40a66b0306 almost forge support 2019-02-04 18:05:05 -08:00
Leijurv
8c899698e0 explore for blocks, fixes #323 2019-02-04 16:27:32 -08:00
Leijurv
58fa1571f3 added more info 2019-02-04 15:43:02 -08:00
Leijurv
2cbe77aa04 many fixes 2019-02-04 15:24:27 -08:00
Leijurv
a0c2935580 Merge branch 'master' into mega-cancer-rendering 2019-02-04 14:52:30 -08:00
Leijurv
798f25ff81 dont glitch weirdly when failing a parkour jump 2019-02-04 13:52:11 -08:00
Leijurv
57b2e360ca dont include current movement cost while deciding when to plan ahead 2019-02-04 13:27:35 -08:00
Leijurv
ee23d59e11 now we can cache flowing water properly 2019-02-04 13:07:56 -08:00
Leijurv
04e7da9b73 lower walk into can be water, but not upper 2019-02-04 13:07:05 -08:00
Leijurv
5382d265f2 crucial performance optimization 2019-02-03 19:46:59 -08:00
Leijurv
0e1534613c appease codacy 2019-02-03 19:34:29 -08:00
Leijurv
d799fac688 epicer gradle output 2019-02-03 19:27:28 -08:00
Leijurv
913247996e smh my head. who right clicks gradle tasks?? 2019-02-02 14:23:01 -08:00
Leijurv
dc3bab26de 6 months =D 2019-02-01 22:54:14 -08:00
Leijurv
5c1cf050e2 im idiot 2019-01-31 20:27:14 -08:00
Leijurv
747bee41b7 holding control shouldnt make all bots sprint 2019-01-31 20:26:24 -08:00
Leijurv
246c00c773 dont repeat that 2019-01-31 19:19:44 -08:00
Leijurv
272dd79426 much needed pathing overhaul 2019-01-30 15:49:37 -08:00
Leijurv
b953da0341 more accurate isEmpty 2019-01-30 12:19:15 -08:00
Leijurv
c2a6445c9e Merge branch 'master' into mega-cancer-rendering 2019-01-30 12:07:58 -08:00
Leijurv
b177ae7ee6 proguard can just ignore GL14 reference actually 2019-01-30 11:57:54 -08:00
Leijurv
22bd5be5a9 explain 2019-01-30 11:54:38 -08:00
Leijurv
90fa347fc2 also get rid of warning in build stage 2019-01-30 11:54:02 -08:00
Leijurv
68a9a1439a maybe this will allow emoji 2019-01-30 11:45:03 -08:00
Leijurv
8947eff3b1 bsi might be old 2019-01-30 11:42:46 -08:00
Brady
06b3c5ddb5 LeijurvUtils 2019-01-30 12:42:26 -06:00
Leijurv
5fb8a1d3d1 Merge branch 'master' into builder 2019-01-29 19:58:51 -08:00
Leijurv
b4d307d4cc cherry pick some movement fixes from builder 2019-01-29 19:56:50 -08:00
Leijurv
306bd18a40 Merge branch 'master' into builder 2019-01-29 19:47:36 -08:00
Leijurv
1968f47fc9 add a setting to play with 2019-01-29 19:44:23 -08:00
Leijurv
9b42aa3634 damn you javadocs 2019-01-29 15:34:31 -08:00
Leijurv
9faa0ddc62 huge number of fixes 2019-01-29 15:22:54 -08:00
Leijurv
6a2cd9d3ba Merge branch 'master' into mega-cancer-rendering 2019-01-29 13:55:00 -08:00
Leijurv
9028564c10 only when the setting is enabled 2019-01-29 13:54:54 -08:00
Brady
8f2b23f8f9 Wew lad 2019-01-29 14:33:34 -06:00
Brady
b471d7419e Replace most of the @Inject usages for cancer render with @Redirect 2019-01-29 12:41:14 -06:00
Leijurv
5179cfc5ba semitransparency working 2019-01-28 21:28:26 -08:00
Leijurv
784b2f541d lol 2019-01-28 19:02:07 -08:00
Leijurv
735cf47c35 actually works 2019-01-28 17:34:14 -08:00
Leijurv
056742479e except without that 2019-01-28 16:06:34 -08:00
Leijurv
840b7e6987 misc fixes #315 2019-01-28 15:59:53 -08:00
Leijurv
a87772c98c remove that image once done 2019-01-28 12:16:45 -08:00
Leijurv
c15f1e8276 link source is cool 2019-01-28 12:06:26 -08:00
Leijurv
49148dfb7a add javadocs link 2019-01-28 11:57:58 -08:00
Leijurv
177f5de2bd yay travis checks javadocs now 2019-01-28 11:56:44 -08:00
Leijurv
96360ddb24 perhaps 2019-01-28 11:49:52 -08:00
Leijurv
f5f2e4970e make travis fail when javadoc doesn't compile 2019-01-28 11:37:02 -08:00
Leijurv
742256c130 more fun javadocs 2019-01-28 11:30:33 -08:00
Leijurv
b4a622d319 editing settings 2019-01-28 10:59:08 -08:00
Leijurv
b0c4752397 finalize all settings 2019-01-28 10:41:28 -08:00
Leijurv
bf78a4dfad whoops forgot that 2019-01-28 10:32:28 -08:00
Leijurv
8d7841b069 privatize 2019-01-27 19:34:12 -08:00
Leijurv
396eaa148c remove extra newline 2019-01-26 21:33:41 -08:00
Leijurv
2a244f1e53 those were a little over the top 2019-01-25 11:51:54 -08:00
Leijurv
847181ada4 Merge branch 'master' into builder 2019-01-24 21:00:52 -08:00
Leijurv
f274f5a0ef windows is epic gamer 2019-01-24 21:00:44 -08:00
Leijurv
bb41883070 did someone say add another badge 2019-01-24 16:31:12 -08:00
Leijurv
fca5457ab9 gotta have closed issues too 2019-01-24 16:25:35 -08:00
Leijurv
4f355ed4a2 two more 2019-01-24 16:10:21 -08:00
Leijurv
b1452c714a b a d g e s 2019-01-24 16:06:58 -08:00
Brady
aba48cca53 Organize some markdown files 2019-01-24 15:21:16 -06:00
Brady
772d5fb0cc SETUP.md 2019-01-24 15:09:04 -06:00
Brady
6b6f8cadb2 Image tutorial epic haha 2019-01-24 15:06:01 -06:00
Brady
82ab79e915 CLI setup 2019-01-24 14:34:35 -06:00
Leijurv
863471b5f1 don't create a new bsi for every selection box every tick 2019-01-23 21:25:38 -08:00
Leijurv
314f280400 pigs 2019-01-22 17:26:00 -08:00
Brady
b75f4bf9a9 Reformat 2019-01-22 13:32:37 -06:00
Brady
253d67ce78 final final final final 2019-01-22 12:01:06 -06:00
Leijurv
1753bc18c1 forgehax 2019-01-21 23:32:41 -08:00
Leijurv
eceba13164 diss wwe 2019-01-20 16:26:23 -08:00
Leijurv
3c6c640f50 unused 2019-01-20 15:41:36 -08:00
Leijurv
30e3018966 trigger brady 2019-01-20 15:33:08 -08:00
Leijurv
5ab0bb3c0d nice round number 2019-01-20 13:53:55 -08:00
Leijurv
0de1517bd8 Merge pull request #316 from babbaj/master
Never send chat message when using prefix
2019-01-20 09:22:03 -08:00
babbaj
39c6d81b9e Never send chat message when using prefix 2019-01-20 06:20:49 -05:00
Leijurv
1c1fbe83ec idk lol 2019-01-19 22:12:54 -08:00
Leijurv
ccd56e0368 Merge branch 'master' into builder 2019-01-19 16:36:42 -08:00
Leijurv
38c7f226cb brady is rart 2019-01-19 16:36:31 -08:00
Brady
f5446cc415 Fix SprintStateEvent 2019-01-19 12:12:26 -06:00
Brady
aa2e680568 Remove ManagedPlayerEvent 2019-01-19 12:10:49 -06:00
Leijurv
bc651cb774 add todo 2019-01-18 20:12:40 -08:00
Brady
20b03d0004 No more setSprinting 2019-01-18 13:43:19 -06:00
Leijurv
b005ce8e6b mega cancer render cached chunks 2019-01-17 18:54:37 -08:00
Brady
979b8b2663 Remove associatedWith in process and some more javadoc changes 2019-01-17 18:20:27 -06:00
Brady
69b1decbba leftClickWorkaround is no longer applicable 2019-01-17 18:04:12 -06:00
Brady
d32c92cbde Specificity time 2019-01-17 18:01:31 -06:00
Leijurv
cef88cde20 epic super 2019-01-17 12:25:48 -08:00
Leijurv
a5b9885767 not even used 2019-01-17 12:22:36 -08:00
Leijurv
2daedecf92 maybe fix 2019-01-16 17:42:43 -08:00
Brady
db24822d2f Fix cursed exception 2019-01-16 13:50:15 -06:00
Brady
aa3833915b Repackage schematic implementations 2019-01-16 13:45:32 -06:00
Brady
59320d9b85 Auto test class javadoc 2019-01-16 13:37:39 -06:00
Brady
0c0bbeff27 Minor AirSchematic access modifier change 2019-01-16 12:39:15 -06:00
Brady
ceda14096c Builder Process API exposure
Professional style 💪
2019-01-15 22:07:06 -06:00
Leijurv
9dfcef6356 crucial performance optimization 2019-01-15 17:21:50 -08:00
Leijurv
d5b393d6bd area clear 2019-01-14 21:41:40 -08:00
Leijurv
ae3fc14b52 refactor name 2019-01-14 19:52:31 -08:00
Leijurv
e2cdd6a7f9 builder with multiple materials 2019-01-14 19:49:26 -08:00
Leijurv
261d02e67b Merge branch 'master' into builder 2019-01-14 13:01:25 -08:00
Leijurv
f8681d179d TODO use nanotime when calc starts on dec 31 2019-01-13 00:00:52 -08:00
Leijurv
f23630064e reorder 2019-01-12 22:33:46 -08:00
Leijurv
a6ce4694fc hotbar selection uwu 2019-01-12 19:51:21 -08:00
Leijurv
bec7f9be96 this lets proguard optimize out one more double division 2019-01-11 13:18:31 -08:00
Leijurv
09e94eaa8e not anymore 2019-01-11 13:02:03 -08:00
Leijurv
14bc65468a tweaks 2019-01-11 10:02:21 -08:00
Leijurv
56d109bf0a Merge pull request #310 from babbaj/builder
make code easy to understand
2019-01-11 10:00:54 -08:00
babbaj
a965859095 make code easy to understand 2019-01-11 01:13:14 -05:00
Leijurv
5f29bb3e7f gotta go fast 2019-01-10 18:55:55 -08:00
Leijurv
1ad6a0d5b5 remove all that crap lol 2019-01-10 18:21:02 -08:00
Leijurv
863ae447b9 except we actually make it work 2019-01-10 18:15:05 -08:00
Brady
f727e71eaf Expose IPathingControlManager in IBaritone 2019-01-10 19:57:09 -06:00
Leijurv
4dd922f1b5 Merge branch 'master' into builder 2019-01-10 17:27:23 -08:00
Leijurv
14f006c3a5 Merge branch 'epic-movement-input' 2019-01-10 17:25:57 -08:00
Leijurv
f95dc40f4c consolidate triple duplicated placement code 2019-01-10 17:23:20 -08:00
Leijurv
200211c186 dont continue walking if there is no process in charge 2019-01-10 13:52:52 -08:00
Leijurv
81786f7a7c reuse calculationcontext for planning ahead next segment 2019-01-10 13:51:26 -08:00
Leijurv
1381d8d94c two small tweaks 2019-01-10 13:50:53 -08:00
Leijurv
5ca214534d mouse stuff 2019-01-09 19:11:53 -08:00
Leijurv
85ea21e83b epic movement input 2019-01-09 18:22:34 -08:00
Leijurv
1dca02517e disable backtrack cost favoring while building 2019-01-09 15:42:49 -08:00
Leijurv
7d572d748b shouldnt be needed actually 2019-01-09 15:13:48 -08:00
Leijurv
fbcae10f96 cherry picked fix from builder 2019-01-09 15:13:09 -08:00
Leijurv
b109fc7420 fun =) 2019-01-09 15:07:06 -08:00
Leijurv
c74c01271d better strategy 2019-01-09 14:36:44 -08:00
Leijurv
a4495ce80a tweaks 2019-01-08 22:00:33 -08:00
Leijurv
f5478f6169 Merge pull request #306 from babbaj/master
fix garbage code
2019-01-08 21:56:27 -08:00
babbaj
ae1e229619 fix garbage code 2019-01-09 05:39:37 -05:00
Leijurv
bc5982b994 fine lol 2019-01-08 20:45:35 -08:00
Leijurv
702b916948 preliminary schematic stuff 2019-01-08 20:45:02 -08:00
Leijurv
8ed2431f37 Merge branch 'master' into builder 2019-01-08 14:56:48 -08:00
Leijurv
e971d5d43f prevent favoring from affecting movement cost thresholds 2019-01-08 14:56:21 -08:00
Leijurv
ee9519d891 tweaks 2019-01-07 08:53:39 -08:00
Leijurv
58bb209158 Merge pull request #305 from babbaj/master
real gamers do it like this
2019-01-07 08:45:26 -08:00
babbaj
23dc97ad5e oops that should have been static 2019-01-07 01:25:39 -05:00
Leijurv
84b580b001 cursed 2019-01-06 22:21:52 -08:00
babbaj
227b303669 value doesnt have to be lowercase 2019-01-07 01:16:52 -05:00
babbaj
712a0a3905 refactor SettingsUtil to be more epic 2019-01-07 01:08:46 -05:00
EvilSourcerer
76427b8ecb real gamers use bufferedreader 2019-01-06 19:10:47 -06:00
Leijurv
8b6d621d20 crucial performance optimization 2019-01-05 23:38:24 -08:00
Leijurv
7898b24bac mc is weird 2019-01-04 23:37:00 -08:00
Leijurv
39648c5dc6 comment 2019-01-03 23:40:43 -08:00
Leijurv
83e6b2fdfe cursed 2019-01-02 21:08:31 -08:00
Leijurv
816727d65b not happening 2019-01-01 22:32:43 -08:00
Leijurv
0e012adb6c unneeded 2018-12-31 08:00:43 -10:00
Leijurv
539b0e64c8 bitshift 2: electric boogaloo 2018-12-30 07:36:10 -10:00
Leijurv
258700ee7b bitshift 2018-12-29 14:50:21 -10:00
Leijurv
1da72ba473 unneeded 2018-12-28 17:17:43 -10:00
Leijurv
c2c69f243e nothing is trashy in baritone 2018-12-27 16:16:12 -10:00
Brady
dffbb8e4c8 Overload reachable with IPlayerContext parameter 2018-12-27 17:15:32 -06:00
Leijurv
c45cbebcce fixed 2018-12-27 08:06:10 -10:00
Leijurv
bebdede33b unneeded 2018-12-26 18:07:14 -10:00
Leijurv
251110c4f8 the start of something big 2018-12-25 21:07:17 -08:00
Leijurv
50d37bb311 lol 2018-12-25 20:07:26 -08:00
Leijurv
bbb73008ac stupid 2018-12-24 18:42:01 -08:00
Brady
c324f11a96 Fix bad block breaking that NCP doesn't agree with 2018-12-24 12:15:23 -06:00
Leijurv
c4eb6be0fe dumb 2018-12-23 23:09:02 -08:00
Leijurv
64200030d2 brady was too optimistic 2018-12-22 20:38:44 -08:00
Leijurv
4d7e74365b reformat 2018-12-21 17:54:16 -08:00
Leijurv
b9b25e7e6b no more stupid wrapper getters 2018-12-20 21:22:18 -08:00
Leijurv
8a4f48f08d diagonal descend option 2018-12-20 21:06:56 -08:00
Leijurv
ae9ab03e51 walk on water hunger penalty 2018-12-19 22:01:47 -08:00
Leijurv
02478ee887 wtF 2018-12-19 21:30:58 -08:00
Leijurv
57f238de7d that was a big screwup 2018-12-19 17:02:09 -08:00
Leijurv
77938a77e8 add jump penalty 2018-12-19 14:37:11 -08:00
Leijurv
d41aa5f9ae epicly fast 2018-12-19 12:59:07 -08:00
Leijurv
0ef3386ebf appease codacy 2018-12-19 12:48:41 -08:00
Brady
9703de86d3 Fix NullPointerException 2018-12-18 19:36:43 -06:00
Brady
764e8d7daa Add windowClick to IPlayerController 2018-12-18 19:27:45 -06:00
Brady
18f5c129a4 Remove dependency for PlayerControllerMP implementation 2018-12-18 19:25:23 -06:00
Leijurv
807d6a0cf4 crucial performance optimization 2018-12-18 16:22:54 -08:00
Leijurv
a0ab2a8ba7 timing meme 2018-12-18 16:16:32 -08:00
Leijurv
90d0fb7efb simplify check 2018-12-17 18:27:31 -08:00
Leijurv
fe4290b218 little fix 2018-12-16 20:14:21 -08:00
Leijurv
cc04342358 epic performance 2018-12-16 16:26:48 -08:00
Leijurv
66da826eab fix toxic cloud 2018-12-15 22:25:50 -08:00
Brady
2afdaa1ac9 Add individual chunk scanning to IWorldScanner 2018-12-14 18:50:39 -06:00
Leijurv
d4947c3c47 tweak custom goal process logic 2018-12-14 08:30:32 -08:00
Brady
35efd9293b BlockInteractEvent Type clarification 2018-12-13 18:22:33 -06:00
Leijurv
d89aa887fb add vulnerabilities badge 2018-12-13 14:43:32 -08:00
Leijurv
801727dca6 fix parkour failures at height limit on NCP 2018-12-12 18:14:56 -08:00
Leijurv
44963fa4c7 diagonal descend 2018-12-11 22:26:55 -08:00
Leijurv
a2534a8227 unused imports 2018-12-11 16:00:48 -08:00
Leijurv
4f9268e571 forgot Vs 2018-12-11 12:23:30 -08:00
Leijurv
e343756e44 i dont like license being orange 2018-12-11 12:21:24 -08:00
Leijurv
9480f0d2bc hell yeah bright green 2018-12-11 12:19:45 -08:00
Leijurv
fb2a808f5c more badges is good 2018-12-11 12:16:36 -08:00
Leijurv
24c0ec905e removed dumb comment 2018-12-10 18:05:31 -08:00
Leijurv
bca6a580e3 combine 2018-12-09 19:25:00 -08:00
Leijurv
1d0413f159 im idiot 2018-12-08 18:28:04 -08:00
Leijurv
72d8863862 fix openness check to work for mulitple bots 2018-12-08 17:49:23 -08:00
Leijurv
c15dac3582 simple inventory management 2018-12-07 16:57:12 -08:00
Leijurv
efe06264bd settings for right click and enter portal 2018-12-07 16:54:12 -08:00
Leijurv
d5e155d77f walk into, and right click on arrival 2018-12-07 15:53:41 -08:00
Leijurv
bf68afdda3 GetToBlock should only highlight the block itself 2018-12-07 15:40:32 -08:00
Leijurv
a61b82748c remove extraneous prints 2018-12-06 21:52:24 -08:00
Leijurv
245b2483ab fix crash when path length is exactly 30 2018-12-05 18:01:23 -08:00
Leijurv
87dbf1dbba fix false positive in check 2018-12-05 17:59:32 -08:00
Leijurv
101f7cb7e2 move heuristic up to exactly equal SPRINT_ONE_BLOCK_COST 2018-12-05 10:22:18 -08:00
Leijurv
c795913259 fix splicing behavior around water 2018-12-05 10:21:56 -08:00
Leijurv
64eabf71f2 traverse place against below 2018-12-05 08:29:32 -08:00
Leijurv
2760354943 cool vine and ladder descending, fixes #159 2018-12-04 18:12:04 -08:00
Leijurv
28c2586452 fix parkour place logic 2018-12-04 15:50:44 -08:00
Leijurv
21d8c11cfe go in the opposite order 2018-12-04 15:33:29 -08:00
Leijurv
862746038d allow down placement, and fixes to replacable 2018-12-04 15:00:45 -08:00
Leijurv
2bd81b08c2 overhaul and fixes to cost calculation 2018-12-04 14:38:08 -08:00
Leijurv
16aee33bdf fix random crash 2018-12-03 21:52:13 -08:00
Leijurv
f4161ed61c ......fixed....... 2018-12-03 21:39:32 -08:00
Brady
bfa0861065 Owned? 2018-12-03 20:45:19 -06:00
Brady
86d1512e5b Rename Waypoints to WaypointCollection 2018-12-03 19:58:37 -06:00
Brady
5c83ee2648 Fix API javadoc errors and make API only javadoc export 2018-12-03 19:37:54 -06:00
Leijurv
7ba987e7f7 save containers and echests 2018-12-03 17:21:46 -08:00
Brady
b22e93d6d0 Fix javadoc errors 2018-12-03 18:47:40 -06:00
Brady
70b74d39fc Fix broken javadoc 2018-12-03 18:21:24 -06:00
Leijurv
0236cb35d9 overhaul memory 2018-12-03 14:49:23 -08:00
Brady
b0066a93ca GoalXZ beacon render setting 2018-12-03 16:42:05 -06:00
Leijurv
e25bf9f077 my fault 2018-12-03 14:22:30 -08:00
Brady
147df1ffb2 Probably fixes 265 2018-12-03 16:15:22 -06:00
Leijurv
4c96759ed5 tighten auto test time limit 2018-12-03 14:09:05 -08:00
Leijurv
8e2df3a030 reinstate proper static cutoff behavior 2018-12-03 14:08:44 -08:00
Leijurv
58a5720b6b reduce reliability in what chunks are loaded when 2018-12-03 13:55:54 -08:00
Leijurv
eedf993d7a remove goal equality condition for path splicing 2018-12-03 13:40:38 -08:00
Leijurv
d058cbf501 revert static cutoff, and fix goal comparisons in splice 2018-12-03 13:34:39 -08:00
Leijurv
d2413e1677 lol 2018-12-02 19:56:35 -08:00
Leijurv
3cb1984892 only apply static cutoff to protrusion beyond min length 2018-12-02 19:40:23 -08:00
Leijurv
17207d44e6 pick map over hybrid, due to performance 2018-12-02 19:39:10 -08:00
Leijurv
36cfcbbbe3 avoidances 2018-12-02 19:26:47 -08:00
Leijurv
1a6c0cd4d9 avoid mobs and spawners, fixes #162, fixes #240, fixes #278 2018-12-02 18:27:49 -08:00
Leijurv
5a97c512f7 fix rare exception 2018-12-02 17:15:22 -08:00
Leijurv
57a3330200 don't splice if not on ground 2018-12-01 10:49:14 -08:00
Leijurv
07ce0a47f7 cleanup 2018-12-01 10:46:10 -08:00
Leijurv
b9f7a05e2a Merge pull request #282 from babbaj/master
Fix proguard not working when compiling with srg mappings
2018-12-01 10:35:53 -08:00
0x22
7f73b4554a Feed codacy and leijurv at the same time? 2018-12-01 13:22:11 -05:00
Leijurv
f2e02794b8 tweak block scanning, fixes #200 2018-12-01 10:04:49 -08:00
babbaj
0a2e45b64b make codacy happy 2018-12-01 06:42:21 -05:00
babbaj
a017e14a48 give proguard the right jar based on mapping type 2018-12-01 06:31:40 -05:00
Leijurv
5ef03ba1d5 didn't make sense like that 2018-11-30 23:06:16 -08:00
Leijurv
6a402b4a2b fix the fire thing in a slightly different way 2018-11-29 20:36:19 -08:00
Leijurv
5daaaf5282 add settings reset command 2018-11-29 15:33:35 -08:00
Leijurv
6f7729e34e add missing synchronized blocks 2018-11-28 18:21:27 -08:00
Leijurv
043d6ffd20 improve pathingbehavior resiliency 2018-11-27 10:37:48 -08:00
Leijurv
a8404a7286 only walk through supported snow, fixes #276 2018-11-26 15:32:28 -08:00
Leijurv
58d9134286 fix behavior around cocoa pods and vines, fixes #277 2018-11-26 15:01:34 -08:00
Leijurv
f25786635b over 10k less objects per second 2018-11-26 07:58:10 -08:00
Leijurv
6d1130d2c3 favored lookup performance 2018-11-26 07:52:00 -08:00
Leijurv
d9effc4a29 avoid creating thousands of unmodifiable lists just to get their size 2018-11-25 22:59:47 -08:00
Leijurv
cf2765e017 thousands here too, on long paths 2018-11-25 22:57:54 -08:00
Leijurv
06dd07dbc6 believe it or not, this saves thousands of object allocations per second 2018-11-25 22:57:08 -08:00
Leijurv
14daf2ce85 unneeded, and was allocating thousands of sets a second 2018-11-25 22:50:22 -08:00
Leijurv
f9a3a3b78b main thread bsi creation doesn't need to copy loaded chunks 2018-11-25 22:30:37 -08:00
Leijurv
2ba0e6ada6 don't create a new bsi hundreds of times a tick maybe? 2018-11-25 22:19:04 -08:00
Leijurv
943b75455b no point if you don't copy it, really fixes #210 2018-11-25 12:13:49 -08:00
Leijurv
2b56d68f7d many fixes to segment calculator, and chat demo usage 2018-11-25 11:53:56 -08:00
Leijurv
93217a3ae3 this is just not possible 2018-11-24 22:04:36 -08:00
Leijurv
ba5c8ffaa6 Merge branch 'failure-cutoff' 2018-11-23 13:18:27 -08:00
Leijurv
9c5274dde4 runnable conversion 2018-11-23 13:12:18 -08:00
Leijurv
002c678b4a Merge branch 'master' into segment-calculation 2018-11-23 13:09:57 -08:00
Leijurv
038533c33f explain documentation more 2018-11-23 15:06:09 -06:00
Leijurv
50d4b5b4ed unneeded 2018-11-23 15:06:09 -06:00
Leijurv
7632d667c9 add a secondary failure cutoff 2018-11-23 15:06:09 -06:00
Leijurv
5aa78cd478 crucial performance optimization 2018-11-23 11:22:49 -08:00
Leijurv
84cd4b1acb unused 2018-11-23 10:58:23 -08:00
Leijurv
b705279153 consistency 2018-11-23 10:55:02 -08:00
Leijurv
d854750ee8 improve accuracy of GoalGetToBlock heuristic 2018-11-23 10:52:56 -08:00
Leijurv
653861107d explain documentation more 2018-11-23 10:50:03 -08:00
Leijurv
4502adda28 segmented path calculator 2018-11-23 10:36:06 -08:00
Leijurv
a98c5d7d99 my house 2018-11-23 10:25:02 -08:00
Leijurv
c81a00268a Merge branch 'master' into segment-calculation 2018-11-23 10:21:45 -08:00
Leijurv
dd47e20070 remove unneeded 2018-11-23 10:20:48 -08:00
Leijurv
f05613147e Merge branch 'master' into failure-cutoff 2018-11-23 09:59:23 -08:00
Leijurv
6ed8d617cd improve path checks, and add a overlap splice option 2018-11-23 09:31:25 -08:00
Leijurv
b228f4c6fb remove extraneous checks in bsi 2018-11-23 09:03:51 -08:00
Leijurv
70f8d1d4ae fix bsi creation on wrong thread, cache chunks, fixes #210 2018-11-23 09:00:52 -08:00
Leijurv
0d7131413a prevent double jumping 2018-11-23 07:55:59 -08:00
Leijurv
b5a4e65fbf unable to start a parkour jump from stairs 2018-11-23 07:47:28 -08:00
Leijurv
7c51106d27 unneeded 2018-11-22 10:08:55 -08:00
Leijurv
1e9786d5b9 add a secondary failure cutoff 2018-11-22 09:39:54 -08:00
Leijurv
4b8c85f8a6 whoops 2018-11-22 08:57:27 -08:00
Leijurv
aed8dae175 hehe 2018-11-21 18:11:58 -08:00
Leijurv
8db26af36c tweak sneak range for ncp compatibility 2018-11-21 11:02:12 -08:00
Leijurv
cfa874982c fix a bunch of stuff in pillar, fixes #266 2018-11-21 11:00:46 -08:00
Leijurv
2a674cb869 don't sprint straight into danger 2018-11-20 18:58:47 -08:00
Leijurv
fb971301a4 fix getting permanently stuck on sideways fence gates in our way 2018-11-20 16:32:55 -08:00
Leijurv
3bb16de67e greatly increase mining visual scan range 2018-11-20 16:32:44 -08:00
Leijurv
033da7e737 fix coefficient 2018-11-20 13:22:33 -08:00
Leijurv
14650f93c5 walk into lava less 2018-11-20 08:19:27 -08:00
Leijurv
e5184efdaa fix cached path loop 2018-11-20 08:00:52 -08:00
Leijurv
d95a72f2cc correct wording 2018-11-19 17:14:54 -08:00
Leijurv
16e3fd9305 IPathingControlManager 2018-11-18 21:41:42 -08:00
Leijurv
4fb6c71174 lol 2018-11-18 17:32:16 -08:00
Leijurv
12bbd57a24 standalone build shouldn't keep ExampleBaritoneControl 2018-11-17 16:09:15 -08:00
Brady
689dc74330 Whoops 2018-11-17 11:41:16 -06:00
Brady
6caae889b7 Fix AStarPathFinder Optional usage that's icky 2018-11-17 11:26:46 -06:00
Brady
ce0e8b4cd1 Clean up some bad Optional practices 2018-11-17 11:18:55 -06:00
Leijurv
737c632227 path creation no longer throws this 2018-11-16 16:28:20 -08:00
Leijurv
04e87c9810 cleaner 2018-11-15 16:03:20 -08:00
Leijurv
57c0613843 rename 2018-11-14 16:39:04 -08:00
Leijurv
f5d0143b09 im dumb 2018-11-14 14:37:41 -08:00
Brady
237f1846d3 Remove Baritone casts 2018-11-14 16:30:20 -06:00
Leijurv
f6dee1ecb7 add todo 2018-11-14 14:29:33 -08:00
Leijurv
f808fc9802 general cleanup 2018-11-14 14:27:30 -08:00
Leijurv
8385bc35ed wow thats a rare bug 2018-11-14 14:26:35 -08:00
Leijurv
80d6d7fd58 simplify 2018-11-14 14:22:14 -08:00
Leijurv
b56cdcda52 remove that toxic cloud 2018-11-14 14:19:24 -08:00
Leijurv
ea81cd76ca sigh 2018-11-14 14:00:56 -08:00
Leijurv
c3a3670785 unused imports 2018-11-14 13:57:37 -08:00
Leijurv
e4045e1343 and another 2018-11-14 13:48:45 -08:00
Leijurv
5a52cea415 epic 2018-11-14 13:48:09 -08:00
Leijurv
933b295c40 context objectMouseOver 2018-11-14 13:46:16 -08:00
Leijurv
ce6ec00a89 get rid of the remaining references to mc.world 2018-11-14 13:24:44 -08:00
Leijurv
b53f3925a4 forgot to add these files lol 2018-11-13 22:28:12 -08:00
Leijurv
e93fd596ff customized TickEvent Type based on player context status 2018-11-13 22:17:18 -08:00
Leijurv
57b60c734b fixes to BlockBreakHelper 2018-11-13 22:15:01 -08:00
Leijurv
c74ccaafbf remove Baritone.INSTANCE 2018-11-13 21:34:11 -08:00
Leijurv
f6891feb64 removed all references to Baritone.INSTANCE 2018-11-13 21:33:14 -08:00
Leijurv
2675852dbe canc 2018-11-13 20:11:51 -08:00
Brady
0302c6f14b Fix really really bad error mega critical 2018-11-13 21:57:22 -06:00
Leijurv
a0dd43244c immense iq 2018-11-13 19:54:24 -08:00
Brady
3ccb0c74c6 Remove timestamps from since annotations 2018-11-13 21:53:27 -06:00
Brady
f9270a7ed0 my house 2018-11-13 21:47:40 -06:00
Brady
d79d56c2f9 Expose all possible Baritone instances 2018-11-13 21:45:26 -06:00
Leijurv
a8f09a7fe9 Merge pull request #259 from cabaletta/currentlyticking-solution
currentlyTicking Solution
2018-11-13 15:11:38 -08:00
Brady
94bf8d4bbd More review things 2018-11-13 16:53:13 -06:00
Brady
5e2f40a322 Fix some things mentioned by @Leijurv 2018-11-13 16:33:45 -06:00
Brady
17161fd576 Resolve merge conflicts 2018-11-13 15:29:02 -06:00
Brady
d3db551cc9 Awesome 2018-11-13 15:14:29 -06:00
Leijurv
72058c792a fix toxic clouds in legit mine 2018-11-13 12:20:27 -08:00
Brady
ef5e3ab06e pwnage 2018-11-13 13:39:11 -06:00
Brady
71e7f0a04c Fix GetToBlockProcess rescan 2018-11-13 11:59:02 -06:00
Brady
bae34e5b80 Initial meme
Still need to fix MovementHelper LUL
2018-11-13 11:50:29 -06:00
Leijurv
1ab3e61984 reformatted 2018-11-12 21:01:40 -08:00
Leijurv
e81b6d4d96 fought 2018-11-12 16:39:58 -08:00
Leijurv
83f14b10bb whoa codacy suggested something actually helpful 2018-11-12 15:45:35 -08:00
Leijurv
7fecd1a5dd tweak 2018-11-12 14:43:39 -08:00
Leijurv
0ce4107d56 "fix" it 2018-11-11 18:23:18 -08:00
Leijurv
66769365d0 much better 2018-11-11 17:59:13 -08:00
Leijurv
e3cb164723 fix blockstateinterface 2018-11-11 17:36:54 -08:00
Brady
903b1b16a4 static 2018-11-11 17:45:01 -06:00
Brady
e81d0a0b1b Small brain 2018-11-11 17:12:18 -06:00
Brady
51243f0981 Some comments 2018-11-11 16:22:00 -06:00
Brady
fad5a6deac lol 2018-11-11 15:46:07 -06:00
Leijurv
355443e440 forgot one 2018-11-11 12:48:53 -08:00
Leijurv
45e4239b26 context specific blockstateinterface lookups. also toxic 2018-11-11 12:35:22 -08:00
Brady
a83074e773 Map Input to state in InputOverrideHandler 2018-11-11 14:20:38 -06:00
Leijurv
f854d886d1 fix water bucket being placed one tick too early 2018-11-10 11:26:52 -08:00
Leijurv
73d4e9bbb9 another day another static world reference gone 2018-11-10 09:37:23 -08:00
Leijurv
232644feb0 these are cool and should default on 2018-11-10 09:25:44 -08:00
Brady
1c80950a70 Add note to MixinBlockPos
I looked at this Mixin for a second and thought wtf why did I make this and then remembered why, so it's probably important to let anybody else that looks at it know why.
2018-11-09 22:32:40 -06:00
Leijurv
0bd46e88a5 branch compatibility message 2018-11-09 20:22:24 -08:00
Leijurv
b054e9dbe8 toxic cloud to get around two references to mc.player.dimension 2018-11-09 19:25:10 -08:00
Leijurv
3ddf6b2335 player and player controller toxic cloud 2018-11-09 19:12:36 -08:00
Leijurv
1a1686b7c3 fix yet more player references 2018-11-09 18:55:53 -08:00
Leijurv
dd08b2c825 no more references to player() from pathing thread 2018-11-09 17:21:02 -08:00
Leijurv
a2a60e9847 misc cleanup 2018-11-09 16:55:31 -08:00
Leijurv
13505a052f wait a tick until objectMouseOver matches, fixes #254 2018-11-09 15:59:08 -08:00
Leijurv
f2dcdda9b3 revamp follow and fix some bugs in mine 2018-11-09 14:49:25 -08:00
Leijurv
dc6389c46f comment 2018-11-08 14:58:18 -08:00
Leijurv
7dc89b0190 single runaway goal object, allows splicing better 2018-11-07 17:27:57 -08:00
Leijurv
5b395ce3da should be in the synchronized block 2018-11-07 17:23:36 -08:00
Leijurv
40da7b3734 don't fail silently in the future 2018-11-07 17:18:43 -08:00
Leijurv
842e50adb9 path cleanup 2018-11-07 17:16:34 -08:00
Leijurv
96da078219 cutoff path up until movement failure, don't throw exception and fail entire path 2018-11-07 14:37:23 -08:00
Leijurv
4a1951b027 many fixes 2018-11-07 14:09:23 -08:00
Leijurv
83348e6b3c rearrange readme 2018-11-06 20:12:02 -08:00
Leijurv
a1778f401f tweak a bit 2018-11-06 11:20:39 -08:00
Leijurv
9c93d3a474 splice next into current if no backtrack, fixes #122, fixes #249 2018-11-06 11:18:13 -08:00
Leijurv
cbc8a6d45b Merge branch 'processes' 2018-11-06 08:43:57 -08:00
Leijurv
382c7e7888 reformat, optimize imports 2018-11-06 08:22:19 -08:00
Leijurv
ae200a56b0 CaPiTaLiZe 2018-11-06 08:19:26 -08:00
Brady
c50af5acfd A couple minor cleanups 2018-11-06 08:02:08 -06:00
Leijurv
527691a2ec fix blockbreakhelper toxic cloud in movement 2018-11-05 20:37:54 -08:00
Leijurv
a182c22d36 this can be moved i think 2018-11-05 20:05:47 -08:00
Leijurv
aac0d623fa why not just... 2018-11-05 20:02:27 -08:00
Leijurv
604ef2bb64 misc cleanup 2018-11-05 20:01:46 -08:00
Leijurv
6ca7f47bf9 +0.5y not helpful 2018-11-05 19:31:05 -08:00
Leijurv
a1b71219cb make sure to pick up dropped items while mining, fixes #170 2018-11-05 18:31:59 -08:00
Leijurv
d59c7cb7a8 temporarily disable cached region ram pruning 2018-11-05 17:30:45 -08:00
Leijurv
d121ca182f spammy 2018-11-05 17:26:52 -08:00
Leijurv
2aee91be10 fix it up a bit 2018-11-05 16:46:24 -08:00
Brady
99da815f49 Massive brain 2018-11-05 18:40:25 -06:00
Brady
ebd3ce42d0 whoops 2018-11-05 18:28:29 -06:00
Brady
fdee1b9453 More javadocs 2018-11-05 18:11:16 -06:00
Brady
472e89239c IBaritoneProcess javadoc update 2018-11-05 18:07:47 -06:00
Leijurv
5692e79e02 more docs 2018-11-05 15:25:19 -08:00
Leijurv
52246e41c8 appease codacy 2018-11-05 15:16:23 -08:00
Leijurv
2da3222115 fix 2018-11-05 14:55:13 -08:00
Leijurv
4d0bfce712 make InputOverrideHandler a Behavior 2018-11-05 14:47:40 -08:00
Leijurv
cb153e039b not used and not publicly exposed 2018-11-05 14:43:57 -08:00
Leijurv
8aa5a6756a add to api 2018-11-05 14:41:17 -08:00
Leijurv
23286dd8b8 disallow null PathingCommandType 2018-11-05 14:38:32 -08:00
Leijurv
30408384c6 fix 2018-11-05 14:37:05 -08:00
Leijurv
e11e3dfd86 explain 2018-11-05 14:22:30 -08:00
Leijurv
2c39cd06ed cleanup 2018-11-05 14:19:50 -08:00
Brady
75a224cef1 Partially revert README update 2018-11-05 16:06:23 -06:00
Brady
0373f1875f Meme 2018-11-05 16:05:45 -06:00
Leijurv
fffd016008 Merge branch 'master' into processes 2018-11-05 13:51:41 -08:00
Leijurv
f286c400a3 when parkouring from soul sand, the maximum gap should be 1, fixes #247 2018-11-05 13:47:06 -08:00
Brady
c0e0f8dc2a Fix last commit lol 2018-11-05 13:53:26 -06:00
Brady
ffb044ffc6 Replace RotationMoveEvent Inject with Redirect 2018-11-05 13:47:55 -06:00
Brady
1c4f029bf4 Update README.md 2018-11-05 12:47:17 -06:00
Leijurv
6812d2ba7d simplify readme 2018-11-04 22:22:11 -08:00
Leijurv
c0b5d60715 fix 2018-11-04 22:17:49 -08:00
0x22
c814874cb6 Updated mappings to stable_39 2018-11-04 20:21:24 -06:00
Leijurv
cd3aef47a5 that already does that 2018-11-04 10:30:46 -08:00
Leijurv
338fdb509a it works 2018-11-04 10:29:22 -08:00
Leijurv
660efe5e16 pathing processes wip 2018-11-03 22:12:51 -07:00
Leijurv
58a2965fea Merge branch 'impact4.4-compat' 2018-11-03 20:25:19 -07:00
Leijurv
c614d7ec6a fix stupid minebehavior bug 2018-11-03 20:25:09 -07:00
Leijurv
e017238aca unneeded 2018-11-03 19:41:40 -07:00
Leijurv
c37a5ba956 revamp readme 2018-11-02 16:23:57 -07:00
Leijurv
da5969c2fd shouldnt have taken this long to figure that out 2018-11-01 20:58:48 -07:00
Leijurv
990107a1fa simplify 2018-11-01 20:27:34 -07:00
Leijurv
42eb86b624 useless check? 2018-11-01 15:41:53 -07:00
Leijurv
b65a199e54 move all checks from BlockStateInterface to MovementHelper 2018-11-01 15:36:32 -07:00
Leijurv
88e3bcdf63 what 2018-11-01 15:32:58 -07:00
Leijurv
0fbfa32e6b fix exception in pathfinder 2018-11-01 15:30:33 -07:00
Leijurv
20405716bc fix impact 4.4 compatibility and add help message 2018-11-01 14:07:08 -07:00
Leijurv
8da7406e8f green 2018-10-31 20:37:18 -07:00
Leijurv
97fd3df8f7 minecraft version badge 2018-10-30 19:06:42 -07:00
Leijurv
b9b33b5351 move calculation context construction to main thread 2018-10-29 18:58:59 -07:00
Brady
19ecb1bbb3 Merge LocationTrackingBehavior into MemoryBehavior
Fixes #242
2018-10-29 16:43:03 -05:00
Leijurv
f6043f4ac6 changed wording 2018-10-28 16:44:56 -07:00
Brady
ed1941abdb Fix desynchronized allowFlying state 2018-10-28 18:38:23 -05:00
Leijurv
24d24728dc intellij be like 2018-10-28 16:05:08 -07:00
Leijurv
77db4cd19f codacy 2018-10-28 15:24:52 -07:00
Leijurv
adbb03e5cb unused lol 2018-10-28 15:24:23 -07:00
Leijurv
f0226f1ea7 brady doesn't know how to do imports 2018-10-28 15:23:34 -07:00
Leijurv
be5df2677b finally add shulkers lol 2018-10-28 13:55:03 -07:00
Brady
3d4a856bb2 Remove unnecessary casts 2018-10-27 23:21:30 -05:00
Leijurv
1b1233d26a only one singleton 2018-10-27 18:45:17 -07:00
Leijurv
c4b0e0a810 codady submission complete 2018-10-27 16:18:03 -07:00
Leijurv
1dee8ef355 completely submitting to codacy 2018-10-27 14:41:25 -07:00
Leijurv
8cee173f92 appease codacy some more 2018-10-27 14:16:34 -07:00
Brady
19e0e6d962 Feed codacy 2018-10-27 14:38:10 -05:00
Leijurv
ef8fd70475 add some more badges for no reason lol 2018-10-27 09:25:53 -07:00
Leijurv
6df05f4b7f add link to my vid 2018-10-27 08:37:30 -07:00
Brady
4e1491a0cc Rename xrayFor to searchWorld 2018-10-26 13:30:16 -05:00
leijurv
55091154c4 start on legitMine 2018-10-25 21:22:00 -07:00
leijurv
a0b1cb2993 preliminary refactoring 2018-10-25 20:09:06 -07:00
Leijurv
7617081637 no longer needed 2018-10-24 23:22:19 -07:00
Leijurv
96e7f37799 add link to adovin's video 2018-10-23 20:41:35 -07:00
Leijurv
a0bf22de86 Merge pull request #233 from ave4224/toolkit
Toolkit fixes
2018-10-22 21:43:42 -07:00
ave4224
9a1aecc002 tool set, fixes #227 2018-10-23 00:41:59 -04:00
Brady
ad941fcbb2 Clarify anti nudge 2018-10-22 18:02:18 -05:00
Leijurv
e5ca30dc26 forgot that one 2018-10-22 14:04:19 -07:00
Leijurv
a23eadf5cf Merge pull request #235 from 0-x-2-2/patch-1
Fixed serious issue.
2018-10-22 12:46:17 -07:00
Leijurv
82417f4f85 comment to explain weird thing 2018-10-22 12:42:08 -07:00
0x22
af788133c2 Fixed serious issue.
Determinizer description was incorrect.
2018-10-22 15:42:05 -04:00
Leijurv
a6dc156a79 bump version to match build gradle 2018-10-21 14:24:23 -07:00
Leijurv
25bebdc172 leftClickCounter shadow appears to be unneeded 2018-10-20 20:33:49 -07:00
Leijurv
b55d96169f update some documentation 2018-10-19 21:15:37 -07:00
Leijurv
1a809fa7a3 dispatch path events from main thread instead of calculation thread 2018-10-18 15:04:40 -07:00
Leijurv
313a5fddbe add release badge 2018-10-18 14:36:14 -07:00
Leijurv
732d806820 allow cutting onto next path one movement earlier 2018-10-17 12:16:03 -07:00
Leijurv
11ed8a2f21 rearrange fields and constructors 2018-10-16 20:05:18 -07:00
Leijurv
3aa8f51015 print shasums on build 2018-10-16 17:00:37 -07:00
Leijurv
85b038dada v1.0.0-hotfix-2 2018-10-16 16:03:51 -07:00
Leijurv
dd25527a62 pillar fixes for ncp 2018-10-16 14:21:27 -07:00
Leijurv
ac372bc6fc v1.0.0-hotfix-1 2018-10-16 11:32:44 -07:00
Leijurv
63ce4fe0bd don't crash on empty region 2018-10-16 11:32:27 -07:00
Leijurv
398169f68e special case for damn daniel 2018-10-16 11:13:35 -07:00
Leijurv
46a24af373 cancel chat event 2018-10-16 11:13:08 -07:00
Leijurv
0cd9bb658f keep ExampleBaritoneControl 2018-10-16 11:04:49 -07:00
Leijurv
b0678fd259 better control 2018-10-16 10:47:44 -07:00
Leijurv
9cb4a1779e fix placement rotation during parkour 2018-10-15 20:37:10 -07:00
Leijurv
3cb4700b16 v1.0.0 2018-10-15 17:21:24 -07:00
Leijurv
94921fe03f update simpletweaker version in proguard too 2018-10-15 17:21:02 -07:00
Leijurv
0202865837 Merge branch 'master' of github.com:cabaletta/baritone 2018-10-15 17:01:35 -07:00
Leijurv
b9b911eb3b add impact link 2018-10-15 17:01:29 -07:00
Brady
54fb2c5f81 Update to SimpleTweaker 1.2 2018-10-15 19:00:52 -05:00
Leijurv
2df97ff986 update install link 2018-10-15 16:55:13 -07:00
Leijurv
4374619ba2 update install and impact information 2018-10-15 16:22:03 -07:00
Leijurv
6b6ebd6968 optimize all imports 2018-10-15 16:16:04 -07:00
Leijurv
b41fdc2bbd remove spammy log prints 2018-10-15 15:39:01 -07:00
Leijurv
3cac37d1a5 cached regions in ram should not expand without bound 2018-10-15 15:19:10 -07:00
Brady
2f7259714a Fix Pathing Thread crash on Forge 2018-10-14 23:46:41 -05:00
Leijurv
c1076461e2 dont jump while using an item, fixes #222 2018-10-14 10:38:47 -07:00
199 changed files with 12604 additions and 5218 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto

1
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1 @@
<!-- No UwU's or OwO's allowed -->

1
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1 @@
<!-- No UwU's or OwO's allowed -->

4
.gitignore vendored
View File

@@ -11,6 +11,8 @@ build/
classes/
*.class
/out
# IntelliJ Files
.idea/
*.iml
@@ -18,4 +20,4 @@ classes/
# Copyright Files
!/.idea/copyright/Baritone.xml
!/.idea/copyright/profiles_settings.xml
!/.idea/copyright/profiles_settings.xml

View File

@@ -9,7 +9,8 @@ install:
- travis_retry docker build -t cabaletta/baritone .
script:
- docker run --name baritone cabaletta/baritone /bin/sh -c "set -e; /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient"
- docker run --rm cabaletta/baritone ./gradlew javadoc
- docker run --name baritone cabaletta/baritone /bin/sh -c "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runAutoTest; cat /code/autotest/success"
- docker cp baritone:/code/dist dist
- ls dist
- cat dist/checksums.txt

83
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,83 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* No Anime
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* Anime
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* ~~Trolling, insulting/derogatory comments, and personal or political attacks~~
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
Project maintainers have the right and responsibility to immediately remove
without any sort of dispute any issues or pull requests that do not align
with their corresponding templates. Absolutely no leniancy shall be accepted
with these terms.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at complaints@leijurv.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -1,24 +1,23 @@
FROM debian:jessie
FROM debian:stretch
RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/stretch-backports.list
ENV DEBIAN_FRONTEND noninteractive
RUN apt update -y
RUN apt install --target-release jessie-backports \
RUN apt install \
openjdk-8-jdk \
ca-certificates-java \
--assume-yes
RUN apt install -qq --force-yes mesa-utils libgl1-mesa-glx libxcursor1 libxrandr2 libxxf86vm1 x11-xserver-utils xfonts-base xserver-common
RUN apt install -qq --assume-yes mesa-utils libgl1-mesa-glx libxcursor1 libxrandr2 libxxf86vm1 x11-xserver-utils xfonts-base xserver-common
COPY . /code
# this .deb is specially patched to support lwjgl
# source: https://github.com/tectonicus/tectonicus/issues/60#issuecomment-154239173
RUN dpkg -i /code/scripts/xvfb_1.16.4-1_amd64.deb
WORKDIR /code
RUN ./gradlew build
# this .deb is specially patched to support lwjgl
# source: https://github.com/tectonicus/tectonicus/issues/60#issuecomment-154239173
RUN dpkg -i scripts/xvfb_1.16.4-1_amd64.deb
RUN ./gradlew build

View File

@@ -4,13 +4,14 @@
- **Block breaking** Baritone considers breaking blocks as part of its path. It also takes into account your current tool set and hot bar. For example, if you have a Eff V diamond pick, it may choose to mine through a stone barrier, while if you only had a wood pick it might be faster to climb over it.
- **Block placing** Baritone considers placing blocks as part of its path. This includes sneak-back-placing, pillaring, etc. It has a configurable penalty of placing a block (set to 1 second by default), to conserve its resources. The list of acceptable throwaway blocks is also configurable, and is cobble, dirt, or netherrack by default. <a href="https://www.youtube.com/watch?v=F6FbI1L9UmU">Example</a>
- **Falling** Baritone will fall up to 3 blocks onto solid ground (configurable, if you have Feather Falling and/or don't mind taking a little damage). If you have a water bucket on your hotbar, it will fall up to 23 blocks and place the bucket beneath it. It will fall an unlimited distance into existing still water.
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`).
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`). Baritone can break its fall by grabbing ladders / vines midair, and understands when that is and isn't possible.
- **Opening fence gates and doors**
- **Slabs and stairs**
- **Falling blocks** Baritone understands the costs of breaking blocks with falling blocks on top, and includes all of their break costs. Additionally, since it avoids breaking any blocks touching a liquid, it won't break the bottom of a gravel stack below a lava lake (anymore).
- **Avoiding dangerous blocks** Obviously, it knows not to walk through fire or on magma, not to corner over lava (that deals some damage), not to break any blocks touching a liquid (it might drown), etc.
- **Parkour** Sprint jumping over 1, 2, or 3 block gaps
- **Parkour place** Sprint jumping over a 3 block gap and placing the block to land on while executing the jump. It's really cool.
- **Pigs** It can sort of control pigs. I wouldn't rely on it though.
# Pathing method
Baritone uses A*, with some modifications:
@@ -21,9 +22,9 @@ Baritone uses A*, with some modifications:
- **Backtrack cost favoring** While calculating the next segment, Baritone favors backtracking its current segment. The cost is decreased heavily, but is still positive (this won't cause it to backtrack if it doesn't need to). This allows it to splice and jump onto the next segment as early as possible, if the next segment begins with a backtrack of the current one. <a href="https://www.youtube.com/watch?v=CGiMcb8-99Y">Example</a>
- **Backtrack detection and pausing** While path calculation happens on a separate thread, the main game thread has access to the latest node considered, and the best path so far (those are rendered light blue and dark blue respectively). When the current best path (rendered dark blue) passes through the player's current position on the current path segment, path execution is paused (if it's safe to do so), because there's no point continuing forward if we're about to turn around and go back that same way. Note that the current best path as reported by the path calculation thread takes into account the incremental cost backoff system, so it's accurate to what the path calculation thread will actually pick once it finishes.
# Configuring Baritone
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>.
To change 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 `pathTimeoutMS 250`). It's case insensitive.
# Chat control
- [Baritone chat control usage](USAGE.md)
# Goals
The pathing goal can be set to any of these options:
@@ -46,7 +47,6 @@ Things it doesn't have yet
See <a href="https://github.com/cabaletta/baritone/issues">issues</a> for more.
Things it may not ever have, from most likely to least likely =(
- Pigs
- Boats
- Horses (2x3 path instead of 1x2)
- Elytra

View File

@@ -1,91 +0,0 @@
# Integration between Baritone and Impact
Impact 4.4 will have Baritone included on release, however, if you're impatient, you can install Baritone into Impact 4.3 right now!
## An Introduction
There are some basic steps to getting Baritone setup with Impact.
- Acquiring a build of Baritone
- Placing Baritone in the libraries directory
- Modifying the Impact Profile JSON to run baritone
- How to use Baritone
## Acquiring a build of Baritone
There are 3 methods of acquiring a build of Baritone (While it is still in development)
### Official Release (Not always up to date)
https://github.com/cabaletta/baritone/releases
For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`.
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`.
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone . && docker run --rm cabaletta/baritone cat /code/dist/checksums.txt` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
### Building Baritone yourself
There are a few steps to this
- Clone this repository
- Setup the project as instructed in the README
- Run the ``build`` gradle task. You can either do this using IntelliJ's gradle UI or through a
command line
- Windows: ``gradlew build``
- Mac/Linux: ``./gradlew build``
- The build should be exported into ``/build/libs/baritone-X.Y.Z.jar``
### Cutting Edge Release
If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit
from his Jenkins server, found <a href="https://plutiejenkins.leijurv.com/job/baritone/lastSuccessfulBuild/">here</a>.
## Placing Baritone in the libraries directory
``/libraries`` is a neat directory in your <a href="https://minecraft.gamepedia.com/.minecraft">Minecraft Installation Directory</a>
that contains all of the dependencies that are required from the game and some mods. This is where we will be
putting baritone.
- Locate the ``libraries`` folder, it should be in the Minecraft Installation Directory
- Create 3 new subdirectories starting from ``libraries``
- ``cabaletta``
- ``baritone``
- ``X.Y.Z``
- Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder
- The full path should look like ``<Minecraft>/libraries/cabaletta/baritone/X.Y.Z/baritone-X.Y.Z.jar``
## Modifying the Impact Profile JSON to run baritone
The final step is "registering" the Baritone library with Impact, so that it loads on launch.
- Ensure your Minecraft launcher is closed
- Navigate back to the Minecraft Installation Directory
- Find the ``versions`` directory, and open in
- In here there should be a ``1.12.2-Impact_4.3`` folder.
- If you don't have any Impact folder or have a version older than 4.3, you can download Impact <a href="https://impactdevelopment.github.io">here</a>.
- Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json``
- Open the JSON file with a text editor that supports your system's line endings
- For example, Notepad on Windows likely will NOT work for this. You should instead use a Text Editor like
<a href="https://notepad-plus-plus.org/">Notepad++</a> if you're on Windows. (For other systems, I'm not sure
what would work the best so you may have to do some research.)
- Find the ``libraries`` array in the JSON. It should look something like this.
```
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.12"
},
{
"name": "com.github.ImpactDevelopment:Impact:4.3-1.12.2",
"url": "https://impactdevelopment.github.io/maven/"
},
{
"name": "com.github.ImpactDeveloment:ClientAPI:3.0.2",
"url": "https://impactdevelopment.github.io/maven/"
},
...
```
- Create a new object in the array, between the ``Impact`` and ``ClientAPI`` dependencies preferably.
```
{
"name": "cabaletta:baritone:X.Y.Z"
},
```
- Now find the ``"minecraftArguments": "..."`` text near the top.
- At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like:
- ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine"``
- If you didn't close your launcher for this step, restart it now.
- You can now launch Impact 4.3 as normal, and Baritone should start up
## How to use Baritone
Instructions on how to use Baritone are limited, and you may have to read a little bit of code (Really nothing much
just plain English), you can view that <a href="https://github.com/cabaletta/baritone#chat-control">here</a>.

BIN
LICENSE-Part-2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -1,70 +1,81 @@
# Baritone
[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone)
[![License](https://img.shields.io/github/license/cabaletta/baritone.svg)](LICENSE)
[![Build Status](https://travis-ci.com/cabaletta/baritone.svg?branch=master)](https://travis-ci.com/cabaletta/baritone/)
[![Release](https://img.shields.io/github/release/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/releases/)
[![License](https://img.shields.io/badge/license-LGPL--3.0%20with%20anime%20exception-green.svg)](LICENSE)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a73d037823b64a5faf597a18d71e3400)](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)
[![HitCount](http://hits.dwyl.com/cabaletta/baritone.svg)](http://hits.dwyl.com/cabaletta/baritone/)
[![GitHub All Releases](https://img.shields.io/github/downloads/cabaletta/baritone/total.svg)](https://github.com/cabaletta/baritone/releases/)
[![Minecraft](https://img.shields.io/badge/MC-1.12.2-green.svg)](https://github.com/cabaletta/baritone/tree/master/)
[![Minecraft](https://img.shields.io/badge/MC-1.13.2-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/1.13.2/)
[![Code of Conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat)](https://github.com/cabaletta/baritone/blob/master/CODE_OF_CONDUCT.md)
[![Known Vulnerabilities](https://snyk.io/test/github/cabaletta/baritone/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle)
[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cabaletta/baritone/issues/)
[![Issues](https://img.shields.io/github/issues/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/issues/)
[![GitHub issues-closed](https://img.shields.io/github/issues-closed/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/issues?q=is%3Aissue+is%3Aclosed)
[![Pull Requests](https://img.shields.io/github/issues-pr/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/pulls/)
![Code size](https://img.shields.io/github/languages/code-size/cabaletta/baritone.svg)
![GitHub repo size](https://img.shields.io/github/repo-size/cabaletta/baritone.svg)
![Lines of Code](https://tokei.rs/b1/github/cabaletta/baritone?category=code)
[![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/)
[![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/)
[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.6%20/%20v1.3.2-brightgreen.svg)](https://impactdevelopment.github.io/)
[![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg)](https://github.com/fr1kin/ForgeHax/)
[![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/)
[![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/)
[![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/)
[![forthebadge](https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg)](http://forthebadge.com/)
<!-- Unofficial Jenkins: [![Build Status](https://plutiejenkins.leijurv.com/job/baritone/badge/icon)](https://plutiejenkins.leijurv.com/job/baritone/lastSuccessfulBuild/) -->
A Minecraft pathfinder bot.
A Minecraft pathfinder bot. This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/),
the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. Baritone focuses on reliability and particularly performance (it's over [29x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).
Baritone is the pathfinding system used in [Impact](https://impactdevelopment.github.io/) since 4.4. There's a [showcase video](https://www.youtube.com/watch?v=yI8hgW_m6dQ) made by @Adovin#3153 on Baritone's integration into Impact. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a video I made showing off what it can do.
The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the forge jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
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 and 1.13.2. 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).
Have committed at least once a day for the last 11 months =D 🦀
1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2
# Getting Started
Here are some links to help to get started:
- [Features](FEATURES.md)
- [Baritone + Impact](IMPACT.md)
- [Installation & setup](SETUP.md)
There's also some useful information down below
- [API Javadocs](https://baritone.leijurv.com/)
# Setup
- [Settings](https://baritone.leijurv.com/baritone/api/Settings.html#field.detail)
## IntelliJ's Gradle UI
- Open the project in IntelliJ as a Gradle project
- Run the Gradle task `setupDecompWorkspace`
- Run the Gradle task `genIntellijRuns`
- Refresh the Gradle project (or just restart IntelliJ)
- Select the "Minecraft Client" launch config and run
- [Usage (chat control)](USAGE.md)
## Command Line
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
# API
Running Baritone:
The API is heavily documented, you can find the Javadocs for the latest release [here](https://baritone.leijurv.com/).
Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release
jar.
```
$ gradlew run
```
Setting up for IntelliJ:
```
$ gradlew setupDecompWorkspace
$ gradlew --refresh-dependencies
$ gradlew genIntellijRuns
```
# Chat control
[Defined Here](src/main/java/baritone/utils/ExampleBaritoneControl.java)
Quick start example: `thisway 1000` or `goal 70` to set the goal, `path` to actually start pathing. Also try `mine diamond_ore`. `cancel` to cancel.
# API example
Below is an example of basic usage for changing some settings, and then pathing to a X/Z goal.
```
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().pathTimeoutMS.value = 2000L;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
BaritoneAPI.getPathingBehavior().setGoal(new GoalXZ(10000, 20000));
BaritoneAPI.getPathingBehavior().path();
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
```
# FAQ
## Can I use Baritone as a library in my hacked client?
## Can I use Baritone as a library in my custom utility client?
Sure! (As long as usage is in compliance with the LGPL 3 License)
That's what it's for, sure! (As long as usage is in compliance with the LGPL 3.0 License)
## How is it so fast?
Magic. (Hours of [Leijurv](https://github.com/leijurv) enduring excruciating pain)
Magic. (Hours of [leijurv](https://github.com/leijurv/) enduring excruciating pain)
## Why is it called Baritone?

102
SETUP.md Normal file
View File

@@ -0,0 +1,102 @@
# Installation
The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone.
Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
## Prebuilt official releases
These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `backfill-2` branch for example, you'll have to build it yourself)
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`.
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
## Artifacts
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
**The Forge release can simply be added as a Forge mod.**
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration.
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
- **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.
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
## More Info
To replace out Impact 4.5's Baritone build with a customized one, build Baritone as above then copy & **rename** `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.2/baritone-api-1.2.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.5/1.12.2-Impact_4.5.json`, find the line `"name": "cabaletta:baritone-api:1.2"`, remove the comma from the end, and **entirely remove the NEXT line** (starts with `"url"`). **Restart your launcher** then load as normal.
You can verify whether or not it worked by running `.b version` in chat (only valid in Impact). It should print out the version that you downloaded. Note: The version that comes with 4.5 is `v1.2.3`.
## Build it yourself
- Clone or download Baritone
![Image](https://i.imgur.com/kbqBtoN.png)
- If you choose to download, make sure you extract the ZIP archive.
- Follow one of the instruction sets below, based on your preference
## Command Line
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
Setting up the Environment:
```
$ gradlew setupDecompWorkspace
$ gradlew --refresh-dependencies
```
Running Baritone:
```
$ gradlew runClient
```
For information on how to build baritone, see [Building Baritone](#building-baritone)
## IntelliJ
- Open the project in IntelliJ as a Gradle project
![Image](https://i.imgur.com/jw7Q6vY.png)
- Run the Gradle tasks `setupDecompWorkspace` then `genIntellijRuns`
![Image](https://i.imgur.com/QEfVvWP.png)
- Refresh the Gradle project (or, to be safe, just restart IntelliJ)
![Image](https://i.imgur.com/3V7EdWr.png)
- Select the "Minecraft Client" launch config
![Image](https://i.imgur.com/1qz2QGV.png)
- Click on ``Edit Configurations...`` from the same dropdown and select the "Minecraft Client" config
![Image](https://i.imgur.com/s4ly0ZF.png)
- In `Edit Configurations...` you need to select `baritone_launch` for `Use classpath of module:`.
![Image](https://i.imgur.com/hrLhG9u.png)
# Building
Make sure that you have properly [setup](#setup) the environment before trying to build it.
## Command Line
```
$ gradlew build
```
## IntelliJ
- Navigate to the gradle tasks on the right tab as follows
![Image](https://i.imgur.com/PE6r9iN.png)
- Double click on **build** to run it

80
USAGE.md Normal file
View File

@@ -0,0 +1,80 @@
(assuming you already have Baritone [set up](SETUP.md))
# Prefix
Baritone's chat control prefix is `#` by default. In Impact, you can also use `.b` as a prefix. (for example, `.b click` instead of `#click`)
Baritone commands can also by default be typed in the chatbox. However if you make a typo, like typing "gola 10000 10000" instead of "goal" it goes into public chat, which is bad, so using `#` is suggested.
To disable direct chat control (with no prefix), turn off the `chatControl` setting. To disable chat control with the `#` prefix, turn off the `prefixControl` setting. In Impact, `.b` cannot be disabled. Be careful that you don't leave yourself with all control methods disabled (if you do, reset your settings by deleting the file `minecraft/baritone/settings.txt` and relaunching).
# Commands
**All** of these commands may need a prefix before them, as above ^.
`help` for (rudimentary) help. You can see what it says [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java#L47).
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:
- `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 go to a certain coordinate
- `goal` to set the goal to your player's feet
- `goal clear` to clear the goal
- `cancel` or `stop` to stop everything
- `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` to mine diamond 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.)
- `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 clear all blocks from an area.
- `follow playerName` to follow a player. `follow` to follow the entity you're looking at (only works if it hitting range). `followplayers` to follow any players in range (combine with Kill Aura for a fun time).
- `save waypointName` to save a waypoint. `goto waypointName` to go to it.
- `build` to build a schematic. `build blah` will load `schematics/blah.schematic` and build it with the origin being your player feet. `build blah x y z` to set the origin. Any of those can be relative to your player (`~ 69 ~-420` would build at x=player x, y=69, z=player z-420).
- `tunnel` to dig just straight ahead and make a tunnel
- `farm` to automatically harvest, replant, or bone meal crops
- `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.
- `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://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java).
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.
- `allowBreak`
- `allowSprint`
- `allowPlace`
- `allowParkour`
- `allowParkourPlace`
- `blockPlacementPenalty`
- `renderCachedChunks` (and `cachedChunksOpacity`) <-- very fun but you need a beefy computer
- `avoidance` (avoidance of mobs / mob spawners)
- `legitMine`
- `followRadius`
- `backfill` (fill in tunnels behind you)
- `buildInLayers`
- `buildRepeatDistance` and `buildRepeatDirection`
- `worldExploringChunkOffset`
- `acceptableThrowawayItems`
- `blocksToAvoidBreaking`
# Troubleshooting / common issues
## Why doesn't Baritone respond to any of my chat commands?
This could be one of many things.
First, make sure it's actually installed. An easy way to check is seeing if it created the folder `baritone` in your Minecraft folder.
Second, make sure that you're using the prefix properly, and that chat control is enabled in the way you expect.
For example, Impact disables direct chat control. (i.e. anything typed in chat without a prefix will be ignored and sent publicly). **This is a saved setting**, so if you run Impact once, `chatControl` will be off from then on, **even in other clients**.
So you'll need to use the `#` prefix or edit `baritone/settings.txt` in your Minecraft folder to undo that (specifically, remove the line `chatControl false` then restart your client).
## Why can I do `.goto x z` in Impact but nowhere else? Why can I do `-path to x z` in KAMI but nowhere else?
These are custom commands that they added; those aren't from Baritone.
The equivalent you're looking for is `goal x z` then `path`.

View File

@@ -1,115 +1,187 @@
/*
* 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/>.
*/
group 'baritone'
version '0.0.9'
buildscript {
repositories {
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'SpongePowered'
url = 'http://repo.spongepowered.org/maven'
}
jcenter()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
}
}
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
sourceSets {
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
}
minecraft {
version = '1.12.2'
mappings = 'snapshot_20180731'
tweakClass = 'baritone.launch.BaritoneTweaker'
runDir = 'run'
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
makeObfSourceJar = true
}
repositories {
mavenCentral()
maven {
name = 'spongepowered-repo'
url = 'http://repo.spongepowered.org/maven/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
}
dependencies {
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.1')
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
testImplementation 'junit:junit:4.12'
}
mixin {
defaultObfuscationEnv notch
add sourceSets.launch, 'mixins.baritone.refmap.json'
}
jar {
from sourceSets.launch.output, sourceSets.api.output
preserveFileTimestamps = false
reproducibleFileOrder = true
}
task proguard(type: ProguardTask) {
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
extract 'proguard6.0.3/lib/proguard.jar'
versionManifest 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
}
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)
/*
* 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/>.
*/
group 'baritone'
version '1.3.3'
buildscript {
repositories {
jcenter()
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
}
dependencies {
classpath group: 'com.github.ImpactDevelopment', name: 'ForgeGradle', version: '3.0.115'
classpath group: 'com.github.ImpactDevelopment', name: 'MixinGradle', version: '0.6.2'
}
}
import baritone.gradle.task.CreateDistTask
import baritone.gradle.task.ProguardTask
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = "UTF-8" // allow emoji in comments :^)
}
sourceSets {
api {
compileClasspath += main.compileClasspath
}
main {
compileClasspath += api.output
}
test {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
launch {
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
runtimeClasspath += main.compileClasspath + main.runtimeClasspath + main.output
}
}
task sourceJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.api.allSource
}
minecraft {
mappings channel: 'snapshot', version: '20190307-1.13.1'
reobfMappings 'notch'
runs {
client {
workingDirectory project.file('run')
source sourceSets.launch
main 'baritone.launch.LaunchTesting'
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', downloadAssets.output
environment 'nativesDirectory', extractNatives.output
environment 'tweakClass', 'baritone.launch.BaritoneTweaker'
if (Os.isFamily(Os.FAMILY_MAC)) {
jvmArgs "-XstartOnFirstThread"
}
}
autoTest {
workingDirectory project.file('autotest')
source sourceSets.launch
main 'baritone.launch.LaunchTesting'
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', downloadAssets.output
environment 'nativesDirectory', extractNatives.output
environment 'tweakClass', 'baritone.launch.BaritoneTweaker'
environment 'BARITONE_AUTO_TEST', 'true'
if (Os.isFamily(Os.FAMILY_MAC)) {
jvmArgs "-XstartOnFirstThread"
}
}
}
}
repositories {
mavenCentral()
maven {
name = 'spongepowered-repo'
url = 'http://repo.spongepowered.org/maven/'
}
maven {
name = 'impactdevelopment-repo'
url = 'https://impactdevelopment.github.io/maven/'
}
}
dependencies {
minecraft 'com.github.ImpactDevelopment:Vanilla:1.13.2'
runtime launchCompile('net.minecraft:launchwrapper:1.12') {
exclude module: 'lwjgl'
}
runtime launchCompile('org.ow2.asm:asm-debug-all:5.2')
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2')
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
exclude module: 'log4j-core'
}
testImplementation 'junit:junit:4.12'
}
mixin {
defaultObfuscationEnv searge
add sourceSets.launch, 'mixins.baritone.refmap.json'
}
javadoc {
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
options.linkSource true
options.encoding "UTF-8" // allow emoji in comments :^)
source = sourceSets.api.allJava
classpath += sourceSets.api.compileClasspath
}
jar {
from sourceSets.launch.output, sourceSets.api.output
preserveFileTimestamps = false
reproducibleFileOrder = true
manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json',
'Implementation-Title': 'Baritone',
'Implementation-Version': version
)
}
}
task proguard(type: ProguardTask) {
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
extract 'proguard6.0.3/lib/proguard.jar'
}
task createDist(type: CreateDistTask, dependsOn: proguard)
build.finalizedBy(createDist)

View File

@@ -17,8 +17,6 @@
package baritone.gradle.task;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.gradle.api.DefaultTask;
import java.io.File;
@@ -26,7 +24,6 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
/**
* @author Brady
@@ -34,9 +31,7 @@ import java.util.List;
*/
class BaritoneGradleTask extends DefaultTask {
static final JsonParser PARSER = new JsonParser();
static final String
protected static final String
PROGUARD_ZIP = "proguard.zip",
PROGUARD_JAR = "proguard.jar",
PROGUARD_CONFIG_TEMPLATE = "scripts/proguard.pro",
@@ -45,58 +40,50 @@ class BaritoneGradleTask extends DefaultTask {
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
PROGUARD_EXPORT_PATH = "proguard_out.jar",
VERSION_MANIFEST = "version_manifest.json",
ARTIFACT_STANDARD = "%s-%s.jar",
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
ARTIFACT_API = "%s-api-%s.jar",
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
TEMP_LIBRARY_DIR = "tempLibraries/",
protected String artifactName, artifactVersion;
protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, proguardOut;
ARTIFACT_STANDARD = "%s-%s.jar",
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
ARTIFACT_API = "%s-api-%s.jar",
ARTIFACT_STANDALONE = "%s-standalone-%s.jar";
String artifactName, artifactVersion;
Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, proguardOut;
void verifyArtifacts() throws Exception {
protected void verifyArtifacts() throws IllegalStateException {
this.artifactName = getProject().getName();
this.artifactVersion = getProject().getVersion().toString();
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
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);
if (!Files.exists(this.artifactPath)) {
throw new Exception("Artifact not found! Run build first!");
throw new IllegalStateException("Artifact not found! Run build first!");
}
}
void write(InputStream stream, Path file) throws Exception {
protected void write(InputStream stream, Path file) throws Exception {
if (Files.exists(file)) {
Files.delete(file);
}
Files.copy(stream, file);
}
String formatVersion(String string) {
protected String formatVersion(String string) {
return String.format(string, this.artifactName, this.artifactVersion);
}
Path getRelativeFile(String file) {
protected Path getRelativeFile(String file) {
return Paths.get(new File(file).getAbsolutePath());
}
Path getTemporaryFile(String file) {
protected Path getTemporaryFile(String file) {
return Paths.get(new File(getTemporaryDir(), file).getAbsolutePath());
}
Path getBuildFile(String file) {
protected Path getBuildFile(String file) {
return getRelativeFile("build/libs/" + file);
}
JsonElement readJson(List<String> lines) {
return PARSER.parse(String.join("\n", lines));
}
}

View File

@@ -42,9 +42,9 @@ public class CreateDistTask extends BaritoneGradleTask {
super.verifyArtifacts();
// Define the distribution file paths
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
// NIO will not automatically create directories
Path dir = getRelativeFile("dist/");
@@ -53,15 +53,17 @@ public class CreateDistTask extends BaritoneGradleTask {
}
// Copy build jars to dist/
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
// Calculate all checksums and format them like "shasum"
List<String> shasum = Stream.of(api, standalone, unoptimized)
.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);
}
@@ -74,7 +76,7 @@ public class CreateDistTask extends BaritoneGradleTask {
return DatatypeConverter.printHexBinary(SHA1_DIGEST.digest(Files.readAllBytes(path))).toLowerCase();
} catch (Exception e) {
// haha no thanks
throw new RuntimeException(e);
throw new IllegalStateException(e);
}
}
}

View File

@@ -18,21 +18,18 @@
package baritone.gradle.task;
import baritone.gradle.util.Determinizer;
import com.google.gson.*;
import org.apache.commons.io.IOUtils;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.Pair;
import java.io.*;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -44,20 +41,12 @@ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
*/
public class ProguardTask extends BaritoneGradleTask {
private static final Pattern TEMP_LIBRARY_PATTERN = Pattern.compile("-libraryjars 'tempLibraries\\/([a-zA-Z0-9/_\\-\\.]+)\\.jar'");
@Input
private String url;
@Input
private String extract;
@Input
private String versionManifest;
private Map<String, String> versionDownloadMap;
private List<String> requiredLibraries;
@TaskAction
protected void exec() throws Exception {
super.verifyArtifacts();
@@ -67,8 +56,6 @@ public class ProguardTask extends BaritoneGradleTask {
downloadProguard();
extractProguard();
generateConfigs();
downloadVersionManifest();
acquireDependencies();
proguardApi();
proguardStandalone();
cleanup();
@@ -112,6 +99,19 @@ public class ProguardTask extends BaritoneGradleTask {
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
template.add(2, "-libraryjars '" + out + "'");
// Discover all of the libraries that we will need to acquire from gradle
acquireDependencies().forEach(f -> {
if (f.toString().endsWith("-recomp.jar")) {
// remove MCP mapped jar
return;
}
if (f.toString().endsWith("client-extra.jar")) {
// go from the extra to the original downloaded client
f = new File(f.getParentFile(), "client.jar");
}
template.add(2, "-libraryjars '" + f + "'");
});
// API config doesn't require any changes from the changes that we made to the template
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
@@ -119,80 +119,10 @@ public class ProguardTask extends BaritoneGradleTask {
List<String> standalone = new ArrayList<>(template);
standalone.removeIf(s -> s.contains("# this is the keep api"));
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
// Discover all of the libraries that we will need to acquire from gradle
this.requiredLibraries = new ArrayList<>();
template.forEach(line -> {
if (!line.startsWith("#")) {
Matcher m = TEMP_LIBRARY_PATTERN.matcher(line);
if (m.find()) {
this.requiredLibraries.add(m.group(1));
}
}
});
}
private void downloadVersionManifest() throws Exception {
Path manifestJson = getTemporaryFile(VERSION_MANIFEST);
write(new URL(this.versionManifest).openStream(), manifestJson);
// Place all the versions in the map with their download URL
this.versionDownloadMap = new HashMap<>();
JsonObject json = readJson(Files.readAllLines(manifestJson)).getAsJsonObject();
JsonArray versions = json.getAsJsonArray("versions");
versions.forEach(element -> {
JsonObject object = element.getAsJsonObject();
this.versionDownloadMap.put(object.get("id").getAsString(), object.get("url").getAsString());
});
}
private void acquireDependencies() throws Exception {
// Create a map of all of the dependencies that we are able to access in this project
// Likely a better way to do this, I just pair the dependency with the first valid configuration
Map<String, Pair<Configuration, Dependency>> dependencyLookupMap = new HashMap<>();
getProject().getConfigurations().stream().filter(Configuration::isCanBeResolved).forEach(config ->
config.getAllDependencies().forEach(dependency ->
dependencyLookupMap.putIfAbsent(dependency.getName() + "-" + dependency.getVersion(), Pair.of(config, dependency))));
// Create the directory if it doesn't already exist
Path tempLibraries = getTemporaryFile(TEMP_LIBRARY_DIR);
if (!Files.exists(tempLibraries)) {
Files.createDirectory(tempLibraries);
}
// Iterate the required libraries to copy them to tempLibraries
for (String lib : this.requiredLibraries) {
// Download the version jar from the URL acquired from the version manifest
if (lib.startsWith("minecraft")) {
String version = lib.split("-")[1];
Path versionJar = getTemporaryFile("tempLibraries/" + lib + ".jar");
if (!Files.exists(versionJar)) {
JsonObject versionJson = PARSER.parse(new InputStreamReader(new URL(this.versionDownloadMap.get(version)).openStream())).getAsJsonObject();
String url = versionJson.getAsJsonObject("downloads").getAsJsonObject("client").getAsJsonPrimitive("url").getAsString();
write(new URL(url).openStream(), versionJar);
}
continue;
}
// Find a configuration/dependency pair that matches the desired library
Pair<Configuration, Dependency> pair = null;
for (Map.Entry<String, Pair<Configuration, Dependency>> entry : dependencyLookupMap.entrySet()) {
if (entry.getKey().startsWith(lib)) {
pair = entry.getValue();
}
}
// The pair must be non-null
Objects.requireNonNull(pair);
// Find the library jar file, and copy it to tempLibraries
for (File file : pair.getLeft().files(pair.getRight())) {
if (file.getName().startsWith(lib)) {
Files.copy(file.toPath(), getTemporaryFile("tempLibraries/" + lib + ".jar"), REPLACE_EXISTING);
}
}
}
private Stream<File> acquireDependencies() {
return getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles().stream().filter(File::isFile);
}
private void proguardApi() throws Exception {
@@ -219,10 +149,6 @@ public class ProguardTask extends BaritoneGradleTask {
this.extract = extract;
}
public void setVersionManifest(String versionManifest) {
this.versionManifest = versionManifest;
}
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)) {
@@ -235,24 +161,24 @@ public class ProguardTask extends BaritoneGradleTask {
.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
this.printOutputLog(p.getInputStream());
this.printOutputLog(p.getErrorStream());
this.printOutputLog(p.getInputStream(), System.out);
this.printOutputLog(p.getErrorStream(), System.err);
// Halt the current thread until the process is complete, if the exit code isn't 0, throw an exception
int exitCode = p.waitFor();
if (exitCode != 0) {
throw new Exception("Proguard exited with code " + exitCode);
throw new IllegalStateException("Proguard exited with code " + exitCode);
}
}
private void printOutputLog(InputStream stream) {
private void printOutputLog(InputStream stream, PrintStream outerr) {
new Thread(() -> {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
outerr.println(line);
}
} catch (final Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}).start();

View File

@@ -32,7 +32,7 @@ import java.util.jar.JarOutputStream;
import java.util.stream.Collectors;
/**
* Make a .jar file deterministic by sorting all entries by name, and setting all the last modified times to 0.
* Make a .jar file deterministic by sorting all entries by name, and setting all the last modified times to 42069.
* This makes the build 100% reproducible since the timestamp when you built it no longer affects the final file.
*
* @author leijurv

View File

@@ -1,6 +1,6 @@
#Tue Jul 31 21:56:56 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
#Tue Jul 31 21:56:56 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip

168
gradlew.bat vendored
View File

@@ -1,84 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

58
scripts/proguard.pro vendored
View File

@@ -12,10 +12,19 @@
-flattenpackagehierarchy
-repackageclasses 'baritone'
# lwjgl is weird
-dontwarn org.lwjgl.**
# also lwjgl lol
-dontwarn module-info
-keep class baritone.api.** { *; } # this is the keep api
# service provider needs these class names
-keep class baritone.BaritoneProvider
-keep class baritone.api.IBaritoneProvider
-keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect
# setting names are reflected from field names, so keep field names
-keepclassmembers class baritone.api.Settings {
public <fields>;
@@ -24,55 +33,6 @@
# need to keep mixin names
-keep class baritone.launch.** { *; }
# copy all necessary libraries into tempLibraries to build
-libraryjars 'tempLibraries/minecraft-1.12.2.jar'
-libraryjars 'tempLibraries/SimpleTweaker-1.1.jar'
-libraryjars 'tempLibraries/authlib-1.5.25.jar'
-libraryjars 'tempLibraries/codecjorbis-20101023.jar'
-libraryjars 'tempLibraries/codecwav-20101023.jar'
-libraryjars 'tempLibraries/commons-codec-1.10.jar'
-libraryjars 'tempLibraries/commons-compress-1.8.1.jar'
-libraryjars 'tempLibraries/commons-io-2.5.jar'
-libraryjars 'tempLibraries/commons-lang3-3.5.jar'
-libraryjars 'tempLibraries/commons-logging-1.1.3.jar'
-libraryjars 'tempLibraries/fastutil-7.1.0.jar'
-libraryjars 'tempLibraries/gson-2.8.0.jar'
-libraryjars 'tempLibraries/guava-21.0.jar'
-libraryjars 'tempLibraries/httpclient-4.3.3.jar'
-libraryjars 'tempLibraries/httpcore-4.3.2.jar'
-libraryjars 'tempLibraries/icu4j-core-mojang-51.2.jar'
-libraryjars 'tempLibraries/jinput-2.0.5.jar'
-libraryjars 'tempLibraries/jna-4.4.0.jar'
-libraryjars 'tempLibraries/jopt-simple-5.0.3.jar'
-libraryjars 'tempLibraries/jsr305-3.0.1.jar'
-libraryjars 'tempLibraries/jutils-1.0.0.jar'
-libraryjars 'tempLibraries/libraryjavasound-20101123.jar'
-libraryjars 'tempLibraries/librarylwjglopenal-20100824.jar'
-libraryjars 'tempLibraries/log4j-api-2.8.1.jar'
-libraryjars 'tempLibraries/log4j-core-2.8.1.jar'
# startsWith is used to check the library, and mac/linux differ in which version they use
# this is FINE
-libraryjars 'tempLibraries/lwjgl-.jar'
-libraryjars 'tempLibraries/lwjgl_util-.jar'
-libraryjars 'tempLibraries/netty-all-4.1.9.Final.jar'
-libraryjars 'tempLibraries/oshi-core-1.1.jar'
-libraryjars 'tempLibraries/patchy-1.1.jar'
-libraryjars 'tempLibraries/platform-3.4.0.jar'
-libraryjars 'tempLibraries/realms-1.10.22.jar'
-libraryjars 'tempLibraries/soundsystem-20120107.jar'
-libraryjars 'tempLibraries/text2speech-1.10.3.jar'
-libraryjars 'tempLibraries/mixin-0.7.11-SNAPSHOT.jar'
-libraryjars 'tempLibraries/launchwrapper-1.11.jar' # TODO why does only 1.11.jar exist?
# Keep - Applications. Keep all application classes, along with their 'main'
# methods.
-keepclasseswithmembers public class * {

View File

@@ -1,19 +1,19 @@
/*
* 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/>.
*/
rootProject.name = 'baritone'
/*
* 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/>.
*/
rootProject.name = 'baritone'

View File

@@ -17,70 +17,36 @@
package baritone.api;
import baritone.api.behavior.*;
import baritone.api.cache.IWorldProvider;
import baritone.api.cache.IWorldScanner;
import baritone.api.event.listener.IGameEventListener;
import baritone.api.utils.SettingsUtil;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* API exposure for various things implemented in Baritone.
* <p>
* W.I.P
* Exposes the {@link IBaritoneProvider} instance and the {@link Settings} instance for API usage.
*
* @author Brady
* @since 9/23/2018
*/
public final class BaritoneAPI {
private static final IBaritoneProvider baritone;
private static final IBaritoneProvider provider;
private static final Settings settings;
static {
ServiceLoader<IBaritoneProvider> baritoneLoader = ServiceLoader.load(IBaritoneProvider.class);
Iterator<IBaritoneProvider> instances = baritoneLoader.iterator();
baritone = instances.next();
provider = instances.next();
settings = new Settings();
SettingsUtil.readAndApply(settings);
}
public static IFollowBehavior getFollowBehavior() {
return baritone.getFollowBehavior();
}
public static ILookBehavior getLookBehavior() {
return baritone.getLookBehavior();
}
public static IMemoryBehavior getMemoryBehavior() {
return baritone.getMemoryBehavior();
}
public static IMineBehavior getMineBehavior() {
return baritone.getMineBehavior();
}
public static IPathingBehavior getPathingBehavior() {
return baritone.getPathingBehavior();
public static IBaritoneProvider getProvider() {
return BaritoneAPI.provider;
}
public static Settings getSettings() {
return settings;
}
public static IWorldProvider getWorldProvider() {
return baritone.getWorldProvider();
}
public static IWorldScanner getWorldScanner() {
return baritone.getWorldScanner();
}
public static void registerEventListener(IGameEventListener listener) {
baritone.registerEventListener(listener);
return BaritoneAPI.settings;
}
}

View File

@@ -0,0 +1,132 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api;
import baritone.api.behavior.ILookBehavior;
import baritone.api.behavior.IPathingBehavior;
import baritone.api.cache.IWorldProvider;
import baritone.api.event.listener.IEventBus;
import baritone.api.pathing.calc.IPathingControlManager;
import baritone.api.process.*;
import baritone.api.utils.IInputOverrideHandler;
import baritone.api.utils.IPlayerContext;
/**
* @author Brady
* @since 9/29/2018
*/
public interface IBaritone {
/**
* Call as soon as Minecraft is ready, initializes all of the processes, behaviors, etc. This will
* only effectively be ran once, any additional calls are redundant because the initialization state
* is saved.
* <p>
* Or whenever your overeager utility client wants.
*/
void init();
/**
* @return The {@link IPathingBehavior} instance
* @see IPathingBehavior
*/
IPathingBehavior getPathingBehavior();
/**
* @return The {@link ILookBehavior} instance
* @see ILookBehavior
*/
ILookBehavior getLookBehavior();
/**
* @return The {@link IFollowProcess} instance
* @see IFollowProcess
*/
IFollowProcess getFollowProcess();
/**
* @return The {@link IMineProcess} instance
* @see IMineProcess
*/
IMineProcess getMineProcess();
/**
* @return The {@link IBuilderProcess} instance
* @see IBuilderProcess
*/
IBuilderProcess getBuilderProcess();
/**
* @return The {@link IExploreProcess} instance
* @see IExploreProcess
*/
IExploreProcess getExploreProcess();
/**
* @return The {@link IFarmProcess} instance
* @see IFarmProcess
*/
IFarmProcess getFarmProcess();
/**
* @return The {@link ICustomGoalProcess} instance
* @see ICustomGoalProcess
*/
ICustomGoalProcess getCustomGoalProcess();
/**
* @return The {@link IGetToBlockProcess} instance
* @see IGetToBlockProcess
*/
IGetToBlockProcess getGetToBlockProcess();
/**
* @return The {@link IWorldProvider} instance
* @see IWorldProvider
*/
IWorldProvider getWorldProvider();
/**
* Returns the {@link IPathingControlManager} for this {@link IBaritone} instance, which is responsible
* for managing the {@link IBaritoneProcess}es which control the {@link IPathingBehavior} state.
*
* @return The {@link IPathingControlManager} instance
* @see IPathingControlManager
*/
IPathingControlManager getPathingControlManager();
/**
* @return The {@link IInputOverrideHandler} instance
* @see IInputOverrideHandler
*/
IInputOverrideHandler getInputOverrideHandler();
/**
* @return The {@link IPlayerContext} instance
* @see IPlayerContext
*/
IPlayerContext getPlayerContext();
/**
* @return The {@link IEventBus} instance
* @see IEventBus
*/
IEventBus getGameEventHandler();
void openClick();
}

View File

@@ -17,70 +17,58 @@
package baritone.api;
import baritone.api.behavior.*;
import baritone.api.cache.IWorldProvider;
import baritone.api.cache.IWorldScanner;
import baritone.api.event.listener.IGameEventListener;
import net.minecraft.client.entity.EntityPlayerSP;
import java.util.List;
/**
* @author Brady
* @since 9/29/2018
* Provides the present {@link IBaritone} instances
*
* @author leijurv
*/
public interface IBaritoneProvider {
/**
* @see IFollowBehavior
* Returns the primary {@link IBaritone} instance. This instance is persistent, and
* is represented by the local player that is created by the game itself, not a "bot"
* player through Baritone.
*
* @return The {@link IFollowBehavior} instance
* @return The primary {@link IBaritone} instance.
*/
IFollowBehavior getFollowBehavior();
IBaritone getPrimaryBaritone();
/**
* @see ILookBehavior
* Returns all of the active {@link IBaritone} instances. This includes the local one
* returned by {@link #getPrimaryBaritone()}.
*
* @return The {@link ILookBehavior} instance
* @return All active {@link IBaritone} instances.
* @see #getBaritoneForPlayer(EntityPlayerSP)
*/
ILookBehavior getLookBehavior();
List<IBaritone> getAllBaritones();
/**
* @see IMemoryBehavior
* Provides the {@link IBaritone} instance for a given {@link EntityPlayerSP}. This will likely be
* replaced with or be overloaded in addition to {@code #getBaritoneForUser(IBaritoneUser)} when
* {@code bot-system} is merged into {@code master}.
*
* @return The {@link IMemoryBehavior} instance
* @param player The player
* @return The {@link IBaritone} instance.
*/
IMemoryBehavior getMemoryBehavior();
default IBaritone getBaritoneForPlayer(EntityPlayerSP player) {
for (IBaritone baritone : getAllBaritones()) {
if (player.equals(baritone.getPlayerContext().player())) {
return baritone;
}
}
return null;
}
/**
* @see IMineBehavior
* Returns the {@link IWorldScanner} instance. This is not a type returned by
* {@link IBaritone} implementation, because it is not linked with {@link IBaritone}.
*
* @return The {@link IMineBehavior} instance
*/
IMineBehavior getMineBehavior();
/**
* @see IPathingBehavior
*
* @return The {@link IPathingBehavior} instance
*/
IPathingBehavior getPathingBehavior();
/**
* @see IWorldProvider
*
* @return The {@link IWorldProvider} instance
*/
IWorldProvider getWorldProvider();
/**
* @see IWorldScanner
*
* @return The {@link IWorldScanner} instance
* @return The {@link IWorldScanner} instance.
*/
IWorldScanner getWorldScanner();
/**
* Registers a {@link IGameEventListener} with Baritone's "event bus".
*
* @param listener The listener
*/
void registerEventListener(IGameEventListener listener);
}

View File

@@ -17,68 +17,96 @@
package baritone.api;
import baritone.api.utils.SettingsUtil;
import baritone.api.utils.TypeUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.ITextComponent;
import java.awt.*;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
import java.util.List;
import java.util.function.Consumer;
/**
* Baritone's settings
* Baritone's settings. Settings apply to all Baritone instances.
*
* @author leijurv
*/
public class Settings {
public final class Settings {
/**
* Allow Baritone to break blocks
*/
public Setting<Boolean> allowBreak = new Setting<>(true);
public final Setting<Boolean> allowBreak = new Setting<>(true);
/**
* Allow Baritone to sprint
*/
public Setting<Boolean> allowSprint = new Setting<>(true);
public final Setting<Boolean> allowSprint = new Setting<>(true);
/**
* Allow Baritone to place blocks
*/
public Setting<Boolean> allowPlace = new Setting<>(true);
public final Setting<Boolean> allowPlace = new Setting<>(true);
/**
* Allow Baritone to move items in your inventory to your hotbar
*/
public final Setting<Boolean> allowInventory = new Setting<>(false);
/**
* It doesn't actually take twenty ticks to place a block, this cost is so high
* because we want to generally conserve blocks which might be limited
* because we want to generally conserve blocks which might be limited.
* <p>
* Decrease to make Baritone more often consider paths that would require placing blocks
*/
public Setting<Double> blockPlacementPenalty = new Setting<>(20D);
public final Setting<Double> blockPlacementPenalty = new Setting<>(20D);
/**
* This is just a tiebreaker to make it less likely to break blocks if it can avoid it.
* For example, fire has a break cost of 0, this makes it nonzero, so all else being equal
* it will take an otherwise equivalent route that doesn't require it to put out fire.
*/
public Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D);
public final Setting<Double> blockBreakAdditionalPenalty = new Setting<>(2D);
/**
* Additional penalty for hitting the space bar (ascend, pillar, or parkour) because it uses hunger
*/
public final Setting<Double> jumpPenalty = new Setting<>(2D);
/**
* Walking on water uses up hunger really quick, so penalize it
*/
public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D);
/**
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
* Reliability: questionable.
*/
public Setting<Boolean> allowWaterBucketFall = new Setting<>(true);
public final Setting<Boolean> allowWaterBucketFall = new Setting<>(true);
/**
* 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.
*/
public Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
public final Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
/**
* If you have Fire Resistance and Jesus then I guess you could turn this on lol
*/
public final Setting<Boolean> assumeWalkOnLava = new Setting<>(false);
/**
* Assume step functionality; don't jump on an Ascend.
*/
public Setting<Boolean> assumeStep = new Setting<>(false);
public final Setting<Boolean> assumeStep = new Setting<>(false);
/**
* Assume safe walk functionality; don't sneak on a backplace traverse.
@@ -87,45 +115,126 @@ public class Settings {
* it won't sneak right click, it'll just right click, which means it'll open the chest instead of placing
* against it. That's why this defaults to off.
*/
public Setting<Boolean> assumeSafeWalk = new Setting<>(false);
public final Setting<Boolean> assumeSafeWalk = new Setting<>(false);
/**
* If true, parkour is allowed to make jumps when standing on blocks at the maximum height, so player feet is y=256
* <p>
* Defaults to false because this fails on constantiam. Please let me know if this is ever disabled. Please.
*/
public final Setting<Boolean> allowJumpAt256 = new Setting<>(false);
/**
* Allow descending diagonally
* <p>
* Safer than allowParkour yet still slightly unsafe, can make contact with unchecked adjacent blocks, so it's unsafe in the nether.
* <p>
* For a generic "take some risks" mode I'd turn on this one, parkour, and parkour place.
*/
public final Setting<Boolean> allowDiagonalDescend = new Setting<>(false);
/**
* Allow mining the block directly beneath its feet
* <p>
* Turn this off to force it to make more staircases and less shafts
*/
public final Setting<Boolean> allowDownward = new Setting<>(true);
/**
* Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.)
*/
public Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList(
Item.getItemFromBlock(Blocks.DIRT),
Item.getItemFromBlock(Blocks.COBBLESTONE),
Item.getItemFromBlock(Blocks.NETHERRACK)
public final Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList(
Blocks.DIRT.asItem(),
Blocks.COBBLESTONE.asItem(),
Blocks.NETHERRACK.asItem(),
Blocks.STONE.asItem()
)));
/**
* Blocks that Baritone will attempt to avoid (Used in avoidance)
*/
public final Setting<List<Block>> blocksToAvoid = new Setting<>(new ArrayList<>(
// Leave Empty by Default
));
/**
* Blocks that Baritone is not allowed to break
*/
public final Setting<List<Block>> blocksToAvoidBreaking = new Setting<>(new ArrayList<>(Arrays.asList( // TODO can this be a HashSet or ImmutableSet?
Blocks.CRAFTING_TABLE,
Blocks.FURNACE,
Blocks.CHEST,
Blocks.TRAPPED_CHEST
)));
/**
* If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block.
* <p>
* I.E. it will never trigger cascading sand / gravel falls
*/
public final Setting<Boolean> avoidUpdatingFallingBlocks = new Setting<>(true);
/**
* Enables some more advanced vine features. They're honestly just gimmicks and won't ever be needed in real
* pathing scenarios. And they can cause Baritone to get trapped indefinitely in a strange scenario.
* <p>
* Never turn this on lol
*/
public Setting<Boolean> allowVines = new Setting<>(false);
public final Setting<Boolean> allowVines = new Setting<>(false);
/**
* Slab behavior is complicated, disable this for higher path reliability. Leave enabled if you have bottom slabs
* everywhere in your base.
*/
public Setting<Boolean> allowWalkOnBottomSlab = new Setting<>(true);
public final Setting<Boolean> allowWalkOnBottomSlab = new Setting<>(true);
/**
* You know what it is
* <p>
* But it's very unreliable and falls off when cornering like all the time so.
* <p>
* It also overshoots the landing pretty much always (making contact with the next block over), so be careful
*/
public Setting<Boolean> allowParkour = new Setting<>(false);
public final Setting<Boolean> allowParkour = new Setting<>(false);
/**
* Like parkour, but even more unreliable!
* Actually pretty reliable.
* <p>
* Doesn't make it any more dangerous compared to just normal allowParkour th
*/
public Setting<Boolean> allowParkourPlace = new Setting<>(false);
public final Setting<Boolean> allowParkourPlace = new Setting<>(false);
/**
* For example, if you have Mining Fatigue or Haste, adjust the costs of breaking blocks accordingly.
*/
public Setting<Boolean> considerPotionEffects = new Setting<>(true);
public final Setting<Boolean> considerPotionEffects = new Setting<>(true);
/**
* Sprint and jump a block early on ascends wherever possible
*/
public final Setting<Boolean> sprintAscends = new Setting<>(true);
/**
* If we overshoot a traverse and end up one block beyond the destination, mark it as successful anyway.
* <p>
* This helps with speed at >=20m/s
*/
public final Setting<Boolean> overshootTraverse = new Setting<>(true);
/**
* When breaking blocks for a movement, wait until all falling blocks have settled before continuing
*/
public final Setting<Boolean> pauseMiningForFallingBlocks = new Setting<>(true);
/**
* How many ticks between right clicks are allowed. Default in game is 4
*/
public final Setting<Integer> rightClickSpeed = new Setting<>(4);
/**
* How many degrees to randomize the yaw every tick. Set to 0 to disable
*/
public final Setting<Double> randomLooking = new Setting<>(2d);
/**
* This is the big A* setting.
@@ -142,95 +251,139 @@ public class Settings {
* <p>
* Finding the optimal path is worth it, so it's the default.
*/
public Setting<Double> costHeuristic = new Setting<>(3.5D);
public final Setting<Double> costHeuristic = new Setting<>(3.563);
// a bunch of obscure internal A* settings that you probably don't want to change
/**
* The maximum number of times it will fetch outside loaded or cached chunks before assuming that
* pathing has reached the end of the known area, and should therefore stop.
*/
public Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
public final Setting<Integer> pathingMaxChunkBorderFetch = new Setting<>(50);
/**
* Set to 1.0 to effectively disable this feature
*
* @see <a href="https://github.com/cabaletta/baritone/issues/18">Issue #18</a>
*/
public Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.5);
public final Setting<Double> backtrackCostFavoringCoefficient = new Setting<>(0.5);
/**
* Toggle the following 4 settings
* <p>
* They have a noticeable performance impact, so they default off
* <p>
* Specifically, building up the avoidance map on the main thread before pathing starts actually takes a noticeable
* amount of time, especially when there are a lot of mobs around, and your game jitters for like 200ms while doing so
*/
public final Setting<Boolean> avoidance = new Setting<>(false);
/**
* Set to 1.0 to effectively disable this feature
* <p>
* Set below 1.0 to go out of your way to walk near mob spawners
*/
public final Setting<Double> mobSpawnerAvoidanceCoefficient = new Setting<>(2.0);
public final Setting<Integer> mobSpawnerAvoidanceRadius = new Setting<>(16);
/**
* Set to 1.0 to effectively disable this feature
* <p>
* Set below 1.0 to go out of your way to walk near mobs
*/
public final Setting<Double> mobAvoidanceCoefficient = new Setting<>(1.5);
public final Setting<Integer> mobAvoidanceRadius = new Setting<>(8);
/**
* When running a goto towards a container block (chest, ender chest, furnace, etc),
* right click and open it once you arrive.
*/
public final Setting<Boolean> rightClickContainerOnArrival = new Setting<>(true);
/**
* When running a goto towards a nether portal block, walk all the way into the portal
* instead of stopping one block before.
*/
public final Setting<Boolean> enterPortal = new Setting<>(true);
/**
* Don't repropagate cost improvements below 0.01 ticks. They're all just floating point inaccuracies,
* and there's no point.
*/
public Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true);
public final Setting<Boolean> minimumImprovementRepropagation = new Setting<>(true);
/**
* After calculating a path (potentially through cached chunks), artificially cut it off to just the part that is
* entirely within currently loaded chunks. Improves path safety because cached chunks are heavily simplified.
* <p>
* This is much safer to leave off now, and makes pathing more efficient. More explanation in the issue.
*
* @see <a href="https://github.com/cabaletta/baritone/issues/144">Issue #144</a>
* @see <a href="https://github.com/cabaletta/baritone/issues/114">Issue #114</a>
*/
public Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false);
public final Setting<Boolean> cutoffAtLoadBoundary = new Setting<>(false);
/**
* If a movement's cost increases by more than this amount between calculation and execution (due to changes
* in the environment / world), cancel and recalculate
*/
public Setting<Double> maxCostIncrease = new Setting<>(10D);
public final Setting<Double> maxCostIncrease = new Setting<>(10D);
/**
* Stop 5 movements before anything that made the path COST_INF.
* For example, if lava has spread across the path, don't walk right up to it then recalculate, it might
* still be spreading lol
*/
public Setting<Integer> costVerificationLookahead = new Setting<>(5);
public final Setting<Integer> costVerificationLookahead = new Setting<>(5);
/**
* Static cutoff factor. 0.9 means cut off the last 10% of all paths, regardless of chunk load state
*/
public Setting<Double> pathCutoffFactor = new Setting<>(0.9);
public final Setting<Double> pathCutoffFactor = new Setting<>(0.9);
/**
* Only apply static cutoff for paths of at least this length (in terms of number of movements)
*/
public Setting<Integer> pathCutoffMinimumLength = new Setting<>(30);
public final Setting<Integer> pathCutoffMinimumLength = new Setting<>(30);
/**
* Start planning the next path once the remaining movements tick estimates sum up to less than this value
*/
public Setting<Integer> planningTickLookAhead = new Setting<>(150);
public final Setting<Integer> planningTickLookahead = new Setting<>(150);
/**
* Default size of the Long2ObjectOpenHashMap used in pathing
*/
public Setting<Integer> pathingMapDefaultSize = new Setting<>(1024);
public final Setting<Integer> pathingMapDefaultSize = new Setting<>(1024);
/**
* Load factor coefficient for the Long2ObjectOpenHashMap used in pathing
* <p>
* Decrease for faster map operations, but higher memory usage
*/
public Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f);
public final Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f);
/**
* How far are you allowed to fall onto solid ground (without a water bucket)?
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have
* Feather Falling IV, you might set it a bit higher, like 4 or 5.
*/
public Setting<Integer> maxFallHeightNoWater = new Setting<>(3);
public final Setting<Integer> maxFallHeightNoWater = new Setting<>(3);
/**
* How far are you allowed to fall onto solid ground (with a water bucket)?
* It's not that reliable, so I've set it below what would kill an unarmored player (23)
*/
public Setting<Integer> maxFallHeightBucket = new Setting<>(20);
public final Setting<Integer> maxFallHeightBucket = new Setting<>(20);
/**
* Is it okay to sprint through a descend followed by a diagonal?
* The player overshoots the landing, but not enough to fall off. And the diagonal ensures that there isn't
* lava or anything that's !canWalkInto in that space, so it's technically safe, just a little sketchy.
* <p>
* Note: this is *not* related to the allowDiagonalDescend setting, that is a completely different thing.
*/
public Setting<Boolean> allowOvershootDiagonalDescend = new Setting<>(true);
public final Setting<Boolean> allowOvershootDiagonalDescend = new Setting<>(true);
/**
* If your goal is a GoalBlock in an unloaded chunk, assume it's far enough away that the Y coord
@@ -239,104 +392,152 @@ public class Settings {
* of considering the Y coord. The reasoning is that if your X and Z are 10,000 blocks away,
* your Y coordinate's accuracy doesn't matter at all until you get much much closer.
*/
public Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true);
public final Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true);
/**
* If a movement takes this many ticks more than its initial cost estimate, cancel it
*/
public Setting<Integer> movementTimeoutTicks = new Setting<>(100);
public final Setting<Integer> movementTimeoutTicks = new Setting<>(100);
/**
* Pathing can never take longer than this
* Pathing ends after this amount of time, but only if a path has been found
* <p>
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
*/
public Setting<Long> pathTimeoutMS = new Setting<>(2000L);
public final Setting<Long> primaryTimeoutMS = new Setting<>(500L);
/**
* Planning ahead while executing a segment can never take longer than this
* Pathing can never take longer than this, even if that means failing to find any path at all
*/
public Setting<Long> planAheadTimeoutMS = new Setting<>(4000L);
public final Setting<Long> failureTimeoutMS = new Setting<>(2000L);
/**
* Planning ahead while executing a segment ends after this amount of time, but only if a path has been found
* <p>
* If no valid path (length above the minimum) has been found, pathing continues up until the failure timeout
*/
public final Setting<Long> planAheadPrimaryTimeoutMS = new Setting<>(4000L);
/**
* Planning ahead while executing a segment can never take longer than this, even if that means failing to find any path at all
*/
public final Setting<Long> planAheadFailureTimeoutMS = new Setting<>(5000L);
/**
* For debugging, consider nodes much much slower
*/
public Setting<Boolean> slowPath = new Setting<>(false);
public final Setting<Boolean> slowPath = new Setting<>(false);
/**
* Milliseconds between each node
*/
public Setting<Long> slowPathTimeDelayMS = new Setting<>(100L);
public final Setting<Long> slowPathTimeDelayMS = new Setting<>(100L);
/**
* The alternative timeout number when slowPath is on
*/
public Setting<Long> slowPathTimeoutMS = new Setting<>(40000L);
public final Setting<Long> slowPathTimeoutMS = new Setting<>(40000L);
/**
* The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing.
*/
public Setting<Boolean> chunkCaching = new Setting<>(true);
public final Setting<Boolean> chunkCaching = new Setting<>(true);
/**
* On save, delete from RAM any cached regions that are more than 1024 blocks away from the player
* <p>
* Temporarily disabled
* <p>
* Temporarily reenabled
*
* @see <a href="https://github.com/cabaletta/baritone/issues/248">Issue #248</a>
*/
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(true);
/**
* Remember the contents of containers (chests, echests, furnaces)
* <p>
* Really buggy since the packet stuff is multithreaded badly thanks to brady
*/
public final Setting<Boolean> containerMemory = new Setting<>(false);
/**
* Fill in blocks behind you
*/
public final Setting<Boolean> backfill = new Setting<>(false);
/**
* Print all the debug messages to chat
*/
public Setting<Boolean> chatDebug = new Setting<>(true);
public final Setting<Boolean> chatDebug = new Setting<>(false);
/**
* Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in
* something else
*/
public Setting<Boolean> chatControl = new Setting<>(true);
public final Setting<Boolean> chatControl = new Setting<>(true);
/**
* A second override over chatControl to force it on
*/
public Setting<Boolean> removePrefix = new Setting<>(false);
public final Setting<Boolean> removePrefix = new Setting<>(false);
/**
* Render the path
*/
public Setting<Boolean> renderPath = new Setting<>(true);
public final Setting<Boolean> renderPath = new Setting<>(true);
/**
* Render the goal
*/
public Setting<Boolean> renderGoal = new Setting<>(true);
public final Setting<Boolean> renderGoal = new Setting<>(true);
/**
* Render selection boxes
*/
public final Setting<Boolean> renderSelectionBoxes = new Setting<>(true);
/**
* Ignore depth when rendering the goal
*/
public Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(false);
public final Setting<Boolean> renderGoalIgnoreDepth = new Setting<>(true);
/**
* Renders X/Z type Goals with the vanilla beacon beam effect. Combining this with
* {@link #renderGoalIgnoreDepth} will cause strange render clipping.
*/
public final Setting<Boolean> renderGoalXZBeacon = new Setting<>(false);
/**
* Ignore depth when rendering the selection boxes (to break, to place, to walk into)
*/
public Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(false);
public final Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(true);
/**
* Ignore depth when rendering the path
*/
public Setting<Boolean> renderPathIgnoreDepth = new Setting<>(false);
public final Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true);
/**
* Line width of the path when rendered, in pixels
*/
public Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F);
public final Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F);
/**
* Line width of the goal when rendered, in pixels
*/
public Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F);
public final Setting<Float> goalRenderLineWidthPixels = new Setting<>(3F);
/**
* Start fading out the path at 20 movements ahead, and stop rendering it entirely 30 movements ahead.
* Improves FPS.
*/
public Setting<Boolean> fadePath = new Setting<>(false);
public final Setting<Boolean> fadePath = new Setting<>(false);
/**
* Move without having to force the client-sided rotations
*/
public Setting<Boolean> freeLook = new Setting<>(true);
public final Setting<Boolean> freeLook = new Setting<>(true);
/**
* Will cause some minor behavioral differences to ensure that Baritone works on anticheats.
@@ -344,37 +545,159 @@ public class Settings {
* At the moment this will silently set the player's rotations when using freeLook so you're not sprinting in
* directions other than forward, which is picken up by more "advanced" anticheats like AAC, but not NCP.
*/
public Setting<Boolean> antiCheatCompatibility = new Setting<>(true);
public final Setting<Boolean> antiCheatCompatibility = new Setting<>(true);
/**
* Exclusively use cached chunks for pathing
* <p>
* Never turn this on
*/
public Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
public final Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
/**
* Continue sprinting while in water
*/
public final Setting<Boolean> sprintInWater = new Setting<>(true);
/**
* When GetToBlockProcess or MineProcess fails to calculate a path, instead of just giving up, mark the closest instance
* of that block as "unreachable" and go towards the next closest. GetToBlock expands this seaarch to the whole "vein"; MineProcess does not.
* This is because MineProcess finds individual impossible blocks (like one block in a vein that has gravel on top then lava, so it can't break)
* Whereas GetToBlock should blacklist the whole "vein" if it can't get to any of them.
*/
public final Setting<Boolean> blacklistClosestOnFailure = new Setting<>(true);
/**
* 😎 Render cached chunks as semitransparent. Doesn't work with OptiFine 😭 Rarely randomly crashes, see <a href="https://github.com/cabaletta/baritone/issues/327">this issue</a>.
* <p>
* Can be very useful on servers with low render distance. After enabling, you may need to reload the world in order for it to have an effect
* (e.g. disconnect and reconnect, enter then exit the nether, die and respawn, etc). This may literally kill your FPS and CPU because
* every chunk gets recompiled twice as much as normal, since the cached version comes into range, then the normal one comes from the server for real.
* <p>
* Note that flowing water is cached as AVOID, which is rendered as lava. As you get closer, you may therefore see lava falls being replaced with water falls.
* <p>
* SOLID is rendered as stone in the overworld, netherrack in the nether, and end stone in the end
*/
public final Setting<Boolean> renderCachedChunks = new Setting<>(false);
/**
* 0.0f = not visible, fully transparent (instead of setting this to 0, turn off renderCachedChunks)
* 1.0f = fully opaque
*/
public final Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
/**
* Whether or not to use the "#" command prefix
*/
public Setting<Boolean> prefix = new Setting<>(false);
/**
* {@code true}: can mine blocks when in inventory, chat, or tabbed away in ESC menu
* <p>
* {@code false}: works on cosmic prisons
* <p>
* LOL
*/
public Setting<Boolean> leftClickWorkaround = new Setting<>(true);
public final Setting<Boolean> prefixControl = new Setting<>(true);
/**
* Don't stop walking forward when you need to break blocks in your way
*/
public Setting<Boolean> walkWhileBreaking = new Setting<>(true);
public final Setting<Boolean> walkWhileBreaking = new Setting<>(true);
/**
* When a new segment is calculated that doesn't overlap with the current one, but simply begins where the current segment ends,
* splice it on and make a longer combined path. If this setting is off, any planned segment will not be spliced and will instead
* be the "next path" in PathingBehavior, and will only start after this one ends. Turning this off hurts planning ahead,
* because the next segment will exist even if it's very short.
*
* @see #planningTickLookahead
*/
public final Setting<Boolean> splicePath = new Setting<>(true);
/**
* If we are more than 300 movements into the current path, discard the oldest segments, as they are no longer useful
*/
public final Setting<Integer> maxPathHistoryLength = new Setting<>(300);
/**
* If the current path is too long, cut off this many movements from the beginning.
*/
public final Setting<Integer> pathHistoryCutoffAmount = new Setting<>(50);
/**
* Rescan for the goal once every 5 ticks.
* Set to 0 to disable.
*/
public Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
public final Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
/**
* After finding this many instances of the target block in the cache, it will stop expanding outward the chunk search.
*/
public final Setting<Integer> maxCachedWorldScanCount = new Setting<>(10);
/**
* When GetToBlock doesn't know any locations for the desired block, explore randomly instead of giving up.
*/
public final Setting<Boolean> exploreForBlocks = new Setting<>(true);
/**
* While exploring the world, offset the closest unloaded chunk by this much in both axes.
* <p>
* This can result in more efficient loading, if you set this to the render distance.
*/
public final Setting<Integer> worldExploringChunkOffset = new Setting<>(0);
/**
* Take the 10 closest chunks, even if they aren't strictly tied for distance metric from origin.
*/
public final Setting<Integer> exploreChunkSetMinimumSize = new Setting<>(10);
/**
* Attempt to maintain Y coordinate while exploring
* <p>
* -1 to disable
*/
public final Setting<Integer> exploreMaintainY = new Setting<>(64);
/**
* Replant nether wart while farming
*/
public final Setting<Boolean> replantNetherWart = new Setting<>(false);
/**
* When the cache scan gives less blocks than the maximum threshold (but still above zero), scan the main world too.
* <p>
* Only if you have a beefy CPU and automatically mine blocks that are in cache
*/
public final Setting<Boolean> extendCacheOnThreshold = new Setting<>(false);
/**
* Don't consider the next layer in builder until the current one is done
*/
public final Setting<Boolean> buildInLayers = new Setting<>(false);
/**
* false = build from bottom to top
* <p>
* true = build from top to bottom
*/
public final Setting<Boolean> layerOrder = 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
*/
public final Setting<Vec3i> buildRepeat = new Setting<>(new Vec3i(0, 0, 0));
/**
* Allow standing above a block while mining it, in BuilderProcess
* <p>
* Experimental
*/
public final Setting<Boolean> breakFromAbove = new Setting<>(false);
/**
* As well as breaking from above, set a goal to up and to the side of all blocks to break.
* <p>
* Never turn this on without also turning on breakFromAbove.
*/
public final Setting<Boolean> goalBreakFromAbove = new Setting<>(false);
/**
* While mining, should it also consider dropped items of the correct type as a pathing destination (as well as ore blocks)?
*/
public final Setting<Boolean> mineScanDroppedItems = new Setting<>(true);
/**
* Cancel the current path if the goal has changed, and the path originally ended in the goal but doesn't anymore.
@@ -389,42 +712,78 @@ public class Settings {
* <p>
* Also on cosmic prisons this should be set to true since you don't actually mine the ore it just gets replaced with stone.
*/
public Setting<Boolean> cancelOnGoalInvalidation = new Setting<>(false);
public final Setting<Boolean> cancelOnGoalInvalidation = new Setting<>(true);
/**
* The "axis" command (aka GoalAxis) will go to a axis, or diagonal axis, at this Y level.
*/
public Setting<Integer> axisHeight = new Setting<>(120);
public final Setting<Integer> axisHeight = new Setting<>(120);
/**
* Disconnect from the server upon arriving at your goal
*/
public final Setting<Boolean> disconnectOnArrival = new Setting<>(false);
/**
* Disallow MineBehavior from using X-Ray to see where the ores are. Turn this option on to force it to mine "legit"
* where it will only mine an ore once it can actually see it, so it won't do or know anything that a normal player
* couldn't. If you don't want it to look like you're X-Raying, turn this on
*/
public final Setting<Boolean> legitMine = new Setting<>(false);
/**
* What Y level to go to for legit strip mining
*/
public final Setting<Integer> legitMineYLevel = new Setting<>(11);
/**
* Magically see ores that are separated diagonally from existing ores. Basically like mining around the ores that it finds
* in case there's one there touching it diagonally, except it checks it un-legit-ly without having the mine blocks to see it.
* You can decide whether this looks plausible or not.
* <p>
* This is disabled because it results in some weird behavior. For example, it can """see""" the top block of a vein of iron_ore
* through a lava lake. This isn't an issue normally since it won't consider anything touching lava, so it just ignores it.
* However, this setting expands that and allows it to see the entire vein so it'll mine under the lava lake to get the iron that
* it can reach without mining blocks adjacent to lava. This really defeats the purpose of legitMine since a player could never
* do that lol, so thats one reason why its disabled
*/
public final Setting<Boolean> legitMineIncludeDiagonals = new Setting<>(false);
/**
* When mining block of a certain type, try to mine two at once instead of one.
* If the block above is also a goal block, set GoalBlock instead of GoalTwoBlocks
* If the block below is also a goal block, set GoalBlock to the position one down instead of GoalTwoBlocks
*/
public Setting<Boolean> forceInternalMining = new Setting<>(true);
public final Setting<Boolean> forceInternalMining = new Setting<>(true);
/**
* Modification to the previous setting, only has effect if forceInternalMining is true
* If true, only apply the previous setting if the block adjacent to the goal isn't air.
*/
public Setting<Boolean> internalMiningAirException = new Setting<>(true);
public final Setting<Boolean> internalMiningAirException = new Setting<>(true);
/**
* The actual GoalNear is set this distance away from the entity you're following
* <p>
* For example, set followOffsetDistance to 5 and followRadius to 0 to always stay precisely 5 blocks north of your follow target.
*/
public Setting<Double> followOffsetDistance = new Setting<>(0D);
public final Setting<Double> followOffsetDistance = new Setting<>(0D);
/**
* The actual GoalNear is set in this direction from the entity you're following
* The actual GoalNear is set in this direction from the entity you're following. This value is in degrees.
*/
public Setting<Float> followOffsetDirection = new Setting<>(0F);
public final Setting<Float> followOffsetDirection = new Setting<>(0F);
/**
* The radius (for the GoalNear) of how close to your target position you actually have to be
*/
public Setting<Integer> followRadius = new Setting<>(3);
public final Setting<Integer> followRadius = new Setting<>(3);
/**
* Turn this on if your exploration filter is enormous, you don't want it to check if it's done,
* and you are just fine with it just hanging on completion
*/
public final Setting<Boolean> disableCompletionCheck = new Setting<>(false);
/**
* Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds
@@ -446,54 +805,60 @@ public class Settings {
* has to build up that cache from scratch. But after it's gone through an area just once, the next time will have zero
* backtracking, since the entire area is now known and cached.
*/
public Setting<Long> cachedChunksExpirySeconds = new Setting<>(-1L);
public final Setting<Long> cachedChunksExpirySeconds = new Setting<>(-1L);
/**
* The function that is called when Baritone will log to chat. This function can be added to
* via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting
* {@link Setting#value};
*/
public Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
public final Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getInstance().ingameGUI.getChatGUI()::printChatMessage);
/**
* The size of the box that is rendered when the current goal is a GoalYLevel
*/
public final Setting<Double> yLevelBoxSize = new Setting<>(15D);
/**
* The color of the current path
*/
public Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
public final Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
/**
* The color of the next path
*/
public Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
public final Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
/**
* The color of the blocks to break
*/
public Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
public final Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
/**
* The color of the blocks to place
*/
public Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
public final Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
/**
* The color of the blocks to walk into
*/
public Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
public final Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
/**
* The color of the best path so far
*/
public Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
public final Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
/**
* The color of the path to the most recent considered node
*/
public Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
public final Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
/**
* The color of the goal box
*/
public Setting<Color> colorGoalBox = new Setting<>(Color.GREEN);
public final Setting<Color> colorGoalBox = new Setting<>(Color.GREEN);
/**
* A map of lowercase setting field names to their respective setting
@@ -505,11 +870,12 @@ public class Settings {
*/
public final List<Setting<?>> allSettings;
public class Setting<T> {
public final Map<Setting<?>, Type> settingTypes;
public final class Setting<T> {
public T value;
public final T defaultValue;
private String name;
private final Class<T> klass;
@SuppressWarnings("unchecked")
private Setting(T value) {
@@ -518,12 +884,16 @@ public class Settings {
}
this.value = value;
this.defaultValue = value;
this.klass = (Class<T>) value.getClass();
}
@SuppressWarnings("unchecked")
public final <K extends T> K get() {
return (K) value;
/**
* Deprecated! Please use .value directly instead
*
* @return the current setting value
*/
@Deprecated
public final T get() {
return value;
}
public final String getName() {
@@ -531,11 +901,24 @@ public class Settings {
}
public Class<T> getValueClass() {
return klass;
// noinspection unchecked
return (Class<T>) TypeUtils.resolveBaseClass(getType());
}
@Override
public String toString() {
return name + ": " + value;
return SettingsUtil.settingToString(this);
}
/**
* Reset this setting to its default value
*/
public void reset() {
value = defaultValue;
}
public final Type getType() {
return settingTypes.get(this);
}
}
@@ -543,8 +926,11 @@ public class Settings {
Settings() {
Field[] temp = getClass().getFields();
HashMap<String, Setting<?>> tmpByName = new HashMap<>();
Map<String, Setting<?>> tmpByName = new HashMap<>();
List<Setting<?>> tmpAll = new ArrayList<>();
Map<Setting<?>, Type> tmpSettingTypes = new HashMap<>();
try {
for (Field field : temp) {
if (field.getType().equals(Setting.class)) {
@@ -557,6 +943,7 @@ public class Settings {
}
tmpByName.put(name, setting);
tmpAll.add(setting);
tmpSettingTypes.put(setting, ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]);
}
}
} catch (IllegalAccessException e) {
@@ -564,6 +951,7 @@ public class Settings {
}
byLowerName = Collections.unmodifiableMap(tmpByName);
allSettings = Collections.unmodifiableList(tmpAll);
settingTypes = Collections.unmodifiableMap(tmpSettingTypes);
}
@SuppressWarnings("unchecked")

View File

@@ -18,10 +18,13 @@
package baritone.api.behavior;
import baritone.api.event.listener.AbstractGameEventListener;
import baritone.api.utils.interfaces.Toggleable;
import baritone.api.event.listener.IGameEventListener;
/**
* A behavior is simply a type that is able to listen to events.
*
* @author Brady
* @see IGameEventListener
* @since 9/23/2018
*/
public interface IBehavior extends AbstractGameEventListener, Toggleable {}
public interface IBehavior extends AbstractGameEventListener {}

View File

@@ -33,7 +33,7 @@ public interface ILookBehavior extends IBehavior {
* otherwise, it should be {@code false};
*
* @param rotation The target rotations
* @param force Whether or not to "force" the rotations
* @param force Whether or not to "force" the rotations
*/
void updateTarget(Rotation rotation, boolean force);
}

View File

@@ -17,9 +17,9 @@
package baritone.api.behavior;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.calc.IPathFinder;
import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.path.IPathExecutor;
import java.util.Optional;
@@ -37,37 +37,55 @@ public interface IPathingBehavior extends IBehavior {
*
* @return The estimated remaining ticks in the current segment.
*/
Optional<Double> ticksRemainingInSegment();
default Optional<Double> ticksRemainingInSegment() {
return ticksRemainingInSegment(true);
}
/**
* Sets the pathing goal.
* Returns the estimated remaining ticks in the current pathing
* segment. Given that the return type is an optional, {@link Optional#empty()}
* will be returned in the case that there is no current segment being pathed.
*
* @param goal The pathing goal
* @param includeCurrentMovement whether or not to include the entirety of the cost of the currently executing movement in the total
* @return The estimated remaining ticks in the current segment.
*/
void setGoal(Goal goal);
default Optional<Double> ticksRemainingInSegment(boolean includeCurrentMovement) {
IPathExecutor current = getCurrent();
if (current == null) {
return Optional.empty();
}
int start = includeCurrentMovement ? current.getPosition() : current.getPosition() + 1;
return Optional.of(current.getPath().ticksRemainingFrom(start));
}
/**
* @return The current pathing goal
*/
Goal getGoal();
/**
* Begins pathing. Calculation will start in a new thread, and once completed,
* movement will commence. Returns whether or not the operation was successful.
*
* @return Whether or not the operation was successful
*/
boolean path();
/**
* @return Whether or not a path is currently being executed.
*/
boolean isPathing();
default boolean isPathing() {
return getCurrent() != null;
}
/**
* Cancels the pathing behavior or the current path calculation.
* Cancels the pathing behavior or the current path calculation, and all processes that could be controlling path.
* <p>
* Basically, "MAKE IT STOP".
*
* @return Whether or not the pathing behavior was canceled. All processes are guaranteed to be canceled, but the
* PathingBehavior might be in the middle of an uncancelable action like a parkour jump
*/
void cancel();
boolean cancelEverything();
/**
* PLEASE never call this
* <p>
* If cancelEverything was like "kill" this is "sudo kill -9". Or shutting off your computer.
*/
void forceCancel();
/**
* Returns the current path, from the current path executor, if there is one.
@@ -81,7 +99,7 @@ public interface IPathingBehavior extends IBehavior {
/**
* @return The current path finder being executed
*/
Optional<IPathFinder> getPathFinder();
Optional<? extends IPathFinder> getInProgress();
/**
* @return The current path executor

View File

@@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos;
/**
* @author Brady
* @since 8/4/2018 2:01 AM
* @since 8/4/2018
*/
public interface IBlockTypeAccess {

View File

@@ -29,21 +29,20 @@ public interface ICachedRegion extends IBlockTypeAccess {
* however, the block coordinates should in on a scale from 0 to 511 (inclusive)
* because region sizes are 512x512 blocks.
*
* @see ICachedWorld#isCached(int, int)
*
* @param blockX The block X coordinate
* @param blockZ The block Z coordinate
* @return Whether or not the specified XZ location is cached
* @see ICachedWorld#isCached(int, int)
*/
boolean isCached(int blockX, int blockZ);
/**
* The X coordinate of this region
* @return The X coordinate of this region
*/
int getX();
/**
* The Z coordinate of this region
* @return The Z coordinate of this region
*/
int getZ();
}

View File

@@ -20,7 +20,7 @@ package baritone.api.cache;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
import java.util.LinkedList;
import java.util.ArrayList;
/**
* @author Brady
@@ -61,12 +61,14 @@ public interface ICachedWorld {
* information that is returned by this method may not be up to date, because
* older cached chunks can contain data that is much more likely to have changed.
*
* @param block The special block to search for
* @param maximum The maximum number of position results to receive
* @param block The special block to search for
* @param maximum The maximum number of position results to receive
* @param centerX The x block coordinate center of the search
* @param centerZ The z block coordinate center of the search
* @param maxRegionDistanceSq The maximum region distance, squared
* @return The locations found that match the special block
*/
LinkedList<BlockPos> getLocationsOf(String block, int maximum, int maxRegionDistanceSq);
ArrayList<BlockPos> getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq);
/**
* Reloads all of the cached regions in this world from disk. Anything that is not saved
@@ -79,4 +81,6 @@ public interface ICachedWorld {
* in a new thread by default.
*/
void save();
}

View File

@@ -15,9 +15,8 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.behavior;
package baritone.api.cache;
import baritone.api.behavior.memory.IRememberedInventory;
import net.minecraft.util.math.BlockPos;
import java.util.Map;
@@ -26,7 +25,7 @@ import java.util.Map;
* @author Brady
* @since 9/23/2018
*/
public interface IMemoryBehavior extends IBehavior {
public interface IContainerMemory {
/**
* Gets a remembered inventory by its block position.

View File

@@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.behavior.memory;
package baritone.api.cache;
import net.minecraft.item.ItemStack;

View File

@@ -50,19 +50,17 @@ public interface IWaypointCollection {
/**
* Gets all of the waypoints that have the specified tag
*
* @see IWaypointCollection#getAllWaypoints()
*
* @param tag The tag
* @return All of the waypoints with the specified tag
* @see IWaypointCollection#getAllWaypoints()
*/
Set<IWaypoint> getByTag(IWaypoint.Tag tag);
/**
* Gets all of the waypoints in this collection, regardless of the tag.
*
* @see IWaypointCollection#getByTag(IWaypoint.Tag)
*
* @return All of the waypoints in this collection
* @see IWaypointCollection#getByTag(IWaypoint.Tag)
*/
Set<IWaypoint> getAllWaypoints();
}

View File

@@ -27,13 +27,19 @@ public interface IWorldData {
* Returns the cached world for this world. A cached world is a simplified format
* of a regular world, intended for use on multiplayer servers where chunks are not
* traditionally stored to disk, allowing for long distance pathing with minimal disk usage.
*
* @return The cached world for this world
*/
ICachedWorld getCachedWorld();
/**
* Returns the waypoint collection for this world.
*
* @return The waypoint collection for this world
*/
IWaypointCollection getWaypoints();
/**
* @return The {@link IContainerMemory} instance
* @see IContainerMemory
*/
IContainerMemory getContainerMemory();
}

View File

@@ -17,8 +17,10 @@
package baritone.api.cache;
import baritone.api.utils.IPlayerContext;
import net.minecraft.block.Block;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import java.util.List;
@@ -31,6 +33,8 @@ public interface IWorldScanner {
/**
* Scans the world, up to the specified max chunk radius, for the specified blocks.
*
* @param ctx The {@link IPlayerContext} containing player and world info that the
* scan is based upon
* @param blocks The blocks to scan for
* @param max The maximum number of blocks to scan before cutoff
* @param yLevelThreshold If a block is found within this Y level, the current result will be
@@ -38,5 +42,19 @@ public interface IWorldScanner {
* @param maxSearchRadius The maximum chunk search radius
* @return The matching block positions
*/
List<BlockPos> scanChunkRadius(List<Block> blocks, int max, int yLevelThreshold, int maxSearchRadius);
List<BlockPos> scanChunkRadius(IPlayerContext ctx, List<Block> blocks, int max, int yLevelThreshold, int maxSearchRadius);
/**
* Scans a single chunk for the specified blocks.
*
* @param ctx The {@link IPlayerContext} containing player and world info that the
* scan is based upon
* @param blocks The blocks to scan for
* @param pos The position of the target chunk
* @param max The maximum number of blocks to scan before cutoff
* @param yLevelThreshold If a block is found within this Y level, the current result will be
* returned, if the value is negative, then this condition doesn't apply.
* @return The matching block positions
*/
List<BlockPos> scanChunk(IPlayerContext ctx, List<Block> blocks, ChunkPos pos, int max, int yLevelThreshold);
}

View File

@@ -15,9 +15,8 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.cache;
package baritone.api.cache;
import baritone.api.cache.IWaypoint;
import net.minecraft.util.math.BlockPos;
import java.util.Date;
@@ -42,12 +41,12 @@ public class Waypoint implements IWaypoint {
* Constructor called when a Waypoint is read from disk, adds the creationTimestamp
* as a parameter so that it is reserved after a waypoint is wrote to the disk.
*
* @param name The waypoint name
* @param tag The waypoint tag
* @param location The waypoint location
* @param name The waypoint name
* @param tag The waypoint tag
* @param location The waypoint location
* @param creationTimestamp When the waypoint was created
*/
Waypoint(String name, Tag tag, BlockPos location, long creationTimestamp) {
public Waypoint(String name, Tag tag, BlockPos location, long creationTimestamp) {
this.name = name;
this.tag = tag;
this.location = location;

View File

@@ -20,7 +20,7 @@ package baritone.api.event.events;
import net.minecraft.util.math.BlockPos;
/**
* Called when the local player interacts with a block, can be either {@link Type#BREAK} or {@link Type#USE}.
* Called when the local player interacts with a block, can be either {@link Type#START_BREAK} or {@link Type#USE}.
*
* @author Brady
* @since 8/22/2018
@@ -59,9 +59,9 @@ public final class BlockInteractEvent {
public enum Type {
/**
* We're breaking the target block.
* We're starting to break the target block.
*/
BREAK,
START_BREAK,
/**
* We're right clicking on the target block. Either placing or interacting with.

View File

@@ -17,22 +17,20 @@
package baritone.api.event.events;
import baritone.api.event.events.type.ManagedPlayerEvent;
import net.minecraft.client.entity.EntityPlayerSP;
import baritone.api.event.events.type.Cancellable;
/**
* @author Brady
* @since 8/1/2018 6:39 PM
* @since 8/1/2018
*/
public final class ChatEvent extends ManagedPlayerEvent.Cancellable {
public final class ChatEvent extends Cancellable {
/**
* The message being sent
*/
private final String message;
public ChatEvent(EntityPlayerSP player, String message) {
super(player);
public ChatEvent(String message) {
this.message = message;
}

View File

@@ -21,7 +21,7 @@ import baritone.api.event.events.type.EventState;
/**
* @author Brady
* @since 8/2/2018 12:32 AM
* @since 8/2/2018
*/
public final class ChunkEvent {
@@ -31,7 +31,9 @@ public final class ChunkEvent {
private final EventState state;
/**
* The type of chunk event that occurred;
* The type of chunk event that occurred
*
* @see Type
*/
private final Type type;
@@ -94,7 +96,16 @@ public final class ChunkEvent {
/**
* When the chunk is being populated with blocks, tile entities, etc.
* <p>
* And it's a full chunk
*/
POPULATE
POPULATE_FULL,
/**
* When the chunk is being populated with blocks, tile entities, etc.
* <p>
* And it's a partial chunk
*/
POPULATE_PARTIAL
}
}

View File

@@ -23,7 +23,7 @@ import net.minecraft.network.Packet;
/**
* @author Brady
* @since 8/6/2018 9:31 PM
* @since 8/6/2018
*/
public final class PacketEvent {

View File

@@ -18,22 +18,19 @@
package baritone.api.event.events;
import baritone.api.event.events.type.EventState;
import baritone.api.event.events.type.ManagedPlayerEvent;
import net.minecraft.client.entity.EntityPlayerSP;
/**
* @author Brady
* @since 8/21/2018
*/
public final class PlayerUpdateEvent extends ManagedPlayerEvent {
public final class PlayerUpdateEvent {
/**
* The state of the event
*/
private final EventState state;
public PlayerUpdateEvent(EntityPlayerSP player, EventState state) {
super(player);
public PlayerUpdateEvent(EventState state) {
this.state = state;
}

View File

@@ -19,7 +19,7 @@ package baritone.api.event.events;
/**
* @author Brady
* @since 8/5/2018 12:28 AM
* @since 8/5/2018
*/
public final class RenderEvent {

View File

@@ -17,9 +17,6 @@
package baritone.api.event.events;
import baritone.api.event.events.type.EventState;
import baritone.api.event.events.type.ManagedPlayerEvent;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -27,7 +24,7 @@ import net.minecraft.entity.EntityLivingBase;
* @author Brady
* @since 8/21/2018
*/
public final class RotationMoveEvent extends ManagedPlayerEvent {
public final class RotationMoveEvent {
/**
* The type of event
@@ -35,21 +32,29 @@ public final class RotationMoveEvent extends ManagedPlayerEvent {
private final Type type;
/**
* The state of the event
* The yaw rotation
*/
private final EventState state;
private float yaw;
public RotationMoveEvent(EntityPlayerSP player, EventState state, Type type) {
super(player);
this.state = state;
public RotationMoveEvent(Type type, float yaw) {
this.type = type;
this.yaw = yaw;
}
/**
* @return The state of the event
* Set the yaw movement rotation
*
* @param yaw Yaw rotation
*/
public final EventState getState() {
return this.state;
public final void setYaw(float yaw) {
this.yaw = yaw;
}
/**
* @return The yaw rotation
*/
public final float getYaw() {
return this.yaw;
}
/**

View File

@@ -0,0 +1,35 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.event.events;
/**
* @author Brady
* @since 1/18/2019
*/
public final class SprintStateEvent {
private Boolean state;
public final void setState(boolean state) {
this.state = state;
}
public final Boolean getState() {
return this.state;
}
}

View File

@@ -22,7 +22,7 @@ import net.minecraft.client.multiplayer.WorldClient;
/**
* @author Brady
* @since 8/4/2018 3:13 AM
* @since 8/4/2018
*/
public final class WorldEvent {

View File

@@ -19,7 +19,7 @@ package baritone.api.event.events.type;
/**
* @author Brady
* @since 8/1/2018 6:41 PM
* @since 8/1/2018
*/
public class Cancellable implements ICancellable {

View File

@@ -19,19 +19,17 @@ package baritone.api.event.events.type;
/**
* @author Brady
* @since 8/2/2018 12:34 AM
* @since 8/2/2018
*/
public enum EventState {
/**
* Indicates that whatever movement the event is being
* dispatched as a result of is about to occur.
* Before the dispatching of what the event is targetting
*/
PRE,
/**
* Indicates that whatever movement the event is being
* dispatched as a result of has already occurred.
* After the dispatching of what the event is targetting
*/
POST
}

View File

@@ -1,61 +0,0 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.event.events.type;
import net.minecraft.client.entity.EntityPlayerSP;
/**
* An event that has a reference to a locally managed player.
*
* @author Brady
* @since 10/11/2018
*/
public class ManagedPlayerEvent {
protected final EntityPlayerSP player;
public ManagedPlayerEvent(EntityPlayerSP player) {
this.player = player;
}
public final EntityPlayerSP getPlayer() {
return this.player;
}
public static class Cancellable extends ManagedPlayerEvent implements ICancellable {
/**
* Whether or not this event has been cancelled
*/
private boolean cancelled;
public Cancellable(EntityPlayerSP player) {
super(player);
}
@Override
public final void cancel() {
this.cancelled = true;
}
@Override
public final boolean isCancelled() {
return this.cancelled;
}
}
}

View File

@@ -26,7 +26,7 @@ import baritone.api.event.events.*;
*
* @author Brady
* @see IGameEventListener
* @since 8/1/2018 6:29 PM
* @since 8/1/2018
*/
public interface AbstractGameEventListener extends IGameEventListener {
@@ -36,9 +36,6 @@ public interface AbstractGameEventListener extends IGameEventListener {
@Override
default void onPlayerUpdate(PlayerUpdateEvent event) {}
@Override
default void onProcessKeyBinds() {}
@Override
default void onSendChatMessage(ChatEvent event) {}
@@ -60,6 +57,9 @@ public interface AbstractGameEventListener extends IGameEventListener {
@Override
default void onPlayerRotationMove(RotationMoveEvent event) {}
@Override
default void onPlayerSprintState(SprintStateEvent event) {}
@Override
default void onBlockInteract(BlockInteractEvent event) {}

View File

@@ -0,0 +1,36 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.event.listener;
/**
* A type of {@link IGameEventListener} that can have additional listeners
* registered so that they receive the events that are dispatched to this
* listener.
*
* @author Brady
* @since 11/14/2018
*/
public interface IEventBus extends IGameEventListener {
/**
* Registers the specified {@link IGameEventListener} to this event bus
*
* @param listener The listener
*/
void registerEventListener(IGameEventListener listener);
}

View File

@@ -18,28 +18,24 @@
package baritone.api.event.listener;
import baritone.api.event.events.*;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiGameOver;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.util.text.ITextComponent;
/**
* @author Brady
* @since 7/31/2018 11:05 PM
* @since 7/31/2018
*/
public interface IGameEventListener {
/**
* Run once per game tick before screen input is handled.
*
* @param event The event
* @see Minecraft#runTick()
*/
void onTick(TickEvent event);
@@ -47,20 +43,15 @@ public interface IGameEventListener {
/**
* Run once per game tick from before and after the player rotation is sent to the server.
*
* @see EntityPlayerSP#onUpdate()
* @param event The event
* @see EntityPlayerSP#tick()
*/
void onPlayerUpdate(PlayerUpdateEvent event);
/**
* Run once per game tick from before keybinds are processed.
*
* @see Minecraft#processKeyBinds()
*/
void onProcessKeyBinds();
/**
* Runs whenever the client player sends a message to the server.
*
* @param event The event
* @see EntityPlayerSP#sendChatMessage(String)
*/
void onSendChatMessage(ChatEvent event);
@@ -68,41 +59,38 @@ public interface IGameEventListener {
/**
* Runs before and after whenever a chunk is either loaded, unloaded, or populated.
*
* @see WorldClient#doPreChunk(int, int, boolean)
* @param event The event
*/
void onChunkEvent(ChunkEvent event);
/**
* Runs once per world render pass. Two passes are made when {@link GameSettings#anaglyph} is on.
* <p>
* <b>Note:</b> {@link GameSettings#anaglyph} has been removed in Minecraft 1.13
* Runs once per world render pass.
*
* @see EntityRenderer#renderWorldPass(int, float, long)
* @param event The event
*/
void onRenderPass(RenderEvent event);
/**
* Runs before and after whenever a new world is loaded
*
* @see Minecraft#loadWorld(WorldClient, String)
* @param event The event
* @see Minecraft#loadWorld(WorldClient, GuiScreen)
*/
void onWorldEvent(WorldEvent event);
/**
* Runs before a outbound packet is sent
*
* @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
* @param event The event
* @see Packet
* @see GenericFutureListener
*/
void onSendPacket(PacketEvent event);
/**
* Runs before an inbound packet is processed
*
* @see NetworkManager#dispatchPacket(Packet, GenericFutureListener[])
* @param event The event
* @see Packet
* @see GenericFutureListener
*/
void onReceivePacket(PacketEvent event);
@@ -110,31 +98,37 @@ public interface IGameEventListener {
* Run once per game tick from before and after the player's moveRelative method is called
* and before and after the player jumps.
*
* @param event The event
* @see Entity#moveRelative(float, float, float, float)
* @see EntityLivingBase#jump()
*/
void onPlayerRotationMove(RotationMoveEvent event);
/**
* Called whenever the sprint keybind state is checked in {@link EntityPlayerSP#livingTick}
*
* @param event The event
* @see EntityPlayerSP#livingTick()
*/
void onPlayerSprintState(SprintStateEvent event);
/**
* Called when the local player interacts with a block, whether it is breaking or opening/placing.
*
* @see Minecraft#clickMouse()
* @see Minecraft#rightClickMouse()
* @param event The event
*/
void onBlockInteract(BlockInteractEvent event);
/**
* Called when the local player dies, as indicated by the creation of the {@link GuiGameOver} screen.
*
* @see GuiGameOver(ITextComponent)
* @see ITextComponent
* @see GuiGameOver
*/
void onPlayerDeath();
/**
* When the pathfinder's state changes
*
* @param event
* @param event The event
*/
void onPathEvent(PathEvent event);
}

View File

@@ -22,6 +22,7 @@ import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.movement.IMovement;
import baritone.api.utils.BetterBlockPos;
import java.util.HashSet;
import java.util.List;
/**
@@ -50,8 +51,12 @@ public interface IPath {
/**
* This path is actually going to be executed in the world. Do whatever additional processing is required.
* (as opposed to Path objects that are just constructed every frame for rendering)
*
* @return The result of path post processing
*/
default void postProcess() {}
default IPath postProcess() {
throw new UnsupportedOperationException();
}
/**
* Returns the number of positions in this path. Equivalent to {@code positions().size()}.
@@ -105,8 +110,9 @@ public interface IPath {
default double ticksRemainingFrom(int pathPosition) {
double sum = 0;
//this is fast because we aren't requesting recalculation, it's just cached
for (int i = pathPosition; i < movements().size(); i++) {
sum += movements().get(i).getCost();
List<IMovement> movements = movements();
for (int i = pathPosition; i < movements.size(); i++) {
sum += movements.get(i).getCost();
}
return sum;
}
@@ -114,23 +120,60 @@ public interface IPath {
/**
* Cuts off this path at the loaded chunk border, and returns the resulting path. Default
* implementation just returns this path, without the intended functionality.
* <p>
* The argument is supposed to be a BlockStateInterface LOL LOL LOL LOL LOL
*
* @param bsi The block state lookup, highly cursed
* @return The result of this cut-off operation
*/
default IPath cutoffAtLoadedChunks() {
return this;
default IPath cutoffAtLoadedChunks(Object bsi) {
throw new UnsupportedOperationException();
}
/**
* Cuts off this path using the min length and cutoff factor settings, and returns the resulting path.
* Default implementation just returns this path, without the intended functionality.
*
* @param destination The end goal of this path
* @return The result of this cut-off operation
* @see Settings#pathCutoffMinimumLength
* @see Settings#pathCutoffFactor
*
* @return The result of this cut-off operation
*/
default IPath staticCutoff(Goal destination) {
return this;
throw new UnsupportedOperationException();
}
/**
* Performs a series of checks to ensure that the assembly of the path went as expected.
*/
default void sanityCheck() {
List<BetterBlockPos> path = positions();
List<IMovement> movements = movements();
if (!getSrc().equals(path.get(0))) {
throw new IllegalStateException("Start node does not equal first path element");
}
if (!getDest().equals(path.get(path.size() - 1))) {
throw new IllegalStateException("End node does not equal last path element");
}
if (path.size() != movements.size() + 1) {
throw new IllegalStateException("Size of path array is unexpected");
}
HashSet<BetterBlockPos> seenSoFar = new HashSet<>();
for (int i = 0; i < path.size() - 1; i++) {
BetterBlockPos src = path.get(i);
BetterBlockPos dest = path.get(i + 1);
IMovement movement = movements.get(i);
if (!src.equals(movement.getSrc())) {
throw new IllegalStateException("Path source is not equal to the movement source");
}
if (!dest.equals(movement.getDest())) {
throw new IllegalStateException("Path destination is not equal to the movement destination");
}
if (seenSoFar.contains(src)) {
throw new IllegalStateException("Path doubles back on itself, making a loop");
}
seenSoFar.add(src);
}
}
}

View File

@@ -18,6 +18,7 @@
package baritone.api.pathing.calc;
import baritone.api.pathing.goals.Goal;
import baritone.api.utils.PathCalculationResult;
import java.util.Optional;
@@ -33,9 +34,11 @@ public interface IPathFinder {
/**
* Calculate the path in full. Will take several seconds.
*
* @param primaryTimeout If a path is found, the path finder will stop after this amount of time
* @param failureTimeout If a path isn't found, the path finder will continue for this amount of time
* @return The final path
*/
Optional<IPath> calculate(long timeout);
PathCalculationResult calculate(long primaryTimeout, long failureTimeout);
/**
* Intended to be called concurrently with calculatePath from a different thread to tell if it's finished yet

View File

@@ -0,0 +1,47 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.pathing.calc;
import baritone.api.process.IBaritoneProcess;
import baritone.api.process.PathingCommand;
import java.util.Optional;
/**
* @author leijurv
*/
public interface IPathingControlManager {
/**
* Registers a process with this pathing control manager. See {@link IBaritoneProcess} for more details.
*
* @param process The process
* @see IBaritoneProcess
*/
void registerProcess(IBaritoneProcess process);
/**
* @return The most recent {@link IBaritoneProcess} that had control
*/
Optional<IBaritoneProcess> mostRecentInControl();
/**
* @return The most recent pathing command executed
*/
Optional<PathingCommand> mostRecentCommand();
}

View File

@@ -30,6 +30,9 @@ public interface Goal {
* Returns whether or not the specified position
* meets the requirement for this goal based.
*
* @param x The goal X position
* @param y The goal Y position
* @param z The goal Z position
* @return Whether or not it satisfies this goal
*/
boolean isInGoal(int x, int y, int z);
@@ -37,6 +40,9 @@ public interface Goal {
/**
* Estimate the number of ticks it will take to get to the goal
*
* @param x The goal X position
* @param y The goal Y position
* @param z The goal Z position
* @return The estimate number of ticks to satisfy the goal
*/
double heuristic(int x, int y, int z);

View File

@@ -25,7 +25,7 @@ public class GoalAxis implements Goal {
@Override
public boolean isInGoal(int x, int y, int z) {
return y == BaritoneAPI.getSettings().axisHeight.get() && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
return y == BaritoneAPI.getSettings().axisHeight.value && (x == 0 || z == 0 || Math.abs(x) == Math.abs(z));
}
@Override
@@ -39,7 +39,7 @@ public class GoalAxis implements Goal {
double flatAxisDistance = Math.min(x, Math.min(z, diff * SQRT_2_OVER_2));
return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.get() + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.get(), y);
return flatAxisDistance * BaritoneAPI.getSettings().costHeuristic.value + GoalYLevel.calculate(BaritoneAPI.getSettings().axisHeight.value, y);
}
@Override

View File

@@ -30,17 +30,17 @@ public class GoalBlock implements Goal, IGoalRenderPos {
/**
* The X block position of this goal
*/
private final int x;
public final int x;
/**
* The Y block position of this goal
*/
private final int y;
public final int y;
/**
* The Z block position of this goal
*/
private final int z;
public final int z;
public GoalBlock(BlockPos pos) {
this(pos.getX(), pos.getY(), pos.getZ());

View File

@@ -17,10 +17,7 @@
package baritone.api.pathing.goals;
import net.minecraft.util.math.BlockPos;
import java.util.Arrays;
import java.util.Collection;
/**
* A composite of many goals, any one of which satisfies the composite.
@@ -40,14 +37,6 @@ public class GoalComposite implements Goal {
this.goals = goals;
}
public GoalComposite(BlockPos... blocks) {
this(Arrays.asList(blocks));
}
public GoalComposite(Collection<BlockPos> blocks) {
this(blocks.stream().map(GoalBlock::new).toArray(Goal[]::new));
}
@Override
public boolean isInGoal(int x, int y, int z) {
for (Goal goal : goals) {

View File

@@ -28,9 +28,9 @@ import net.minecraft.util.math.BlockPos;
*/
public class GoalGetToBlock implements Goal, IGoalRenderPos {
private final int x;
private final int y;
private final int z;
public final int x;
public final int y;
public final int z;
public GoalGetToBlock(BlockPos pos) {
this.x = pos.getX();
@@ -48,10 +48,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
if (yDiff < 0) {
yDiff++;
}
return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1;
return Math.abs(xDiff) + Math.abs(yDiff < 0 ? yDiff + 1 : yDiff) + Math.abs(zDiff) <= 1;
}
@Override
@@ -59,7 +56,7 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff);
return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff);
}
@Override

View File

@@ -61,6 +61,6 @@ public class GoalNear implements Goal, IGoalRenderPos {
", y=" + y +
", z=" + z +
", rangeSq=" + rangeSq +
'}';
"}";
}
}

View File

@@ -32,16 +32,26 @@ public class GoalRunAway implements Goal {
private final double distanceSq;
private final Integer maintainY;
public GoalRunAway(double distance, BlockPos... from) {
this(distance, null, from);
}
public GoalRunAway(double distance, Integer maintainY, BlockPos... from) {
if (from.length == 0) {
throw new IllegalArgumentException();
}
this.from = from;
this.distanceSq = distance * distance;
this.maintainY = maintainY;
}
@Override
public boolean isInGoal(int x, int y, int z) {
if (maintainY != null && maintainY != y) {
return false;
}
for (BlockPos p : from) {
int diffX = x - p.getX();
int diffZ = z - p.getZ();
@@ -62,11 +72,19 @@ public class GoalRunAway implements Goal {
min = h;
}
}
return -min;
min = -min;
if (maintainY != null) {
min = min * 0.6 + GoalYLevel.calculate(maintainY, y) * 1.5;
}
return min;
}
@Override
public String toString() {
return "GoalRunAwayFrom" + Arrays.asList(from);
if (maintainY != null) {
return "GoalRunAwayFromMaintainY y=" + maintainY + ", " + Arrays.asList(from);
} else {
return "GoalRunAwayFrom" + Arrays.asList(from);
}
}
}

View File

@@ -0,0 +1,75 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.pathing.goals;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
/**
* Dig a tunnel in a certain direction, but if you have to deviate from the path, go back to where you started
*/
public class GoalStrictDirection implements Goal {
public final int x;
public final int y;
public final int z;
public final int dx;
public final int dz;
public GoalStrictDirection(BlockPos origin, EnumFacing direction) {
x = origin.getX();
y = origin.getY();
z = origin.getZ();
dx = direction.getXOffset();
dz = direction.getZOffset();
if (dx == 0 && dz == 0) {
throw new IllegalArgumentException(direction + "");
}
}
@Override
public boolean isInGoal(int x, int y, int z) {
return false;
}
@Override
public double heuristic(int x, int y, int z) {
int distanceFromStartInDesiredDirection = (x - this.x) * dx + (z - this.z) * dz;
int distanceFromStartInIncorrectDirection = Math.abs((x - this.x) * dz) + Math.abs((z - this.z) * dx);
int verticalDistanceFromStart = Math.abs(y - this.y);
// we want heuristic to decrease as desiredDirection increases
double heuristic = -distanceFromStartInDesiredDirection * 100;
heuristic += distanceFromStartInIncorrectDirection * 1000;
heuristic += verticalDistanceFromStart * 1000;
return heuristic;
}
@Override
public String toString() {
return "GoalStrictDirection{" +
"x=" + x +
", y=" + y +
", z=" + z +
", dx=" + dx +
", dz=" + dz +
"}";
}
}

View File

@@ -31,17 +31,17 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos {
/**
* The X block position of this goal
*/
private final int x;
protected final int x;
/**
* The Y block position of this goal
*/
private final int y;
protected final int y;
/**
* The Z block position of this goal
*/
private final int z;
protected final int z;
public GoalTwoBlocks(BlockPos pos) {
this(pos.getX(), pos.getY(), pos.getZ());
@@ -63,10 +63,7 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
if (yDiff < 0) {
yDiff++;
}
return GoalBlock.calculate(xDiff, yDiff, zDiff);
return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff);
}
@Override

View File

@@ -80,7 +80,7 @@ public class GoalXZ implements Goal {
diagonal = z;
}
diagonal *= SQRT_2;
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.get(); // big TODO tune
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.value; // big TODO tune
}
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {

View File

@@ -29,7 +29,7 @@ public class GoalYLevel implements Goal, ActionCosts {
/**
* The target Y level
*/
private final int level;
public final int level;
public GoalYLevel(int level) {
this.level = level;

View File

@@ -20,8 +20,6 @@ package baritone.api.pathing.movement;
import baritone.api.utils.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
import java.util.List;
/**
* @author Brady
* @since 10/8/2018
@@ -47,10 +45,6 @@ public interface IMovement {
*/
boolean safeToCancel();
double recalculateCost();
double calculateCostWithoutCaching();
boolean calculatedWhileLoaded();
BetterBlockPos getSrc();
@@ -58,10 +52,4 @@ public interface IMovement {
BetterBlockPos getDest();
BlockPos getDirection();
List<BlockPos> toBreak();
List<BlockPos> toPlace();
List<BlockPos> toWalkInto();
}

View File

@@ -26,4 +26,6 @@ import baritone.api.pathing.calc.IPath;
public interface IPathExecutor {
IPath getPath();
int getPosition();
}

View File

@@ -0,0 +1,114 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import baritone.api.behavior.IPathingBehavior;
import baritone.api.event.events.PathEvent;
/**
* A process that can control the PathingBehavior.
* <p>
* Differences between a baritone process and a behavior:
* <ul>
* <li>Only one baritone process can be active at a time</li>
* <li>PathingBehavior can only be controlled by a process</li>
* </ul>
* <p>
* That's it actually
*
* @author leijurv
*/
public interface IBaritoneProcess {
/**
* Default priority. Most normal processes should have this value.
* <p>
* Some examples of processes that should have different values might include some kind of automated mob avoidance
* that would be temporary and would forcefully take control. Same for something that pauses pathing for auto eat, etc.
* <p>
* The value is -1 beacuse that's what Impact 4.5's beta auto walk returns and I want to tie with it.
*/
double DEFAULT_PRIORITY = -1;
/**
* Would this process like to be in control?
*
* @return Whether or not this process would like to be in contorl.
*/
boolean isActive();
/**
* Called when this process is in control of pathing; Returns what Baritone should do.
*
* @param calcFailed {@code true} if this specific process was in control last tick,
* and there was a {@link PathEvent#CALC_FAILED} event last tick
* @param isSafeToCancel {@code true} if a {@link PathingCommandType#REQUEST_PAUSE} would happen this tick, and
* {@link IPathingBehavior} wouldn't actually tick. {@code false} if the PathExecutor reported
* pausing would be unsafe at the end of the last tick. Effectively "could request cancel or
* pause and have it happen right away"
* @return What the {@link IPathingBehavior} should do
*/
PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel);
/**
* Returns whether or not this process should be treated as "temporary".
* <p>
* If a process is temporary, it doesn't call {@link #onLostControl} on the processes that aren't execute because of it.
* <p>
* For example, {@code CombatPauserProcess} and {@code PauseForAutoEatProcess} should return {@code true} always,
* and should return {@link #isActive} {@code true} only if there's something in range this tick, or if the player would like
* to start eating this tick. {@code PauseForAutoEatProcess} should only actually right click once onTick is called with
* {@code isSafeToCancel} true though.
*
* @return Whethor or not if this control is temporary
*/
boolean isTemporary();
/**
* Called if {@link #isActive} returned {@code true}, but another non-temporary
* process has control. Effectively the same as cancel. You want control but you
* don't get it.
*/
void onLostControl();
/**
* Used to determine which Process gains control if multiple are reporting {@link #isActive()}. The one
* that returns the highest value will be given control.
*
* @return A double representing the priority
*/
default double priority() {
return DEFAULT_PRIORITY;
}
/**
* Returns a user-friendly name for this process. Suitable for a HUD.
*
* @return A display name that's suitable for a HUD
*/
default String displayName() {
if (!isActive()) {
// i love it when impcat's scuffed HUD calls displayName for inactive processes for 1 tick too long
// causing NPEs when the displayname relies on fields that become null when inactive
return "INACTIVE";
}
return displayName0();
}
String displayName0();
}

View File

@@ -0,0 +1,62 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import baritone.api.utils.ISchematic;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import java.io.File;
/**
* @author Brady
* @since 1/15/2019
*/
public interface IBuilderProcess extends IBaritoneProcess {
/**
* Requests a build for the specified schematic, labeled as specified, with the specified origin.
*
* @param name A user-friendly name for the schematic
* @param schematic The object representation of the schematic
* @param origin The origin position of the schematic being built
*/
void build(String name, ISchematic schematic, Vec3i origin);
/**
* Requests a build for the specified schematic, labeled as specified, with the specified origin.
*
* @param name A user-friendly name for the schematic
* @param schematic The file path of the schematic
* @param origin The origin position of the schematic being built
* @return Whether or not the schematic was able to load from file
*/
boolean build(String name, File schematic, Vec3i origin);
default boolean build(String schematicFile, BlockPos origin) {
File file = new File(new File(Minecraft.getInstance().gameDir, "schematics"), schematicFile);
return build(schematicFile, file, origin);
}
void pause();
void resume();
void clearArea(BlockPos corner1, BlockPos corner2);
}

View File

@@ -0,0 +1,50 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import baritone.api.pathing.goals.Goal;
public interface ICustomGoalProcess extends IBaritoneProcess {
/**
* Sets the pathing goal
*
* @param goal The new goal
*/
void setGoal(Goal goal);
/**
* Starts path calculation and execution.
*/
void path();
/**
* @return The current goal
*/
Goal getGoal();
/**
* Sets the goal and begins the path execution.
*
* @param goal The new goal
*/
default void setGoalAndPath(Goal goal) {
this.setGoal(goal);
this.path();
}
}

View File

@@ -0,0 +1,26 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import java.nio.file.Path;
public interface IExploreProcess extends IBaritoneProcess {
void explore(int centerX, int centerZ);
void applyJsonFilter(Path path, boolean invert) throws Exception;
}

View File

@@ -15,13 +15,8 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
/**
* @author Brady
* @since 9/23/2018
*/
public class Logger {
package baritone.api.process;
public interface IFarmProcess extends IBaritoneProcess {
void farm();
}

View File

@@ -15,30 +15,37 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.behavior;
package baritone.api.process;
import net.minecraft.entity.Entity;
import java.util.List;
import java.util.function.Predicate;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IFollowBehavior extends IBehavior {
public interface IFollowProcess extends IBaritoneProcess {
/**
* Set the follow target to the specified entity;
* Set the follow target to any entities matching this predicate
*
* @param entity The entity to follow
* @param filter the predicate
*/
void follow(Entity entity);
void follow(Predicate<Entity> filter);
/**
* @return The entity that is currently being followed
* @return The entities that are currently being followed. null if not currently following, empty if nothing matches the predicate
*/
Entity following();
List<Entity> following();
Predicate<Entity> currentFilter();
/**
* Cancels the follow behavior, this will clear the current follow target.
*/
void cancel();
default void cancel() {
onLostControl();
}
}

View File

@@ -0,0 +1,30 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import net.minecraft.block.Block;
/**
* but it rescans the world every once in a while so it doesn't get fooled by its cache
*/
public interface IGetToBlockProcess extends IBaritoneProcess {
void getToBlock(Block block);
boolean blacklistClosest();
}

View File

@@ -15,7 +15,7 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.behavior;
package baritone.api.process;
import net.minecraft.block.Block;
@@ -23,7 +23,7 @@ import net.minecraft.block.Block;
* @author Brady
* @since 9/23/2018
*/
public interface IMineBehavior extends IBehavior {
public interface IMineProcess extends IBaritoneProcess {
/**
* Begin to search for and mine the specified blocks until
@@ -31,9 +31,9 @@ public interface IMineBehavior extends IBehavior {
* are mined. This is based on the first target block to mine.
*
* @param quantity The number of items to get from blocks mined
* @param blocks The blocks to mine
* @param blocks The blocks to mine
*/
void mine(int quantity, String... blocks);
void mineByName(int quantity, String... blocks);
/**
* Begin to search for and mine the specified blocks until
@@ -41,7 +41,7 @@ public interface IMineBehavior extends IBehavior {
* are mined. This is based on the first target block to mine.
*
* @param quantity The number of items to get from blocks mined
* @param blocks The blocks to mine
* @param blocks The blocks to mine
*/
void mine(int quantity, Block... blocks);
@@ -50,8 +50,8 @@ public interface IMineBehavior extends IBehavior {
*
* @param blocks The blocks to mine
*/
default void mine(String... blocks) {
this.mine(0, blocks);
default void mineByName(String... blocks) {
mineByName(0, blocks);
}
/**
@@ -60,11 +60,13 @@ public interface IMineBehavior extends IBehavior {
* @param blocks The blocks to mine
*/
default void mine(Block... blocks) {
this.mine(0, blocks);
mine(0, blocks);
}
/**
* Cancels the current mining task
*/
void cancel();
default void cancel() {
onLostControl();
}
}

View File

@@ -0,0 +1,61 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import baritone.api.pathing.goals.Goal;
import java.util.Objects;
/**
* @author leijurv
*/
public class PathingCommand {
/**
* The target goal, may be {@code null}.
*/
public final Goal goal;
/**
* The command type.
*
* @see PathingCommandType
*/
public final PathingCommandType commandType;
/**
* Create a new {@link PathingCommand}.
*
* @param goal The target goal, may be {@code null}.
* @param commandType The command type, cannot be {@code null}.
* @throws NullPointerException if {@code commandType} is {@code null}.
* @see Goal
* @see PathingCommandType
*/
public PathingCommand(Goal goal, PathingCommandType commandType) {
Objects.requireNonNull(commandType);
this.goal = goal;
this.commandType = commandType;
}
@Override
public String toString() {
return commandType + " " + goal;
}
}

View File

@@ -0,0 +1,60 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import baritone.api.Settings;
public enum PathingCommandType {
/**
* Set the goal and path.
* <p>
* If you use this alongside a {@code null} goal, it will continue along its current path and current goal.
*/
SET_GOAL_AND_PATH,
/**
* Has no effect on the current goal or path, just requests a pause
*/
REQUEST_PAUSE,
/**
* Set the goal (regardless of {@code null}), and request a cancel of the current path (when safe)
*/
CANCEL_AND_SET_GOAL,
/**
* Set the goal and path.
* <p>
* If {@link Settings#cancelOnGoalInvalidation} is {@code true}, revalidate the
* current goal, and cancel if it's no longer valid, or if the new goal is {@code null}.
*/
REVALIDATE_GOAL_AND_PATH,
/**
* Set the goal and path.
* <p>
* Cancel the current path if the goals are not equal
*/
FORCE_REVALIDATE_GOAL_AND_PATH,
/**
* Go and ask the next process what to do
*/
DEFER
}

View File

@@ -61,6 +61,8 @@ public final class BetterBlockPos extends BlockPos {
}
public static long longHash(int x, int y, int z) {
// TODO use the same thing as BlockPos.fromLong();
// invertibility would be incredibly useful
/*
* This is the hashcode implementation of Vec3i (the superclass of the class which I shall not name)
*

View File

@@ -0,0 +1,67 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import net.minecraft.block.Block;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.IRegistry;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class BlockUtils {
private static transient Map<String, Block> resourceCache = new HashMap<>();
public static String blockToString(Block block) {
ResourceLocation loc = IRegistry.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?
name = loc.toString(); // include the namespace with the colon
}
return name;
}
public static Block stringToBlockRequired(String name) {
if (name.equals("lit_redstone_ore")) { // workaround for Impact 4.6 only
return stringToBlockRequired("redstone_ore");
}
Block block = stringToBlockNullable(name);
Objects.requireNonNull(block);
return block;
}
public static Block stringToBlockNullable(String name) {
// do NOT just replace this with a computeWithAbsent, it isn't thread safe
Block block = resourceCache.get(name); // map is never mutated in place so this is safe
if (block != null) {
return block;
}
if (resourceCache.containsKey(name)) {
return null; // cached as null
}
block = IRegistry.BLOCK.get(ResourceLocation.tryCreate(name.contains(":") ? name : "minecraft:" + name));
Map<String, Block> copy = new HashMap<>(resourceCache); // read only copy is safe, wont throw concurrentmodification
copy.put(name, block);
resourceCache = copy;
return block;
}
private BlockUtils() {}
}

View File

@@ -0,0 +1,710 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.Settings;
import baritone.api.behavior.IPathingBehavior;
import baritone.api.cache.IRememberedInventory;
import baritone.api.cache.IWaypoint;
import baritone.api.cache.Waypoint;
import baritone.api.event.events.ChatEvent;
import baritone.api.event.listener.AbstractGameEventListener;
import baritone.api.pathing.goals.*;
import baritone.api.process.IBaritoneProcess;
import baritone.api.process.ICustomGoalProcess;
import baritone.api.process.IGetToBlockProcess;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
import java.nio.file.Path;
import java.util.*;
public class ExampleBaritoneControl implements Helper, AbstractGameEventListener {
private static final String HELP_MSG =
"baritone - Output settings into chat\n" +
"settings - Same as baritone\n" +
"goal - Create a goal (one number is '<Y>', two is '<X> <Z>', three is '<X> <Y> <Z>, 'clear' to clear)\n" +
"path - Go towards goal\n" +
"repack - (debug) Repacks chunk cache\n" +
"rescan - (debug) Same as repack\n" +
"axis - Paths towards the closest axis or diagonal axis, at y=120\n" +
"cancel - Cancels current path\n" +
"forcecancel - sudo cancel (only use if very glitched, try toggling 'pause' first)\n" +
"gc - Calls System.gc();\n" +
"invert - Runs away from the goal instead of towards it\n" +
"follow - Follows a player 'follow username'\n" +
"reloadall - (debug) Reloads chunk cache\n" +
"saveall - (debug) Saves chunk cache\n" +
"find - (debug) outputs how many blocks of a certain type are within the cache\n" +
"mine - Paths to and mines specified blocks 'mine x_ore y_ore ...'\n" +
"thisway - Creates a goal X blocks where you're facing\n" +
"list - Lists waypoints under a category\n" +
"get - Same as list\n" +
"show - Same as list\n" +
"save - Saves a waypoint (works but don't try to make sense of it)\n" +
"delete - Deletes a waypoint\n" +
"goto - Paths towards specified block or waypoint\n" +
"spawn - Paths towards world spawn or your most recent bed right-click\n" +
"sethome - Sets \"home\"\n" +
"home - Paths towards \"home\" \n" +
"costs - (debug) all movement costs from current location\n" +
"damn - Daniel\n" +
"Go to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information";
private static final String COMMAND_PREFIX = "#";
public final IBaritone baritone;
public final IPlayerContext ctx;
public ExampleBaritoneControl(IBaritone baritone) {
this.baritone = baritone;
this.ctx = baritone.getPlayerContext();
baritone.getGameEventHandler().registerEventListener(this);
}
@Override
public void onSendChatMessage(ChatEvent event) {
String msg = event.getMessage();
if (BaritoneAPI.getSettings().prefixControl.value && msg.startsWith(COMMAND_PREFIX)) {
if (!runCommand(msg.substring(COMMAND_PREFIX.length()))) {
logDirect("Invalid command");
}
event.cancel(); // always cancel if using prefixControl
return;
}
if (!BaritoneAPI.getSettings().chatControl.value && !BaritoneAPI.getSettings().removePrefix.value) {
return;
}
if (runCommand(msg)) {
event.cancel();
}
}
public boolean runCommand(String msg0) { // you may think this can be private, but impcat calls it from .b =)
String msg = msg0.toLowerCase(Locale.US).trim(); // don't reassign the argument LOL
IPathingBehavior pathingBehavior = baritone.getPathingBehavior();
ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
List<Settings.Setting<Boolean>> toggleable = BaritoneAPI.getSettings().getAllValuesByType(Boolean.class);
for (Settings.Setting<Boolean> setting : toggleable) {
if (msg.equalsIgnoreCase(setting.getName())) {
setting.value ^= true;
logDirect("Toggled " + setting.getName() + " to " + setting.value);
SettingsUtil.save(BaritoneAPI.getSettings());
return true;
}
}
if (msg.equals("baritone") || msg.equals("modifiedsettings") || msg.startsWith("settings m") || msg.equals("modified")) {
logDirect("All settings that have been modified from their default values:");
for (Settings.Setting<?> setting : SettingsUtil.modifiedSettings(BaritoneAPI.getSettings())) {
logDirect(setting.toString());
}
return true;
}
if (msg.startsWith("settings")) {
String rest = msg.substring("settings".length());
try {
int page = Integer.parseInt(rest.trim());
int min = page * 10;
int max = Math.min(BaritoneAPI.getSettings().allSettings.size(), (page + 1) * 10);
logDirect("Settings " + min + " to " + (max - 1) + ":");
for (int i = min; i < max; i++) {
logDirect(BaritoneAPI.getSettings().allSettings.get(i).toString());
}
} catch (Exception ex) { // NumberFormatException | ArrayIndexOutOfBoundsException and probably some others I'm forgetting lol
ex.printStackTrace();
logDirect("All settings:");
for (Settings.Setting<?> setting : BaritoneAPI.getSettings().allSettings) {
logDirect(setting.toString());
}
logDirect("To get one page of ten settings at a time, do settings <num>");
}
return true;
}
if (msg.equals("") || msg.equals("help") || msg.equals("?")) {
for (String line : HELP_MSG.split("\n")) {
logDirect(line);
}
return true;
}
if (msg.contains(" ")) {
String settingName = msg.substring(0, msg.indexOf(' '));
String settingValue = msg.substring(msg.indexOf(' ') + 1);
Settings.Setting setting = BaritoneAPI.getSettings().byLowerName.get(settingName);
if (setting != null) {
if (settingValue.equals("reset")) {
logDirect("Resetting setting " + settingName + " to default value.");
setting.reset();
} else {
try {
SettingsUtil.parseAndApply(BaritoneAPI.getSettings(), settingName, settingValue);
} catch (Exception ex) {
logDirect("Unable to parse setting");
return true;
}
}
SettingsUtil.save(BaritoneAPI.getSettings());
logDirect(setting.toString());
return true;
}
}
if (BaritoneAPI.getSettings().byLowerName.containsKey(msg)) {
Settings.Setting<?> setting = BaritoneAPI.getSettings().byLowerName.get(msg);
logDirect(setting.toString());
return true;
}
if (msg.startsWith("goal")) {
String rest = msg.substring(4).trim();
Goal goal;
if (rest.equals("clear") || rest.equals("none")) {
goal = null;
} else {
String[] params = rest.split(" ");
if (params[0].equals("")) {
params = new String[]{};
}
goal = parseGoal(params);
if (goal == null) {
return true;
}
}
customGoalProcess.setGoal(goal);
logDirect("Goal: " + goal);
return true;
}
if (msg.equals("crash")) {
StringBuilder meme = new StringBuilder();
CrashReport rep = new CrashReport("Manually triggered debug crash", new Throwable());
mc.addGraphicsAndWorldToCrashReport(rep);
rep.getSectionsInStringBuilder(meme);
System.out.println(meme);
logDirect(meme.toString());
logDirect("ok");
return true;
}
if (msg.equals("path")) {
if (pathingBehavior.getGoal() == null) {
logDirect("No goal.");
} else if (pathingBehavior.getGoal().isInGoal(ctx.playerFeet())) {
logDirect("Already in goal");
} else if (pathingBehavior.isPathing()) {
logDirect("Currently executing a path. Please cancel it first.");
} else {
customGoalProcess.setGoalAndPath(pathingBehavior.getGoal());
}
return true;
}
/*if (msg.equals("fullpath")) {
if (pathingBehavior.getGoal() == null) {
logDirect("No goal.");
} else {
logDirect("Started segmented calculator");
SegmentedCalculator.calculateSegmentsThreaded(pathingBehavior.pathStart(), pathingBehavior.getGoal(), new CalculationContext(baritone, true), ipath -> {
logDirect("Found a path");
logDirect("Ends at " + ipath.getDest());
logDirect("Length " + ipath.length());
logDirect("Estimated time " + ipath.ticksRemainingFrom(0));
pathingBehavior.secretCursedFunctionDoNotCall(ipath); // it's okay when *I* do it
}, () -> {
logDirect("Path calculation failed, no path");
});
}
return true;
}*/
if (msg.equals("proc")) {
Optional<IBaritoneProcess> proc = baritone.getPathingControlManager().mostRecentInControl();
if (!proc.isPresent()) {
logDirect("No process is in control");
return true;
}
IBaritoneProcess p = proc.get();
logDirect("Class: " + p.getClass());
logDirect("Priority: " + p.priority());
logDirect("Temporary: " + p.isTemporary());
logDirect("Display name: " + p.displayName());
logDirect("Command: " + baritone.getPathingControlManager().mostRecentCommand());
return true;
}
if (msg.equals("version")) {
String version = ExampleBaritoneControl.class.getPackage().getImplementationVersion();
if (version == null) {
logDirect("No version detected. Either dev environment or broken install.");
} else {
logDirect("You are using Baritone v" + version);
}
return true;
}
if (msg.equals("repack") || msg.equals("rescan")) {
ChunkProviderClient cli = (ChunkProviderClient) ctx.world().getChunkProvider();
int playerChunkX = ctx.playerFeet().getX() >> 4;
int playerChunkZ = ctx.playerFeet().getZ() >> 4;
int count = 0;
for (int x = playerChunkX - 40; x <= playerChunkX + 40; x++) {
for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) {
Chunk chunk = cli.getChunk(x, z, false, false);
if (chunk != null) {
count++;
baritone.getWorldProvider().getCurrentWorld().getCachedWorld().queueForPacking(chunk);
}
}
}
logDirect("Queued " + count + " chunks for repacking");
return true;
}
if (msg.startsWith("build")) {
String file;
BlockPos origin;
try {
String[] coords = msg.substring("build".length()).trim().split(" ");
file = coords[0] + ".schematic";
origin = new BlockPos(parseOrDefault(coords[1], ctx.playerFeet().x), parseOrDefault(coords[2], ctx.playerFeet().y), parseOrDefault(coords[3], ctx.playerFeet().z));
} catch (Exception ex) {
file = msg.substring(5).trim() + ".schematic";
origin = ctx.playerFeet();
}
logDirect("Loading '" + file + "' to build from origin " + origin);
boolean success = baritone.getBuilderProcess().build(file, origin);
logDirect(success ? "Loaded" : "Unable to load");
return true;
}
if (msg.equals("come")) {
customGoalProcess.setGoalAndPath(new GoalBlock(new BlockPos(Helper.mc.getRenderViewEntity())));
logDirect("Coming");
return true;
}
if (msg.equals("axis") || msg.equals("highway")) {
customGoalProcess.setGoalAndPath(new GoalAxis());
return true;
}
if (msg.equals("cancel") || msg.equals("stop")) {
pathingBehavior.cancelEverything();
logDirect("ok canceled");
return true;
}
if (msg.equals("forcecancel")) {
pathingBehavior.cancelEverything();
pathingBehavior.forceCancel();
logDirect("ok force canceled");
return true;
}
if (msg.equals("gc")) {
System.gc();
logDirect("Called System.gc();");
return true;
}
if (msg.equals("invert")) {
Goal goal = pathingBehavior.getGoal();
BlockPos runAwayFrom;
if (goal instanceof GoalXZ) {
runAwayFrom = new BlockPos(((GoalXZ) goal).getX(), 0, ((GoalXZ) goal).getZ());
} else if (goal instanceof GoalBlock) {
runAwayFrom = ((GoalBlock) goal).getGoalPos();
} else {
logDirect("Goal must be GoalXZ or GoalBlock to invert");
logDirect("Inverting goal of player feet");
runAwayFrom = ctx.playerFeet();
}
customGoalProcess.setGoalAndPath(new GoalRunAway(1, runAwayFrom) {
@Override
public boolean isInGoal(int x, int y, int z) {
return false;
}
});
return true;
}
if (msg.startsWith("cleararea")) {
String suffix = msg.substring("cleararea".length());
BlockPos corner1;
BlockPos corner2;
if (suffix.isEmpty()) {
// clear the area from the current goal to here
Goal goal = baritone.getPathingBehavior().getGoal();
if (!(goal instanceof GoalBlock)) {
logDirect("Need to specify goal of opposite corner");
return true;
}
corner1 = ((GoalBlock) goal).getGoalPos();
corner2 = ctx.playerFeet();
} else {
try {
String[] spl = suffix.split(" ");
corner1 = ctx.playerFeet();
corner2 = new BlockPos(Integer.parseInt(spl[0]), Integer.parseInt(spl[1]), Integer.parseInt(spl[2]));
} catch (NumberFormatException | ArrayIndexOutOfBoundsException | NullPointerException ex) {
logDirect("unable to parse");
return true;
}
}
baritone.getBuilderProcess().clearArea(corner1, corner2);
return true;
}
if (msg.equals("resume")) {
baritone.getBuilderProcess().resume();
logDirect("resumed");
return true;
}
if (msg.equals("pause")) {
baritone.getBuilderProcess().pause();
logDirect("paused");
return true;
}
if (msg.equals("reset")) {
for (Settings.Setting setting : BaritoneAPI.getSettings().allSettings) {
setting.reset();
}
SettingsUtil.save(BaritoneAPI.getSettings());
logDirect("Baritone settings reset");
return true;
}
if (msg.equals("tunnel")) {
customGoalProcess.setGoalAndPath(new GoalStrictDirection(ctx.playerFeet(), ctx.player().getHorizontalFacing()));
logDirect("tunneling");
return true;
}
if (msg.equals("render")) {
BetterBlockPos pf = ctx.playerFeet();
Minecraft.getInstance().worldRenderer.markBlockRangeForRenderUpdate(pf.x - 500, pf.y - 500, pf.z - 500, pf.x + 500, pf.y + 500, pf.z + 500);
logDirect("okay");
return true;
}
if (msg.equals("farm")) {
baritone.getFarmProcess().farm();
logDirect("farming");
return true;
}
if (msg.equals("chests")) {
for (Map.Entry<BlockPos, IRememberedInventory> entry : baritone.getWorldProvider().getCurrentWorld().getContainerMemory().getRememberedInventories().entrySet()) {
logDirect(entry.getKey() + "");
log(entry.getValue().getContents());
}
return true;
}
if (msg.startsWith("followplayers")) {
baritone.getFollowProcess().follow(EntityPlayer.class::isInstance); // O P P A
logDirect("Following any players");
return true;
}
if (msg.startsWith("follow")) {
String name = msg.substring(6).trim();
Optional<Entity> toFollow = Optional.empty();
if (name.length() == 0) {
toFollow = ctx.getSelectedEntity();
} else {
for (EntityPlayer pl : ctx.world().playerEntities) {
String theirName = pl.getName().getString().trim().toLowerCase();
if (!theirName.equals(ctx.player().getName().getString().trim().toLowerCase()) && (theirName.contains(name) || name.contains(theirName))) { // don't follow ourselves lol
toFollow = Optional.of(pl);
}
}
}
if (!toFollow.isPresent()) {
logDirect("Not found");
return true;
}
Entity effectivelyFinal = toFollow.get();
baritone.getFollowProcess().follow(effectivelyFinal::equals);
logDirect("Following " + toFollow.get());
return true;
}
if (msg.startsWith("explorefilter")) {
// explorefilter blah.json
// means that entries in blah.json are already explored
// explorefilter blah.json invert
// means that entries in blah.json are NOT already explored
String path = msg.substring("explorefilter".length()).trim();
String[] parts = path.split(" ");
Path path1 = Minecraft.getInstance().gameDir.toPath().resolve(parts[0]);
boolean invert = parts.length > 1;
try {
baritone.getExploreProcess().applyJsonFilter(path1, invert);
logDirect("Loaded filter. Inverted: " + invert);
if (invert) {
logDirect("Chunks on this list will be treated as possibly unexplored, all others will be treated as certainly explored");
} else {
logDirect("Chunks on this list will be treated as certainly explored, all others will be treated as possibly unexplored");
}
} catch (Exception e) {
e.printStackTrace();
logDirect("Unable to load " + path1);
}
return true;
}
if (msg.equals("reloadall")) {
baritone.getWorldProvider().getCurrentWorld().getCachedWorld().reloadAllFromDisk();
logDirect("ok");
return true;
}
if (msg.equals("saveall")) {
baritone.getWorldProvider().getCurrentWorld().getCachedWorld().save();
logDirect("ok");
return true;
}
if (msg.startsWith("explore")) {
String rest = msg.substring("explore".length()).trim();
int centerX;
int centerZ;
try {
centerX = Integer.parseInt(rest.split(" ")[0]);
centerZ = Integer.parseInt(rest.split(" ")[1]);
} catch (Exception ex) {
centerX = ctx.playerFeet().x;
centerZ = ctx.playerFeet().z;
}
baritone.getExploreProcess().explore(centerX, centerZ);
logDirect("Exploring from " + centerX + "," + centerZ);
return true;
}
if (msg.equals("blacklist")) {
IGetToBlockProcess proc = baritone.getGetToBlockProcess();
if (!proc.isActive()) {
logDirect("GetToBlockProcess is not currently active");
return true;
}
if (proc.blacklistClosest()) {
logDirect("Blacklisted closest instances");
} else {
logDirect("No known locations, unable to blacklist");
}
return true;
}
if (msg.startsWith("find")) {
String blockType = msg.substring(4).trim();
ArrayList<BlockPos> locs = baritone.getWorldProvider().getCurrentWorld().getCachedWorld().getLocationsOf(blockType, 1, ctx.playerFeet().getX(), ctx.playerFeet().getZ(), 4);
logDirect("Have " + locs.size() + " locations");
for (BlockPos pos : locs) {
Block actually = ctx.world().getBlockState(pos).getBlock();
if (!BlockUtils.blockToString(actually).equalsIgnoreCase(blockType)) {
logDebug("Was looking for " + blockType + " but actually found " + actually + " " + BlockUtils.blockToString(actually));
}
}
return true;
}
if (msg.startsWith("mine")) {
String[] blockTypes = msg.substring(4).trim().split(" ");
try {
int quantity = Integer.parseInt(blockTypes[1]);
Block block = BlockUtils.stringToBlockRequired(blockTypes[0]);
baritone.getMineProcess().mine(quantity, block);
logDirect("Will mine " + quantity + " " + blockTypes[0]);
return true;
} catch (NumberFormatException | ArrayIndexOutOfBoundsException | NullPointerException ex) {}
for (String s : blockTypes) {
if (BlockUtils.stringToBlockNullable(s) == null) {
logDirect(s + " isn't a valid block name");
return true;
}
}
baritone.getMineProcess().mineByName(0, blockTypes);
logDirect("Started mining blocks of type " + Arrays.toString(blockTypes));
return true;
}
if (msg.equals("click")) {
baritone.openClick();
logDirect("aight dude");
return true;
}
if (msg.startsWith("thisway") || msg.startsWith("forward")) {
try {
Goal goal = GoalXZ.fromDirection(ctx.playerFeetAsVec(), ctx.player().rotationYaw, Double.parseDouble(msg.substring(7).trim()));
customGoalProcess.setGoal(goal);
logDirect("Goal: " + goal);
} catch (NumberFormatException ex) {
logDirect("Error unable to parse '" + msg.substring(7).trim() + "' to a double.");
}
return true;
}
if (msg.startsWith("list") || msg.startsWith("get ") || msg.startsWith("show")) {
String waypointType = msg.substring(4).trim();
if (waypointType.endsWith("s")) {
// for example, "show deaths"
waypointType = waypointType.substring(0, waypointType.length() - 1);
}
IWaypoint.Tag tag = IWaypoint.Tag.fromString(waypointType);
if (tag == null) {
logDirect("Not a valid tag. Tags are: " + Arrays.asList(IWaypoint.Tag.values()).toString().toLowerCase());
return true;
}
Set<IWaypoint> waypoints = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getByTag(tag);
// might as well show them from oldest to newest
List<IWaypoint> sorted = new ArrayList<>(waypoints);
sorted.sort(Comparator.comparingLong(IWaypoint::getCreationTimestamp));
logDirect("Waypoints under tag " + tag + ":");
for (IWaypoint waypoint : sorted) {
logDirect(waypoint.toString());
}
return true;
}
if (msg.startsWith("save")) {
String name = msg.substring(4).trim();
BlockPos pos = ctx.playerFeet();
if (name.contains(" ")) {
logDirect("Name contains a space, assuming it's in the format 'save waypointName X Y Z'");
String[] parts = name.split(" ");
if (parts.length != 4) {
logDirect("Unable to parse, expected four things");
return true;
}
try {
pos = new BlockPos(Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]));
} catch (NumberFormatException ex) {
logDirect("Unable to parse coordinate integers");
return true;
}
name = parts[0];
}
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint(name, IWaypoint.Tag.USER, pos));
logDirect("Saved user defined position " + pos + " under name '" + name + "'. Say 'goto " + name + "' to set goal, say 'list user' to list custom waypoints.");
return true;
}
if (msg.startsWith("delete")) {
String name = msg.substring(6).trim();
IWaypoint waypoint = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getAllWaypoints().stream().filter(w -> w.getTag() == IWaypoint.Tag.USER && w.getName().equalsIgnoreCase(name)).findFirst().orElse(null);
if (waypoint == null) {
logDirect("No user defined position under the name '" + name + "' found.");
return true;
}
baritone.getWorldProvider().getCurrentWorld().getWaypoints().removeWaypoint(waypoint);
logDirect("Deleted user defined position under name '" + name + "'.");
return true;
}
if (msg.startsWith("goto")) {
String waypointType = msg.substring(4).trim();
if (waypointType.endsWith("s") && IWaypoint.Tag.fromString(waypointType.substring(0, waypointType.length() - 1)) != null) {
// for example, "show deaths"
waypointType = waypointType.substring(0, waypointType.length() - 1);
}
IWaypoint.Tag tag = IWaypoint.Tag.fromString(waypointType);
IWaypoint waypoint;
if (tag == null) {
String mining = waypointType;
Block block = BlockUtils.stringToBlockNullable(mining);
//logDirect("Not a valid tag. Tags are: " + Arrays.asList(Waypoint.Tag.values()).toString().toLowerCase());
if (block == null) {
waypoint = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getAllWaypoints().stream().filter(w -> w.getName().equalsIgnoreCase(mining)).max(Comparator.comparingLong(IWaypoint::getCreationTimestamp)).orElse(null);
if (waypoint == null) {
Goal goal = parseGoal(waypointType.split(" "));
if (goal != null) {
logDirect("Going to " + goal);
customGoalProcess.setGoalAndPath(goal);
}
return true;
}
} else {
baritone.getGetToBlockProcess().getToBlock(block);
return true;
}
} else {
waypoint = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getMostRecentByTag(tag);
if (waypoint == null) {
logDirect("None saved for tag " + tag);
return true;
}
}
Goal goal = waypoint.getTag() == IWaypoint.Tag.BED ? new GoalGetToBlock(waypoint.getLocation()) : new GoalBlock(waypoint.getLocation());
customGoalProcess.setGoalAndPath(goal);
return true;
}
if (msg.equals("spawn") || msg.equals("bed")) {
IWaypoint waypoint = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getMostRecentByTag(IWaypoint.Tag.BED);
if (waypoint == null) {
BlockPos spawnPoint = ctx.player().getBedLocation();
// for some reason the default spawnpoint is underground sometimes
Goal goal = new GoalXZ(spawnPoint.getX(), spawnPoint.getZ());
logDirect("spawn not saved, defaulting to world spawn. set goal to " + goal);
customGoalProcess.setGoalAndPath(goal);
} else {
Goal goal = new GoalGetToBlock(waypoint.getLocation());
customGoalProcess.setGoalAndPath(goal);
logDirect("Set goal to most recent bed " + goal);
}
return true;
}
if (msg.equals("sethome")) {
baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("", IWaypoint.Tag.HOME, ctx.playerFeet()));
logDirect("Saved. Say home to set goal.");
return true;
}
if (msg.equals("home")) {
IWaypoint waypoint = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getMostRecentByTag(IWaypoint.Tag.HOME);
if (waypoint == null) {
logDirect("home not saved");
} else {
Goal goal = new GoalBlock(waypoint.getLocation());
customGoalProcess.setGoalAndPath(goal);
logDirect("Going to saved home " + goal);
}
return true;
}
if (msg.equals("damn")) {
logDirect("daniel");
}
return false;
}
private int parseOrDefault(String str, int i) {
return str.equals("~") ? i : str.startsWith("~") ? Integer.parseInt(str.substring(1)) + i : Integer.parseInt(str);
}
private void log(List<ItemStack> stacks) {
for (ItemStack stack : stacks) {
if (!stack.isEmpty()) {
logDirect(stack.getCount() + "x " + stack.getDisplayName() + "@" + stack.getDamage());
}
}
}
private Goal parseGoal(String[] params) {
Goal goal;
try {
BetterBlockPos playerFeet = ctx.playerFeet();
switch (params.length) {
case 0:
goal = new GoalBlock(playerFeet);
break;
case 1:
goal = new GoalYLevel(parseOrDefault(params[0], playerFeet.y));
break;
case 2:
goal = new GoalXZ(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.z));
break;
case 3:
goal = new GoalBlock(new BlockPos(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.y), parseOrDefault(params[2], playerFeet.z)));
break;
default:
logDirect("unable to understand lol");
return null;
}
} catch (NumberFormatException ex) {
logDirect("unable to parse integer " + ex);
return null;
}
return goal;
}
}

View File

@@ -1,107 +1,72 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.utils;
import baritone.Baritone;
import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Rotation;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
/**
* @author Brady
* @since 8/1/2018 12:18 AM
*/
public interface Helper {
/**
* Instance of {@link Helper}. Used for static-context reference.
*/
Helper HELPER = new Helper() {};
ITextComponent MESSAGE_PREFIX = new TextComponentString(String.format(
"%s[%sBaritone%s]%s",
TextFormatting.DARK_PURPLE,
TextFormatting.LIGHT_PURPLE,
TextFormatting.DARK_PURPLE,
TextFormatting.GRAY
));
Minecraft mc = Minecraft.getMinecraft();
default EntityPlayerSP player() {
return mc.player;
}
default WorldClient world() {
return mc.world;
}
default BetterBlockPos playerFeet() {
// TODO find a better way to deal with soul sand!!!!!
BetterBlockPos feet = new BetterBlockPos(player().posX, player().posY + 0.1251, player().posZ);
if (BlockStateInterface.get(feet).getBlock() instanceof BlockSlab) {
return feet.up();
}
return feet;
}
default Vec3d playerFeetAsVec() {
return new Vec3d(player().posX, player().posY, player().posZ);
}
default Vec3d playerHead() {
return new Vec3d(player().posX, player().posY + player().getEyeHeight(), player().posZ);
}
default Rotation playerRotations() {
return new Rotation(player().rotationYaw, player().rotationPitch);
}
/**
* Send a message to chat only if chatDebug is on
*
* @param message
*/
default void logDebug(String message) {
if (!Baritone.settings().chatDebug.get()) {
System.out.println("Suppressed debug message:");
System.out.println(message);
return;
}
logDirect(message);
}
/**
* Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a direct response to a chat command)
*
* @param message
*/
default void logDirect(String message) {
ITextComponent component = MESSAGE_PREFIX.createCopy();
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(new TextComponentString(" " + message));
Baritone.settings().logger.get().accept(component);
}
}
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import baritone.api.BaritoneAPI;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
/**
* @author Brady
* @since 8/1/2018
*/
public interface Helper {
/**
* Instance of {@link Helper}. Used for static-context reference.
*/
Helper HELPER = new Helper() {};
ITextComponent MESSAGE_PREFIX = new TextComponentString(String.format(
"%s[%sBaritone%s]%s",
TextFormatting.DARK_PURPLE,
TextFormatting.LIGHT_PURPLE,
TextFormatting.DARK_PURPLE,
TextFormatting.GRAY
));
Minecraft mc = Minecraft.getInstance();
/**
* Send a message to chat only if chatDebug is on
*
* @param message The message to display in chat
*/
default void logDebug(String message) {
if (!BaritoneAPI.getSettings().chatDebug.value) {
//System.out.println("Suppressed debug message:");
//System.out.println(message);
return;
}
logDirect(message);
}
/**
* Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a direct response to a chat command)
*
* @param message The message to display in chat
*/
default void logDirect(String message) {
ITextComponent component = MESSAGE_PREFIX.shallowCopy();
component.getStyle().setColor(TextFormatting.GRAY);
component.appendSibling(new TextComponentString(" " + message));
Minecraft.getInstance().addScheduledTask(() -> BaritoneAPI.getSettings().logger.value.accept(component));
}
}

View File

@@ -0,0 +1,34 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import baritone.api.behavior.IBehavior;
import baritone.api.utils.input.Input;
/**
* @author Brady
* @since 11/12/2018
*/
public interface IInputOverrideHandler extends IBehavior {
boolean isInputForcedDown(Input input);
void setInputForceState(Input input, boolean forced);
void clearAllKeys();
}

View File

@@ -0,0 +1,97 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import baritone.api.cache.IWorldData;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import java.util.Optional;
/**
* @author Brady
* @since 11/12/2018
*/
public interface IPlayerContext {
EntityPlayerSP player();
IPlayerController playerController();
World world();
IWorldData worldData();
RayTraceResult objectMouseOver();
default BetterBlockPos playerFeet() {
// TODO find a better way to deal with soul sand!!!!!
BetterBlockPos feet = new BetterBlockPos(player().posX, player().posY + 0.1251, player().posZ);
if (world().getBlockState(feet).getBlock() instanceof BlockSlab) {
return feet.up();
}
return feet;
}
default Vec3d playerFeetAsVec() {
return new Vec3d(player().posX, player().posY, player().posZ);
}
default Vec3d playerHead() {
return new Vec3d(player().posX, player().posY + player().getEyeHeight(), player().posZ);
}
default Rotation playerRotations() {
return new Rotation(player().rotationYaw, player().rotationPitch);
}
/**
* Returns the block that the crosshair is currently placed over. Updated once per tick.
*
* @return The position of the highlighted block
*/
default Optional<BlockPos> getSelectedBlock() {
RayTraceResult result = objectMouseOver();
if (result != null && result.type == RayTraceResult.Type.BLOCK) {
return Optional.of(result.getBlockPos());
}
return Optional.empty();
}
default boolean isLookingAt(BlockPos pos) {
return getSelectedBlock().equals(Optional.of(pos));
}
/**
* Returns the entity that the crosshair is currently placed over. Updated once per tick.
*
* @return The entity
*/
default Optional<Entity> getSelectedEntity() {
RayTraceResult result = objectMouseOver();
if (result != null && result.type == RayTraceResult.Type.ENTITY) {
return Optional.of(result.entity);
}
return Optional.empty();
}
}

View File

@@ -0,0 +1,55 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
/**
* @author Brady
* @since 12/14/2018
*/
public interface IPlayerController {
boolean onPlayerDamageBlock(BlockPos pos, EnumFacing side);
void resetBlockRemoving();
ItemStack windowClick(int windowId, int slotId, int mouseButton, ClickType type, EntityPlayer player);
void setGameType(GameType type);
GameType getGameType();
default double getBlockReachDistance() {
return this.getGameType().isCreative() ? 5.0F : 4.5F;
}
EnumActionResult processRightClickBlock(EntityPlayerSP player, World world, BlockPos pos, EnumFacing direction, Vec3d vec, EnumHand hand);
EnumActionResult processRightClick(EntityPlayerSP player, World world, EnumHand hand);
}

View File

@@ -0,0 +1,85 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
/**
* Basic representation of a schematic. Provides the dimensions and
* the desired statefor a given position relative to the origin.
*
* @author leijurv
*/
public interface ISchematic {
/**
* Does the block at this coordinate matter to the schematic?
* <p>
* Normally just a check for if the coordinate is in the cube.
* <p>
* However, in the case of something like a map art, anything that's below the level of the map art doesn't matter,
* so this function should return false in that case. (i.e. it doesn't really have to be air below the art blocks)
*
* @param x The x position of the block, relative to the origin
* @param y The y position of the block, relative to the origin
* @param z The z position of the block, relative to the origin
* @return Whether or not the specified position is within the bounds of this schematic
*/
default boolean inSchematic(int x, int y, int z) {
return x >= 0 && x < widthX() && y >= 0 && y < heightY() && z >= 0 && z < lengthZ();
}
default int size(EnumFacing.Axis axis) {
switch (axis) {
case X:
return widthX();
case Y:
return heightY();
case Z:
return lengthZ();
default:
throw new UnsupportedOperationException(axis + "");
}
}
/**
* Returns the desired block state at a given (X, Y, Z) position relative to the origin (0, 0, 0).
*
* @param x The x position of the block, relative to the origin
* @param y The y position of the block, relative to the origin
* @param z The z position of the block, relative to the origin
* @return The desired block state at the specified position
*/
IBlockState desiredState(int x, int y, int z);
/**
* @return The width (X axis length) of this schematic
*/
int widthX();
/**
* @return The height (Y axis length) of this schematic
*/
int heightY();
/**
* @return The length (Z axis length) of this schematic
*/
int lengthZ();
}

View File

@@ -0,0 +1,37 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import com.google.gson.annotations.SerializedName;
/**
* Need a non obfed chunkpos that we can load using GSON
*/
public class MyChunkPos {
@SerializedName("x")
public int x;
@SerializedName("y")
public int z;
@Override
public String toString() {
return x + ", " + z;
}
}

View File

@@ -0,0 +1,55 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import baritone.api.pathing.calc.IPath;
import java.util.Objects;
import java.util.Optional;
public class PathCalculationResult {
private final IPath path;
private final Type type;
public PathCalculationResult(Type type) {
this(type, null);
}
public PathCalculationResult(Type type, IPath path) {
Objects.requireNonNull(type);
this.path = path;
this.type = type;
}
public final Optional<IPath> getPath() {
return Optional.ofNullable(this.path);
}
public final Type getType() {
return this.type;
}
public enum Type {
SUCCESS_TO_GOAL,
SUCCESS_SEGMENT,
FAILURE,
CANCELLATION,
EXCEPTION,
}
}

View File

@@ -17,14 +17,11 @@
package baritone.api.utils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceFluidMode;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import java.util.Optional;
/**
* @author Brady
* @since 8/25/2018
@@ -33,82 +30,24 @@ public final class RayTraceUtils {
private RayTraceUtils() {}
/**
* The {@link Minecraft} instance
*/
private static final Minecraft mc = Minecraft.getMinecraft();
/**
* Simulates a "vanilla" raytrace. A RayTraceResult returned by this method
* will be that of the next render pass given that the local player's yaw and
* pitch match the specified yaw and pitch values. This is particularly useful
* when you would like to simulate a "legit" raytrace with certainty that the only
* thing to achieve the desired outcome (whether it is hitting and entity or placing
* a block) can be done just by modifying user input.
*
* @param yaw The yaw to raytrace with
* @param pitch The pitch to raytrace with
* @return The calculated raytrace result
*/
public static RayTraceResult simulateRayTrace(float yaw, float pitch) {
RayTraceResult oldTrace = mc.objectMouseOver;
float oldYaw = mc.player.rotationYaw;
float oldPitch = mc.player.rotationPitch;
mc.player.rotationYaw = yaw;
mc.player.rotationPitch = pitch;
mc.entityRenderer.getMouseOver(1.0F);
RayTraceResult result = mc.objectMouseOver;
mc.objectMouseOver = oldTrace;
mc.player.rotationYaw = oldYaw;
mc.player.rotationPitch = oldPitch;
return result;
}
/**
* Performs a block raytrace with the specified rotations. This should only be used when
* any entity collisions can be ignored, because this method will not recognize if an
* entity is in the way or not. The local player's block reach distance will be used.
*
* @param rotation The rotation to raytrace towards
* @param entity The entity representing the raytrace source
* @param rotation The rotation to raytrace towards
* @param blockReachDistance The block reach distance of the entity
* @return The calculated raytrace result
*/
public static RayTraceResult rayTraceTowards(Rotation rotation) {
double blockReachDistance = mc.playerController.getBlockReachDistance();
Vec3d start = mc.player.getPositionEyes(1.0F);
public static RayTraceResult rayTraceTowards(Entity entity, Rotation rotation, double blockReachDistance) {
Vec3d start = entity.getEyePosition(1.0F);
Vec3d direction = RotationUtils.calcVec3dFromRotation(rotation);
Vec3d end = start.add(
direction.x * blockReachDistance,
direction.y * blockReachDistance,
direction.z * blockReachDistance
);
return mc.world.rayTraceBlocks(start, end, false, false, true);
}
/**
* Returns the block that the crosshair is currently placed over. Updated once per render tick.
*
* @return The position of the highlighted block
*/
public static Optional<BlockPos> getSelectedBlock() {
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) {
return Optional.of(mc.objectMouseOver.getBlockPos());
}
return Optional.empty();
}
/**
* Returns the entity that the crosshair is currently placed over. Updated once per render tick.
*
* @return The entity
*/
public static Optional<Entity> getSelectedEntity() {
if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY) {
return Optional.of(mc.objectMouseOver.entityHit);
}
return Optional.empty();
return entity.world.rayTraceBlocks(start, end, RayTraceFluidMode.NEVER, false, true);
}
}

View File

@@ -36,6 +36,9 @@ public class Rotation {
public Rotation(float yaw, float pitch) {
this.yaw = yaw;
this.pitch = pitch;
if (Float.isInfinite(yaw) || Float.isNaN(yaw) || Float.isInfinite(pitch) || Float.isNaN(pitch)) {
throw new IllegalStateException(yaw + " " + pitch);
}
}
/**
@@ -86,7 +89,7 @@ public class Rotation {
public Rotation clamp() {
return new Rotation(
this.yaw,
RotationUtils.clampPitch(this.pitch)
clampPitch(this.pitch)
);
}
@@ -95,7 +98,7 @@ public class Rotation {
*/
public Rotation normalize() {
return new Rotation(
RotationUtils.normalizeYaw(this.yaw),
normalizeYaw(this.yaw),
this.pitch
);
}
@@ -105,8 +108,55 @@ public class Rotation {
*/
public Rotation normalizeAndClamp() {
return new Rotation(
RotationUtils.normalizeYaw(this.yaw),
RotationUtils.clampPitch(this.pitch)
normalizeYaw(this.yaw),
clampPitch(this.pitch)
);
}
/**
* Is really close to
*
* @param other another rotation
* @return are they really close
*/
public boolean isReallyCloseTo(Rotation other) {
return yawIsReallyClose(other) && Math.abs(this.pitch - other.pitch) < 0.01;
}
public boolean yawIsReallyClose(Rotation other) {
float yawDiff = Math.abs(normalizeYaw(yaw) - normalizeYaw(other.yaw)); // you cant fool me
return (yawDiff < 0.01 || yawDiff > 359.99);
}
/**
* Clamps the specified pitch value between -90 and 90.
*
* @param pitch The input pitch
* @return The clamped pitch
*/
public static float clampPitch(float pitch) {
return Math.max(-90, Math.min(90, pitch));
}
/**
* Normalizes the specified yaw value between -180 and 180.
*
* @param yaw The input yaw
* @return The normalized yaw
*/
public static float normalizeYaw(float yaw) {
float newYaw = yaw % 360F;
if (newYaw < -180F) {
newYaw += 360F;
}
if (newYaw > 180F) {
newYaw -= 360F;
}
return newYaw;
}
@Override
public String toString() {
return "Yaw: " + yaw + ", Pitch: " + pitch;
}
}

View File

@@ -17,11 +17,19 @@
package baritone.api.utils;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import net.minecraft.block.BlockFire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.*;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import java.util.Optional;
@@ -31,13 +39,6 @@ import java.util.Optional;
*/
public final class RotationUtils {
private RotationUtils() {}
/**
* The {@link Minecraft} instance
*/
private static final Minecraft mc = Minecraft.getMinecraft();
/**
* Constant that a degree value is multiplied by to get the equivalent radian value
*/
@@ -60,32 +61,7 @@ public final class RotationUtils {
new Vec3d(1, 0.5, 0.5) // East
};
/**
* Clamps the specified pitch value between -90 and 90.
*
* @param pitch The input pitch
* @return The clamped pitch
*/
public static float clampPitch(float pitch) {
return Math.max(-90, Math.min(90, pitch));
}
/**
* Normalizes the specified yaw value between -180 and 180.
*
* @param yaw The input yaw
* @return The normalized yaw
*/
public static float normalizeYaw(float yaw) {
float newYaw = yaw % 360F;
if (newYaw < -180F) {
newYaw += 360F;
}
if (newYaw >= 180F) {
newYaw -= 360F;
}
return newYaw;
}
private RotationUtils() {}
/**
* Calculates the rotation from BlockPos<sub>dest</sub> to BlockPos<sub>orig</sub>
@@ -104,10 +80,13 @@ public final class RotationUtils {
* angles back to it.
*
* @param current The current angles
* @param target The target angles
* @param target The target angles
* @return The wrapped angles
*/
public static Rotation wrapAnglesToRelative(Rotation current, Rotation target) {
if (current.yawIsReallyClose(target)) {
return new Rotation(current.getYaw(), target.getPitch());
}
return target.subtract(current).normalize().add(current);
}
@@ -115,12 +94,11 @@ public final class RotationUtils {
* Calculates the rotation from Vec<sub>dest</sub> to Vec<sub>orig</sub> and makes the
* return value relative to the specified current rotations.
*
* @see #wrapAnglesToRelative(Rotation, Rotation)
*
* @param orig The origin position
* @param dest The destination position
* @param orig The origin position
* @param dest The destination position
* @param current The current rotations
* @return The rotation from the origin to the destination
* @see #wrapAnglesToRelative(Rotation, Rotation)
*/
public static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest, Rotation current) {
return wrapAnglesToRelative(current, calcRotationFromVec3d(orig, dest));
@@ -133,8 +111,8 @@ public final class RotationUtils {
* @param dest The destination position
* @return The rotation from the origin to the destination
*/
public static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
double[] delta = { orig.x - dest.x, orig.y - dest.y, orig.z - dest.z };
private static Rotation calcRotationFromVec3d(Vec3d orig, Vec3d dest) {
double[] delta = {orig.x - dest.x, orig.y - dest.y, orig.z - dest.z};
double yaw = MathHelper.atan2(delta[0], -delta[2]);
double dist = Math.sqrt(delta[0] * delta[0] + delta[2] * delta[2]);
double pitch = MathHelper.atan2(delta[1], dist);
@@ -158,6 +136,16 @@ public final class RotationUtils {
return new Vec3d((double) (f1 * f2), (double) f3, (double) (f * f2));
}
/**
* @param ctx Context for the viewing entity
* @param pos The target block position
* @return The optional rotation
* @see #reachable(EntityPlayerSP, BlockPos, double)
*/
public static Optional<Rotation> reachable(IPlayerContext ctx, BlockPos pos) {
return reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance());
}
/**
* Determines if the specified entity is able to reach the center of any of the sides
* of the specified block. It first checks if the block center is reachable, and if so,
@@ -165,12 +153,14 @@ public final class RotationUtils {
* side that is reachable. The return type will be {@link Optional#empty()} if the entity is
* unable to reach any of the sides of the block.
*
* @param entity The viewing entity
* @param pos The target block position
* @param entity The viewing entity
* @param pos The target block position
* @param blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachable(Entity entity, BlockPos pos) {
if (pos.equals(RayTraceUtils.getSelectedBlock().orElse(null))) {
public static Optional<Rotation> reachable(EntityPlayerSP entity, BlockPos pos, double blockReachDistance) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(entity);
if (baritone.getPlayerContext().isLookingAt(pos)) {
/*
* why add 0.0001?
* to indicate that we actually have a desired pitch
@@ -178,22 +168,27 @@ public final class RotationUtils {
* is by setting the desired pitch to the current pitch
* setting the desired pitch to the current pitch + 0.0001 means that we do have a desired pitch, it's
* just what it currently is
*
* or if you're a normal person literally all this does it ensure that we don't nudge the pitch to a normal level
*/
return Optional.of(new Rotation(entity.rotationYaw, entity.rotationPitch + 0.0001F));
}
Optional<Rotation> possibleRotation = reachableCenter(entity, pos);
Optional<Rotation> possibleRotation = reachableCenter(entity, pos, blockReachDistance);
//System.out.println("center: " + possibleRotation);
if (possibleRotation.isPresent()) {
return possibleRotation;
}
IBlockState state = mc.world.getBlockState(pos);
AxisAlignedBB aabb = state.getBoundingBox(entity.world, pos);
IBlockState state = entity.world.getBlockState(pos);
VoxelShape shape = state.getShape(entity.world, pos);
if (shape.isEmpty()) {
shape = VoxelShapes.fullCube();
}
for (Vec3d sideOffset : BLOCK_SIDE_MULTIPLIERS) {
double xDiff = aabb.minX * sideOffset.x + aabb.maxX * (1 - sideOffset.x);
double yDiff = aabb.minY * sideOffset.y + aabb.maxY * (1 - sideOffset.y);
double zDiff = aabb.minZ * sideOffset.z + aabb.maxZ * (1 - sideOffset.z);
possibleRotation = reachableOffset(entity, pos, new Vec3d(pos).add(xDiff, yDiff, zDiff));
double xDiff = shape.getStart(EnumFacing.Axis.X) * sideOffset.x + shape.getEnd(EnumFacing.Axis.X) * (1 - sideOffset.x);
double yDiff = shape.getStart(EnumFacing.Axis.Y) * sideOffset.y + shape.getEnd(EnumFacing.Axis.Y) * (1 - sideOffset.y);
double zDiff = shape.getStart(EnumFacing.Axis.Z) * sideOffset.z + shape.getEnd(EnumFacing.Axis.Z) * (1 - sideOffset.z);
possibleRotation = reachableOffset(entity, pos, new Vec3d(pos).add(xDiff, yDiff, zDiff), blockReachDistance);
if (possibleRotation.isPresent()) {
return possibleRotation;
}
@@ -206,23 +201,22 @@ public final class RotationUtils {
* the given offsetted position. The return type will be {@link Optional#empty()} if
* the entity is unable to reach the block with the offset applied.
*
* @param entity The viewing entity
* @param pos The target block position
* @param offsetPos The position of the block with the offset applied.
* @param entity The viewing entity
* @param pos The target block position
* @param offsetPos The position of the block with the offset applied.
* @param blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachableOffset(Entity entity, BlockPos pos, Vec3d offsetPos) {
Rotation rotation = calcRotationFromVec3d(entity.getPositionEyes(1.0F), offsetPos);
RayTraceResult result = RayTraceUtils.rayTraceTowards(rotation);
System.out.println(result);
if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
public static Optional<Rotation> reachableOffset(Entity entity, BlockPos pos, Vec3d offsetPos, double blockReachDistance) {
Rotation rotation = calcRotationFromVec3d(entity.getEyePosition(1.0F), offsetPos, new Rotation(entity.rotationYaw, entity.rotationPitch));
RayTraceResult result = RayTraceUtils.rayTraceTowards(entity, rotation, blockReachDistance);
//System.out.println(result);
if (result != null && result.type == RayTraceResult.Type.BLOCK) {
if (result.getBlockPos().equals(pos)) {
return Optional.of(rotation);
}
if (entity.world.getBlockState(pos).getBlock() instanceof BlockFire) {
if (result.getBlockPos().equals(pos.down())) {
return Optional.of(rotation);
}
if (entity.world.getBlockState(pos).getBlock() instanceof BlockFire && result.getBlockPos().equals(pos.down())) {
return Optional.of(rotation);
}
}
return Optional.empty();
@@ -232,11 +226,12 @@ public final class RotationUtils {
* Determines if the specified entity is able to reach the specified block where it is
* looking at the direct center of it's hitbox.
*
* @param entity The viewing entity
* @param pos The target block position
* @param entity The viewing entity
* @param pos The target block position
* @param blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachableCenter(Entity entity, BlockPos pos) {
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(pos));
public static Optional<Rotation> reachableCenter(Entity entity, BlockPos pos, double blockReachDistance) {
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.world, pos), blockReachDistance);
}
}

View File

@@ -18,124 +18,252 @@
package baritone.api.utils;
import baritone.api.Settings;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.IRegistry;
import net.minecraft.util.math.Vec3i;
import java.awt.*;
import java.io.File;
import java.io.FileOutputStream;
import java.util.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SettingsUtil {
private static final Path SETTINGS_PATH = Minecraft.getInstance().gameDir.toPath().resolve("baritone").resolve("settings.txt");
private static final Pattern SETTING_PATTERN = Pattern.compile("^(?<setting>[^ ]+) +(?<value>.+)"); // key and value split by the first space
private static final File settingsFile = new File(new File(Minecraft.getMinecraft().gameDir, "baritone"), "settings.txt");
private static final Map<Class<?>, SettingsIO> map;
private static boolean isComment(String line) {
return line.startsWith("#") || line.startsWith("//");
}
private static void forEachLine(Path file, Consumer<String> consumer) throws IOException {
try (BufferedReader scan = Files.newBufferedReader(file)) {
String line;
while ((line = scan.readLine()) != null) {
if (line.isEmpty() || isComment(line)) {
continue;
}
consumer.accept(line);
}
}
}
public static void readAndApply(Settings settings) {
try (Scanner scan = new Scanner(settingsFile)) {
while (scan.hasNextLine()) {
String line = scan.nextLine();
if (line.isEmpty()) {
continue;
try {
forEachLine(SETTINGS_PATH, line -> {
Matcher matcher = SETTING_PATTERN.matcher(line);
if (!matcher.matches()) {
System.out.println("Invalid syntax in setting file: " + line);
return;
}
if (line.startsWith("#") || line.startsWith("//")) {
continue;
}
int space = line.indexOf(" ");
if (space == -1) {
System.out.println("Skipping invalid line with no space: " + line);
continue;
}
String settingName = line.substring(0, space).trim().toLowerCase();
String settingValue = line.substring(space).trim();
String settingName = matcher.group("setting").toLowerCase();
String settingValue = matcher.group("value");
try {
parseAndApply(settings, settingName, settingValue);
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Unable to parse line " + line);
ex.printStackTrace();
}
}
});
} catch (NoSuchFileException ignored) {
System.out.println("Baritone settings file not found, resetting.");
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Exception while reading Baritone settings, some settings may be reset to default values!");
ex.printStackTrace();
}
}
public static synchronized void save(Settings settings) {
try (FileOutputStream out = new FileOutputStream(settingsFile)) {
for (Settings.Setting setting : settings.allSettings) {
if (setting.get() == null) {
System.out.println("NULL SETTING?" + setting.getName());
continue;
}
if (setting.getName().equals("logger")) {
continue; // NO
}
if (setting.value == setting.defaultValue) {
continue;
}
SettingsIO io = map.get(setting.getValueClass());
if (io == null) {
throw new IllegalStateException("Missing " + setting.getValueClass() + " " + setting + " " + setting.getName());
}
out.write((setting.getName() + " " + io.toString.apply(setting.get()) + "\n").getBytes());
try (BufferedWriter out = Files.newBufferedWriter(SETTINGS_PATH)) {
for (Settings.Setting setting : modifiedSettings(settings)) {
out.write(settingToString(setting) + "\n");
}
} catch (Exception ex) {
System.out.println("Exception thrown while saving Baritone settings!");
ex.printStackTrace();
System.out.println("Exception while saving Baritone settings!");
}
}
private static void parseAndApply(Settings settings, String settingName, String settingValue) throws IllegalStateException, NumberFormatException {
public static List<Settings.Setting> modifiedSettings(Settings settings) {
List<Settings.Setting> modified = new ArrayList<>();
for (Settings.Setting setting : settings.allSettings) {
if (setting.value == null) {
System.out.println("NULL SETTING?" + setting.getName());
continue;
}
if (setting.getName().equals("logger")) {
continue; // NO
}
if (setting.value == setting.defaultValue) {
continue;
}
modified.add(setting);
}
return modified;
}
public static String settingToString(Settings.Setting setting) throws IllegalStateException {
if (setting.getName().equals("logger")) {
return "logger";
}
Parser io = Parser.getParser(setting.getType());
if (io == null) {
throw new IllegalStateException("Missing " + setting.getValueClass() + " " + setting.getName());
}
return setting.getName() + " " + io.toString(new ParserContext(setting), setting.value);
}
public static void parseAndApply(Settings settings, String settingName, String settingValue) throws IllegalStateException, NumberFormatException {
Settings.Setting setting = settings.byLowerName.get(settingName);
if (setting == null) {
throw new IllegalStateException("No setting by that name");
}
Class intendedType = setting.getValueClass();
SettingsIO ioMethod = map.get(intendedType);
Object parsed = ioMethod.parser.apply(settingValue);
ISettingParser ioMethod = Parser.getParser(setting.getType());
Object parsed = ioMethod.parse(new ParserContext(setting), settingValue);
if (!intendedType.isInstance(parsed)) {
throw new IllegalStateException(ioMethod + " parser returned incorrect type, expected " + intendedType + " got " + parsed + " which is " + parsed.getClass());
}
setting.value = parsed;
}
private enum SettingsIO {
private interface ISettingParser<T> {
T parse(ParserContext context, String raw);
String toString(ParserContext context, T value);
boolean accepts(Type type);
}
private static class ParserContext {
private final Settings.Setting<?> setting;
private ParserContext(Settings.Setting<?> setting) {
this.setting = setting;
}
private Settings.Setting<?> getSetting() {
return this.setting;
}
}
private enum Parser implements ISettingParser {
DOUBLE(Double.class, Double::parseDouble),
BOOLEAN(Boolean.class, Boolean::parseBoolean),
INTEGER(Integer.class, Integer::parseInt),
FLOAT(Float.class, Float::parseFloat),
LONG(Long.class, Long::parseLong),
ENUMFACING(EnumFacing.class, EnumFacing::byName),
COLOR(
Color.class,
str -> new Color(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue()
),
VEC3I(
Vec3i.class,
str -> new Vec3i(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])),
vec -> vec.getX() + "," + vec.getY() + "," + vec.getZ()
),
BLOCK(
Block.class,
str -> BlockUtils.stringToBlockRequired(str.trim()),
BlockUtils::blockToString
),
ITEM(
Item.class,
str -> IRegistry.ITEM.get(new ResourceLocation(str.trim())),
item -> IRegistry.ITEM.getKey(item).toString()
),
LIST() {
@Override
public Object parse(ParserContext context, String raw) {
Type type = ((ParameterizedType) context.getSetting().getType()).getActualTypeArguments()[0];
Parser parser = Parser.getParser(type);
return Arrays.stream(raw.split(","))
.map(s -> parser.parse(context, s))
.collect(Collectors.toList());
}
ITEM_LIST(ArrayList.class, str -> Stream.of(str.split(",")).map(Item::getByNameOrId).collect(Collectors.toCollection(ArrayList::new)), list -> ((ArrayList<Item>) list).stream().map(Item.REGISTRY::getNameForObject).map(ResourceLocation::toString).collect(Collectors.joining(","))),
COLOR(Color.class, str -> new Color(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])), color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue());
@Override
public String toString(ParserContext context, Object value) {
Type type = ((ParameterizedType) context.getSetting().getType()).getActualTypeArguments()[0];
Parser parser = Parser.getParser(type);
return ((List<?>) value).stream()
.map(o -> parser.toString(context, o))
.collect(Collectors.joining(","));
}
Class<?> klass;
Function<String, Object> parser;
Function<Object, String> toString;
@Override
public boolean accepts(Type type) {
return List.class.isAssignableFrom(TypeUtils.resolveBaseClass(type));
}
};
<T> SettingsIO(Class<T> klass, Function<String, T> parser) {
private final Class<?> klass;
private final Function<String, Object> parser;
private final Function<Object, String> toString;
Parser() {
this.klass = null;
this.parser = null;
this.toString = null;
}
<T> Parser(Class<T> klass, Function<String, T> parser) {
this(klass, parser, Object::toString);
}
<T> SettingsIO(Class<T> klass, Function<String, T> parser, Function<T, String> toString) {
<T> Parser(Class<T> klass, Function<String, T> parser, Function<T, String> toString) {
this.klass = klass;
this.parser = parser::apply;
this.toString = x -> toString.apply((T) x);
}
}
static {
HashMap<Class<?>, SettingsIO> tempMap = new HashMap<>();
for (SettingsIO type : SettingsIO.values()) {
tempMap.put(type.klass, type);
@Override
public Object parse(ParserContext context, String raw) {
Object parsed = this.parser.apply(raw);
Objects.requireNonNull(parsed);
return parsed;
}
@Override
public String toString(ParserContext context, Object value) {
return this.toString.apply(value);
}
@Override
public boolean accepts(Type type) {
return type instanceof Class && this.klass.isAssignableFrom((Class) type);
}
public static Parser getParser(Type type) {
return Arrays.stream(values())
.filter(parser -> parser.accepts(type))
.findFirst().orElse(null);
}
map = Collections.unmodifiableMap(tempMap);
}
}

View File

@@ -0,0 +1,44 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
* @author Brady
* @since 4/20/2019
*/
public final class TypeUtils {
private TypeUtils() {}
/**
* Resolves the "base type" for the specified type. For example, if the specified
* type is {@code List<String>}, then {@code List.class} will be returned. If the
* specified type is already a class, then it is directly returned.
*
* @param type The type to resolve
* @return The base class
*/
public static Class<?> resolveBaseClass(Type type) {
return type instanceof Class ? (Class<?>) type
: type instanceof ParameterizedType ? (Class<?>) ((ParameterizedType) type).getRawType()
: null;
}
}

View File

@@ -19,11 +19,12 @@ package baritone.api.utils;
import net.minecraft.block.BlockFire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.World;
/**
* @author Brady
@@ -33,25 +34,26 @@ public final class VecUtils {
private VecUtils() {}
/**
* The {@link Minecraft} instance
*/
private static final Minecraft mc = Minecraft.getMinecraft();
/**
* Calculates the center of the block at the specified position's bounding box
*
* @see #getBlockPosCenter(BlockPos)
*
* @param pos The block position
* @param world The world that the block is in, used to provide the bounding box
* @param pos The block position
* @return The center of the block's bounding box
* @see #getBlockPosCenter(BlockPos)
*/
public static Vec3d calculateBlockCenter(BlockPos pos) {
IBlockState b = mc.world.getBlockState(pos);
AxisAlignedBB bbox = b.getBoundingBox(mc.world, pos);
double xDiff = (bbox.minX + bbox.maxX) / 2;
double yDiff = (bbox.minY + bbox.maxY) / 2;
double zDiff = (bbox.minZ + bbox.maxZ) / 2;
public static Vec3d calculateBlockCenter(World world, BlockPos pos) {
IBlockState b = world.getBlockState(pos);
VoxelShape shape = b.getCollisionShape(world, pos);
if (shape.isEmpty()) {
return getBlockPosCenter(pos);
}
double xDiff = (shape.getStart(EnumFacing.Axis.X) + shape.getEnd(EnumFacing.Axis.X)) / 2;
double yDiff = (shape.getStart(EnumFacing.Axis.Y) + shape.getEnd(EnumFacing.Axis.Y)) / 2;
double zDiff = (shape.getStart(EnumFacing.Axis.Z) + shape.getEnd(EnumFacing.Axis.Z)) / 2;
if (Double.isNaN(xDiff) || Double.isNaN(yDiff) || Double.isNaN(zDiff)) {
throw new IllegalStateException(b + " " + pos + " " + shape);
}
if (b.getBlock() instanceof BlockFire) {//look at bottom of fire when putting it out
yDiff = 0;
}
@@ -68,10 +70,9 @@ public final class VecUtils {
* <p>
* TODO: We may want to consider replacing many usages of this method with #calculateBlockCenter(BlockPos)
*
* @see #calculateBlockCenter(BlockPos)
*
* @param pos The block position
* @return The assumed center of the position
* @see #calculateBlockCenter(World, BlockPos)
*/
public static Vec3d getBlockPosCenter(BlockPos pos) {
return new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
@@ -80,19 +81,17 @@ public final class VecUtils {
/**
* Gets the distance from the specified position to the assumed center of the specified block position.
*
* @see #getBlockPosCenter(BlockPos)
*
* @param pos The block position
* @param x The x pos
* @param y The y pos
* @param z The z pos
* @param x The x pos
* @param y The y pos
* @param z The z pos
* @return The distance from the assumed block center to the position
* @see #getBlockPosCenter(BlockPos)
*/
public static double distanceToCenter(BlockPos pos, double x, double y, double z) {
Vec3d center = getBlockPosCenter(pos);
double xdiff = x - center.x;
double ydiff = y - center.y;
double zdiff = z - center.z;
double xdiff = pos.getX() + 0.5 - x;
double ydiff = pos.getY() + 0.5 - y;
double zdiff = pos.getZ() + 0.5 - z;
return Math.sqrt(xdiff * xdiff + ydiff * ydiff + zdiff * zdiff);
}
@@ -100,11 +99,10 @@ public final class VecUtils {
* Gets the distance from the specified entity's position to the assumed
* center of the specified block position.
*
* @see #getBlockPosCenter(BlockPos)
*
* @param entity The entity
* @param pos The block position
* @param pos The block position
* @return The distance from the entity to the block's assumed center
* @see #getBlockPosCenter(BlockPos)
*/
public static double entityDistanceToCenter(Entity entity, BlockPos pos) {
return distanceToCenter(pos, entity.posX, entity.posY, entity.posZ);
@@ -114,11 +112,10 @@ public final class VecUtils {
* Gets the distance from the specified entity's position to the assumed
* center of the specified block position, ignoring the Y axis.
*
* @see #getBlockPosCenter(BlockPos)
*
* @param entity The entity
* @param pos The block position
* @param pos The block position
* @return The horizontal distance from the entity to the block's assumed center
* @see #getBlockPosCenter(BlockPos)
*/
public static double entityFlatDistanceToCenter(Entity entity, BlockPos pos) {
return distanceToCenter(pos, entity.posX, pos.getY() + 0.5, entity.posZ);

View File

@@ -15,40 +15,57 @@
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.utils.interfaces;
package baritone.api.utils.input;
/**
* @author Brady
* @since 8/20/2018
* An {@link Enum} representing the inputs that control the player's
* behavior. This includes moving, interacting with blocks, jumping,
* sneaking, and sprinting.
*/
public interface Toggleable {
public enum Input {
/**
* Toggles the enabled state of this {@link Toggleable}.
*
* @return The new state.
* The move forward input
*/
boolean toggle();
MOVE_FORWARD,
/**
* Sets the enabled state of this {@link Toggleable}.
*
* @return The new state.
* The move back input
*/
boolean setEnabled(boolean enabled);
MOVE_BACK,
/**
* @return Whether or not this {@link Toggleable} object is enabled
* The move left input
*/
boolean isEnabled();
MOVE_LEFT,
/**
* Called when the state changes from disabled to enabled
* The move right input
*/
default void onEnable() {}
MOVE_RIGHT,
/**
* Called when the state changes from enabled to disabled
* The attack input
*/
default void onDisable() {}
CLICK_LEFT,
/**
* The use item input
*/
CLICK_RIGHT,
/**
* The jump input
*/
JUMP,
/**
* The sneak input
*/
SNEAK,
/**
* The sprint input
*/
SPRINT
}

View File

@@ -29,7 +29,7 @@ import java.util.List;
/**
* @author Brady
* @since 7/31/2018 9:59 PM
* @since 7/31/2018
*/
public class BaritoneTweaker extends SimpleTweaker {

View File

@@ -0,0 +1,105 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch;
import com.google.common.base.Strings;
import com.google.gson.GsonBuilder;
import com.mojang.authlib.Agent;
import com.mojang.authlib.exceptions.AuthenticationException;
import com.mojang.authlib.properties.PropertyMap;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
import net.minecraft.launchwrapper.Launch;
import java.io.File;
import java.lang.reflect.Field;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Based on GradleStart from ForgeGradle 2.3
*
* @author Brady
* @since 3/11/2019
*/
public class LaunchTesting {
public static void main(String[] args) {
Map<String, String> arguments = new HashMap<>();
hackNatives();
arguments.put("version", "BaritownedDeveloperEnvironment");
arguments.put("assetIndex", System.getenv("assetIndex"));
arguments.put("assetsDir", System.getenv().getOrDefault("assetDirectory", "assets"));
arguments.put("accessToken", "FML");
arguments.put("userProperties", "{}");
arguments.put("tweakClass", System.getenv("tweakClass"));
String password = System.getenv("password");
if (password != null && !password.isEmpty()) {
attemptLogin(arguments, System.getenv("username"), System.getenv("password"));
}
List<String> argsArray = new ArrayList<>();
arguments.forEach((k, v) -> {
argsArray.add("--" + k);
argsArray.add(v);
});
Launch.main(argsArray.toArray(new String[0]));
}
private static void hackNatives() {
String paths = System.getProperty("java.library.path");
String nativesDir = System.getenv().get("nativesDirectory");
if (Strings.isNullOrEmpty(paths))
paths = nativesDir;
else
paths += File.pathSeparator + nativesDir;
System.setProperty("java.library.path", paths);
// hack the classloader now.
try {
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);
} catch (Throwable ignored) {}
}
private static void attemptLogin(Map<String, String> argMap, String username, String password) {
YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) (new YggdrasilAuthenticationService(Proxy.NO_PROXY, "1")).createUserAuthentication(Agent.MINECRAFT);
auth.setUsername(username);
auth.setPassword(password);
try {
auth.logIn();
} catch (AuthenticationException var4) {
throw new RuntimeException(var4);
}
argMap.put("accessToken", auth.getAuthenticatedToken());
argMap.put("uuid", auth.getSelectedProfile().getId().toString().replace("-", ""));
argMap.put("username", auth.getSelectedProfile().getName());
argMap.put("userType", auth.getUserType().getName());
argMap.put("userProperties", (new GsonBuilder()).registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer()).create().toJson(auth.getUserProperties()));
}
}

View File

@@ -32,7 +32,9 @@ import java.io.File;
@Mixin(AnvilChunkLoader.class)
public class MixinAnvilChunkLoader implements IAnvilChunkLoader {
@Shadow @Final private File chunkSaveLocation;
@Shadow
@Final
private File chunkSaveLocation;
@Override
public File getChunkSaveLocation() {

View File

@@ -35,6 +35,12 @@ public class MixinBlockPos extends Vec3i {
super(xIn, yIn, zIn);
}
/**
* The purpose of this was to ensure a friendly name for when we print raw
* block positions to chat in the context of an obfuscated environment.
*
* @return a string representation of the object.
*/
@Override
@Nonnull
public String toString() {

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