Compare commits

..

943 Commits

Author SHA1 Message Date
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
b4d307d4cc cherry pick some movement fixes from builder 2019-01-29 19:56:50 -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
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
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
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
59320d9b85 Auto test class javadoc 2019-01-16 13:37:39 -06:00
Leijurv
9dfcef6356 crucial performance optimization 2019-01-15 17:21:50 -08:00
Leijurv
ae3fc14b52 refactor name 2019-01-14 19:52:31 -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
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
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
Brady
f727e71eaf Expose IPathingControlManager in IBaritone 2019-01-10 19:57:09 -06:00
Leijurv
14f006c3a5 Merge branch 'epic-movement-input' 2019-01-10 17:25:57 -08:00
Leijurv
200211c186 dont continue walking if there is no process in charge 2019-01-10 13:52:52 -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
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
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
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
bebdede33b unneeded 2018-12-26 18:07:14 -10: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
Leijurv
6fdf845349 v0.0.9 2018-10-14 10:27:50 -07:00
Brady
c80b855dab Move a lot of utils to api 2018-10-14 00:55:30 -05:00
Brady
83fc11e75b private static final > private final static 2018-10-14 00:24:59 -05:00
Brady
9654892e54 Make BlockStateInterface.AIR final 2018-10-14 00:23:49 -05:00
Brady
b46fad1442 Fix bad reference 2018-10-13 23:27:11 -05:00
Brady
ff652dbe40 scanLoadedChunks -> scanChunkRadius 2018-10-13 23:15:34 -05:00
leijurv
897483884a fix 2 block parkour failure on lilypads and after descends 2018-10-13 17:01:40 -07:00
Leijurv
ba68990ef8 update codacy badge 2018-10-13 12:36:05 -07:00
Leijurv
de29a6532f privatize 2018-10-13 12:29:14 -07:00
Leijurv
9045791e7f cleanup 2018-10-13 12:28:20 -07:00
Leijurv
ab2fa0ba88 update instructions for new build system 2018-10-12 21:36:41 -07:00
Leijurv
56b67cbc47 no longer needed 2018-10-12 21:21:51 -07:00
leijurv
b6a1608e73 some improvements 2018-10-12 21:19:24 -07:00
Brady
6277c20e4c funny number 2018-10-12 22:15:54 -05:00
Brady
2fc282477d No need to override Read 2018-10-12 22:13:21 -05:00
Brady
917f393f7a Merge pull request #221 from cabaletta/gradle-proguard
Proguard Gradle Build Magic
2018-10-12 21:39:47 -05:00
Brady
045504ecf7 No differences. 100% NONE 2018-10-12 21:38:05 -05:00
Leijurv
7efc0ae8ca fix snow bs 2018-10-12 19:33:03 -07:00
Brady
3958dce341 cancer 2018-10-12 21:31:33 -05:00
Brady
d1a9012deb 2 spaces 2018-10-12 21:24:35 -05:00
Leijurv
dbde993a76 Merge branch 'master' into gradle-proguard 2018-10-12 19:24:18 -07:00
Brady
96c66d2809 CreateDist task 2018-10-12 21:21:16 -05:00
Brady
df1633b2a1 You shouldn't write a json to a jar and treat it like a jar 2018-10-12 20:42:24 -05:00
Brady
24f18f0ac2 Json sorting 2018-10-12 19:47:13 -05:00
Brady
416fea2aa5 Remove unnecessary removeIf usage 2018-10-12 18:10:54 -05:00
Brady
93286a646f Use Gradle Internal Pair 2018-10-12 18:08:15 -05:00
Brady
8fba36c05e Initial Proguard Task meme
Working Determinizer, but it doesn't sort the JSON object keys
time to rek travis
2018-10-12 17:56:09 -05:00
Leijurv
b443be1795 more accurate check 2018-10-12 15:29:25 -07:00
Leijurv
4892192c6c remove unused functions 2018-10-12 15:14:39 -07:00
Leijurv
6b7a8e2bd3 better protection logic, fix placing outside worldborder 2018-10-12 14:34:33 -07:00
Leijurv
c5f5445f4b fix exception when calculating descend from starting position above 256 2018-10-12 14:19:11 -07:00
Leijurv
8a65f43a0b check world border, fixes #218 2018-10-12 14:12:06 -07:00
Leijurv
76e4a1a649 brag about reproducible builds some more 2018-10-11 21:22:46 -07:00
Leijurv
5167c0c886 zip too 2018-10-11 21:12:00 -07:00
Leijurv
9d3d8f6c82 forgot install 2018-10-11 21:05:00 -07:00
Leijurv
7e4a1169af extract, sort, and reinsert refmap json into final jar 2018-10-11 21:04:07 -07:00
Leijurv
773ad89951 refactor problematic area 2018-10-11 20:36:18 -07:00
Leijurv
c2adcdb051 fix 2018-10-11 20:11:35 -07:00
Leijurv
b75bc6d03d comment out until its back online 2018-10-11 20:04:45 -07:00
Leijurv
e3b80f11ad brag about how reproducible our builds are 2018-10-11 20:02:26 -07:00
Leijurv
f33a2ef11b fully automated reproducible space deterministic builds 2018-10-11 18:52:58 -07:00
Brady
130b21f738 Fix issue with user input check that messed up Auto Eat 2018-10-11 18:50:55 -05:00
Leijurv
ee954d6a4e break proguard less 2018-10-11 13:24:23 -07:00
Brady
54215bdb18 Just ONE tweaker
When we make the next release, we need to specify in the setup files that Baritone now requires the SimpleTweaker dependency, and we need to remove the old alternate tweaker references. (Optifine and Forge)
2018-10-11 14:53:20 -05:00
Leijurv
0db18a7caf v0.0.8 2018-10-11 11:48:07 -07:00
Leijurv
a1c0f4dbb4 keep baritone provider properly 2018-10-11 11:10:59 -07:00
Brady
db7d3184c9 fINAL 2018-10-11 12:34:40 -05:00
Brady
7dfe6ac3ca Add EntityPlayerSP field to relevant events 2018-10-11 12:32:42 -05:00
Leijurv
8fd921c60e disable cancelOnGoalInvalidation 2018-10-10 21:28:55 -07:00
Leijurv
fec29d03fd automatically break block while suffocating, fixes #33 2018-10-10 21:25:21 -07:00
Leijurv
9bd205f190 center pillar regardless of timing 2018-10-10 21:07:59 -07:00
Leijurv
089037663e tweak backtrack cost favoring coefficient 2018-10-10 21:06:31 -07:00
leijurv
8c0bc3e2ef splice tighter, fixes #44 2018-10-10 20:49:25 -07:00
leijurv
db21045cfb renderPathIgnoreDepth 2018-10-10 20:40:15 -07:00
Leijurv
fbf0f2271c revamp pathStart, fixes #209 2018-10-10 17:05:51 -07:00
Leijurv
7e78ed2139 rework minebehavior threading model, fixes #217 2018-10-10 16:40:33 -07:00
Leijurv
5676acbba6 add off hand, fixes #206 2018-10-10 16:29:48 -07:00
Leijurv
43b155d7b8 better check than air 2018-10-10 16:27:48 -07:00
Brady
93158226b6 The sources jar should use SRG names not MCP 2018-10-10 14:10:02 -05:00
Leijurv
d3bf4ef198 renderSelectionBoxesIgnoreDepth 2018-10-09 19:34:53 -07:00
Leijurv
fc9d13a03c there was literally no reason to have it like that 2018-10-09 17:36:35 -07:00
Leijurv
22d2036657 splice better, fixes #215 2018-10-09 16:40:04 -07:00
Leijurv
9e15960581 fix pause stuttering, fixes #216 2018-10-09 16:13:46 -07:00
leijurv
738ce25ff0 tighten fall column 2018-10-09 11:15:42 -07:00
Brady
5da9347e2c Merge pull request #214 from cabaletta/path-api
Pathing API
2018-10-09 00:14:25 -05:00
Brady
771e892b31 Get Cutoff implementation out of API we DON'T need you 2018-10-09 00:10:50 -05:00
Leijurv
9df5f942de add shebang 2018-10-08 22:01:57 -07:00
Brady
0fb5f3233f MovementStatus javadocs 2018-10-08 23:52:36 -05:00
Leijurv
f17ce87e45 publicize 2018-10-08 21:51:19 -07:00
Leijurv
a497a944a6 bottom of the class 2018-10-08 21:49:36 -07:00
Brady
2e69bbe371 Minimal CutoffResult Javadocs 2018-10-08 23:34:12 -05:00
Brady
875f01c358 More comprehensive IPath javadocs 2018-10-08 23:29:16 -05:00
Leijurv
8e1d827819 v0.0.7 2018-10-08 20:57:06 -07:00
Brady
6a4a8ab2d9 I'm an IDIOT 2018-10-08 21:09:54 -05:00
Brady
8278576227 Rename getCurrentPathSearch to getPathFinder 2018-10-08 21:02:55 -05:00
Brady
7d0aa4d7a5 Add override annotation to getPath in PathExecutor 2018-10-08 20:39:33 -05:00
Brady
2b4512ee3f Move to API 2018-10-08 20:37:52 -05:00
Leijurv
413e505683 epic 2018-10-08 18:08:01 -07:00
Leijurv
0f1edba5f1 save settings 2018-10-08 18:05:08 -07:00
Brady
e23a9c976a Bad code 2018-10-08 20:01:44 -05:00
Brady
1449edb8af Didn't need to do that 2018-10-08 19:59:25 -05:00
Brady
d177db5a35 IMovement
Hey would you look at that
2018-10-08 19:57:22 -05:00
Brady
1245e222a7 Begin path api prep 2018-10-08 19:23:43 -05:00
Leijurv
336154fd9b clean up build and remove unnecessary files 2018-10-08 15:25:09 -07:00
Brady
0ee14b4b90 Good javadocs
They're not good they're shit I lied to you
2018-10-08 17:12:51 -05:00
Leijurv
5a9e5cdac4 move rendering, fixes #212 2018-10-08 15:11:07 -07:00
Brady
10bb177664 Add renderGoalIgnoreDepth setting 2018-10-08 17:06:41 -05:00
leijurv
69762bf4b4 fix parkour maybe? fixes #211 2018-10-07 22:08:37 -07:00
leijurv
e17cc79cb3 synchronize MemoryBehavior, fixes #198 2018-10-07 21:55:40 -07:00
leijurv
60c29fd159 actually stop sprinting, fixes #199 2018-10-07 21:40:18 -07:00
Leijurv
7481c98dbc more documentation 2018-10-07 17:57:07 -07:00
Leijurv
796b45601e add info about reproducibility 2018-10-07 17:39:13 -07:00
Leijurv
b5347cebc3 cleanup build gradle 2018-10-07 17:02:21 -07:00
Leijurv
65ce5ca752 fix nullpointerexception in cachedworld 2018-10-07 16:57:04 -07:00
Leijurv
d1e62ef8f2 ok but really this time they're deterministic 2018-10-07 16:56:46 -07:00
Leijurv
db8daf4c59 maybe in jar 2018-10-07 16:07:35 -07:00
Leijurv
80240cb9f2 maybe needs to be higher 2018-10-07 14:23:29 -07:00
Leijurv
4da0731664 deterministic 2018-10-07 12:00:18 -07:00
leijurv
af357d4d8e fix a weird bug 2018-10-06 20:28:47 -07:00
Leijurv
8c76573395 don't pause on one block overlap 2018-10-06 18:43:20 -07:00
Leijurv
939e9c32d5 pause when current best is a backtrack, fixes #201 2018-10-06 18:39:48 -07:00
Brady
e4ef659756 Fix WorldScanner exposure 2018-10-06 20:35:32 -05:00
Brady
4b61452c62 Expose WorldScanner in API 2018-10-06 20:30:09 -05:00
Brady
d5130aa6ba Expose event listener registry in API 2018-10-06 20:16:38 -05:00
Leijurv
6c9f317f31 don't look to the side on a parkour place until the place is in range 2018-10-05 18:27:02 -07:00
Leijurv
1ab5609d4e spam travis less 2018-10-05 15:51:23 -07:00
Leijurv
78b626af23 v0.0.6 2018-10-05 15:42:02 -07:00
Leijurv
046de84360 that should really default to true 2018-10-05 14:39:17 -07:00
Leijurv
ca48dabcc7 change sneak-backplace behavior, fixes #208 2018-10-05 13:49:47 -07:00
Leijurv
9880a4e948 when asusmeSafeWalk is on, we don't sneak in the first place 2018-10-05 13:11:09 -07:00
Leijurv
cb589219d8 use mutable move result to avoid instantianing ten million move result objects 2018-10-05 12:32:42 -07:00
Leijurv
6fff4c5254 reduce repetition in Moves 2018-10-05 10:17:58 -07:00
Leijurv
4049c116d9 dynamicY and yOffset 2018-10-05 10:10:24 -07:00
Leijurv
b720742f53 render the goal block, fixes #166 2018-10-04 21:28:34 -07:00
leijurv
c1af050fa6 fix lilypad fall cost, fixes #207 2018-10-04 16:01:27 -07:00
Leijurv
39f415d4be allowplace and allowparkourplace 2018-10-03 19:00:58 -07:00
Leijurv
4590b9f6da they say you are what you eat, but i don't remember eating a minecraft damn daniel mod 2018-10-03 13:45:43 -07:00
Brady
ee6e0b1784 Add message and actually cancel event 2018-10-03 12:45:57 -05:00
Brady
820c108548 Add pause "command" in ExampleBaritoneControl 2018-10-03 12:44:28 -05:00
Leijurv
239bb14e3a add blockBreakAdditionalPenalty 2018-10-03 08:20:24 -07:00
Leijurv
1bd7c8455f crucial performance optimization 2018-10-03 08:14:15 -07:00
Leijurv
6986f179cd it's not much of an improvement, but it won't make it slower 2018-10-03 08:12:57 -07:00
Leijurv
28af41b789 defer movement propagation and assembly to postprocessing 2018-10-03 08:04:30 -07:00
Leijurv
36bdaa99ec DAE BlockPos bad? 2018-10-03 07:57:24 -07:00
Leijurv
1ee44024b2 don't construct favored positions hashset if the coefficient renders it useless 2018-10-03 07:52:17 -07:00
Leijurv
cd926283b3 avoid synthetic lambda creation 2018-10-03 07:48:26 -07:00
Leijurv
04d210bd8b no need to calculate the hash on contstruction anymore 2018-10-03 07:43:45 -07:00
Leijurv
38895beb5d remove width and height override part 2: electric boogaloo 2018-10-02 17:15:00 -07:00
Leijurv
3fdc4d6ee0 parkour jumping onto a vine, sort of 2018-10-02 15:34:46 -07:00
Leijurv
baf27363aa fix movement ascend x z cardinal asymmetry, fixes #204 2018-10-02 15:02:27 -07:00
Leijurv
da137f35de fix parkour jumps ending on lilypads, fixes #203 2018-10-02 14:04:24 -07:00
Brady
feeeae5918 Add autotest directory to gitignore
If you're not using "autotest" as ur auto test "testing" directory, you SHOULD.
2018-10-02 15:28:20 -05:00
Brady
02a04773c6 bad javadocs 2018-10-02 15:27:25 -05:00
Brady
7e7b9f4fdb Make MemoryBehavior store data by world 2018-10-02 15:25:58 -05:00
Leijurv
85e4a57c76 no longer needed since goal is in api which in unobfed 2018-10-02 10:19:14 -07:00
Leijurv
6fd7b2a7f3 fix proguard for service provider 2018-10-02 10:17:56 -07:00
Leijurv
24be1d0ff3 lookahead a little more 2018-10-02 10:01:54 -07:00
Leijurv
2867e0626f reenable diagonal through water 2018-10-02 09:59:07 -07:00
Leijurv
f0c3e59a6f move from todo to issue 2018-10-01 22:50:51 -07:00
Leijurv
4e11d92d19 fix parkour cost calculation 2018-10-01 19:23:13 -07:00
Leijurv
07eee481cb fix failure on repeated descend 2018-10-01 15:42:16 -07:00
Leijurv
8f146d1a2b increase degree of backtrack cost favoring 2018-10-01 15:35:18 -07:00
Leijurv
1cc03e3aca it doesn't actually have to be falling, it just has to be solid 2018-10-01 15:20:52 -07:00
Leijurv
023822b5d9 stop breaking block on cancel, even if not requested by player 2018-10-01 15:11:52 -07:00
Leijurv
41ffd4455d don't cancel for any reason while doing a water bucket fall, fixes #98, fixes #123 2018-10-01 14:50:20 -07:00
Leijurv
810b92fbad Merge pull request #193 from cabaletta/service-loader
Service loader
2018-10-01 14:37:15 -07:00
Leijurv
6db31cbe74 now that that's fixed, we can tighten the maximum time again 2018-10-01 14:37:01 -07:00
Leijurv
b55a102d37 take depth strider into acocunt for water speed, fixes #101 2018-10-01 14:26:55 -07:00
Leijurv
f338cdd2e5 clear all keys including sprint in the next movement, fixes #194 2018-10-01 14:26:08 -07:00
Leijurv
76365a4564 sprint on soul sand, fixes #120 2018-10-01 10:05:04 -07:00
Leijurv
109cffc3de rearrange blockstate lookups 2018-10-01 09:57:47 -07:00
Leijurv
c67339dc42 Merge branch 'master' into service-loader 2018-10-01 09:53:03 -07:00
Leijurv
f56766be26 maybe it just needs more time 2018-10-01 09:51:43 -07:00
Leijurv
b1e1cc43e0 simplify properly even when obfuscated 2018-09-30 21:43:07 -07:00
Leijurv
13aaec07cd draw most recent node considered even if there is no valid best 2018-09-30 21:42:34 -07:00
Leijurv
08b9eab9f3 draw most recent node considered even if there is no valid best 2018-09-30 21:32:13 -07:00
Leijurv
09ac3c615c more time maybe 2018-09-30 09:14:23 -07:00
Leijurv
19ce1cf4a7 Merge branch 'master' into service-loader 2018-09-30 08:08:46 -07:00
Leijurv
d58ad6f68f finalize 2018-09-30 08:03:33 -07:00
Leijurv
866648192b readd width and height override 2018-09-30 07:58:44 -07:00
Brady
3184eaf595 Remove IBaritoneProvider#getSettings 2018-09-29 23:59:32 -05:00
Brady
b12c2ea62f UTILIZE Service Loaders
https://i.imgur.com/kAm0xd3.png
2018-09-29 23:52:01 -05:00
Leijurv
bcb95c55c9 allow a bit more time, it's a little flaky on travis right now 2018-09-29 07:43:34 -07:00
Leijurv
229739575c BaritoneAutoTest overrides width and height on its own 2018-09-29 07:32:58 -07:00
Leijurv
4b76af2487 update settings link 2018-09-29 07:30:56 -07:00
Leijurv
c383186808 sprint through descend then ascend in the same direction, fixes #115 2018-09-28 18:55:04 -07:00
Leijurv
2f602f8718 no stop dont 2018-09-27 16:11:55 -07:00
Leijurv
015462eddb beg people not to disable chunk caching 2018-09-27 15:37:22 -07:00
Leijurv
de6d6c8714 cached chunks expiration setting, fixes #181 2018-09-27 15:19:55 -07:00
Leijurv
1b2304146b reorganized diagonal 2018-09-26 17:25:18 -07:00
Leijurv
f28cdc531f this will really help performance a lot 2018-09-26 15:34:06 -07:00
Leijurv
2aa4770b45 add settings for pathing hashmap 2018-09-26 15:01:14 -07:00
Brady
1d931a4bb6 lol epic 2018-09-26 16:21:53 -05:00
Leijurv
9094c712d6 only optimize game settings if we are going to be auto testing 2018-09-26 13:46:08 -07:00
Leijurv
40a3177ae7 no need to get that twice 2018-09-26 13:05:36 -07:00
Leijurv
8ef89a8c80 bump mixin 2018-09-26 12:43:00 -07:00
Leijurv
ceb9ad9aa8 retry failed dependency downloads 2018-09-26 12:40:53 -07:00
Leijurv
dec1877123 bump lwjgl 2018-09-26 12:36:07 -07:00
Leijurv
34aa7cb6b5 only 1.11 exists 2018-09-26 11:22:06 -07:00
Leijurv
730ebb0070 remove sources 2018-09-26 11:09:25 -07:00
Leijurv
c4a3820c6a Try in other order 2018-09-26 10:46:42 -07:00
Leijurv
d4a846a672 maybe fix 2018-09-26 10:18:08 -07:00
Leijurv
a125170840 fix proguard path 2018-09-26 10:12:23 -07:00
Leijurv
d5d1d65bf3 fix build failure on repeated runs 2018-09-26 10:07:44 -07:00
Leijurv
fb45d73406 fetch jars from gradle instead of dropbox, fixes #189 2018-09-26 10:06:52 -07:00
Leijurv
5ec3971380 should match build.gradle 2018-09-26 09:51:25 -07:00
Leijurv
63b6169475 renamed 1.12.2 to minecraft 1.12.2 2018-09-26 09:50:24 -07:00
Leijurv
ab0d713882 THX 0x22 2018-09-25 22:18:19 -07:00
Leijurv
19661cc99c it takes more time to go a longer distance what a wild concept 2018-09-25 22:07:51 -07:00
Leijurv
d58656571a thx 0x22 2018-09-25 21:58:22 -07:00
Leijurv
4900c76752 merge 2018-09-25 21:57:00 -07:00
Brady
d899ff7f7b 2 iq 2018-09-25 23:24:48 -05:00
Brady
36651553fe Increase max ticks accordingly
See last commit
2018-09-25 23:17:15 -05:00
Brady
d9596fcac9 Travis may actually take 10 seconds to load in 2018-09-25 23:16:20 -05:00
Leijurv
aa7b77b413 can't pause on lost focus in xvfb 2018-09-25 18:57:50 -07:00
Brady
b3f06c6fac Allow pause on lost focus 2018-09-25 20:54:33 -05:00
Brady
3483be4bed Sync framerate limit with tps in auto test 2018-09-25 20:43:49 -05:00
Brady
d7a0d26fd2 Optimize game settings for better travis performance 2018-09-25 20:31:54 -05:00
Brady
90666cdfc1 Plutie's Jenkins is back 2018-09-25 19:04:34 -05:00
Leijurv
3072de610c add release link 2018-09-25 16:17:32 -07:00
Leijurv
a3e12d299f no release body 2018-09-25 14:42:00 -07:00
Leijurv
3556a22818 properly escape quotes 2018-09-25 14:18:49 -07:00
Leijurv
9abc34ca4c less unneeded output 2018-09-25 13:55:03 -07:00
Leijurv
f561ff84fa a more interesting route 2018-09-25 13:45:29 -07:00
Leijurv
cd9f7637b4 less verbose wget 2018-09-25 12:27:24 -07:00
Leijurv
c9b57e8052 remove dist/ from checksums 2018-09-25 12:25:35 -07:00
Leijurv
cf43a410c3 tweak travis 2018-09-25 12:06:02 -07:00
Leijurv
00658dcaba allow a little more time 2018-09-25 11:56:48 -07:00
Leijurv
9624e343af fix dockerfile 2018-09-25 11:46:23 -07:00
Leijurv
eb78a1f49b tweak starting and ending positions for less water 2018-09-25 11:37:45 -07:00
Leijurv
b056f18444 Merge branch 'master' into travis-test 2018-09-25 11:32:49 -07:00
Leijurv
a3f42e2292 fix pillar up in water without throwaway 2018-09-25 11:32:40 -07:00
Leijurv
ce55cc56c1 BaritoneAutoTest 2018-09-25 11:19:25 -07:00
Leijurv
7db973017a merge 2018-09-25 10:02:38 -07:00
Leijurv
6b810c570b install jshon earlier 2018-09-25 09:58:11 -07:00
Leijurv
353f2c7d9f extra end paren 2018-09-25 09:53:19 -07:00
Leijurv
5a82b2b322 deploy checksums to body 2018-09-25 09:08:35 -07:00
Leijurv
1b1670427b bump version and move proguard to scripts 2018-09-25 08:06:39 -07:00
Leijurv
c165070c5e release checksums 2018-09-25 08:01:10 -07:00
Leijurv
35710103cd me, an idiot 2018-09-25 07:52:39 -07:00
Leijurv
3e606e83b5 lol 2018-09-25 07:49:46 -07:00
Leijurv
09f0eca7cb script it 2018-09-25 07:46:45 -07:00
Brady
c94ac6e26c Better Rotation 2018-09-25 09:40:22 -05:00
Leijurv
9d3392c25c maybe it needs to be exported 2018-09-25 07:40:00 -07:00
Leijurv
50ea3d7b93 maybe it needs to be in env 2018-09-25 07:37:08 -07:00
Leijurv
17591736c4 version only in build.gradle 2018-09-25 07:33:16 -07:00
Brady
bb5b1a7a91 Rename ActionCosts...Test
that one
2018-09-25 09:08:29 -05:00
Brady
7632f0184c I'm kind of dumb 2018-09-25 07:52:56 -05:00
Brady
0a451dc15e Fix checksums 2018-09-25 07:40:13 -05:00
Brady
56717b83a8 Deploy optimized and regular jars to release 2018-09-25 07:39:47 -05:00
Brady
cd379c1852 Fix version to 0.0.2 and update references 2018-09-25 07:32:32 -05:00
Brady
a74c1531db Change version to 0.0.1 in build.gradle 2018-09-25 07:19:26 -05:00
Leijurv
67f0a3d73f automatic release builds 2018-09-24 21:46:26 -07:00
Leijurv
780d967d41 update prebuilt jar 2018-09-24 19:05:42 -07:00
Leijurv
61cf103df4 fix pathing 2018-09-24 18:56:57 -07:00
Brady
80a734141c Fix compiler error 2018-09-24 20:45:16 -05:00
Brady
40bea503c3 Merge ActionCosts with ActionCostsButOnlyTheOnesThatMakeMickeyDieInside 2018-09-24 20:40:04 -05:00
Brady
0f7743263e Move goals to api 2018-09-24 20:33:00 -05:00
Leijurv
1b74c8c8be Update BlockBreakHelper.java 2018-09-24 18:16:13 -07:00
Leijurv
8c397d1454 t e s t 2018-09-24 17:19:59 -07:00
Brady
b9cba93d33 Jurv's absolutely autistic practices made me have to do this shit 2018-09-24 19:19:07 -05:00
Leijurv
34e5811613 and a couple more 2018-09-24 17:15:22 -07:00
Brady
ce39183482 Add more fast methods to BetterBlockPos 2018-09-24 19:03:19 -05:00
Brady
529f8dae47 Remove ignored hashCode call 2018-09-24 18:58:08 -05:00
Brady
b575f54977 Revert BlockStateInterface changes because jurv wurv sad 2018-09-24 18:55:57 -05:00
Brady
6ec6ff4596 Clean all imports 2018-09-24 18:51:10 -05:00
Brady
30b63abb73 Replace creation of new Helper instances in Utils 2018-09-24 18:50:29 -05:00
Brady
2a8575caa8 Begin to create interfaces in api for cached World and Region 2018-09-24 18:45:41 -05:00
Leijurv
6829bc920e demolish goto, fixes #182 2018-09-24 16:21:14 -07:00
Leijurv
8ee7446517 save by coordinate, fixes #175 2018-09-24 16:16:04 -07:00
Brady
559f575db5 Add javadocs to RayTraceUtils 2018-09-24 18:09:10 -05:00
Leijurv
750da2f1a6 stop breaking on cancel, hopefully fixes #127 2018-09-24 16:05:09 -07:00
Brady
7d27509e63 Don't forget 2018-09-24 18:01:26 -05:00
Leijurv
76f287582e overhaul betterblockpostest 2018-09-24 15:58:08 -07:00
Brady
239a95961e Replace for loop with forEach 2018-09-24 17:56:27 -05:00
Leijurv
3e189510d4 bits test 2018-09-24 15:50:09 -07:00
Leijurv
cef4fb0f50 convert blocks to strings and back less 2018-09-24 15:45:12 -07:00
Leijurv
da3f5251b5 refactor 2018-09-24 15:37:05 -07:00
Brady
fc591eafd3 We must preserve it 2018-09-24 17:32:12 -05:00
Leijurv
5087e65c61 what 2018-09-24 15:27:37 -07:00
Leijurv
1553f99129 unneeded 2018-09-24 14:35:14 -07:00
Leijurv
2c4384970c that class has moved 2018-09-24 14:33:41 -07:00
Leijurv
65672b5564 gotta go fast lol 2018-09-24 13:14:36 -07:00
Leijurv
758e9c511a tiny optimization 2018-09-24 13:13:24 -07:00
Brady
812c23e1ca Fix compiler error and revert addAll meme 2018-09-24 14:48:01 -05:00
Leijurv
9e27a59d7f cache on load check 2018-09-24 12:44:41 -07:00
Brady
787665ae08 Actually add getter for the world provider instance in api 2018-09-24 14:43:02 -05:00
Brady
35c8b03122 Create IWorldData and IWorldProvider interfaces in api
This fully exposes waypoints in the api, next step is cached worlds!
2018-09-24 14:42:22 -05:00
Brady
1cf4c9419f Add setting for goal box color 2018-09-24 14:17:02 -05:00
Brady
111e03c5b8 i agree 2018-09-24 13:39:40 -05:00
Leijurv
0ed6bc966e standardize on moveresult 2018-09-24 10:55:35 -07:00
Leijurv
ba7e9a56e3 remove intermediate object 2018-09-24 10:50:40 -07:00
Brady
df88b02ed5 Create IWaypointCollection interface in api 2018-09-24 12:48:00 -05:00
Brady
d6c2c053db Create IWaypoint interface in api 2018-09-24 12:36:25 -05:00
Leijurv
5650c86a7d update goal in new thread 2018-09-24 10:17:01 -07:00
Leijurv
4ec9a4fc5b really cancel, fixes #178 2018-09-24 09:57:20 -07:00
Brady
7b0f14a0e5 Configurable colors for path rendering 2018-09-23 21:47:19 -05:00
Brady
c3a21b928e When PathingBehavior is disabled, clear all of the key override states 2018-09-23 21:35:56 -05:00
Leijurv
89ad673ae3 convenience methods 2018-09-23 18:44:54 -07:00
Leijurv
fa7a0b3c45 readd costs 2018-09-23 18:00:54 -07:00
Brady
23e1ea0020 Plutie's Jenkins is dead rn 2018-09-23 19:48:17 -05:00
Brady
5edd4e06bb Utilize another relative link in README 2018-09-23 19:39:37 -05:00
Brady
aa6bdd7f33 Minor changes to the README 2018-09-23 19:39:04 -05:00
Brady
4d5446ddbd We don't keep secrets here 2018-09-23 19:34:04 -05:00
Brady
e3b777d2ef Update the API usage 2018-09-23 19:23:57 -05:00
Brady
eeea07ed2b Move Settings to api 2018-09-23 18:35:55 -05:00
Brady
4ac2ade7c6 Create IPathingBehavior and expose all behaviors
This is still a biiiiiig WIP
2018-09-23 18:29:03 -05:00
Brady
62b8bc0f47 Create IMemoryBehavior interface 2018-09-23 17:07:53 -05:00
Brady
7edf581c6a Move Behavior back to main sourceSet 2018-09-23 16:50:18 -05:00
Brady
e99fc5d9b7 Make IMineBehavior extend IBehavior 2018-09-23 16:45:00 -05:00
Brady
a6aa659629 Begin to create default behavior exposing interfaces in api 2018-09-23 16:44:35 -05:00
Leijurv
182c1e6ff5 refactor 2018-09-23 14:23:23 -07:00
Brady
6770985b3a Ew TUPLE 2018-09-23 15:26:57 -05:00
Leijurv
943794726a wtf intellij 2018-09-23 12:24:56 -07:00
Leijurv
59b4e1a993 parkour 2018-09-23 12:24:07 -07:00
Leijurv
a05d3269a3 link to back up that claim 2018-09-23 11:48:16 -07:00
Leijurv
5ca5fdf777 misc fixes 2018-09-23 11:37:39 -07:00
Leijurv
53590a96b9 you are no longer being poisoned by a toxic cloud 2018-09-23 11:17:31 -07:00
Leijurv
1a6b7d184a cache chunk load check through block state interface 2018-09-23 10:20:19 -07:00
Leijurv
c623250387 no reason to do that actually 2018-09-23 10:13:09 -07:00
Leijurv
289637a370 what is testing :S 2018-09-23 09:42:20 -07:00
Leijurv
b20f148fa6 might as well 2018-09-23 08:58:45 -07:00
Leijurv
cc01c88dbd begone betterblockpos 2018-09-23 08:54:26 -07:00
Leijurv
23c11a5170 finish moving away from betterblockpos in path calculation 2018-09-23 08:52:03 -07:00
Leijurv
7fa6e001e6 don't cause exception on main thread if a movement becomes impossible 2018-09-23 08:13:21 -07:00
Leijurv
65a59cb739 add bench link 2018-09-23 08:05:59 -07:00
Brady
b2cbce28b3 Merge pull request #180 from cabaletta/sanik
Gotta go fast, fixes #179, fixes #168
2018-09-23 09:36:56 -05:00
Leijurv
0d0eefec9c s a n i k 2018-09-22 22:00:28 -07:00
Leijurv
1b576eca28 MovementDescend 2018-09-22 19:58:03 -07:00
Leijurv
2d3cdddc51 why do i even do this 2018-09-22 19:48:33 -07:00
Leijurv
3c4708fef7 performance is key 2018-09-22 19:46:18 -07:00
Leijurv
eaa44c90f3 MovementAscend 2018-09-22 19:46:10 -07:00
Leijurv
e33564f1eb MovementPillar 2018-09-22 19:13:59 -07:00
Leijurv
7888dd24e5 comments 2018-09-22 11:23:26 -07:00
Leijurv
f07c02ff41 Merge branch 'master' into noblockpos 2018-09-22 09:35:33 -07:00
Leijurv
c64785f0ce don't let a NaN slip through 2018-09-22 09:34:42 -07:00
Leijurv
d471bfa948 fewer blockpos 2018-09-22 09:28:59 -07:00
Leijurv
c508fb2cb7 optimized checks 2018-09-22 09:17:28 -07:00
Leijurv
15fa12fe08 end of an era. stop randomizing movements 2018-09-22 09:04:10 -07:00
Leijurv
e16bc5eca4 more better block pos 2018-09-22 08:56:49 -07:00
Leijurv
8b307f296a fix very rare null pointer exception 2018-09-21 22:14:18 -07:00
Leijurv
9661ab3b42 more info on cancelOnGoalInvalidation 2018-09-21 09:30:37 -07:00
Leijurv
ae59e94a6c lmao wtf 2018-09-21 08:49:49 -07:00
Leijurv
21568f593a fix goal offset logic 2018-09-20 21:27:25 -07:00
Leijurv
2cac115211 fix scan logic 2018-09-20 14:09:13 -07:00
Leijurv
4513a537db fix logic in minebehavior 2018-09-20 14:08:56 -07:00
Leijurv
e3434115ac logger 2018-09-20 13:29:26 -07:00
Brady
ddf7b3739a Fix compiler error 2018-09-20 14:29:37 -05:00
Brady
1c2e47c39a Add maxSearchRadius parameter to WorldScanner 2018-09-20 14:14:59 -05:00
Brady
0575e2d667 Fix size parameter not being properly recognized by WorldScanner 2018-09-20 13:52:29 -05:00
Brady
37f00f3e14 Made foundWithinY in WorldScanner an "option" 2018-09-20 12:21:23 -05:00
Brady
d0fd370d53 Fix issue with WorldScanner where no chunks match exact dist squared 2018-09-20 11:35:36 -05:00
Leijurv
454bc9c628 versions, not profiles 2018-09-19 21:22:57 -07:00
Brady
5bd4dcadf8 gitHUB 2018-09-19 22:35:52 -05:00
Brady
01b88caa93 Consistent Indentation 2018-09-19 22:32:19 -05:00
Leijurv
8a03428635 change url 2018-09-19 20:32:06 -07:00
Brady
d3c194c746 Brady doesn't know how to remove things that he didn't want to add 2018-09-19 22:30:30 -05:00
Leijurv
28a8e7ea63 home should path, not just set goal 2018-09-19 20:30:17 -07:00
Brady
d4f1a127d7 iMpAtIeNt 2018-09-19 22:29:42 -05:00
Brady
ecd8da553b Can't forget the tweaker 2018-09-19 22:28:53 -05:00
Brady
caccc3001e Better Impact Install Instructions 2018-09-19 22:23:42 -05:00
Leijurv
139d05d93f disable mergeinterfacesaggressively for jit performance 2018-09-19 20:12:27 -07:00
Leijurv
2e63ac41d9 possibly fix oscillation problem with a large goal composite 2018-09-19 19:34:05 -07:00
Leijurv
1790534421 allow swimming up a water column, fixes #174, fixes #129 2018-09-19 17:16:42 -07:00
Leijurv
2375f1a408 better encapsulation of currentlyRunning 2018-09-19 14:39:57 -07:00
Leijurv
ef55d86913 fix follow offset while at large x and z coordinates 2018-09-18 20:59:48 -07:00
Leijurv
28ebf065ee 5x harder to break while sneaking 2018-09-18 13:14:22 -07:00
Leijurv
b47b813462 deal with fence gate properly, fixes #172 2018-09-18 12:23:03 -07:00
Leijurv
f13bcbd49f no more flowing water 2018-09-17 20:25:52 -07:00
Leijurv
dc5514b5b7 update prebuilt jar 2018-09-17 17:27:28 -07:00
Leijurv
66e6216b71 l 2018-09-17 16:12:07 -07:00
Brady
63a1083e19 Let's talk about doors 2018-09-17 17:46:23 -05:00
Brady
6b61a00bed Change License to GNU Lesser General Public License v3 2018-09-17 17:11:40 -05:00
Leijurv
bfdf8d6c87 update readme 2018-09-17 14:33:14 -07:00
Leijurv
71952410eb mine quantity 2018-09-17 14:22:45 -07:00
Leijurv
42e179c4ce loL 2018-09-17 13:44:27 -07:00
Leijurv
e981bfa346 follow player by name 2018-09-17 10:56:37 -07:00
Leijurv
043dd80e28 higher priority 2018-09-17 10:38:37 -07:00
Leijurv
b3654492be follow offset distance and direction 2018-09-17 10:36:47 -07:00
Brady
583a5046ef Utilize the fact that all MovementState methods return "this" 2018-09-17 12:17:58 -05:00
Leijurv
d2be54f138 license badge 2018-09-16 20:23:08 -07:00
Leijurv
f36b11016e codacy badge 2018-09-16 20:19:41 -07:00
Leijurv
a589cb0d9e rearranged constructors 2018-09-16 20:16:05 -07:00
Leijurv
74dc8d4118 unneeded 2018-09-16 19:58:44 -07:00
Leijurv
0b640199ef add defaults to more switches 2018-09-16 19:56:33 -07:00
Leijurv
3011b85aee add defaults to switches 2018-09-16 19:50:14 -07:00
Leijurv
f25f264fd3 epicer default 2018-09-16 19:43:48 -07:00
Leijurv
71473ab17d nit 2 2018-09-16 19:34:18 -07:00
Leijurv
eac5184d4d nit 2018-09-16 19:30:47 -07:00
Leijurv
5f0009a060 fuming 2018-09-16 19:25:21 -07:00
Brady
b4ddd98bcb cUrLy BrAcKeT 2018-09-16 21:24:13 -05:00
Brady
aa2caf63d3 Clean up PathingBehavior#findPath 2018-09-16 21:18:39 -05:00
Brady
bc82276e62 Why null check when you can default null 2018-09-16 20:14:51 -05:00
Leijurv
b7cc707737 misc cleanup 4 2018-09-16 17:58:35 -07:00
Leijurv
543c0d0a33 dont modify arguments 2018-09-16 17:51:39 -07:00
Leijurv
af58304b38 misc cleanup 3 2018-09-16 17:49:19 -07:00
Leijurv
e75d0ff102 huh thats neat 2018-09-16 17:25:14 -07:00
Leijurv
dbd1fb2aa2 misc cleanup 2 2018-09-16 17:15:33 -07:00
Leijurv
fb7d729b11 misc cleanup 2018-09-16 17:11:04 -07:00
Leijurv
51f1cadbb8 now unused 2018-09-16 16:50:56 -07:00
Leijurv
7fd0d2d038 clean up toLowerCase 2018-09-16 16:45:56 -07:00
Brady
a92465a5f9 Exceedingly beautiful 2018-09-16 16:46:41 -05:00
Leijurv
8dac838fe0 thread pool executor 2018-09-16 14:23:15 -07:00
Brady
23779329a9 Expose registerEventListener in Baritone class 2018-09-16 15:59:52 -05:00
Leijurv
3f15451e88 command to rescan and repack all loaded chunks 2018-09-16 13:43:54 -07:00
Brady
0ce68ee21f Replace some issue references with proper javadocs where applicable 2018-09-16 15:28:52 -05:00
Leijurv
30fc72a34c scan loaded if not cached 2018-09-16 13:28:16 -07:00
Brady
5492dc59e2 Replace Setting<Number> usages with their actual number types 2018-09-16 15:05:05 -05:00
Leijurv
9937739518 force internal mining 2018-09-16 13:00:44 -07:00
Leijurv
eca41a046a more accurate name 2018-09-15 19:35:35 -07:00
Leijurv
e54ea6c571 pathingbehavior must emit canceled event for mining to recalc 2018-09-15 15:22:34 -07:00
Leijurv
43cf2062bc locations cache 2018-09-15 12:56:35 -07:00
Leijurv
27b9324cf1 add goal axis and fix movement fall path detection 2018-09-15 12:51:37 -07:00
Leijurv
a978ddec08 mineGoalUpdateInterval and cancelOnGoalInvalidation 2018-09-15 10:34:02 -07:00
Leijurv
b5a512963d don't get stuck on ascend, fixes #171 2018-09-15 10:04:48 -07:00
Leijurv
67c5a9caa0 fix failure to break on fall 2018-09-15 09:29:03 -07:00
Leijurv
20ecab7d53 fix breaking movementfall last block with assumeWalkOnWater 2018-09-15 08:31:46 -07:00
Leijurv
0b30e822c2 fix flowing water detection for assumeWalkOnWater 2018-09-15 08:00:24 -07:00
Leijurv
19b47d77e5 can still fall into water if assumeWalkOnWater is true 2018-09-15 07:51:46 -07:00
Leijurv
9b375e1f5f fix path not derendering once finished 2018-09-15 07:42:03 -07:00
Leijurv
1745ce6a62 fix wrong y coordinate on path beginning 2018-09-15 07:38:53 -07:00
Leijurv
5513d0669f helps with nether fortresses 2018-09-15 07:04:22 -07:00
Leijurv
12b64ead5c a much needed path executor overhaul 2018-09-14 18:29:35 -07:00
Leijurv
13cfb8e369 walkWhileBreaking, fixes #147 2018-09-14 16:45:51 -07:00
Leijurv
29391af5ad solidarity 2018-09-14 15:57:46 -07:00
Leijurv
7d94cb259f world scanner do 1 chunk only if blocks at same y have been found 2018-09-14 12:24:53 -07:00
Leijurv
1bd15e5d5b added link to plutie's jenkins 2018-09-14 11:35:41 -07:00
Leijurv
001070d406 more robust path destination verification 2018-09-14 09:21:59 -07:00
Leijurv
a38da64c49 make the left click workaround optional 2018-09-14 09:05:29 -07:00
Leijurv
d7a646789e fixes to parkour place 2018-09-14 08:40:34 -07:00
Leijurv
6b45b84784 special request from plutie#9079 2018-09-13 18:40:50 -07:00
Leijurv
853cbf3554 add waypoint user 2018-09-13 18:00:08 -07:00
Leijurv
5f9b6683ac update prebuilt jar 2018-09-13 17:01:16 -07:00
Leijurv
7d0914bd43 don't crash on thisway typo lol 2018-09-13 16:40:55 -07:00
Leijurv
e3830643f6 only fail on movement cost increase if calced through cached, fixes #165 2018-09-13 16:18:26 -07:00
Leijurv
924cea342b user defined not home 2018-09-13 15:41:00 -07:00
Leijurv
33a0a2a7f9 derp 2018-09-13 15:40:11 -07:00
Brady
13628789c8 We should only care about real client-sided packet flow
Prior to this commit, IntegratedServer packets would be picked up by PacketEvent
2018-09-13 15:10:29 -05:00
Brady
380f21bb38 Remove pythagoreanMetric setting 2018-09-13 14:48:23 -05:00
Brady
651bfac786 Fix copyright comment detection 2018-09-13 14:12:59 -05:00
Brady
d536d311d6 Update README.md 2018-09-13 12:14:10 -05:00
Brady
d07eb3f486 jurv is a noob 2018-09-13 12:00:43 -05:00
Leijurv
530bdfae0f add save command 2018-09-13 09:15:50 -07:00
Brady
4c5c35069d Remove keycode state forcing
It was a feature that was in the source of MineBot, but was actually never used.
2018-09-13 09:44:51 -05:00
Leijurv
df765a14b0 update prebuilt baritone 2018-09-12 20:50:23 -07:00
Leijurv
315c1bf63c help i cannot math into number 2018-09-12 16:40:27 -07:00
Leijurv
796be3da79 can't break nether roof, fixes #164 2018-09-12 16:29:10 -07:00
Brady
ef396829f0 Collapse impl package for default behaviors 2018-09-12 17:58:33 -05:00
Brady
0a0209d2e1 Move Behavior to api 2018-09-12 17:53:29 -05:00
Brady
fb8ee44447 Remove hacky "softCancel" thing 2018-09-12 17:25:01 -05:00
Brady
2fd888b9ee Replace String lists containing block names with actual block lists
It just makes sense like wtf
2018-09-12 17:12:06 -05:00
Leijurv
a7504caa67 Merge branch 'skynet' 2018-09-12 10:13:39 -07:00
Leijurv
39a3c1cd4a oh my god 2018-09-12 07:55:40 -07:00
Leijurv
7f983c92f4 assumeSafeWalk 2018-09-11 20:50:29 -07:00
Leijurv
e82f6b8e35 assumeStep 2018-09-11 20:24:27 -07:00
Leijurv
5669204b4a skynet 2018-09-11 20:09:53 -07:00
Leijurv
3afc77bc9a fix infinite recalc when jumping over flowing water 2018-09-11 19:39:47 -07:00
Leijurv
0412298555 don't try to place against water, actually fixes #155 2018-09-11 19:05:45 -07:00
Leijurv
9334cf1dd4 stop walking into liquids, fixes #155 2018-09-11 18:33:03 -07:00
Leijurv
acd9cecd66 improve path safety 2018-09-11 18:26:10 -07:00
Leijurv
1bf34d42e2 added maxCostIncrease, fixes #154 2018-09-11 15:51:29 -07:00
Brady
e6c574063e Prevent flying capabilities when pathing, fixes #130 2018-09-11 17:37:26 -05:00
Leijurv
ff2714b15f refactor logging, fixes #153 2018-09-11 13:45:43 -07:00
Leijurv
bafc938424 possibly fix parkour cost calculation issue 2018-09-11 13:15:13 -07:00
Leijurv
ab1037bcfd blockstateinterface reorg 2018-09-11 11:57:16 -07:00
Leijurv
3dfde818d3 api source set 2018-09-11 11:29:54 -07:00
Leijurv
35ed0f6821 refactor chunk to cache 2018-09-11 10:28:03 -07:00
Brady
a0a480e2cc Move api package in main to api sourceset 2018-09-11 12:05:12 -05:00
Leijurv
9daf46e30c typos 2018-09-11 06:37:08 -07:00
Brady
a67e6fd163 Create and use injection point on pre/post jump, fixes #146
Also removed ItemSlotEvent because @leijurv is retarded
2018-09-10 17:18:01 -05:00
Leijurv
d8790e1dc6 misc cleanup 2018-09-10 14:48:18 -07:00
Leijurv
fb07e47141 better instructions 2018-09-10 10:47:31 -07:00
Leijurv
a59d30d11e update commit and link 2018-09-10 10:45:08 -07:00
Leijurv
72eec135d0 misc improvements 2018-09-10 09:22:32 -07:00
Leijurv
075ad3f244 almost forgot crucial performance numbers 2018-09-09 15:38:59 -07:00
Brady
ecbb34366f Hyperlink the benchmark spreadsheet for BetterBlockPos 2018-09-09 17:37:12 -05:00
Leijurv
8fa0d63ae5 add link to benchmark 2018-09-09 15:33:53 -07:00
Leijurv
5cbc9d2d74 fix binary heap 2018-09-02 20:59:25 -07:00
Leijurv
3d63abe950 smaller 2018-09-02 20:54:26 -07:00
Leijurv
805b870d7d fix test working directory 2018-09-02 19:58:06 -07:00
Leijurv
d7cf6b1438 forgive me 2018-09-02 19:53:08 -07:00
Leijurv
56762780e3 without dev 2018-09-02 16:51:24 -07:00
Leijurv
50cc05a680 perhaps 2018-09-02 16:48:33 -07:00
Leijurv
ca91d09fbf maybe apt update 2018-09-02 16:41:52 -07:00
Leijurv
7333f9dc9a disable betterblockpostest 2018-09-02 16:38:32 -07:00
Leijurv
685cc4d06e glxinfo 2018-09-02 16:37:56 -07:00
Leijurv
230cca391a env 2018-09-02 16:35:56 -07:00
Leijurv
7f8747afc7 separate command 2018-09-02 16:11:52 -07:00
Leijurv
b2aced82ee Merge branch 'master' into travis-test 2018-09-02 15:29:04 -07:00
Leijurv
4363cb20f3 try again 2018-09-02 15:27:57 -07:00
Leijurv
4c864a433f run version 2018-09-02 15:21:56 -07:00
Leijurv
c05b02484a extra option 2018-09-02 15:17:48 -07:00
Leijurv
e456040661 add lwjgl opengl extensions to xvfb for travis minecraft load 2018-09-02 15:14:12 -07:00
Leijurv
8c03a75cb7 create minecraft x window with xvfb-run 2018-09-02 15:08:04 -07:00
Leijurv
1d89370edc Merge branch 'master' into travis-test 2018-09-02 15:05:08 -07:00
Leijurv
4f76607233 better practice 2018-09-02 15:04:29 -07:00
Leijurv
22926289fc run locally 2018-09-02 15:03:35 -07:00
Leijurv
581ef474ad included 2018-09-02 15:03:14 -07:00
Leijurv
8544917c34 run 2018-09-02 15:01:52 -07:00
Leijurv
3c28d07cb6 introduce bug in binary heap 2018-09-02 14:51:10 -07:00
210 changed files with 13941 additions and 6490 deletions

2
.gitignore vendored
View File

@@ -2,6 +2,8 @@
**/*.swp
run/
autotest/
dist/
# Gradle
build/

View File

@@ -1,6 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="This file is part of Baritone.&#10;&#10;Baritone is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;Baritone is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with Baritone. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
<option name="keyword" value="This file is part of Baritone" />
<option name="notice" value="This file is part of Baritone.&#10;&#10;Baritone is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU Lesser General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;Baritone is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU Lesser General Public License for more details.&#10;&#10;You should have received a copy of the GNU Lesser General Public License&#10;along with Baritone. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
<option name="myName" value="Baritone" />
</copyright>
</component>

View File

@@ -1 +1,29 @@
language: java
sudo: required
services:
- docker
install:
- travis_retry docker build -t cabaletta/baritone .
script:
- docker run --rm cabaletta/baritone ./gradlew javadoc
- 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 cp baritone:/code/dist dist
- ls dist
- cat dist/checksums.txt
deploy:
provider: releases
api_key:
secure: YOuiXoJNpB4bW89TQoY2IGXg0tqOKls55YMXsSPU6Mx8WzRu8CjjO/A8KA9nGfNrKM+NucjiKr/h53O2Dp2uyy0i0SLvav/G0MaBMeB1NlPRwFopi6tVPNaoZsvr8NW4BIURhspckYLpOTYWnfmOkIv8q7AxrjUZWPKDlq0dte20UxEqUE6msHJ7U9XlKo/4fX40kvWMfwGI2hTyAtL0cRT1QPsd+uW3OQjAPcQj+jKaWld46V8pBK8g9Qde9mo8HC9NBv97zw1bBF1EFkynW569kElHvaS2Opl2QLGaf66guDbpnqDpGHMhQrDdxsZHJ4RksyITn+8A9UArmbkU35BxKqBeQqOWxod2+M0axdLh1pvX43Q1t9n7RiZBf7GvV8vkXL5Sjf8v6Y4LqkJGhvQkTUwpH+0knwrE761DMCtBC34AiWG70D4u7msmhurkflr9kmRHSj/3lyJ1Q2lkt8L+FOAlQBVs64vXTsfgc6Yge7N0O3UD5hCkrDNoz3BzhNBdCkbdxdKCGip71UZgUNkPy9o3ui8jATNj9ypx3+U8ovqP0XWlJqUZmyeXyNGW9NrLeCkRLTlLnZ/dv6OPONa1oAu4TwF1w5A+TGRFZcZjH/PnZKZDQ1OYQOR6drLKRYdr2unvuf5KUKUGqZ7aYtLGhP0rBvGWddRV7DSmX/s=
all_branches: true
file_glob: true
file:
- dist/*
skip_cleanup: true
on:
tags: true
repo: cabaletta/baritone

24
Dockerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM debian:jessie
RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
ENV DEBIAN_FRONTEND noninteractive
RUN apt update -y
RUN apt install --target-release jessie-backports \
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
COPY . /code
WORKDIR /code
# 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

@@ -10,16 +10,20 @@
- **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 modified version of A*.
Baritone uses A*, with some modifications:
- **Incremental cost backoff** Since most of the time Baritone only knows the terrain up to the render distance, it can't calculate a full path to the goal. Therefore it needs to select a segment to execute first (assuming it will calculate the next segment at the end of this one). It uses incremental cost backoff to select the best node by varying metrics, then paths to that node. This is unchanged from MineBot and I made a <a href="https://docs.google.com/document/d/1WVHHXKXFdCR1Oz__KtK8sFqyvSwJN_H4lftkHFgmzlc/edit">write-up</a> that still applies. In essence, it keeps track of the best node by various increasing coefficients, then picks the node with the least coefficient that goes at least 5 blocks from the starting position.
- **Segmented calculation** Traditional A* calculates until the most promising node is in the goal, however in the environment of Minecraft with a limited render distance, we don't know the environment all the way to our goal. Baritone has three possible ways for path calculation to end: finding a path all the way to the goal, running out of time, or getting to the render distance. In the latter two scenarios, the selection of which segment to actually execute falls to the next item (incremental cost backoff). Whenever the path calculation thread finds that the best / most promising node is at the edge of loaded chunks, it increments a counter. If this happens more than 50 times (configurable), path calculation exits early. This happens with very low render distances. Otherwise, calculation continues until the timeout is hit (also configurable) or we find a path all the way to the goal.
- **Incremental cost backoff** When path calculation exits early without getting all the way to the goal, Baritone it needs to select a segment to execute first (assuming it will calculate the next segment at the end of this one). It uses incremental cost backoff to select the best node by varying metrics, then paths to that node. This is unchanged from MineBot and I made a <a href="https://docs.google.com/document/d/1WVHHXKXFdCR1Oz__KtK8sFqyvSwJN_H4lftkHFgmzlc/edit">write-up</a> that still applies. In essence, it keeps track of the best node by various increasing coefficients, then picks the node with the least coefficient that goes at least 5 blocks from the starting position.
- **Minimum improvement repropagation** The pathfinder ignores alternate routes that provide minimal improvements (less than 0.01 ticks of improvement), because the calculation cost of repropagating this to all connected nodes is much higher than the half-millisecond path time improvement it would get.
- **Backtrack cost favoring** While calculating the next segment, Baritone favors backtracking its current segment slightly, as a tiebreaker. 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 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/main/java/baritone/Settings.java">here</a>.
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.
# Goals
@@ -30,6 +34,7 @@ The pathing goal can be set to any of these options:
- **GoalTwoBlocks** a block position that the player should stand in, either at foot or eye level
- **GoalGetToBlock** a block position that the player should stand adjacent to, below, or on top of
- **GoalNear** a block position that the player should get within a certain radius of, used for following entities
- **GoalAxis** a block position on an axis or diagonal axis (so x=0, z=0, or x=z), and y=120 (configurable)
And finally `GoalComposite`. `GoalComposite` is a list of other goals, any one of which satisfies the goal. For example, `mine diamond_ore` creates a `GoalComposite` of `GoalTwoBlocks`s for every diamond ore location it knows of.
@@ -38,12 +43,10 @@ And finally `GoalComposite`. `GoalComposite` is a list of other goals, any one o
Things it doesn't have yet
- Trapdoors
- Sprint jumping in a 1x2 corridor
- Parkour (jumping over gaps of any length) [IN PROGRESS]
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,16 +0,0 @@
# Integration between Baritone and Impact
Baritone will be in Impact 4.4 with nice integrations with its utility modules, but if you're impatient you can run Baritone on top of Impact 4.3 right now.
You can either build Baritone yourself, or download the jar from September 4 from <a href="https://www.dropbox.com/s/imc6xwwpwsh3i0y/baritone-1.0.0.jar?dl=0">here</a>
To build it yourself, clone and setup Baritone (instructions in main README.md). Then, build the jar. From the command line, it's `./gradlew build` (or `gradlew build` on Windows). In IntelliJ, you can just start the `build` task in the Gradle menu.
Copy the jar into place. It should be `build/libs/baritone-1.0.0.jar` in baritone. Copy it to your libraries in your Minecraft install. For example, on Mac I do `cp Documents/baritone/build/libs/baritone-1.0.0.jar Library/Application\ Support/minecraft/libraries/cabaletta/baritone/1.0.0/baritone-1.0.0.jar`. The first time you'll need to make the directory `cabaletta/baritone/1.0.0` in libraries first.
Then, we'll need to modify the Impact launch json. Open `minecraft/versions/1.12.2-Impact_4.3/1.12.2-Impact_4.3.json` or copy your existing installation and rename the version folder, json, and id in the json.
- Add the Baritone tweak class to line 7 "minecraftArguments" like so: `"minecraftArguments": " ... --tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.BaritoneTweakerOptifine",`. You need the Optifine tweaker even though there is no Optifine involved, for reasons I don't quite understand.
- Add the Baritone library. Insert `{ "name": "cabaletta:baritone:1.0.0" },` between Impact and ClientAPI, which should be between lines 15 and 16.
Restart the Minecraft launcher, then load Impact 4.3 as normal, and it should now include Baritone.

88
INSTALL.md Normal file
View File

@@ -0,0 +1,88 @@
# Integration between Baritone and Impact
Impact 4.4 has Baritone included.
These instructions apply to Impact 4.3 (and potentially other "hacked clients").
To run Baritone on Vanilla, just follow the instructions in the README (it's `./gradlew runClient`).
## An Introduction
There are some basic steps to getting Baritone setup with Impact.
- Acquiring a build of Baritone
- Placing Baritone in the libraries directory
- Modifying the Impact Profile JSON to run baritone
- How to use Baritone
## Acquiring a build of Baritone
There are two methods of acquiring a build of Baritone
### Official Release (Not always up to date)
https://github.com/cabaletta/baritone/releases
For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`.
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
You can either build Baritone through a command line or through IntelliJ's UI, information on that can be found [here](SETUP.md#building).
## Placing Baritone in the libraries directory
``/libraries`` is a neat directory in your <a href="https://minecraft.gamepedia.com/.minecraft">Minecraft Installation Directory</a>
that contains all of the dependencies that are required from the game and some mods. This is where we will be
putting baritone.
- Locate the ``libraries`` folder, it should be in the Minecraft Installation Directory
- Create 3 new subdirectories starting from ``libraries``
- ``cabaletta``
- ``baritone``
- ``X.Y.Z``
- Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder
- The full path should look like ``<Minecraft>/libraries/cabaletta/baritone/X.Y.Z/baritone-X.Y.Z.jar``
## Modifying the Impact Profile JSON to run baritone
The final step is "registering" the Baritone library with Impact, so that it loads on launch.
- Ensure your Minecraft launcher is closed
- Navigate back to the Minecraft Installation Directory
- Find the ``versions`` directory, and open in
- In here there should be a ``1.12.2-Impact_4.3`` folder.
- If you don't have any Impact folder or have a version older than 4.3, you can download Impact <a href="https://impactdevelopment.github.io">here</a>.
- Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json``
- Open the JSON file with a text editor that supports your system's line endings
- For example, Notepad on Windows likely will NOT work for this. You should instead use a Text Editor like
<a href="https://notepad-plus-plus.org/">Notepad++</a> if you're on Windows. (For other systems, I'm not sure
what would work the best so you may have to do some research.)
- Find the ``libraries`` array in the JSON. It should look something like this.
```
"libraries": [
{
"name": "net.minecraft:launchwrapper:1.12"
},
{
"name": "com.github.ImpactDevelopment:Impact:4.3-1.12.2",
"url": "https://impactdevelopment.github.io/maven/"
},
{
"name": "com.github.ImpactDeveloment:ClientAPI:3.0.2",
"url": "https://impactdevelopment.github.io/maven/"
},
...
```
- Create two new objects in the array, between the ``Impact`` and ``ClientAPI`` dependencies preferably.
```
{
"name": "cabaletta:baritone:X.Y.Z"
},
{
"name": "com.github.ImpactDevelopment:SimpleTweaker:1.2",
"url": "https://impactdevelopment.github.io/maven/"
},
```
- Now find the ``"minecraftArguments": "..."`` text near the top.
- At the very end of the quotes where it says ``--tweakClass clientapi.load.ClientTweaker"``, add on the following so it looks like:
- ``--tweakClass clientapi.load.ClientTweaker --tweakClass baritone.launch.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>.

165
LICENSE Normal file
View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Baritone Copyright (C) 2018 Cabaletta
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,57 +1,75 @@
# Baritone
[![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-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)
[![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)
[![Minecraft](https://img.shields.io/badge/MC-1.12.2-green.svg)](https://minecraft.gamepedia.com/1.12.2)
[![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/)
[![Asuna integration](https://img.shields.io/badge/Asuna%20integration-builder%20branch-brightgreen.svg)](https://github.com/EmotionalLove/Asuna/)
[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.0.0--hotfix--4-green.svg)](https://impactdevelopment.github.io/)
[![KAMI integration](https://img.shields.io/badge/KAMI%20integration-v1.0.0-orange.svg)](https://github.com/zeroeightysix/KAMI/)
[![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-v1.0.0%3F%3F%20smh%20license%20violations-orange.svg)](https://wweclient.com/)
[![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/)
[![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20integration-Soon™-red.svg)](https://github.com/fr1kin/ForgeHax)
A Minecraft 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.
A Minecraft pathfinder bot.
<a href="https://github.com/cabaletta/baritone/blob/master/FEATURES.md">Features</a>
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.
<a href="https://github.com/cabaletta/baritone/blob/master/IMPACT.md">Baritone + Impact</a>
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 [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).
# Setup
- 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
Have committed at least once a day for the last 6 months =D 🦀
## Command Line
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
Here are some links to help to get started:
Running Baritone:
- [Features](FEATURES.md)
```
$ gradlew run
```
- [Setup](SETUP.md)
Setting up for IntelliJ:
```
$ gradlew setupDecompWorkspace
$ gradlew --refresh-dependencies
$ gradlew genIntellijRuns
```
- [Installation](INSTALL.md)
- [Javadocs](https://baritone.leijurv.com/)
# Chat control
<a href="https://github.com/cabaletta/baritone/blob/master/src/main/java/baritone/utils/ExampleBaritoneControl.java">Defined here</a>
[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.
On v1.1.0 and newer: Put a `#` in front so that if you make a typo it doesn't go into public chat (anything beginning with `#` isn't sent).
For older than v1.1.0, `#` must be enabled by toggling on the `prefix` setting.
**Only** in Impact is `.b` also a valid prefix
# API example
```
Baritone.settings().allowSprint.value = true;
Baritone.settings().pathTimeoutMS.value = 2000L;
BaritoneAPI.getSettings().allowSprint.value = true;
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
PathingBehavior.INSTANCE.setGoal(new GoalXZ(10000, 20000));
PathingBehavior.INSTANCE.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 GPL 3 License)
Sure! (As long as usage is in compliance with the LGPL 3 License)
## How is it so fast?
Magic
Magic. (Hours of [Leijurv](https://github.com/leijurv) enduring excruciating pain)
## Why is it called Baritone?
It's named for FitMC's deep sultry voice.

88
SETUP.md Normal file
View File

@@ -0,0 +1,88 @@
# Setup
## Prebuilt
[Releases](https://github.com/cabaletta/baritone/releases)
Not always completely up to date with latest features.
The forge release (currently `baritone-forge-1.1.0.jar`) can simply be added as a Forge mod. However, it is not fully compatible with the latest version of Forge. `freeLook` was broken in Forge 14.23.4.2744. You should use Forge 14.23.4.2743 or **older** with Baritone. Newer versions of Forge "work", sort of, but Baritone's movement becomes unreliable and `freeLook` must be off.
## 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
## Artifacts
Building Baritone will result in 4 artifacts created in the ``dist`` directory.
- **Forge**: Forge mod
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
## More Info
To replace out Impact 4.4's Baritone build with a customized one, switch to the `impact4.4-compat` branch, build Baritone as above then copy `dist/baritone-api-$VERSION$.jar` into `minecraft/libraries/cabaletta/baritone-api/1.0.0/baritone-api-1.0.0.jar`, replacing the jar that was previously there. You also need to edit `minecraft/versions/1.12.2-Impact_4.4/1.12.2-Impact_4.4.json`, find the line `"name": "cabaletta:baritone-api:1.0.0"`, remove the comma from the end, and entirely remove the line that's immediately after (starts with `"url"`).

View File

@@ -2,21 +2,21 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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.0.0'
version '1.1.2'
buildscript {
repositories {
@@ -37,6 +37,10 @@ buildscript {
}
}
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'
@@ -44,6 +48,7 @@ apply plugin: 'org.spongepowered.mixin'
sourceCompatibility = targetCompatibility = '1.8'
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
options.encoding = "UTF-8" // allow emoji in comments :^)
}
sourceSets {
@@ -54,10 +59,12 @@ sourceSets {
minecraft {
version = '1.12.2'
mappings = 'snapshot_20180731'
mappings = 'stable_39'
tweakClass = 'baritone.launch.BaritoneTweaker'
runDir = 'run'
makeObfSourceJar = false
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
makeObfSourceJar = true
}
repositories {
@@ -67,9 +74,15 @@ repositories {
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.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'
@@ -82,10 +95,37 @@ dependencies {
}
mixin {
defaultObfuscationEnv notch
defaultObfuscationEnv searge
add sourceSets.launch, 'mixins.baritone.refmap.json'
}
jar {
from sourceSets.launch.output
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
}
jar {
manifest {
attributes(
'MixinConfigs': 'mixins.baritone.json'
)
}
}
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)

3
buildSrc/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
build/
.gradle/
out/

View File

@@ -2,26 +2,24 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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 net.minecraft.util.Tuple;
public class Rotation extends Tuple<Float, Float> {
public Rotation(Float yaw, Float pitch) {
super(yaw, pitch);
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
}

View File

@@ -0,0 +1,104 @@
/*
* 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.gradle.task;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.gradle.api.DefaultTask;
import java.io.File;
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
* @since 10/12/2018
*/
class BaritoneGradleTask extends DefaultTask {
protected static final JsonParser PARSER = new JsonParser();
protected static final String
PROGUARD_ZIP = "proguard.zip",
PROGUARD_JAR = "proguard.jar",
PROGUARD_CONFIG_TEMPLATE = "scripts/proguard.pro",
PROGUARD_CONFIG_DEST = "template.pro",
PROGUARD_API_CONFIG = "api.pro",
PROGUARD_STANDALONE_CONFIG = "standalone.pro",
PROGUARD_EXPORT_PATH = "proguard_out.jar",
VERSION_MANIFEST = "version_manifest.json",
TEMP_LIBRARY_DIR = "tempLibraries/",
ARTIFACT_STANDARD = "%s-%s.jar",
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
ARTIFACT_API = "%s-api-%s.jar",
ARTIFACT_STANDALONE = "%s-standalone-%s.jar",
ARTIFACT_FORGE = "%s-forge-%s.jar";
protected String artifactName, artifactVersion;
protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, artifactForgePath, proguardOut;
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.artifactForgePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE));
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
if (!Files.exists(this.artifactPath)) {
throw new IllegalStateException("Artifact not found! Run build first!");
}
}
protected void write(InputStream stream, Path file) throws Exception {
if (Files.exists(file)) {
Files.delete(file);
}
Files.copy(stream, file);
}
protected String formatVersion(String string) {
return String.format(string, this.artifactName, this.artifactVersion);
}
protected Path getRelativeFile(String file) {
return Paths.get(new File(file).getAbsolutePath());
}
protected Path getTemporaryFile(String file) {
return Paths.get(new File(getTemporaryDir(), file).getAbsolutePath());
}
protected Path getBuildFile(String file) {
return getRelativeFile("build/libs/" + file);
}
protected JsonElement readJson(List<String> lines) {
return PARSER.parse(String.join("\n", lines));
}
}

View File

@@ -0,0 +1,84 @@
/*
* 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.gradle.task;
import org.gradle.api.tasks.TaskAction;
import javax.xml.bind.DatatypeConverter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
/**
* @author Brady
* @since 10/12/2018
*/
public class CreateDistTask extends BaritoneGradleTask {
private static MessageDigest SHA1_DIGEST;
@TaskAction
protected void exec() throws Exception {
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 forge = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE));
// NIO will not automatically create directories
Path dir = getRelativeFile("dist/");
if (!Files.exists(dir)) {
Files.createDirectory(dir);
}
// 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.artifactForgePath, forge, REPLACE_EXISTING);
// Calculate all checksums and format them like "shasum"
List<String> shasum = Stream.of(api, standalone, unoptimized, forge)
.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);
}
private static synchronized String sha1(Path path) {
try {
if (SHA1_DIGEST == null) {
SHA1_DIGEST = MessageDigest.getInstance("SHA-1");
}
return DatatypeConverter.printHexBinary(SHA1_DIGEST.digest(Files.readAllBytes(path))).toLowerCase();
} catch (Exception e) {
// haha no thanks
throw new IllegalStateException(e);
}
}
}

View File

@@ -0,0 +1,336 @@
/*
* 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.gradle.task;
import baritone.gradle.util.Determinizer;
import baritone.gradle.util.MappingType;
import baritone.gradle.util.ReobfWrapper;
import org.apache.commons.io.IOUtils;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.internal.plugins.DefaultConvention;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.TaskAction;
import org.gradle.internal.Pair;
import java.io.*;
import java.lang.reflect.Field;
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.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
/**
* @author Brady
* @since 10/11/2018
*/
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;
private List<String> requiredLibraries;
private File mixin;
@TaskAction
protected void exec() throws Exception {
super.verifyArtifacts();
// "Haha brady why don't you make separate tasks"
processArtifact();
downloadProguard();
extractProguard();
generateConfigs();
acquireDependencies();
proguardApi();
proguardStandalone();
createForge();
cleanup();
}
private void processArtifact() throws Exception {
if (Files.exists(this.artifactUnoptimizedPath)) {
Files.delete(this.artifactUnoptimizedPath);
}
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), Optional.empty());
}
private void downloadProguard() throws Exception {
Path proguardZip = getTemporaryFile(PROGUARD_ZIP);
if (!Files.exists(proguardZip)) {
write(new URL(this.url).openStream(), proguardZip);
}
}
private void extractProguard() throws Exception {
Path proguardJar = getTemporaryFile(PROGUARD_JAR);
if (!Files.exists(proguardJar)) {
ZipFile zipFile = new ZipFile(getTemporaryFile(PROGUARD_ZIP).toFile());
ZipEntry zipJarEntry = zipFile.getEntry(this.extract);
write(zipFile.getInputStream(zipJarEntry), proguardJar);
zipFile.close();
}
}
private void generateConfigs() throws Exception {
Files.copy(getRelativeFile(PROGUARD_CONFIG_TEMPLATE), getTemporaryFile(PROGUARD_CONFIG_DEST), REPLACE_EXISTING);
// Setup the template that will be used to derive the API and Standalone configs
List<String> template = Files.readAllLines(getTemporaryFile(PROGUARD_CONFIG_DEST));
template.add(0, "-injars " + this.artifactPath.toString());
template.add(1, "-outjars " + this.getTemporaryFile(PROGUARD_EXPORT_PATH));
// Acquire the RT jar using "java -verbose". This doesn't work on Java 9+
Process p = new ProcessBuilder("java", "-verbose").start();
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
template.add(2, "-libraryjars '" + out + "'");
// API config doesn't require any changes from the changes that we made to the template
Files.write(getTemporaryFile(PROGUARD_API_CONFIG), template);
// For the Standalone config, don't keep the API package
List<String> standalone = new ArrayList<>(template);
standalone.removeIf(s -> s.contains("# this is the keep api"));
Files.write(getTemporaryFile(PROGUARD_STANDALONE_CONFIG), standalone);
// 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 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) {
// copy from the forgegradle cache
if (lib.equals("minecraft")) {
Path cachedJar = getMinecraftJar();
Path inTempDir = getTemporaryFile("tempLibraries/minecraft.jar");
// TODO: maybe try not to copy every time
Files.copy(cachedJar, inTempDir, REPLACE_EXISTING);
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)) {
if (lib.contains("mixin")) {
mixin = file;
}
Files.copy(file.toPath(), getTemporaryFile("tempLibraries/" + lib + ".jar"), REPLACE_EXISTING);
}
}
}
if (mixin == null) {
throw new IllegalStateException("Unable to find mixin jar");
}
}
// a bunch of epic stuff to get the path to the cached jar
private Path getMinecraftJar() throws Exception {
MappingType mappingType;
try {
mappingType = getMappingType();
} catch (Exception e) {
System.err.println("Failed to get mapping type, assuming NOTCH.");
mappingType = MappingType.NOTCH;
}
String suffix;
switch (mappingType) {
case NOTCH:
suffix = "";
break;
case SEARGE:
suffix = "-srgBin";
break;
case CUSTOM:
throw new IllegalStateException("Custom mappings not supported!");
default:
throw new IllegalStateException("Unknown mapping type: " + mappingType);
}
DefaultConvention convention = (DefaultConvention) this.getProject().getConvention();
Object extension = convention.getAsMap().get("minecraft");
Objects.requireNonNull(extension);
// for some reason cant use Class.forName
Class<?> class_baseExtension = extension.getClass().getSuperclass().getSuperclass().getSuperclass(); // <-- cursed
Field f_replacer = class_baseExtension.getDeclaredField("replacer");
f_replacer.setAccessible(true);
Object replacer = f_replacer.get(extension);
Class<?> class_replacementProvider = replacer.getClass();
Field replacement_replaceMap = class_replacementProvider.getDeclaredField("replaceMap");
replacement_replaceMap.setAccessible(true);
Map<String, Object> replacements = (Map) replacement_replaceMap.get(replacer);
String cacheDir = replacements.get("CACHE_DIR").toString() + "/net/minecraft";
String mcVersion = replacements.get("MC_VERSION").toString();
String mcpInsert = replacements.get("MAPPING_CHANNEL").toString() + "/" + replacements.get("MAPPING_VERSION").toString();
String fullJarName = "minecraft-" + mcVersion + suffix + ".jar";
String baseDir = String.format("%s/minecraft/%s/", cacheDir, mcVersion);
String jarPath;
if (mappingType == MappingType.SEARGE) {
jarPath = String.format("%s/%s/%s", baseDir, mcpInsert, fullJarName);
} else {
jarPath = baseDir + fullJarName;
}
jarPath = jarPath
.replace("/", File.separator)
.replace("\\", File.separator); // hecking regex
return new File(jarPath).toPath();
}
// throws IllegalStateException if mapping type is ambiguous or it fails to find it
private MappingType getMappingType() {
// if it fails to find this then its probably a forgegradle version problem
Set<Object> reobf = (NamedDomainObjectContainer<Object>) this.getProject().getExtensions().getByName("reobf");
List<MappingType> mappingTypes = getUsedMappingTypes(reobf);
long mappingTypesUsed = mappingTypes.size();
if (mappingTypesUsed == 0) {
throw new IllegalStateException("Failed to find mapping type (no jar task?)");
}
if (mappingTypesUsed > 1) {
throw new IllegalStateException("Ambiguous mapping type (multiple jars with different mapping types?)");
}
return mappingTypes.get(0);
}
private List<MappingType> getUsedMappingTypes(Set<Object> reobf) {
return reobf.stream()
.map(ReobfWrapper::new)
.map(ReobfWrapper::getMappingType)
.distinct()
.collect(Collectors.toList());
}
private void proguardApi() throws Exception {
runProguard(getTemporaryFile(PROGUARD_API_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Optional.empty());
}
private void proguardStandalone() throws Exception {
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Optional.empty());
}
private void createForge() throws Exception {
Determinizer.determinize(this.proguardOut.toString(), this.artifactForgePath.toString(), Optional.of(mixin));
}
private void cleanup() {
try {
Files.delete(this.proguardOut);
} catch (IOException ignored) {}
}
public void setUrl(String url) {
this.url = url;
}
public void setExtract(String extract) {
this.extract = extract;
}
private void runProguard(Path config) throws Exception {
// Delete the existing proguard output file. Proguard probably handles this already, but why not do it ourselves
if (Files.exists(this.proguardOut)) {
Files.delete(this.proguardOut);
}
Path proguardJar = getTemporaryFile(PROGUARD_JAR);
Process p = new ProcessBuilder("java", "-jar", proguardJar.toString(), "@" + config.toString())
.directory(getTemporaryFile("").toFile()) // Set the working directory to the temporary folder]
.start();
// We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this
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 IllegalStateException("Proguard exited with code " + exitCode);
}
}
private void printOutputLog(InputStream stream, PrintStream outerr) {
new Thread(() -> {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
String line;
while ((line = reader.readLine()) != null) {
outerr.println(line);
}
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
}

View File

@@ -0,0 +1,160 @@
/*
* 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.gradle.util;
import com.google.gson.*;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.*;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
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 42069.
* This makes the build 100% reproducible since the timestamp when you built it no longer affects the final file.
*
* @author leijurv
*/
public class Determinizer {
public static void determinize(String inputPath, String outputPath, Optional<File> toInclude) throws IOException {
System.out.println("Running Determinizer");
System.out.println(" Input path: " + inputPath);
System.out.println(" Output path: " + outputPath);
try (
JarFile jarFile = new JarFile(new File(inputPath));
JarOutputStream jos = new JarOutputStream(new FileOutputStream(new File(outputPath)))
) {
List<JarEntry> entries = jarFile.stream()
.sorted(Comparator.comparing(JarEntry::getName))
.collect(Collectors.toList());
for (JarEntry entry : entries) {
if (entry.getName().equals("META-INF/fml_cache_annotation.json")) {
continue;
}
if (entry.getName().equals("META-INF/fml_cache_class_versions.json")) {
continue;
}
JarEntry clone = new JarEntry(entry.getName());
clone.setTime(42069);
jos.putNextEntry(clone);
if (entry.getName().endsWith(".refmap.json")) {
JsonObject object = new JsonParser().parse(new InputStreamReader(jarFile.getInputStream(entry))).getAsJsonObject();
jos.write(writeSorted(object).getBytes());
} else if (entry.getName().equals("META-INF/MANIFEST.MF") && toInclude.isPresent()) { // only replace for forge jar
ByteArrayOutputStream cancer = new ByteArrayOutputStream();
copy(jarFile.getInputStream(entry), cancer);
String manifest = new String(cancer.toByteArray());
if (!manifest.contains("baritone.launch.BaritoneTweaker")) {
throw new IllegalStateException("unable to replace");
}
manifest = manifest.replace("baritone.launch.BaritoneTweaker", "org.spongepowered.asm.launch.MixinTweaker");
jos.write(manifest.getBytes());
} else {
copy(jarFile.getInputStream(entry), jos);
}
}
if (toInclude.isPresent()) {
try (JarFile mixin = new JarFile(toInclude.get())) {
for (JarEntry entry : mixin.stream().sorted(Comparator.comparing(JarEntry::getName)).collect(Collectors.toList())) {
if (entry.getName().startsWith("META-INF") && !entry.getName().startsWith("META-INF/services")) {
continue;
}
jos.putNextEntry(entry);
copy(mixin.getInputStream(entry), jos);
}
}
}
jos.finish();
}
}
private static void copy(InputStream is, OutputStream os) throws IOException {
byte[] buffer = new byte[1024];
int len;
while ((len = is.read(buffer)) != -1) {
os.write(buffer, 0, len);
}
}
private static String writeSorted(JsonObject in) throws IOException {
StringWriter writer = new StringWriter();
JsonWriter jw = new JsonWriter(writer);
ORDERED_JSON_WRITER.write(jw, in);
return writer.toString() + "\n";
}
/**
* All credits go to GSON and its contributors. GSON is licensed under the Apache 2.0 License.
* This implementation has been modified to write {@link JsonObject} keys in order.
*
* @see <a href="https://github.com/google/gson/blob/master/LICENSE">GSON License</a>
* @see <a href="https://github.com/google/gson/blob/master/gson/src/main/java/com/google/gson/internal/bind/TypeAdapters.java#L698">Original Source</a>
*/
private static final TypeAdapter<JsonElement> ORDERED_JSON_WRITER = new TypeAdapter<JsonElement>() {
@Override
public JsonElement read(JsonReader in) {
return null;
}
@Override
public void write(JsonWriter out, JsonElement value) throws IOException {
if (value == null || value.isJsonNull()) {
out.nullValue();
} else if (value.isJsonPrimitive()) {
JsonPrimitive primitive = value.getAsJsonPrimitive();
if (primitive.isNumber()) {
out.value(primitive.getAsNumber());
} else if (primitive.isBoolean()) {
out.value(primitive.getAsBoolean());
} else {
out.value(primitive.getAsString());
}
} else if (value.isJsonArray()) {
out.beginArray();
for (JsonElement e : value.getAsJsonArray()) {
write(out, e);
}
out.endArray();
} else if (value.isJsonObject()) {
out.beginObject();
List<Map.Entry<String, JsonElement>> entries = new ArrayList<>(value.getAsJsonObject().entrySet());
entries.sort(Comparator.comparing(Map.Entry::getKey));
for (Map.Entry<String, JsonElement> e : entries) {
out.name(e.getKey());
write(out, e.getValue());
}
out.endObject();
} else {
throw new IllegalArgumentException("Couldn't write " + value.getClass());
}
}
};
}

View File

@@ -0,0 +1,29 @@
/*
* 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.gradle.util;
/**
* All credits go to AsmLibGradle and its contributors.
*
* @see <a href="https://github.com/pozzed/AsmLibGradle/blob/8f917dbc3939eab7a3d9daf54d9d285fdf34f4b2/src/main/java/net/futureclient/asmlib/forgegradle/MappingType.java">Original Source</a>
*/
public enum MappingType {
SEARGE,
NOTCH,
CUSTOM // forgegradle
}

View File

@@ -0,0 +1,63 @@
/*
* 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.gradle.util;
import java.lang.reflect.Field;
import java.util.Objects;
/**
* All credits go to AsmLibGradle and its contributors.
*
* @see <a href="https://github.com/pozzed/AsmLibGradle/blob/8f917dbc3939eab7a3d9daf54d9d285fdf34f4b2/src/main/java/net/futureclient/asmlib/forgegradle/ReobfWrapper.java">Original Source</a>
*/
public class ReobfWrapper {
private final Object instance;
private final Class<?> type;
public ReobfWrapper(Object instance) {
this.instance = instance;
Objects.requireNonNull(instance);
this.type = instance.getClass();
}
public String getName() {
try {
Field nameField = type.getDeclaredField("name");
nameField.setAccessible(true);
return (String) nameField.get(this.instance);
} catch (ReflectiveOperationException ex) {
throw new IllegalStateException(ex);
}
}
public MappingType getMappingType() {
try {
Field enumField = type.getDeclaredField("mappingType");
enumField.setAccessible(true);
Enum<?> aEnum = (Enum<?>) enumField.get(this.instance);
MappingType mappingType = MappingType.values()[aEnum.ordinal()];
if (!aEnum.name().equals(mappingType.name())) {
throw new IllegalStateException("ForgeGradle ReobfMappingType is not equivalent to MappingType (version error?)");
}
return mappingType;
} catch (ReflectiveOperationException ex) {
throw new IllegalStateException(ex);
}
}
}

View File

@@ -1,29 +1,31 @@
-injars baritone-1.0.0.jar
-outjars Obfuscated
-keepattributes Signature
-keepattributes *Annotation*
-optimizationpasses 20
-optimizationpasses 5
-verbose
-allowaccessmodification # anything not kept can be changed from public to private and inlined etc
-mergeinterfacesaggressively
-overloadaggressively
-dontusemixedcaseclassnames
# instead of obfing to a, b, c, obf to baritone.a, baritone.b, baritone.c so as to not conflict with mcp
# instead of renaming to a, b, c, rename to baritone.a, baritone.b, baritone.c so as to not conflict with minecraft's obfd classes
-flattenpackagehierarchy
-repackageclasses 'baritone'
#-keep class baritone.behavior.** { *; }
#-keep class baritone.api.** { *; }
#-keep class baritone.* { *; }
#-keep class baritone.pathing.goals.** { *; }
# lwjgl is weird
-dontwarn org.lwjgl.opengl.GL14
-keep class baritone.api.** { *; } # this is the keep api
# service provider needs these class names
-keep class baritone.BaritoneProvider
-keep class baritone.api.IBaritoneProvider
# hack
-keep class baritone.utils.ExampleBaritoneControl { *; } # have to include this string to remove this keep in the standalone build: # this is the keep api
# setting names are reflected from field names, so keep field names
-keepclassmembers class baritone.Settings {
-keepclassmembers class baritone.api.Settings {
public <fields>;
}
@@ -31,9 +33,11 @@
-keep class baritone.launch.** { *; }
# copy all necessary libraries into tempLibraries to build
-libraryjars '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/rt.jar'
-libraryjars 'tempLibraries/1.12.2.jar'
# The correct jar will be copied from the forgegradle cache based on the mapping type being compiled with
-libraryjars 'tempLibraries/minecraft.jar'
-libraryjars 'tempLibraries/SimpleTweaker-1.2.jar'
-libraryjars 'tempLibraries/authlib-1.5.25.jar'
-libraryjars 'tempLibraries/codecjorbis-20101023.jar'
@@ -49,22 +53,21 @@
-libraryjars 'tempLibraries/httpclient-4.3.3.jar'
-libraryjars 'tempLibraries/httpcore-4.3.2.jar'
-libraryjars 'tempLibraries/icu4j-core-mojang-51.2.jar'
-libraryjars 'tempLibraries/java-objc-bridge-1.0.0-natives-osx.jar'
-libraryjars 'tempLibraries/java-objc-bridge-1.0.0.jar'
-libraryjars 'tempLibraries/jinput-2.0.5.jar'
-libraryjars 'tempLibraries/jinput-platform-2.0.5-natives-osx.jar'
-libraryjars 'tempLibraries/jna-4.4.0.jar'
-libraryjars 'tempLibraries/jopt-simple-5.0.3.jar'
-libraryjars 'tempLibraries/jsr305-3.0.1-sources.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'
-libraryjars 'tempLibraries/lwjgl-2.9.2-nightly-20140822.jar'
-libraryjars 'tempLibraries/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar'
-libraryjars 'tempLibraries/lwjgl_util-2.9.2-nightly-20140822.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'
@@ -73,8 +76,8 @@
-libraryjars 'tempLibraries/soundsystem-20120107.jar'
-libraryjars 'tempLibraries/text2speech-1.10.3.jar'
-libraryjars 'tempLibraries/mixin-0.7.8-SNAPSHOT.jar'
-libraryjars 'tempLibraries/launchwrapper-1.12.jar'
-libraryjars 'tempLibraries/mixin-0.7.11-SNAPSHOT.jar'
-libraryjars 'tempLibraries/launchwrapper-1.11.jar' # TODO why does only 1.11.jar exist?

Binary file not shown.

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/

View File

@@ -0,0 +1,54 @@
/*
* 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.utils.SettingsUtil;
import java.util.Iterator;
import java.util.ServiceLoader;
/**
* API exposure for various things implemented in Baritone.
* <p>
* W.I.P
*
* @author Brady
* @since 9/23/2018
*/
public final class BaritoneAPI {
private static final IBaritoneProvider provider;
private static final Settings settings;
static {
ServiceLoader<IBaritoneProvider> baritoneLoader = ServiceLoader.load(IBaritoneProvider.class);
Iterator<IBaritoneProvider> instances = baritoneLoader.iterator();
provider = instances.next();
settings = new Settings();
SettingsUtil.readAndApply(settings);
}
public static IBaritoneProvider getProvider() {
return BaritoneAPI.provider;
}
public static Settings getSettings() {
return BaritoneAPI.settings;
}
}

View File

@@ -0,0 +1,79 @@
/*
* 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.ICustomGoalProcess;
import baritone.api.process.IFollowProcess;
import baritone.api.process.IGetToBlockProcess;
import baritone.api.process.IMineProcess;
import baritone.api.utils.IInputOverrideHandler;
import baritone.api.utils.IPlayerContext;
/**
* @author Brady
* @since 9/29/2018
*/
public interface IBaritone {
/**
* @return The {@link IFollowProcess} instance
* @see IFollowProcess
*/
IFollowProcess getFollowProcess();
/**
* @return The {@link ILookBehavior} instance
* @see ILookBehavior
*/
ILookBehavior getLookBehavior();
/**
* @return The {@link IMineProcess} instance
* @see IMineProcess
*/
IMineProcess getMineProcess();
/**
* @return The {@link IPathingBehavior} instance
* @see IPathingBehavior
*/
IPathingBehavior getPathingBehavior();
/**
* @return The {@link IWorldProvider} instance
* @see IWorldProvider
*/
IWorldProvider getWorldProvider();
IPathingControlManager getPathingControlManager();
IInputOverrideHandler getInputOverrideHandler();
ICustomGoalProcess getCustomGoalProcess();
IGetToBlockProcess getGetToBlockProcess();
IPlayerContext getPlayerContext();
IEventBus getGameEventHandler();
}

View File

@@ -0,0 +1,71 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api;
import baritone.api.cache.IWorldScanner;
import net.minecraft.client.entity.EntityPlayerSP;
import java.util.List;
/**
* @author Leijurv
*/
public interface IBaritoneProvider {
/**
* 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 primary {@link IBaritone} instance.
*/
IBaritone getPrimaryBaritone();
/**
* Returns all of the active {@link IBaritone} instances. This includes the local one
* returned by {@link #getPrimaryBaritone()}.
*
* @return All active {@link IBaritone} instances.
* @see #getBaritoneForPlayer(EntityPlayerSP)
*/
List<IBaritone> getAllBaritones();
/**
* Provides the {@link IBaritone} instance for a given {@link EntityPlayerSP}. This will likely be
* replaced with {@code #getBaritoneForUser(IBaritoneUser)} when {@code bot-system} is merged.
*
* @param player The player
* @return The {@link IBaritone} instance.
*/
default IBaritone getBaritoneForPlayer(EntityPlayerSP player) {
for (IBaritone baritone : getAllBaritones()) {
if (player.equals(baritone.getPlayerContext().player())) {
return baritone;
}
}
throw new IllegalStateException("No baritone for player " + player);
}
/**
* 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 IWorldScanner} instance.
*/
IWorldScanner getWorldScanner();
}

View File

@@ -0,0 +1,741 @@
/*
* 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 net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.text.ITextComponent;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.*;
import java.util.List;
import java.util.function.Consumer;
/**
* Baritone's settings
*
* @author leijurv
*/
public final class Settings {
/**
* Allow Baritone to break blocks
*/
public final Setting<Boolean> allowBreak = new Setting<>(true);
/**
* Allow Baritone to sprint
*/
public final Setting<Boolean> allowSprint = new Setting<>(true);
/**
* Allow Baritone to place blocks
*/
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
*/
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 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<>(5D);
/**
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
* Reliability: questionable.
*/
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 final Setting<Boolean> assumeWalkOnWater = new Setting<>(false);
/**
* Assume step functionality; don't jump on an Ascend.
*/
public final Setting<Boolean> assumeStep = new Setting<>(false);
/**
* Assume safe walk functionality; don't sneak on a backplace traverse.
* <p>
* Warning: if you do something janky like sneak-backplace from an ender chest, if this is true
* 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 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
*/
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);
/**
* Blocks that Baritone is allowed to place (as throwaway, for sneak bridging, pillaring, etc.)
*/
public final Setting<List<Item>> acceptableThrowawayItems = new Setting<>(new ArrayList<>(Arrays.asList(
Item.getItemFromBlock(Blocks.DIRT),
Item.getItemFromBlock(Blocks.COBBLESTONE),
Item.getItemFromBlock(Blocks.NETHERRACK)
)));
/**
* 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 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 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 final Setting<Boolean> allowParkour = new Setting<>(false);
/**
* Actually pretty reliable.
* <p>
* Doesn't make it any more dangerous compared to just normal allowParkour th
*/
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 final Setting<Boolean> considerPotionEffects = new Setting<>(true);
/**
* This is the big A* setting.
* As long as your cost heuristic is an *underestimate*, it's guaranteed to find you the best path.
* 3.5 is always an underestimate, even if you are sprinting.
* If you're walking only (with allowSprint off) 4.6 is safe.
* Any value below 3.5 is never worth it. It's just more computation to find the same path, guaranteed.
* (specifically, it needs to be strictly slightly less than ActionCosts.WALK_ONE_BLOCK_COST, which is about 3.56)
* <p>
* Setting it at 3.57 or above with sprinting, or to 4.64 or above without sprinting, will result in
* faster computation, at the cost of a suboptimal path. Any value above the walk / sprint cost will result
* in it going straight at its goal, and not investigating alternatives, because the combined cost / heuristic
* metric gets better and better with each block, instead of slightly worse.
* <p>
* Finding the optimal path is worth it, so it's the default.
*/
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 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 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 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/114">Issue #114</a>
*/
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 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 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 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 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 final Setting<Integer> planningTickLookAhead = new Setting<>(150);
/**
* Default size of the Long2ObjectOpenHashMap used in pathing
*/
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 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 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 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.
*/
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
* doesn't matter yet, and replace it with a GoalXZ to the same place before calculating a path.
* Once a segment ends within chunk load range of the GoalBlock, it will go back to normal behavior
* 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 final Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true);
/**
* If a movement takes this many ticks more than its initial cost estimate, cancel it
*/
public final Setting<Integer> movementTimeoutTicks = new Setting<>(100);
/**
* 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 final Setting<Long> primaryTimeoutMS = new Setting<>(500L);
/**
* Pathing can never take longer than this, even if that means failing to find any path at all
*/
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 final Setting<Boolean> slowPath = new Setting<>(false);
/**
* Milliseconds between each node
*/
public final Setting<Long> slowPathTimeDelayMS = new Setting<>(100L);
/**
* The alternative timeout number when slowPath is on
*/
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 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
*
* @see <a href="https://github.com/cabaletta/baritone/issues/248">Issue #248</a>
*/
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(false);
/**
* Print all the debug messages to chat
*/
public final Setting<Boolean> chatDebug = new Setting<>(true);
/**
* Allow chat based control of Baritone. Most likely should be disabled when Baritone is imported for use in
* something else
*/
public final Setting<Boolean> chatControl = new Setting<>(true);
/**
* A second override over chatControl to force it on
*/
public final Setting<Boolean> removePrefix = new Setting<>(false);
/**
* Render the path
*/
public final Setting<Boolean> renderPath = new Setting<>(true);
/**
* Render the goal
*/
public final Setting<Boolean> renderGoal = new Setting<>(true);
/**
* Ignore depth when rendering the goal
*/
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 final Setting<Boolean> renderSelectionBoxesIgnoreDepth = new Setting<>(true);
/**
* Ignore depth when rendering the path
*/
public final Setting<Boolean> renderPathIgnoreDepth = new Setting<>(true);
/**
* Line width of the path when rendered, in pixels
*/
public final Setting<Float> pathRenderLineWidthPixels = new Setting<>(5F);
/**
* Line width of the goal when rendered, in pixels
*/
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 final Setting<Boolean> fadePath = new Setting<>(false);
/**
* Move without having to force the client-sided rotations
*/
public final Setting<Boolean> freeLook = new Setting<>(true);
/**
* Will cause some minor behavioral differences to ensure that Baritone works on anticheats.
* <p>
* 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 final Setting<Boolean> antiCheatCompatibility = new Setting<>(true);
/**
* Exclusively use cached chunks for pathing
*/
public final Setting<Boolean> pathThroughCachedOnly = new Setting<>(false);
/**
* 😎 Render cached chunks as semitransparent.
* <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 Setting<Boolean> renderCachedChunks = new Setting<>(false);
/**
* 0.0f = not visible, fully transparent
* 1.0f = fully opaque
*/
public Setting<Float> cachedChunksOpacity = new Setting<>(0.5f);
/**
* If true, Baritone will not allow you to left or right click while pathing
*/
public Setting<Boolean> suppressClicks = new Setting<>(false);
/**
* Whether or not to use the "#" command prefix
*/
public final Setting<Boolean> prefixControl = new Setting<>(true);
/**
* Don't stop walking forward when you need to break blocks in your way
*/
public final Setting<Boolean> walkWhileBreaking = 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 final Setting<Integer> mineGoalUpdateInterval = new Setting<>(5);
/**
* 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 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.
* <p>
* Currently only runs when either MineBehavior or FollowBehavior is active.
* <p>
* For example, if Baritone is doing "mine iron_ore", the instant it breaks the ore (and it becomes air), that location
* is no longer a goal. This means that if this setting is true, it will stop there. If this setting were off, it would
* continue with its path, and walk into that location. The tradeoff is if this setting is true, it mines ores much faster
* since it doesn't waste any time getting into locations that no longer contain ores, but on the other hand, it misses
* some drops, and continues on without ever picking them up.
* <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 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 final Setting<Integer> axisHeight = new Setting<>(120);
/**
* 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);
/**
* 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 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 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 final Setting<Double> followOffsetDistance = new Setting<>(0D);
/**
* The actual GoalNear is set in this direction from the entity you're following. This value is in degrees.
*/
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 final Setting<Integer> followRadius = new Setting<>(3);
/**
* Cached chunks (regardless of if they're in RAM or saved to disk) expire and are deleted after this number of seconds
* -1 to disable
* <p>
* I would highly suggest leaving this setting disabled (-1).
* <p>
* The only valid reason I can think of enable this setting is if you are extremely low on disk space and you play on multiplayer,
* and can't take (average) 300kb saved for every 512x512 area. (note that more complicated terrain is less compressible and will take more space)
* <p>
* However, simply discarding old chunks because they are old is inadvisable. Baritone is extremely good at correcting
* itself and its paths as it learns new information, as new chunks load. There is no scenario in which having an
* incorrect cache can cause Baritone to get stuck, take damage, or perform any action it wouldn't otherwise, everything
* is rechecked once the real chunk is in range.
* <p>
* Having a robust cache greatly improves long distance pathfinding, as it's able to go around large scale obstacles
* before they're in render distance. In fact, when the chunkCaching setting is disabled and Baritone starts anew
* every time, or when you enter a completely new and very complicated area, it backtracks far more often because it
* 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 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 final Setting<Consumer<ITextComponent>> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage);
/**
* The color of the current path
*/
public final Setting<Color> colorCurrentPath = new Setting<>(Color.RED);
/**
* The color of the next path
*/
public final Setting<Color> colorNextPath = new Setting<>(Color.MAGENTA);
/**
* The color of the blocks to break
*/
public final Setting<Color> colorBlocksToBreak = new Setting<>(Color.RED);
/**
* The color of the blocks to place
*/
public final Setting<Color> colorBlocksToPlace = new Setting<>(Color.GREEN);
/**
* The color of the blocks to walk into
*/
public final Setting<Color> colorBlocksToWalkInto = new Setting<>(Color.MAGENTA);
/**
* The color of the best path so far
*/
public final Setting<Color> colorBestPathSoFar = new Setting<>(Color.BLUE);
/**
* The color of the path to the most recent considered node
*/
public final Setting<Color> colorMostRecentConsidered = new Setting<>(Color.CYAN);
/**
* The color of the goal box
*/
public final Setting<Color> colorGoalBox = new Setting<>(Color.GREEN);
/**
* A map of lowercase setting field names to their respective setting
*/
public final Map<String, Setting<?>> byLowerName;
/**
* A list of all settings
*/
public final List<Setting<?>> allSettings;
public void reset() {
for (Setting setting : allSettings) {
setting.value = setting.defaultValue;
}
}
public class Setting<T> {
public T value;
public final T defaultValue;
private String name;
private final Class<T> klass;
@SuppressWarnings("unchecked")
private Setting(T value) {
if (value == null) {
throw new IllegalArgumentException("Cannot determine value type class from null");
}
this.value = value;
this.defaultValue = value;
this.klass = (Class<T>) value.getClass();
}
@SuppressWarnings("unchecked")
public final <K extends T> K get() {
return (K) value;
}
public final String getName() {
return name;
}
public Class<T> getValueClass() {
return klass;
}
public String toString() {
return name + ": " + value;
}
}
// here be dragons
Settings() {
Field[] temp = getClass().getFields();
HashMap<String, Setting<?>> tmpByName = new HashMap<>();
List<Setting<?>> tmpAll = new ArrayList<>();
try {
for (Field field : temp) {
if (field.getType().equals(Setting.class)) {
Setting<?> setting = (Setting<?>) field.get(this);
String name = field.getName();
setting.name = name;
name = name.toLowerCase();
if (tmpByName.containsKey(name)) {
throw new IllegalStateException("Duplicate setting name");
}
tmpByName.put(name, setting);
tmpAll.add(setting);
}
}
} catch (IllegalAccessException e) {
throw new IllegalStateException(e);
}
byLowerName = Collections.unmodifiableMap(tmpByName);
allSettings = Collections.unmodifiableList(tmpAll);
}
@SuppressWarnings("unchecked")
public <T> List<Setting<T>> getAllValuesByType(Class<T> klass) {
List<Setting<T>> result = new ArrayList<>();
for (Setting<?> setting : allSettings) {
if (setting.getValueClass().equals(klass)) {
result.add((Setting<T>) setting);
}
}
return result;
}
}

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.behavior;
import baritone.api.event.listener.AbstractGameEventListener;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IBehavior extends AbstractGameEventListener {}

View File

@@ -0,0 +1,39 @@
/*
* 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.behavior;
import baritone.api.utils.Rotation;
/**
* @author Brady
* @since 9/23/2018
*/
public interface ILookBehavior extends IBehavior {
/**
* Updates the current {@link ILookBehavior} target to target
* the specified rotations on the next tick. If force is {@code true},
* then freeLook will be overriden and angles will be set regardless.
* If any sort of block interaction is required, force should be {@code true},
* otherwise, it should be {@code false};
*
* @param rotation The target rotations
* @param force Whether or not to "force" the rotations
*/
void updateTarget(Rotation rotation, boolean force);
}

View File

@@ -0,0 +1,108 @@
/*
* 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.behavior;
import baritone.api.pathing.calc.IPath;
import baritone.api.pathing.calc.IPathFinder;
import baritone.api.pathing.goals.Goal;
import baritone.api.pathing.path.IPathExecutor;
import java.util.Optional;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IPathingBehavior extends IBehavior {
/**
* 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.
*
* @return The estimated remaining ticks in the current segment.
*/
default Optional<Double> ticksRemainingInSegment() {
return ticksRemainingInSegment(true);
}
/**
* 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 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.
*/
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();
/**
* @return Whether or not a path is currently being executed.
*/
default boolean isPathing() {
return getCurrent() != null;
}
/**
* 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
*/
boolean cancelEverything();
/**
* Returns the current path, from the current path executor, if there is one.
*
* @return The current path
*/
default Optional<IPath> getPath() {
return Optional.ofNullable(getCurrent()).map(IPathExecutor::getPath);
}
/**
* @return The current path finder being executed
*/
Optional<? extends IPathFinder> getInProgress();
/**
* @return The current path executor
*/
IPathExecutor getCurrent();
/**
* Returns the next path executor, created when planning ahead.
*
* @return The next path executor
*/
IPathExecutor getNext();
}

View File

@@ -2,30 +2,29 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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.pathing;
package baritone.api.cache;
import baritone.utils.Helper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
/**
* @author Brady
* @since 8/4/2018 2:01 AM
* @since 8/4/2018
*/
public interface IBlockTypeAccess extends Helper {
public interface IBlockTypeAccess {
IBlockState getBlock(int x, int y, int z);

View File

@@ -0,0 +1,48 @@
/*
* 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.cache;
/**
* @author Brady
* @since 9/24/2018
*/
public interface ICachedRegion extends IBlockTypeAccess {
/**
* Returns whether or not the block at the specified X and Z coordinates
* is cached in this world. Similar to {@link ICachedWorld#isCached(int, int)},
* however, the block coordinates should in on a scale from 0 to 511 (inclusive)
* because region sizes are 512x512 blocks.
*
* @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);
/**
* @return The X coordinate of this region
*/
int getX();
/**
* @return The Z coordinate of this region
*/
int getZ();
}

View File

@@ -0,0 +1,84 @@
/*
* 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.cache;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.chunk.Chunk;
import java.util.LinkedList;
/**
* @author Brady
* @since 9/24/2018
*/
public interface ICachedWorld {
/**
* Returns the region at the specified region coordinates
*
* @param regionX The region X coordinate
* @param regionZ The region Z coordinate
* @return The region located at the specified coordinates
*/
ICachedRegion getRegion(int regionX, int regionZ);
/**
* Queues the specified chunk for packing. This entails reading the contents
* of the chunk, then packing the data into the 2-bit format, and storing that
* in this cached world.
*
* @param chunk The chunk to pack and store
*/
void queueForPacking(Chunk chunk);
/**
* Returns whether or not the block at the specified X and Z coordinates
* is cached in this world.
*
* @param blockX The block X coordinate
* @param blockZ The block Z coordinate
* @return Whether or not the specified XZ location is cached
*/
boolean isCached(int blockX, int blockZ);
/**
* Scans the cached chunks for location of the specified special block. The
* 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 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 centerX, int centerZ, int maxRegionDistanceSq);
/**
* Reloads all of the cached regions in this world from disk. Anything that is not saved
* will be lost. This operation does not execute in a new thread by default.
*/
void reloadAllFromDisk();
/**
* Saves all of the cached regions in this world to disk. This operation does not execute
* in a new thread by default.
*/
void save();
}

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.cache;
import net.minecraft.util.math.BlockPos;
import java.util.Map;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IContainerMemory {
/**
* Gets a remembered inventory by its block position.
*
* @param pos The position of the container block
* @return The remembered inventory
*/
IRememberedInventory getInventoryByPos(BlockPos pos);
/**
* Gets the map of all block positions to their remembered inventories.
*
* @return Map of block positions to their respective remembered inventories
*/
Map<BlockPos, IRememberedInventory> getRememberedInventories();
}

View File

@@ -2,33 +2,38 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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;
package baritone.api.cache;
import net.minecraft.item.ItemStack;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Brady
* @since 7/31/2018 10:10 PM
* @since 9/23/2018
*/
public class BaritoneTweakerOptifine extends BaritoneTweaker {
public interface IRememberedInventory {
@Override
public final void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
this.args = new ArrayList<>();
}
/**
* @return The contents of this inventory
*/
List<ItemStack> getContents();
/**
* @return The number of slots in this inventory
*/
int getSize();
}

View File

@@ -0,0 +1,111 @@
/*
* 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.cache;
import net.minecraft.util.math.BlockPos;
import org.apache.commons.lang3.ArrayUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* A marker for a position in the world.
*
* @author Brady
* @since 9/24/2018
*/
public interface IWaypoint {
/**
* @return The label for this waypoint
*/
String getName();
/**
* Returns the tag for this waypoint. The tag is a category
* for the waypoint in a sense, it describes the source of
* the waypoint.
*
* @return The waypoint tag
*/
Tag getTag();
/**
* Returns the unix epoch time in milliseconds that this waypoint
* was created. This value should only be set once, when the waypoint
* is initially created, and not when it is being loaded from file.
*
* @return The unix epoch milliseconds that this waypoint was created
*/
long getCreationTimestamp();
/**
* Returns the actual block position of this waypoint.
*
* @return The block position of this waypoint
*/
BlockPos getLocation();
enum Tag {
/**
* Tag indicating a position explictly marked as a home base
*/
HOME("home", "base"),
/**
* Tag indicating a position that the local player has died at
*/
DEATH("death"),
/**
* Tag indicating a bed position
*/
BED("bed", "spawn"),
/**
* Tag indicating that the waypoint was user-created
*/
USER("user");
/**
* A list of all of the
*/
private static final List<Tag> TAG_LIST = Collections.unmodifiableList(Arrays.asList(Tag.values()));
/**
* The names for the tag, anything that the tag can be referred to as.
*/
private final String[] names;
Tag(String... names) {
this.names = names;
}
/**
* Finds a tag from one of the names that could be used to identify said tag.
*
* @param name The name of the tag
* @return The tag, if one is found, otherwise, {@code null}
*/
public static Tag fromString(String name) {
return TAG_LIST.stream().filter(tag -> ArrayUtils.contains(tag.names, name.toLowerCase())).findFirst().orElse(null);
}
}
}

View File

@@ -0,0 +1,66 @@
/*
* 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.cache;
import java.util.Set;
/**
* @author Brady
* @since 9/24/2018
*/
public interface IWaypointCollection {
/**
* Adds a waypoint to this collection
*
* @param waypoint The waypoint
*/
void addWaypoint(IWaypoint waypoint);
/**
* Removes a waypoint from this collection
*
* @param waypoint The waypoint
*/
void removeWaypoint(IWaypoint waypoint);
/**
* Gets the most recently created waypoint by the specified {@link IWaypoint.Tag}
*
* @param tag The tag
* @return The most recently created waypoint with the specified tag
*/
IWaypoint getMostRecentByTag(IWaypoint.Tag tag);
/**
* Gets all of the waypoints that have the specified tag
*
* @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.
*
* @return All of the waypoints in this collection
* @see IWaypointCollection#getByTag(IWaypoint.Tag)
*/
Set<IWaypoint> getAllWaypoints();
}

View File

@@ -0,0 +1,45 @@
/*
* 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.cache;
/**
* @author Brady
* @since 9/24/2018
*/
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();
/**
* @return The waypoint collection for this world
*/
IWaypointCollection getWaypoints();
/**
* @return The {@link IContainerMemory} instance
* @see IContainerMemory
*/
IContainerMemory getContainerMemory();
}

View File

@@ -0,0 +1,32 @@
/*
* 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.cache;
/**
* @author Brady
* @since 9/24/2018
*/
public interface IWorldProvider {
/**
* Returns the data of the currently loaded world
*
* @return The current world data
*/
IWorldData getCurrentWorld();
}

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.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;
/**
* @author Brady
* @since 10/6/2018
*/
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
* returned, if the value is negative, then this condition doesn't apply.
* @param maxSearchRadius The maximum chunk search radius
* @return The matching block positions
*/
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

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -20,6 +20,8 @@ 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#START_BREAK} or {@link Type#USE}.
*
* @author Brady
* @since 8/22/2018
*/
@@ -57,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

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -21,7 +21,7 @@ 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 Cancellable {

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -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

@@ -2,39 +2,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 General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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;
import baritone.api.event.events.type.EventState;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
/**
* @author Brady
* @since 8/6/2018 9:31 PM
* @since 8/6/2018
*/
public final class PacketEvent {
private final NetworkManager networkManager;
private final EventState state;
private final Packet<?> packet;
public PacketEvent(EventState state, Packet<?> packet) {
public PacketEvent(NetworkManager networkManager, EventState state, Packet<?> packet) {
this.networkManager = networkManager;
this.state = state;
this.packet = packet;
}
public final NetworkManager getNetworkManager() {
return this.networkManager;
}
public final EventState getState() {
return this.state;
}

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -28,5 +28,6 @@ public enum PathEvent {
AT_GOAL,
PATH_FINISHED_NEXT_STILL_CALCULATING,
NEXT_CALC_FAILED,
DISCARD_NEXT
DISCARD_NEXT,
CANCELED;
}

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -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

@@ -0,0 +1,83 @@
/*
* 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;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
/**
* @author Brady
* @since 8/21/2018
*/
public final class RotationMoveEvent {
/**
* The type of event
*/
private final Type type;
/**
* The yaw rotation
*/
private float yaw;
public RotationMoveEvent(Type type, float yaw) {
this.type = type;
this.yaw = yaw;
}
/**
* Set the yaw movement rotation
*
* @param yaw Yaw rotation
*/
public final void setYaw(float yaw) {
this.yaw = yaw;
}
/**
* @return The yaw rotation
*/
public final float getYaw() {
return this.yaw;
}
/**
* @return The type of the event
*/
public final Type getType() {
return this.type;
}
public enum Type {
/**
* Called when the player's motion is updated.
*
* @see Entity#moveRelative(float, float, float, float)
*/
MOTION_UPDATE,
/**
* Called when the player jumps.
*
* @see EntityLivingBase#jump
*/
JUMP
}
}

View File

@@ -2,42 +2,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 General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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;
import baritone.api.event.events.type.EventState;
/**
* @author Brady
* @since 8/21/2018
* @since 1/18/2019
*/
public final class RelativeMoveEvent {
public final class SprintStateEvent {
/**
* The state of the event
*/
private final EventState state;
private Boolean state;
public RelativeMoveEvent(EventState state) {
public final void setState(boolean state) {
this.state = state;
}
/**
* @return The state of the event
*/
public final EventState getState() {
public final Boolean getState() {
return this.state;
}
}

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -23,10 +23,22 @@ public final class TickEvent {
private final EventState state;
private final Type type;
private final int count;
private static int overallTickCount;
public TickEvent(EventState state, Type type) {
this.state = state;
this.type = type;
this.count = incrementCount();
}
private static synchronized int incrementCount() {
return overallTickCount++;
}
public int getCount() {
return count;
}
public Type getType() {

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -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

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -19,25 +19,21 @@ package baritone.api.event.events.type;
/**
* @author Brady
* @since 8/1/2018 6:41 PM
* @since 8/1/2018
*/
public class Cancellable {
public class Cancellable implements ICancellable {
/**
* Whether or not this event has been cancelled
*/
private boolean cancelled;
/**
* Cancels this event
*/
@Override
public final void cancel() {
this.cancelled = true;
}
/**
* @return Whether or not this event has been cancelled
*/
@Override
public final boolean isCancelled() {
return this.cancelled;
}

View File

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -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 occured.
* After the dispatching of what the event is targetting
*/
POST
}

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.type;
/**
* @author Brady
* @since 10/11/2018
*/
public interface ICancellable {
/**
* Cancels this event
*/
void cancel();
/**
* @return Whether or not this event has been cancelled
*/
boolean isCancelled();
}

View File

@@ -2,33 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -43,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 {
@@ -53,9 +36,6 @@ public interface AbstractGameEventListener extends IGameEventListener {
@Override
default void onPlayerUpdate(PlayerUpdateEvent event) {}
@Override
default void onProcessKeyBinds() {}
@Override
default void onSendChatMessage(ChatEvent event) {}
@@ -75,7 +55,10 @@ public interface AbstractGameEventListener extends IGameEventListener {
default void onReceivePacket(PacketEvent event) {}
@Override
default void onPlayerRelativeMove(RelativeMoveEvent event) {}
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

@@ -2,33 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -40,22 +23,20 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiGameOver;
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.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);
@@ -63,20 +44,15 @@ public interface IGameEventListener {
/**
* Run once per game tick from before and after the player rotation is sent to the server.
*
* @param event The event
* @see EntityPlayerSP#onUpdate()
*/
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);
@@ -84,6 +60,7 @@ public interface IGameEventListener {
/**
* Runs before and after whenever a chunk is either loaded, unloaded, or populated.
*
* @param event The event
* @see WorldClient#doPreChunk(int, int, boolean)
*/
void onChunkEvent(ChunkEvent event);
@@ -93,13 +70,14 @@ public interface IGameEventListener {
* <p>
* <b>Note:</b> {@link GameSettings#anaglyph} has been removed in Minecraft 1.13
*
* @see EntityRenderer#renderWorldPass(int, float, long)
* @param event The event
*/
void onRenderPass(RenderEvent event);
/**
* Runs before and after whenever a new world is loaded
*
* @param event The event
* @see Minecraft#loadWorld(WorldClient, String)
*/
void onWorldEvent(WorldEvent event);
@@ -107,43 +85,56 @@ public interface IGameEventListener {
/**
* 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);
/**
* 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)
*/
void onPlayerRelativeMove(RelativeMoveEvent event);
void onPlayerRotationMove(RotationMoveEvent event);
/**
* Called whenever the sprint keybind state is checked in {@link EntityPlayerSP#onLivingUpdate}
*
* @param event The event
* @see EntityPlayerSP#onLivingUpdate()
*/
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 GuiGameOver
*/
void onPlayerDeath();
/**
* When the pathfinder's state changes
*
* @param event
* @param event The event
*/
void onPathEvent(PathEvent event);
}

View File

@@ -0,0 +1,179 @@
/*
* 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.Settings;
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;
/**
* @author leijurv, Brady
*/
public interface IPath {
/**
* Ordered list of movements to carry out.
* movements.get(i).getSrc() should equal positions.get(i)
* movements.get(i).getDest() should equal positions.get(i+1)
* movements.size() should equal positions.size()-1
*
* @return All of the movements to carry out
*/
List<IMovement> movements();
/**
* All positions along the way.
* Should begin with the same as getSrc and end with the same as getDest
*
* @return All of the positions along this path
*/
List<BetterBlockPos> positions();
/**
* 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 IPath postProcess() {
throw new UnsupportedOperationException();
}
/**
* Returns the number of positions in this path. Equivalent to {@code positions().size()}.
*
* @return Number of positions in this path
*/
default int length() {
return positions().size();
}
/**
* @return The goal that this path was calculated towards
*/
Goal getGoal();
/**
* Returns the number of nodes that were considered during calculation before
* this path was found.
*
* @return The number of nodes that were considered before finding this path
*/
int getNumNodesConsidered();
/**
* Returns the start position of this path. This is the first element in the
* {@link List} that is returned by {@link IPath#positions()}.
*
* @return The start position of this path
*/
default BetterBlockPos getSrc() {
return positions().get(0);
}
/**
* Returns the end position of this path. This is the last element in the
* {@link List} that is returned by {@link IPath#positions()}.
*
* @return The end position of this path.
*/
default BetterBlockPos getDest() {
List<BetterBlockPos> pos = positions();
return pos.get(pos.size() - 1);
}
/**
* Returns the estimated number of ticks to complete the path from the given node index.
*
* @param pathPosition The index of the node we're calculating from
* @return The estimated number of ticks remaining frm the given position
*/
default double ticksRemainingFrom(int pathPosition) {
double sum = 0;
//this is fast because we aren't requesting recalculation, it's just cached
List<IMovement> movements = movements();
for (int i = pathPosition; i < movements.size(); i++) {
sum += movements.get(i).getCost();
}
return sum;
}
/**
* 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(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
*/
default IPath staticCutoff(Goal destination) {
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

@@ -2,24 +2,23 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.calc;
package baritone.api.pathing.calc;
import baritone.pathing.goals.Goal;
import baritone.pathing.path.IPath;
import net.minecraft.util.math.BlockPos;
import baritone.api.pathing.goals.Goal;
import baritone.api.utils.PathCalculationResult;
import java.util.Optional;
@@ -30,16 +29,16 @@ import java.util.Optional;
*/
public interface IPathFinder {
BlockPos getStart();
Goal getGoal();
/**
* 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

@@ -2,22 +2,21 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.pathing.movement.ActionCosts;
import net.minecraft.util.math.BlockPos;
/**
@@ -25,22 +24,34 @@ import net.minecraft.util.math.BlockPos;
*
* @author leijurv
*/
public interface Goal extends ActionCosts {
public interface Goal {
/**
* Returns whether or not the specified position
* meets the requirement for this goal based.
*
* @param pos The position
* @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(BlockPos pos);
boolean isInGoal(int x, int y, int z);
/**
* Estimate the number of ticks it will take to get to the goal
*
* @param pos The
* @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(BlockPos pos);
double heuristic(int x, int y, int z);
default boolean isInGoal(BlockPos pos) {
return isInGoal(pos.getX(), pos.getY(), pos.getZ());
}
default double heuristic(BlockPos pos) {
return heuristic(pos.getX(), pos.getY(), pos.getZ());
}
}

View File

@@ -0,0 +1,49 @@
/*
* 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 baritone.api.BaritoneAPI;
public class GoalAxis implements Goal {
private static final double SQRT_2_OVER_2 = Math.sqrt(2) / 2;
@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));
}
@Override
public double heuristic(int x0, int y, int z0) {
int x = Math.abs(x0);
int z = Math.abs(z0);
int shrt = Math.min(x, z);
int lng = Math.max(x, z);
int diff = lng - shrt;
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);
}
@Override
public String toString() {
return "GoalAxis";
}
}

View File

@@ -2,22 +2,22 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import baritone.api.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
/**
@@ -53,36 +53,27 @@ public class GoalBlock implements Goal, IGoalRenderPos {
}
@Override
public boolean isInGoal(BlockPos pos) {
return pos.getX() == this.x && pos.getY() == this.y && pos.getZ() == this.z;
public boolean isInGoal(int x, int y, int z) {
return x == this.x && y == this.y && z == this.z;
}
/**
* The min range value over which to begin considering Y coordinate in the heuristic
*/
private static final double MIN = 20;
/**
* The max range value over which to begin considering Y coordinate in the heuristic
*/
private static final double MAX = 150;
@Override
public double heuristic(BlockPos pos) {
int xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
int zDiff = pos.getZ() - this.z;
public double heuristic(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return calculate(xDiff, yDiff, zDiff);
}
@Override
public String toString() {
return "Goal{x=" + x + ",y=" + y + ",z=" + z + "}";
return "GoalBlock{x=" + x + ",y=" + y + ",z=" + z + "}";
}
/**
* @return The position of this goal as a {@link BlockPos}
*/
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}
@@ -92,7 +83,7 @@ public class GoalBlock implements Goal, IGoalRenderPos {
// if yDiff is 1 that means that pos.getY()-this.y==1 which means that we're 1 block below where we should be
// therefore going from 0,0,0 to a GoalYLevel of pos.getY()-this.y is accurate
heuristic += new GoalYLevel(yDiff).heuristic(new BlockPos(0, 0, 0));
heuristic += GoalYLevel.calculate(yDiff, 0);
//use the pythagorean and manhattan mixture from GoalXZ
heuristic += GoalXZ.calculate(xDiff, zDiff);

View File

@@ -2,24 +2,22 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import java.util.Arrays;
import java.util.Collection;
import net.minecraft.util.math.BlockPos;
/**
* A composite of many goals, any one of which satisfies the composite.
@@ -33,30 +31,28 @@ public class GoalComposite implements Goal {
/**
* An array of goals that any one of must be satisfied
*/
public final Goal[] goals;
private final Goal[] goals;
public GoalComposite(Goal... goals) {
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) {
if (goal.isInGoal(x, y, z)) {
return true;
}
}
return false;
}
@Override
public boolean isInGoal(BlockPos pos) {
return Arrays.stream(this.goals).anyMatch(goal -> goal.isInGoal(pos));
}
@Override
public double heuristic(BlockPos pos) {
public double heuristic(int x, int y, int z) {
double min = Double.MAX_VALUE;
for (Goal g : goals) {
min = Math.min(min, g.heuristic(pos)); // whichever is closest
// TODO technically this isn't admissible...?
min = Math.min(min, g.heuristic(x, y, z)); // whichever is closest
}
return min;
}

View File

@@ -2,23 +2,22 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
import baritone.api.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
@@ -39,26 +38,29 @@ public class GoalGetToBlock implements Goal, IGoalRenderPos {
this.z = pos.getZ();
}
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}
@Override
public boolean isInGoal(BlockPos pos) {
int xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
int zDiff = pos.getZ() - this.z;
if (yDiff < 0) {
yDiff++;
}
return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1;
public boolean isInGoal(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return Math.abs(xDiff) + Math.abs(yDiff < 0 ? yDiff + 1 : yDiff) + Math.abs(zDiff) <= 1;
}
@Override
public double heuristic(BlockPos pos) {
int xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
int zDiff = pos.getZ() - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff);
public double heuristic(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff);
}
@Override
public String toString() {
return "GoalGetToBlock{x=" + x + ",y=" + y + ",z=" + z + "}";
}
}

View File

@@ -2,29 +2,29 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import baritone.api.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
public class GoalNear implements Goal, IGoalRenderPos {
final int x;
final int y;
final int z;
final int rangeSq;
private final int x;
private final int y;
private final int z;
private final int rangeSq;
public GoalNear(BlockPos pos, int range) {
this.x = pos.getX();
@@ -34,21 +34,22 @@ public class GoalNear implements Goal, IGoalRenderPos {
}
@Override
public boolean isInGoal(BlockPos pos) {
int diffX = x - pos.getX();
int diffY = y - pos.getY();
int diffZ = z - pos.getZ();
return diffX * diffX + diffY * diffY + diffZ * diffZ <= rangeSq;
public boolean isInGoal(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return xDiff * xDiff + yDiff * yDiff + zDiff * zDiff <= rangeSq;
}
@Override
public double heuristic(BlockPos pos) {
int diffX = x - pos.getX();
int diffY = y - pos.getY();
int diffZ = z - pos.getZ();
return GoalBlock.calculate(diffX, diffY, diffZ);
public double heuristic(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff);
}
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}

View File

@@ -2,47 +2,59 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import net.minecraft.util.math.BlockPos;
import java.util.Arrays;
import net.minecraft.util.math.BlockPos;
/**
* Useful for automated combat (retreating specifically)
*
* @author leijurv
*/
public class GoalRunAway implements Goal {
public final BlockPos[] from;
private final BlockPos[] from;
final double distanceSq;
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(BlockPos pos) {
public boolean isInGoal(int x, int y, int z) {
if (maintainY != null && maintainY != y) {
return false;
}
for (BlockPos p : from) {
int diffX = pos.getX() - p.getX();
int diffZ = pos.getZ() - p.getZ();
int diffX = x - p.getX();
int diffZ = z - p.getZ();
double distSq = diffX * diffX + diffZ * diffZ;
if (distSq < distanceSq) {
return false;
@@ -52,19 +64,27 @@ public class GoalRunAway implements Goal {
}
@Override
public double heuristic(BlockPos pos) {//mostly copied from GoalBlock
public double heuristic(int x, int y, int z) {//mostly copied from GoalBlock
double min = Double.MAX_VALUE;
for (BlockPos p : from) {
double h = GoalXZ.calculate(p.getX() - pos.getX(), p.getZ() - pos.getZ());
double h = GoalXZ.calculate(p.getX() - x, p.getZ() - z);
if (h < min) {
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

@@ -2,22 +2,22 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.utils.interfaces.IGoalRenderPos;
import baritone.api.utils.interfaces.IGoalRenderPos;
import net.minecraft.util.math.BlockPos;
/**
@@ -54,21 +54,19 @@ public class GoalTwoBlocks implements Goal, IGoalRenderPos {
}
@Override
public boolean isInGoal(BlockPos pos) {
return pos.getX() == this.x && (pos.getY() == this.y || pos.getY() == this.y - 1) && pos.getZ() == this.z;
public boolean isInGoal(int x, int y, int z) {
return x == this.x && (y == this.y || y == this.y - 1) && z == this.z;
}
@Override
public double heuristic(BlockPos pos) {
double xDiff = pos.getX() - this.x;
int yDiff = pos.getY() - this.y;
if (yDiff < 0) {
yDiff++;
}
double zDiff = pos.getZ() - this.z;
return GoalBlock.calculate(xDiff, yDiff, zDiff);
public double heuristic(int x, int y, int z) {
int xDiff = x - this.x;
int yDiff = y - this.y;
int zDiff = z - this.z;
return GoalBlock.calculate(xDiff, yDiff < 0 ? yDiff + 1 : yDiff, zDiff);
}
@Override
public BlockPos getGoalPos() {
return new BlockPos(x, y, z);
}

View File

@@ -2,24 +2,22 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import baritone.Baritone;
import baritone.utils.Utils;
import net.minecraft.util.math.BlockPos;
import baritone.api.BaritoneAPI;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
@@ -48,26 +46,23 @@ public class GoalXZ implements Goal {
}
@Override
public boolean isInGoal(BlockPos pos) {
return pos.getX() == x && pos.getZ() == z;
public boolean isInGoal(int x, int y, int z) {
return x == this.x && z == this.z;
}
@Override
public double heuristic(BlockPos pos) {//mostly copied from GoalBlock
double xDiff = pos.getX() - this.x;
double zDiff = pos.getZ() - this.z;
public double heuristic(int x, int y, int z) {//mostly copied from GoalBlock
int xDiff = x - this.x;
int zDiff = z - this.z;
return calculate(xDiff, zDiff);
}
@Override
public String toString() {
return "Goal{x=" + x + ",z=" + z + "}";
return "GoalXZ{x=" + x + ",z=" + z + "}";
}
public static double calculate(double xDiff, double zDiff) {
if (Baritone.settings().pythagoreanMetric.get()) {
return Math.sqrt(xDiff * xDiff + zDiff * zDiff) * Baritone.settings().costHeuristic.get();
}
//This is a combination of pythagorean and manhattan distance
//It takes into account the fact that pathing can either walk diagonally or forwards
@@ -85,11 +80,11 @@ public class GoalXZ implements Goal {
diagonal = z;
}
diagonal *= SQRT_2;
return (diagonal + straight) * Baritone.settings().costHeuristic.get(); // big TODO tune
return (diagonal + straight) * BaritoneAPI.getSettings().costHeuristic.get(); // big TODO tune
}
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
float theta = (float) Utils.degToRad(yaw);
float theta = (float) Math.toRadians(yaw);
double x = origin.x - MathHelper.sin(theta) * distance;
double z = origin.z + MathHelper.cos(theta) * distance;
return new GoalXZ((int) x, (int) z);

View File

@@ -2,29 +2,29 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.goals;
package baritone.api.pathing.goals;
import net.minecraft.util.math.BlockPos;
import baritone.api.pathing.movement.ActionCosts;
/**
* Useful for mining (getting to diamond / iron level)
*
* @author leijurv
*/
public class GoalYLevel implements Goal {
public class GoalYLevel implements Goal, ActionCosts {
/**
* The target Y level
@@ -36,25 +36,29 @@ public class GoalYLevel implements Goal {
}
@Override
public boolean isInGoal(BlockPos pos) {
return pos.getY() == level;
public boolean isInGoal(int x, int y, int z) {
return y == level;
}
@Override
public double heuristic(BlockPos pos) {
if (pos.getY() > level) {
public double heuristic(int x, int y, int z) {
return calculate(level, y);
}
public static double calculate(int goalY, int currentY) {
if (currentY > goalY) {
// need to descend
return FALL_N_BLOCKS_COST[2] / 2 * (pos.getY() - level);
return FALL_N_BLOCKS_COST[2] / 2 * (currentY - goalY);
}
if (pos.getY() < level) {
if (currentY < goalY) {
// need to ascend
return (level - pos.getY()) * JUMP_ONE_BLOCK_COST;
return (goalY - currentY) * JUMP_ONE_BLOCK_COST;
}
return 0;
}
@Override
public String toString() {
return "Goal{y=" + level + "}";
return "GoalYLevel{y=" + level + "}";
}
}

View File

@@ -2,22 +2,49 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.pathing.movement;
package baritone.api.pathing.movement;
public interface ActionCosts {
/**
* These costs are measured roughly in ticks btw
*/
double WALK_ONE_BLOCK_COST = 20 / 4.317; // 4.633
double WALK_ONE_IN_WATER_COST = 20 / 2.2; // 9.091
double WALK_ONE_OVER_SOUL_SAND_COST = WALK_ONE_BLOCK_COST * 2; // 0.4 in BlockSoulSand but effectively about half
double LADDER_UP_ONE_COST = 20 / 2.35; // 8.511
double LADDER_DOWN_ONE_COST = 20 / 3.0; // 6.667
double SNEAK_ONE_BLOCK_COST = 20 / 1.3; // 15.385
double SPRINT_ONE_BLOCK_COST = 20 / 5.612; // 3.564
double SPRINT_MULTIPLIER = SPRINT_ONE_BLOCK_COST / WALK_ONE_BLOCK_COST; // 0.769
/**
* To walk off an edge you need to walk 0.5 to the edge then 0.3 to start falling off
*/
double WALK_OFF_BLOCK_COST = WALK_ONE_BLOCK_COST * 0.8; // 3.706
/**
* To walk the rest of the way to be centered on the new block
*/
double CENTER_AFTER_FALL_COST = WALK_ONE_BLOCK_COST - WALK_OFF_BLOCK_COST; // 0.927
/**
* don't make this Double.MAX_VALUE because it's added to other things, maybe other COST_INFs,
* and that would make it overflow to negative
*/
double COST_INF = 1000000;
public interface ActionCostsButOnlyTheOnesThatMakeMickeyDieInside {
double[] FALL_N_BLOCKS_COST = generateFallNBlocksCost();
double FALL_1_25_BLOCKS_COST = distanceToTicks(1.25);
@@ -57,16 +84,15 @@ public interface ActionCostsButOnlyTheOnesThatMakeMickeyDieInside {
if (distance == 0) {
return 0; // Avoid 0/0 NaN
}
double tmpDistance = distance;
int tickCount = 0;
while (true) {
double fallDistance = velocity(tickCount);
if (distance <= fallDistance) {
return tickCount + distance / fallDistance;
if (tmpDistance <= fallDistance) {
return tickCount + tmpDistance / fallDistance;
}
distance -= fallDistance;
tmpDistance -= fallDistance;
tickCount++;
}
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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.movement;
import baritone.api.utils.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
/**
* @author Brady
* @since 10/8/2018
*/
public interface IMovement {
double getCost();
MovementStatus update();
/**
* Resets the current state status to {@link MovementStatus#PREPPING}
*/
void reset();
/**
* Resets the cache for special break, place, and walk into blocks
*/
void resetBlockCache();
/**
* @return Whether or not it is safe to cancel the current movement state
*/
boolean safeToCancel();
double recalculateCost();
double calculateCostWithoutCaching();
boolean calculatedWhileLoaded();
BetterBlockPos getSrc();
BetterBlockPos getDest();
BlockPos getDirection();
}

View File

@@ -0,0 +1,74 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.pathing.movement;
/**
* @author Brady
* @since 10/8/2018
*/
public enum MovementStatus {
/**
* We are preparing the movement to be executed. This is when any blocks obstructing the destination are broken.
*/
PREPPING(false),
/**
* We are waiting for the movement to begin, after {@link MovementStatus#PREPPING}.
*/
WAITING(false),
/**
* The movement is currently in progress, after {@link MovementStatus#WAITING}
*/
RUNNING(false),
/**
* The movement has been completed and we are at our destination
*/
SUCCESS(true),
/**
* There was a change in state between calculation and actual
* movement execution, and the movement has now become impossible.
*/
UNREACHABLE(true),
/**
* Unused
*/
FAILED(true),
/**
* "Unused"
*/
CANCELED(true);
/**
* Whether or not this status indicates a complete movement.
*/
private final boolean complete;
MovementStatus(boolean complete) {
this.complete = complete;
}
public final boolean isComplete() {
return this.complete;
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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.path;
import baritone.api.pathing.calc.IPath;
/**
* @author Brady
* @since 10/8/2018
*/
public interface IPathExecutor {
IPath getPath();
int getPosition();
}

View File

@@ -0,0 +1,93 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.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 {
/**
* 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
*/
double priority();
/**
* Returns a user-friendly name for this process. Suitable for a HUD.
*
* @return A display name that's suitable for a HUD
*/
String displayName();
}

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,51 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.api.process;
import net.minecraft.entity.Entity;
import java.util.List;
import java.util.function.Predicate;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IFollowProcess extends IBaritoneProcess {
/**
* Set the follow target to any entities matching this predicate
*
* @param filter the predicate
*/
void follow(Predicate<Entity> filter);
/**
* @return The entities that are currently being followed. null if not currently following, empty if nothing matches the predicate
*/
List<Entity> following();
Predicate<Entity> currentFilter();
/**
* Cancels the follow behavior, this will clear the current follow target.
*/
default void cancel() {
onLostControl();
}
}

View File

@@ -0,0 +1,28 @@
/*
* 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);
}

View File

@@ -0,0 +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.api.process;
import net.minecraft.block.Block;
/**
* @author Brady
* @since 9/23/2018
*/
public interface IMineProcess extends IBaritoneProcess {
/**
* Begin to search for and mine the specified blocks until
* the number of specified items to get from the blocks that
* 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
*/
void mineByName(int quantity, String... blocks);
/**
* Begin to search for and mine the specified blocks until
* the number of specified items to get from the blocks that
* 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
*/
void mine(int quantity, Block... blocks);
/**
* Begin to search for and mine the specified blocks.
*
* @param blocks The blocks to mine
*/
default void mineByName(String... blocks) {
mineByName(0, blocks);
}
/**
* Begin to search for and mine the specified blocks.
*
* @param blocks The blocks to mine
*/
default void mine(Block... blocks) {
mine(0, blocks);
}
/**
* Cancels the current mining task
*/
default void cancel() {
onLostControl();
}
}

View File

@@ -0,0 +1,56 @@
/*
* 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;
}
}

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.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
}

View File

@@ -0,0 +1,183 @@
/*
* 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.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
/**
* A better BlockPos that has fewer hash collisions (and slightly more performant offsets)
* <p>
* Is it really faster to subclass BlockPos and calculate a hash in the constructor like this, taking everything into account?
* Yes. 20% faster actually. It's called BETTER BlockPos for a reason. Source:
* <a href="https://docs.google.com/spreadsheets/d/1GWjOjOZINkg_0MkRgKRPH1kUzxjsnEROD9u3UFh_DJc">Benchmark Spreadsheet</a>
*
* @author leijurv
*/
public final class BetterBlockPos extends BlockPos {
public final int x;
public final int y;
public final int z;
public BetterBlockPos(int x, int y, int z) {
super(x, y, z);
this.x = x;
this.y = y;
this.z = z;
}
public BetterBlockPos(double x, double y, double z) {
this(MathHelper.floor(x), MathHelper.floor(y), MathHelper.floor(z));
}
public BetterBlockPos(BlockPos pos) {
this(pos.getX(), pos.getY(), pos.getZ());
}
@Override
public int hashCode() {
return (int) longHash(x, y, z);
}
public static long longHash(BetterBlockPos pos) {
return longHash(pos.x, pos.y, pos.z);
}
public static long longHash(int x, int y, int z) {
/*
* This is the hashcode implementation of Vec3i (the superclass of the class which I shall not name)
*
* public int hashCode() {
* return (this.getY() + this.getZ() * 31) * 31 + this.getX();
* }
*
* That is terrible and has tons of collisions and makes the HashMap terribly inefficient.
*
* That's why we grab out the X, Y, Z and calculate our own hashcode
*/
long hash = 3241;
hash = 3457689L * hash + x;
hash = 8734625L * hash + y;
hash = 2873465L * hash + z;
return hash;
}
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (o instanceof BetterBlockPos) {
BetterBlockPos oth = (BetterBlockPos) o;
return oth.x == x && oth.y == y && oth.z == z;
}
// during path execution, like "if (whereShouldIBe.equals(whereAmI)) {"
// sometimes we compare a BlockPos to a BetterBlockPos
BlockPos oth = (BlockPos) o;
return oth.getX() == x && oth.getY() == y && oth.getZ() == z;
}
@Override
public BetterBlockPos up() {
// this is unimaginably faster than blockpos.up
// that literally calls
// this.up(1)
// which calls this.offset(EnumFacing.UP, 1)
// which does return n == 0 ? this : new BlockPos(this.getX() + facing.getXOffset() * n, this.getY() + facing.getYOffset() * n, this.getZ() + facing.getZOffset() * n);
// how many function calls is that? up(), up(int), offset(EnumFacing, int), new BlockPos, getX, getXOffset, getY, getYOffset, getZ, getZOffset
// that's ten.
// this is one function call.
return new BetterBlockPos(x, y + 1, z);
}
@Override
public BetterBlockPos up(int amt) {
// see comment in up()
return amt == 0 ? this : new BetterBlockPos(x, y + amt, z);
}
@Override
public BetterBlockPos down() {
// see comment in up()
return new BetterBlockPos(x, y - 1, z);
}
@Override
public BetterBlockPos down(int amt) {
// see comment in up()
return amt == 0 ? this : new BetterBlockPos(x, y - amt, z);
}
@Override
public BetterBlockPos offset(EnumFacing dir) {
Vec3i vec = dir.getDirectionVec();
return new BetterBlockPos(x + vec.getX(), y + vec.getY(), z + vec.getZ());
}
@Override
public BetterBlockPos offset(EnumFacing dir, int dist) {
if (dist == 0) {
return this;
}
Vec3i vec = dir.getDirectionVec();
return new BetterBlockPos(x + vec.getX() * dist, y + vec.getY() * dist, z + vec.getZ() * dist);
}
@Override
public BetterBlockPos north() {
return new BetterBlockPos(x, y, z - 1);
}
@Override
public BetterBlockPos north(int amt) {
return amt == 0 ? this : new BetterBlockPos(x, y, z - amt);
}
@Override
public BetterBlockPos south() {
return new BetterBlockPos(x, y, z + 1);
}
@Override
public BetterBlockPos south(int amt) {
return amt == 0 ? this : new BetterBlockPos(x, y, z + amt);
}
@Override
public BetterBlockPos east() {
return new BetterBlockPos(x + 1, y, z);
}
@Override
public BetterBlockPos east(int amt) {
return amt == 0 ? this : new BetterBlockPos(x + amt, y, z);
}
@Override
public BetterBlockPos west() {
return new BetterBlockPos(x - 1, y, z);
}
@Override
public BetterBlockPos west(int amt) {
return amt == 0 ? this : new BetterBlockPos(x - amt, y, z);
}
}

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 baritone.api.behavior.IBehavior;
import baritone.api.utils.input.Input;
import net.minecraft.client.settings.KeyBinding;
/**
* @author Brady
* @since 11/12/2018
*/
public interface IInputOverrideHandler extends IBehavior {
Boolean isInputForcedDown(KeyBinding key);
boolean isInputForcedDown(Input input);
void setInputForceState(Input input, boolean forced);
void clearAllKeys();
}

View File

@@ -0,0 +1,91 @@
/*
* 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() {
if (objectMouseOver() != null && objectMouseOver().typeOfHit == RayTraceResult.Type.BLOCK) {
return Optional.of(objectMouseOver().getBlockPos());
}
return Optional.empty();
}
/**
* Returns the entity that the crosshair is currently placed over. Updated once per tick.
*
* @return The entity
*/
default Optional<Entity> getSelectedEntity() {
if (objectMouseOver() != null && objectMouseOver().typeOfHit == RayTraceResult.Type.ENTITY) {
return Optional.of(objectMouseOver().entityHit);
}
return Optional.empty();
}
}

View File

@@ -0,0 +1,46 @@
/*
* 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.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
/**
* @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;
}
}

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

@@ -0,0 +1,52 @@
/*
* 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.entity.Entity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
/**
* @author Brady
* @since 8/25/2018
*/
public final class RayTraceUtils {
private RayTraceUtils() {}
/**
* 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 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(Entity entity, Rotation rotation, double blockReachDistance) {
Vec3d start = entity.getPositionEyes(1.0F);
Vec3d direction = RotationUtils.calcVec3dFromRotation(rotation);
Vec3d end = start.add(
direction.x * blockReachDistance,
direction.y * blockReachDistance,
direction.z * blockReachDistance
);
return entity.world.rayTraceBlocks(start, end, false, false, true);
}
}

View File

@@ -0,0 +1,150 @@
/*
* 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;
/**
* @author Brady
* @since 9/25/2018
*/
public class Rotation {
/**
* The yaw angle of this Rotation
*/
private float yaw;
/**
* The pitch angle of this Rotation
*/
private float pitch;
public Rotation(float yaw, float pitch) {
this.yaw = yaw;
this.pitch = pitch;
}
/**
* @return The yaw of this rotation
*/
public float getYaw() {
return this.yaw;
}
/**
* @return The pitch of this rotation
*/
public float getPitch() {
return this.pitch;
}
/**
* Adds the yaw/pitch of the specified rotations to this
* rotation's yaw/pitch, and returns the result.
*
* @param other Another rotation
* @return The result from adding the other rotation to this rotation
*/
public Rotation add(Rotation other) {
return new Rotation(
this.yaw + other.yaw,
this.pitch + other.pitch
);
}
/**
* Subtracts the yaw/pitch of the specified rotations from this
* rotation's yaw/pitch, and returns the result.
*
* @param other Another rotation
* @return The result from subtracting the other rotation from this rotation
*/
public Rotation subtract(Rotation other) {
return new Rotation(
this.yaw - other.yaw,
this.pitch - other.pitch
);
}
/**
* @return A copy of this rotation with the pitch clamped
*/
public Rotation clamp() {
return new Rotation(
this.yaw,
clampPitch(this.pitch)
);
}
/**
* @return A copy of this rotation with the yaw normalized
*/
public Rotation normalize() {
return new Rotation(
normalizeYaw(this.yaw),
this.pitch
);
}
/**
* @return A copy of this rotation with the pitch clamped and the yaw normalized
*/
public Rotation normalizeAndClamp() {
return new Rotation(
normalizeYaw(this.yaw),
clampPitch(this.pitch)
);
}
/**
* Is really close to
*
* @param other another rotation
* @return are they really close
*/
public boolean isReallyCloseTo(Rotation other) {
float yawDiff = Math.abs(this.yaw - other.yaw); // you cant fool me
return (yawDiff < 0.01 || yawDiff > 359.9) && Math.abs(this.pitch - other.pitch) < 0.01;
}
/**
* 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;
}
}

View File

@@ -0,0 +1,225 @@
/*
* 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 net.minecraft.block.BlockFire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.*;
import java.util.Optional;
/**
* @author Brady
* @since 9/25/2018
*/
public final class RotationUtils {
/**
* Constant that a degree value is multiplied by to get the equivalent radian value
*/
public static final double DEG_TO_RAD = Math.PI / 180.0;
/**
* Constant that a radian value is multiplied by to get the equivalent degree value
*/
public static final double RAD_TO_DEG = 180.0 / Math.PI;
/**
* Offsets from the root block position to the center of each side.
*/
private static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[]{
new Vec3d(0.5, 0, 0.5), // Down
new Vec3d(0.5, 1, 0.5), // Up
new Vec3d(0.5, 0.5, 0), // North
new Vec3d(0.5, 0.5, 1), // South
new Vec3d(0, 0.5, 0.5), // West
new Vec3d(1, 0.5, 0.5) // East
};
private RotationUtils() {}
/**
* Calculates the rotation from BlockPos<sub>dest</sub> to BlockPos<sub>orig</sub>
*
* @param orig The origin position
* @param dest The destination position
* @return The rotation from the origin to the destination
*/
public static Rotation calcRotationFromCoords(BlockPos orig, BlockPos dest) {
return calcRotationFromVec3d(new Vec3d(orig), new Vec3d(dest));
}
/**
* Wraps the target angles to a relative value from the current angles. This is done by
* subtracting the current from the target, normalizing it, and then adding the current
* angles back to it.
*
* @param current The current angles
* @param target The target angles
* @return The wrapped angles
*/
public static Rotation wrapAnglesToRelative(Rotation current, Rotation target) {
return target.subtract(current).normalize().add(current);
}
/**
* Calculates the rotation from Vec<sub>dest</sub> to Vec<sub>orig</sub> and makes the
* return value relative to the specified current rotations.
*
* @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));
}
/**
* Calculates the rotation from Vec<sub>dest</sub> to Vec<sub>orig</sub>
*
* @param orig The origin position
* @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};
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);
return new Rotation(
(float) (yaw * RAD_TO_DEG),
(float) (pitch * RAD_TO_DEG)
);
}
/**
* Calculates the look vector for the specified yaw/pitch rotations.
*
* @param rotation The input rotation
* @return Look vector for the rotation
*/
public static Vec3d calcVec3dFromRotation(Rotation rotation) {
float f = MathHelper.cos(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
float f1 = MathHelper.sin(-rotation.getYaw() * (float) DEG_TO_RAD - (float) Math.PI);
float f2 = -MathHelper.cos(-rotation.getPitch() * (float) DEG_TO_RAD);
float f3 = MathHelper.sin(-rotation.getPitch() * (float) DEG_TO_RAD);
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,
* that rotation will be returned. If not, it will return the first center of a given
* 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 blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachable(EntityPlayerSP entity, BlockPos pos, double blockReachDistance) {
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(entity);
if (pos.equals(baritone.getPlayerContext().getSelectedBlock().orElse(null))) {
/*
* why add 0.0001?
* to indicate that we actually have a desired pitch
* the way we indicate that the pitch can be whatever and we only care about the yaw
* 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, blockReachDistance);
//System.out.println("center: " + possibleRotation);
if (possibleRotation.isPresent()) {
return possibleRotation;
}
IBlockState state = entity.world.getBlockState(pos);
AxisAlignedBB aabb = state.getBoundingBox(entity.world, pos);
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), blockReachDistance);
if (possibleRotation.isPresent()) {
return possibleRotation;
}
}
return Optional.empty();
}
/**
* Determines if the specified entity is able to reach the specified block with
* 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 blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachableOffset(Entity entity, BlockPos pos, Vec3d offsetPos, double blockReachDistance) {
Rotation rotation = calcRotationFromVec3d(entity.getPositionEyes(1.0F), offsetPos);
RayTraceResult result = RayTraceUtils.rayTraceTowards(entity, rotation, blockReachDistance);
//System.out.println(result);
if (result != null && result.typeOfHit == RayTraceResult.Type.BLOCK) {
if (result.getBlockPos().equals(pos)) {
return Optional.of(rotation);
}
if (entity.world.getBlockState(pos).getBlock() instanceof BlockFire && result.getBlockPos().equals(pos.down())) {
return Optional.of(rotation);
}
}
return Optional.empty();
}
/**
* 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 blockReachDistance The block reach distance of the entity
* @return The optional rotation
*/
public static Optional<Rotation> reachableCenter(Entity entity, BlockPos pos, double blockReachDistance) {
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.world, pos), blockReachDistance);
}
}

View File

@@ -0,0 +1,162 @@
/*
* 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.Settings;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import java.awt.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
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;
import static net.minecraft.client.Minecraft.getMinecraft;
public class SettingsUtil {
private static final Path SETTINGS_PATH = getMinecraft().gameDir.toPath().resolve("baritone").resolve("settings.txt");
private static final Pattern SETTING_PATTERN = Pattern.compile("^(?<setting>[^ ]+) +(?<value>[^ ]+)"); // 2 words separated by spaces
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 {
forEachLine(SETTINGS_PATH, line -> {
Matcher matcher = SETTING_PATTERN.matcher(line);
if (!matcher.matches()) {
System.out.println("Invalid syntax in setting file: " + line);
return;
}
String settingName = matcher.group("setting").toLowerCase();
String settingValue = matcher.group("value");
try {
parseAndApply(settings, settingName, settingValue);
} catch (Exception ex) {
System.out.println("Unable to parse line " + line);
ex.printStackTrace();
}
});
} catch (Exception ex) {
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 (BufferedWriter out = Files.newBufferedWriter(SETTINGS_PATH)) {
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");
}
} catch (Exception ex) {
System.out.println("Exception thrown while saving Baritone settings!");
ex.printStackTrace();
}
}
private 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);
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 {
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),
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());
Class<?> klass;
Function<String, Object> parser;
Function<Object, String> toString;
<T> SettingsIO(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) {
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);
}
map = Collections.unmodifiableMap(tempMap);
}
}

View File

@@ -0,0 +1,116 @@
/*
* 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.BlockFire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
/**
* @author Brady
* @since 10/13/2018
*/
public final class VecUtils {
private VecUtils() {}
/**
* Calculates the center of the block at the specified position's bounding box
*
* @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(World world, BlockPos pos) {
IBlockState b = world.getBlockState(pos);
AxisAlignedBB bbox = b.getBoundingBox(world, pos);
double xDiff = (bbox.minX + bbox.maxX) / 2;
double yDiff = (bbox.minY + bbox.maxY) / 2;
double zDiff = (bbox.minZ + bbox.maxZ) / 2;
if (b.getBlock() instanceof BlockFire) {//look at bottom of fire when putting it out
yDiff = 0;
}
return new Vec3d(
pos.getX() + xDiff,
pos.getY() + yDiff,
pos.getZ() + zDiff
);
}
/**
* Gets the assumed center position of the given block position.
* This is done by adding 0.5 to the X, Y, and Z axes.
* <p>
* TODO: We may want to consider replacing many usages of this method with #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);
}
/**
* Gets the distance from the specified position to the assumed center of the specified block position.
*
* @param pos The block position
* @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) {
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);
}
/**
* Gets the distance from the specified entity's position to the assumed
* center of the specified block position.
*
* @param entity The entity
* @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);
}
/**
* Gets the distance from the specified entity's position to the assumed
* center of the specified block position, ignoring the Y axis.
*
* @param entity The entity
* @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

@@ -0,0 +1,119 @@
/*
* 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.input;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
/**
* An {@link Enum} representing the inputs that control the player's
* behavior. This includes moving, interacting with blocks, jumping,
* sneaking, and sprinting.
*/
public enum Input {
/**
* The move forward input
*/
MOVE_FORWARD(s -> s.keyBindForward),
/**
* The move back input
*/
MOVE_BACK(s -> s.keyBindBack),
/**
* The move left input
*/
MOVE_LEFT(s -> s.keyBindLeft),
/**
* The move right input
*/
MOVE_RIGHT(s -> s.keyBindRight),
/**
* The attack input
*/
CLICK_LEFT(s -> s.keyBindAttack),
/**
* The use item input
*/
CLICK_RIGHT(s -> s.keyBindUseItem),
/**
* The jump input
*/
JUMP(s -> s.keyBindJump),
/**
* The sneak input
*/
SNEAK(s -> s.keyBindSneak),
/**
* The sprint input
*/
SPRINT(s -> s.keyBindSprint);
/**
* Map of {@link KeyBinding} to {@link Input}. Values should be queried through {@link #getInputForBind(KeyBinding)}
*/
private static final Map<KeyBinding, Input> bindToInputMap = new HashMap<>();
/**
* The actual game {@link KeyBinding} being forced.
*/
private final KeyBinding keyBinding;
Input(Function<GameSettings, KeyBinding> keyBindingMapper) {
/*
Here, a Function is used because referring to a static field in this enum for the game instance,
as it was before, wouldn't be possible in an Enum constructor unless the static field was in an
interface that this class implemented. (Helper acted as this interface) I didn't feel like making
an interface with a game instance field just to not have to do this.
*/
this.keyBinding = keyBindingMapper.apply(Minecraft.getMinecraft().gameSettings);
}
/**
* @return The actual game {@link KeyBinding} being forced.
*/
public final KeyBinding getKeyBinding() {
return this.keyBinding;
}
/**
* Finds the {@link Input} constant that is associated with the specified {@link KeyBinding}.
*
* @param binding The {@link KeyBinding} to find the associated {@link Input} for
* @return The {@link Input} associated with the specified {@link KeyBinding}
*/
public static Input getInputForBind(KeyBinding binding) {
return bindToInputMap.computeIfAbsent(binding, b -> Arrays.stream(values()).filter(input -> input.keyBinding == b).findFirst().orElse(null));
}
}

View File

@@ -2,20 +2,20 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* 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.interfaces;
package baritone.api.utils.interfaces;
import net.minecraft.util.math.BlockPos;

View File

@@ -2,76 +2,54 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch;
import net.minecraft.launchwrapper.ITweaker;
import io.github.impactdevelopment.simpletweaker.SimpleTweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;
import org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Brady
* @since 7/31/2018 9:59 PM
* @since 7/31/2018
*/
public class BaritoneTweaker implements ITweaker {
List<String> args;
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
this.args = new ArrayList<>(args);
if (gameDir != null) {
addArg("gameDir", gameDir.getAbsolutePath());
}
if (assetsDir != null) {
addArg("assetsDir", assetsDir.getAbsolutePath());
}
if (profile != null) {
addArg("version", profile);
}
}
public class BaritoneTweaker extends SimpleTweaker {
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
super.injectIntoClassLoader(classLoader);
MixinBootstrap.init();
// noinspection unchecked
List<String> tweakClasses = (List<String>) Launch.blackboard.get("TweakClasses");
String obfuscation = ObfuscationServiceMCP.NOTCH;
if (tweakClasses.stream().anyMatch(s -> s.contains("net.minecraftforge.fml.common.launcher"))) {
obfuscation = ObfuscationServiceMCP.SEARGE;
}
MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT);
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(ObfuscationServiceMCP.NOTCH);
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(obfuscation);
Mixins.addConfiguration("mixins.baritone.json");
}
@Override
public final String getLaunchTarget() {
return "net.minecraft.client.main.Main";
}
@Override
public final String[] getLaunchArguments() {
return this.args.toArray(new String[0]);
}
private void addArg(String label, String value) {
if (!args.contains("--" + label) && value != null) {
this.args.add("--" + label);
this.args.add(value);
}
}
}

View File

@@ -1,44 +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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author Brady
* @since 7/31/2018 10:09 PM
*/
public class BaritoneTweakerForge extends BaritoneTweaker {
@Override
public final void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
this.args = new ArrayList<>();
}
@Override
public final void injectIntoClassLoader(LaunchClassLoader classLoader) {
super.injectIntoClassLoader(classLoader);
MixinEnvironment.getDefaultEnvironment().setObfuscationContext(ObfuscationServiceMCP.SEARGE);
}
}

View File

@@ -2,33 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -49,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

@@ -2,16 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -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() {

View File

@@ -0,0 +1,39 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins;
import baritone.utils.accessor.IChunkProviderClient;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.world.chunk.Chunk;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(ChunkProviderClient.class)
public class MixinChunkProviderClient implements IChunkProviderClient {
@Shadow
@Final
private Long2ObjectMap<Chunk> loadedChunks;
@Override
public Long2ObjectMap<Chunk> loadedChunks() {
return this.loadedChunks;
}
}

View File

@@ -2,33 +2,16 @@
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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 General Public License for more details.
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
@@ -48,7 +31,9 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(ChunkProviderServer.class)
public class MixinChunkProviderServer implements IChunkProviderServer {
@Shadow @Final private IChunkLoader chunkLoader;
@Shadow
@Final
private IChunkLoader chunkLoader;
@Override
public IChunkLoader getChunkLoader() {

View File

@@ -0,0 +1,48 @@
/*
* This file is part of Baritone.
*
* Baritone is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Baritone is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
*/
package baritone.launch.mixins;
import baritone.Baritone;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ChunkRenderContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.chunk.RenderChunk;
import org.lwjgl.opengl.GL14;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static org.lwjgl.opengl.GL11.*;
@Mixin(ChunkRenderContainer.class)
public class MixinChunkRenderContainer {
@Inject(
method = "preRenderChunk",
at = @At("HEAD")
)
private void preRenderChunk(RenderChunk renderChunkIn, CallbackInfo ci) {
if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get());
GlStateManager.tryBlendFuncSeparate(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, GL_ONE, GL_ZERO);
}
}
}

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