Compare commits
1910 Commits
v1.0.0
...
pr/invento
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a6d0642be | ||
|
|
dbf5058066 | ||
|
|
bc18f0eabd | ||
|
|
827ce7e2a8 | ||
|
|
2e32c63bc2 | ||
|
|
53651980ad | ||
|
|
ec089cdeaa | ||
|
|
2408c9b6af | ||
|
|
600d5e8a67 | ||
|
|
57c3e369b0 | ||
|
|
827125d827 | ||
|
|
4d7eb003e6 | ||
|
|
1ef622c936 | ||
|
|
c44701e689 | ||
|
|
7f27c9d85f | ||
|
|
15621ea763 | ||
|
|
4591fd7eb3 | ||
|
|
028405dd30 | ||
|
|
2953b1cfaf | ||
|
|
b2cdd27ca2 | ||
|
|
4bf2dd6851 | ||
|
|
8211ae4af5 | ||
|
|
15f4253b3d | ||
|
|
24b0bd2edf | ||
|
|
e3a1ac85cc | ||
|
|
1ea071de09 | ||
|
|
c9a18caf49 | ||
|
|
bfae100cb9 | ||
|
|
b0ebbf4dfb | ||
|
|
9d12a4ba3d | ||
|
|
6dc953631b | ||
|
|
0682e63707 | ||
|
|
7e426bd2e8 | ||
|
|
367ce5fa17 | ||
|
|
41d730fb04 | ||
|
|
30278a1c52 | ||
|
|
d87d1ab9b5 | ||
|
|
31c9072970 | ||
|
|
f7a20a3acf | ||
|
|
b111fd2f3e | ||
|
|
84777c2437 | ||
|
|
13742df877 | ||
|
|
f55f7f19b4 | ||
|
|
e43200865c | ||
|
|
1de2d55965 | ||
|
|
6c8f2698d6 | ||
|
|
411c43d90e | ||
|
|
bac5fd7438 | ||
|
|
4df31a3fbb | ||
|
|
5fd915ab8a | ||
|
|
6aeb73b5bd | ||
|
|
a665605a5a | ||
|
|
e00e0032b4 | ||
|
|
f1bf1e8663 | ||
|
|
ef4cdfd646 | ||
|
|
c86643874d | ||
|
|
26a2945696 | ||
|
|
04b09fbfbd | ||
|
|
f14caa3778 | ||
|
|
ea9245ad26 | ||
|
|
8534e1ba55 | ||
|
|
ae66004b80 | ||
|
|
5b39c0dd96 | ||
|
|
2db2d8be59 | ||
|
|
75d47bb110 | ||
|
|
3662b3fdf1 | ||
|
|
b03d31e990 | ||
|
|
54f0a3c14c | ||
|
|
6a80b0d4ff | ||
|
|
5e724c1e3a | ||
|
|
88e604426c | ||
|
|
dd7b492b0c | ||
|
|
c7f4e366e2 | ||
|
|
382f82b0e0 | ||
|
|
ab3d9e9c47 | ||
|
|
714ebb2c2d | ||
|
|
1b254a4811 | ||
|
|
76fe0d14d3 | ||
|
|
2022d33d03 | ||
|
|
c8b8deb3d6 | ||
|
|
4885d49d20 | ||
|
|
13fc58933d | ||
|
|
c217a34f13 | ||
|
|
15182cb151 | ||
|
|
8a65a1cfc5 | ||
|
|
5bdd5b0c0d | ||
|
|
7da802a238 | ||
|
|
e334aae608 | ||
|
|
c48a9d98b4 | ||
|
|
ed34ae73c0 | ||
|
|
c8a0ae9e10 | ||
|
|
67a085c95f | ||
|
|
1d5ee079b4 | ||
|
|
bb36ebfc0c | ||
|
|
a7d15d1e32 | ||
|
|
4317dca024 | ||
|
|
77ca36c794 | ||
|
|
a09e63d6aa | ||
|
|
fbe28e397e | ||
|
|
364ae87ef8 | ||
|
|
ffd00080f2 | ||
|
|
94d757104b | ||
|
|
9729e63d98 | ||
|
|
f232bbdb15 | ||
|
|
26574b4a9b | ||
|
|
a1b1ef88cf | ||
|
|
b6c52cd8e1 | ||
|
|
34abbfb5da | ||
|
|
0d14bde583 | ||
|
|
4b0a8eb166 | ||
|
|
80ec9023ce | ||
|
|
5dd10b6e81 | ||
|
|
415fa048ba | ||
|
|
a1661e94b5 | ||
|
|
c45a714b77 | ||
|
|
271c2ff636 | ||
|
|
e4cd35ac33 | ||
|
|
e8a4a9fdac | ||
|
|
5f2eadbfa6 | ||
|
|
35ab687d5e | ||
|
|
3ff2bd4f17 | ||
|
|
f334b3b765 | ||
|
|
ff1732011e | ||
|
|
c5721fb7e3 | ||
|
|
3200d976d7 | ||
|
|
6698505dd8 | ||
|
|
790a4f6769 | ||
|
|
c9d7a5bea6 | ||
|
|
f1ead19b6e | ||
|
|
174bdd2307 | ||
|
|
814c17522a | ||
|
|
b622adf300 | ||
|
|
c1b58f8a01 | ||
|
|
c1a9621dfa | ||
|
|
6de266a106 | ||
|
|
334d9c119b | ||
|
|
1a2c30b4e3 | ||
|
|
413cc1469f | ||
|
|
7404414e7a | ||
|
|
49b1f3528b | ||
|
|
26cceede15 | ||
|
|
698d40d797 | ||
|
|
2b6c59fa8a | ||
|
|
21bc830143 | ||
|
|
aa9206381d | ||
|
|
d6d9af65fb | ||
|
|
a3f70e7977 | ||
|
|
6bbdba7a21 | ||
|
|
6a175379fb | ||
|
|
85c21fa8e3 | ||
|
|
bc8c823045 | ||
|
|
9935da8a6f | ||
|
|
c39b6c3fe7 | ||
|
|
c47a6f92c5 | ||
|
|
778628da30 | ||
|
|
ba0ca0cc65 | ||
|
|
fba3828479 | ||
|
|
c8dd4f26f7 | ||
|
|
16a62625b3 | ||
|
|
de5f6d5fce | ||
|
|
98a87d099b | ||
|
|
a6f3c95684 | ||
|
|
75e39e7ef5 | ||
|
|
77b2b26a7a | ||
|
|
1680eeb80d | ||
|
|
9a9b4a1874 | ||
|
|
145a944860 | ||
|
|
dd127ff3e7 | ||
|
|
b0fb474e1d | ||
|
|
a1a94ec0d1 | ||
|
|
678f8bc77f | ||
|
|
41968546d1 | ||
|
|
f76283ebfe | ||
|
|
e59bf9ab97 | ||
|
|
b2f66241d5 | ||
|
|
b71c9e776a | ||
|
|
746faf6df6 | ||
|
|
a367031fe2 | ||
|
|
853dadd906 | ||
|
|
e55db05f20 | ||
|
|
98a748afb3 | ||
|
|
c04eb066cb | ||
|
|
6260c6d3d7 | ||
|
|
ce1fb49252 | ||
|
|
ecdec87e7a | ||
|
|
cfdbc851a0 | ||
|
|
6ccebdc978 | ||
|
|
df53040339 | ||
|
|
42dc5b14b0 | ||
|
|
e2538abcb1 | ||
|
|
1697293f12 | ||
|
|
96f432d2d5 | ||
|
|
0ae59755e3 | ||
|
|
12b596e536 | ||
|
|
0b6088cd2d | ||
|
|
1736f2ffc7 | ||
|
|
d60e1e8a05 | ||
|
|
d157756d94 | ||
|
|
ea1914a248 | ||
|
|
85087ce04a | ||
|
|
e09127eadf | ||
|
|
e1095962a1 | ||
|
|
eabd1150b0 | ||
|
|
93501248cd | ||
|
|
3a945c8c10 | ||
|
|
3cef7a7911 | ||
|
|
1cd2fb5b18 | ||
|
|
ba3ca47f8c | ||
|
|
4699b46744 | ||
|
|
69ffdb7665 | ||
|
|
f9c5386e7a | ||
|
|
55273b5340 | ||
|
|
5cd1c9d15d | ||
|
|
b461b2af2f | ||
|
|
3a5608566e | ||
|
|
fc65f22feb | ||
|
|
f53bfa89a9 | ||
|
|
fdfeeb2ffa | ||
|
|
3e75cc7408 | ||
|
|
d1930e03e1 | ||
|
|
144a534bb3 | ||
|
|
de1256cc80 | ||
|
|
76404c8af6 | ||
|
|
fb814e912d | ||
|
|
43ee86b4fe | ||
|
|
eb697b7a17 | ||
|
|
3da5bbd267 | ||
|
|
c14be17e53 | ||
|
|
45c0b38156 | ||
|
|
025f6235f9 | ||
|
|
4ba3c883e6 | ||
|
|
3a4168a661 | ||
|
|
484b3326c7 | ||
|
|
e99fcbbe36 | ||
|
|
7ba3de57d0 | ||
|
|
5ff274f040 | ||
|
|
293f5db172 | ||
|
|
d928e705b9 | ||
|
|
7a48824ced | ||
|
|
8aa8918124 | ||
|
|
a091c17b83 | ||
|
|
52aa0d9b8a | ||
|
|
3d8eddc4e1 | ||
|
|
295265c261 | ||
|
|
376d6422ec | ||
|
|
113e340474 | ||
|
|
c89d8b69e5 | ||
|
|
70303634f5 | ||
|
|
325aa7201b | ||
|
|
75a3fc699e | ||
|
|
3cd8ce8323 | ||
|
|
240e81a9e0 | ||
|
|
40449400d3 | ||
|
|
9ffe4f2c25 | ||
|
|
af95f77134 | ||
|
|
78f1c45e13 | ||
|
|
cf47573298 | ||
|
|
96ba96ca69 | ||
|
|
da998eb469 | ||
|
|
e75a4b95cc | ||
|
|
344085f4ef | ||
|
|
d37a6a0b2d | ||
|
|
d7fc916d20 | ||
|
|
80a4757242 | ||
|
|
658048ff2d | ||
|
|
0587223da8 | ||
|
|
2d1b81dc20 | ||
|
|
0bd16fb81a | ||
|
|
0c1fec5d1e | ||
|
|
ee16eb7fde | ||
|
|
5c9aeab6b4 | ||
|
|
5c7cae9ab0 | ||
|
|
93fa6cf875 | ||
|
|
5b7bee977b | ||
|
|
8018dac396 | ||
|
|
85ab317c6c | ||
|
|
6b0fb1721b | ||
|
|
fdcdcbb85f | ||
|
|
4e2095d251 | ||
|
|
51275b3a65 | ||
|
|
8d480cefb9 | ||
|
|
3e7f9039c4 | ||
|
|
49828baae3 | ||
|
|
a73e1185dc | ||
|
|
441dceb731 | ||
|
|
57c4f9e103 | ||
|
|
2741fc2683 | ||
|
|
868c023dbd | ||
|
|
e7c357ab7f | ||
|
|
9e1a5008ed | ||
|
|
a6557121a0 | ||
|
|
2dad6262cf | ||
|
|
af1eb58bb8 | ||
|
|
17a2aa42e9 | ||
|
|
231f671400 | ||
|
|
221eba11dd | ||
|
|
ad40a9225e | ||
|
|
cbef05838d | ||
|
|
2cf973809a | ||
|
|
65974e15ba | ||
|
|
dc6b32a154 | ||
|
|
76f593e4bb | ||
|
|
15b991a48e | ||
|
|
702d0790bc | ||
|
|
2953e2c522 | ||
|
|
bf450b7d68 | ||
|
|
4e6b6d97ce | ||
|
|
6aadd00e72 | ||
|
|
e036f5360c | ||
|
|
8c2aae2ddc | ||
|
|
511941c714 | ||
|
|
e58220e2c4 | ||
|
|
02711a73ed | ||
|
|
25d418e96b | ||
|
|
10430f8142 | ||
|
|
8aba97b577 | ||
|
|
8fe5b2369a | ||
|
|
dc6c87b58d | ||
|
|
ef4e19002b | ||
|
|
e6ee5fc6b8 | ||
|
|
b19c935da1 | ||
|
|
0ade37f14f | ||
|
|
91be4c4643 | ||
|
|
d2b62e2d21 | ||
|
|
7052fe6225 | ||
|
|
49357790f1 | ||
|
|
694219e497 | ||
|
|
9b70ace180 | ||
|
|
e0a53144db | ||
|
|
25de332492 | ||
|
|
2d0f10c79f | ||
|
|
74ea803651 | ||
|
|
0908e509a1 | ||
|
|
ad14226c5c | ||
|
|
3fcc032547 | ||
|
|
b52de9b197 | ||
|
|
c2de6e3f3d | ||
|
|
a5638bdba1 | ||
|
|
bb8e4bd737 | ||
|
|
7a96772a9b | ||
|
|
9b07aa17e4 | ||
|
|
90c59d5b8e | ||
|
|
fd3d5b66e9 | ||
|
|
d97346be6c | ||
|
|
9d13bcfe11 | ||
|
|
724ee62246 | ||
|
|
26e8f02e85 | ||
|
|
b3ff3d2466 | ||
|
|
9c3882e91f | ||
|
|
32a7657c4f | ||
|
|
54617bf634 | ||
|
|
61a00b3965 | ||
|
|
0214ffd158 | ||
|
|
1919f7b2a7 | ||
|
|
c2f4e00314 | ||
|
|
3adfa16db8 | ||
|
|
90fcffdf2a | ||
|
|
0ca84a790b | ||
|
|
04802fbb15 | ||
|
|
21534d1c0b | ||
|
|
8579332cdf | ||
|
|
9dc9edbbee | ||
|
|
2980bb0320 | ||
|
|
084798bd1b | ||
|
|
1c27b9b712 | ||
|
|
129ec8472c | ||
|
|
724162f37f | ||
|
|
3244b102ad | ||
|
|
c8966d22ba | ||
|
|
6669d49636 | ||
|
|
3b480dabdb | ||
|
|
3e69281d61 | ||
|
|
1b04386b01 | ||
|
|
1ca736692d | ||
|
|
4dc4795cb7 | ||
|
|
bcc33362b8 | ||
|
|
ba0b5f929f | ||
|
|
89c960c455 | ||
|
|
14178fcd14 | ||
|
|
5e0fe6d897 | ||
|
|
53ef26dabd | ||
|
|
3db5f2a67f | ||
|
|
13d0e2a5bf | ||
|
|
c3085ae34f | ||
|
|
ce2ec8047e | ||
|
|
335cb7016e | ||
|
|
7a7b050615 | ||
|
|
6ff7ae800a | ||
|
|
2159773723 | ||
|
|
ab3a015d61 | ||
|
|
3142387e45 | ||
|
|
051325e10f | ||
|
|
199d5d57d5 | ||
|
|
b96795c517 | ||
|
|
64ba96daf2 | ||
|
|
14b17d86e5 | ||
|
|
90d5f27026 | ||
|
|
16386b8ddc | ||
|
|
cbef21b9ad | ||
|
|
cec44e3668 | ||
|
|
f09f1e7f85 | ||
|
|
95910bc6cb | ||
|
|
cc488ccff0 | ||
|
|
37e129bfb9 | ||
|
|
6adc923bcb | ||
|
|
065470cecb | ||
|
|
260989bda6 | ||
|
|
64b6e0fd56 | ||
|
|
8f45718b75 | ||
|
|
e66bb7a14b | ||
|
|
8bfe32eeef | ||
|
|
e85c1bbc0d | ||
|
|
f99bf0d000 | ||
|
|
db24a2251f | ||
|
|
fcb3747690 | ||
|
|
dcc27a7447 | ||
|
|
bea39bc613 | ||
|
|
546493ba45 | ||
|
|
dda4928693 | ||
|
|
7d144dd076 | ||
|
|
73e0700ea3 | ||
|
|
3fc36cf798 | ||
|
|
dbc43b445b | ||
|
|
638fcd393a | ||
|
|
7b5f419713 | ||
|
|
253fbad3db | ||
|
|
522de3d4b7 | ||
|
|
dc9ae67657 | ||
|
|
fccac8ed74 | ||
|
|
24c895084e | ||
|
|
16fbfdecb5 | ||
|
|
b79e281074 | ||
|
|
93ac380fd6 | ||
|
|
46066d4cac | ||
|
|
c13cf4f29c | ||
|
|
a4f06a9e1e | ||
|
|
cbc5fc8d08 | ||
|
|
0a27c0b6e4 | ||
|
|
f348a20035 | ||
|
|
bdb98b487f | ||
|
|
2cb6402189 | ||
|
|
861bb7a00a | ||
|
|
43d5458a25 | ||
|
|
fe491e4a7d | ||
|
|
9d1b979318 | ||
|
|
c1794dd0ca | ||
|
|
8f7d8b1cba | ||
|
|
8ebb8a04fa | ||
|
|
ef6435a02a | ||
|
|
5cbe0a8230 | ||
|
|
dcef6b556c | ||
|
|
c07a636db2 | ||
|
|
a6be95fe33 | ||
|
|
14149aa6b1 | ||
|
|
ae901219fb | ||
|
|
6d9600d132 | ||
|
|
ccc55562cd | ||
|
|
67d9ae881f | ||
|
|
61e0525ee8 | ||
|
|
363519db02 | ||
|
|
4bc179bd2a | ||
|
|
76debda76e | ||
|
|
b4eabe19cb | ||
|
|
971b75860f | ||
|
|
5a926bf169 | ||
|
|
d34f37c563 | ||
|
|
6035a01019 | ||
|
|
c880f71dc8 | ||
|
|
13422ef7ce | ||
|
|
84e2efd42c | ||
|
|
113d26937d | ||
|
|
34606415d7 | ||
|
|
6b9c1f0a22 | ||
|
|
132cc0e131 | ||
|
|
5926369a56 | ||
|
|
ff068d374f | ||
|
|
4132d6ff61 | ||
|
|
1f10199e64 | ||
|
|
e97704b37f | ||
|
|
4ae81a3b0b | ||
|
|
f4ec9a8ec1 | ||
|
|
711037b619 | ||
|
|
b32c9f1724 | ||
|
|
be132c531e | ||
|
|
fb8826caf4 | ||
|
|
adff60b118 | ||
|
|
8f863bf19b | ||
|
|
331a7f3842 | ||
|
|
25de16e051 | ||
|
|
a732e766f4 | ||
|
|
91854f97ad | ||
|
|
835fb3471f | ||
|
|
a9f497981f | ||
|
|
74dd88d123 | ||
|
|
fd61207709 | ||
|
|
b94494d386 | ||
|
|
974b19fcc7 | ||
|
|
364b7b5438 | ||
|
|
8c1a9f460d | ||
|
|
f6d4a315c7 | ||
|
|
0222c47113 | ||
|
|
fc1a2a6112 | ||
|
|
13547781d2 | ||
|
|
d375d1abc9 | ||
|
|
33d007eea5 | ||
|
|
5e4f31f39e | ||
|
|
79e0f4ba23 | ||
|
|
dba186347c | ||
|
|
7988274d61 | ||
|
|
72cf9392b1 | ||
|
|
b6265036d4 | ||
|
|
dc70d810c9 | ||
|
|
16cfcb36a3 | ||
|
|
6bec994a57 | ||
|
|
a99206b6c2 | ||
|
|
c491d67925 | ||
|
|
b9eeab06a1 | ||
|
|
853b5ca771 | ||
|
|
f4706fff18 | ||
|
|
7218a46211 | ||
|
|
c0f7d5ab44 | ||
|
|
60f81fb89d | ||
|
|
49bc96dc7e | ||
|
|
320a5d64a3 | ||
|
|
b16a8ecf21 | ||
|
|
73265ef944 | ||
|
|
3bbc141e9a | ||
|
|
9ca95e8e14 | ||
|
|
9922382581 | ||
|
|
4aa52d2f2e | ||
|
|
6d51e10090 | ||
|
|
14b75973b0 | ||
|
|
0bfd0bca0c | ||
|
|
cafb810a1f | ||
|
|
07704b3ec7 | ||
|
|
7032efcc05 | ||
|
|
65a5677b33 | ||
|
|
5d3522ca0a | ||
|
|
bfb530e02b | ||
|
|
9393192036 | ||
|
|
3cdbc4cb83 | ||
|
|
0c7741120a | ||
|
|
e529438c7e | ||
|
|
5a5d11922f | ||
|
|
39cfebeb34 | ||
|
|
950f47ccae | ||
|
|
d2c625e1c9 | ||
|
|
3f207b7041 | ||
|
|
8deb9e5a35 | ||
|
|
5eeb33a6f5 | ||
|
|
918f009e8a | ||
|
|
d6665f1cd5 | ||
|
|
af29ed7146 | ||
|
|
8ddc795158 | ||
|
|
8a572516fc | ||
|
|
aebfbba20e | ||
|
|
85cc86346c | ||
|
|
b20e095683 | ||
|
|
b4d7f05165 | ||
|
|
46a12754e9 | ||
|
|
411b2a0acc | ||
|
|
508dacac63 | ||
|
|
13ca691f5d | ||
|
|
7e4d2c9b28 | ||
|
|
500c34c330 | ||
|
|
234fd3f75e | ||
|
|
32ef30686b | ||
|
|
175df6ce7a | ||
|
|
96b874c099 | ||
|
|
612510550f | ||
|
|
80e4852f90 | ||
|
|
071243b99a | ||
|
|
547db3a6b4 | ||
|
|
063f698bd2 | ||
|
|
bcbfca100f | ||
|
|
8206b1673c | ||
|
|
7255ccbdaa | ||
|
|
45dc8b949d | ||
|
|
10e3a5afc4 | ||
|
|
303aa79ffb | ||
|
|
35f3be9296 | ||
|
|
d7088c8eea | ||
|
|
695954bdb0 | ||
|
|
d29b3ee893 | ||
|
|
d9cecb35cb | ||
|
|
71dd6c6333 | ||
|
|
56f13d314a | ||
|
|
b628d67961 | ||
|
|
bf723deced | ||
|
|
9636e69a6b | ||
|
|
ed91e2aa7b | ||
|
|
3c691bb498 | ||
|
|
ea35a3478f | ||
|
|
b7d1ba1fa5 | ||
|
|
5f686c1c12 | ||
|
|
4eea8308d7 | ||
|
|
7f9704592e | ||
|
|
523f13c430 | ||
|
|
1c8079c051 | ||
|
|
2abd024b3c | ||
|
|
7992b63aae | ||
|
|
836ef3328c | ||
|
|
c470dc1a17 | ||
|
|
97a1029a72 | ||
|
|
5f9602796a | ||
|
|
02e7886e77 | ||
|
|
9851623557 | ||
|
|
f0d2bae3d1 | ||
|
|
f3561cab47 | ||
|
|
38d047dbd1 | ||
|
|
e6ba4ef309 | ||
|
|
460833f7d6 | ||
|
|
2eba22031a | ||
|
|
ac55de63e9 | ||
|
|
88e2fba447 | ||
|
|
94ac15a8fc | ||
|
|
19355cb4f2 | ||
|
|
e0ff16e2dd | ||
|
|
49db52673a | ||
|
|
f8872e1cd4 | ||
|
|
2ed3e10833 | ||
|
|
2b6fe188ed | ||
|
|
2ddc2c3660 | ||
|
|
b187d86074 | ||
|
|
727694fdd5 | ||
|
|
7081cf7172 | ||
|
|
a25afd5c13 | ||
|
|
c180eb9975 | ||
|
|
9e45998a65 | ||
|
|
2acf64a0d0 | ||
|
|
9d41367eff | ||
|
|
b64dd8f25f | ||
|
|
cbb3483456 | ||
|
|
6603e8b11e | ||
|
|
d522f9dfa3 | ||
|
|
f02476ff3a | ||
|
|
eafca1e1fe | ||
|
|
0055a059f7 | ||
|
|
8262909063 | ||
|
|
e42c19bfec | ||
|
|
8fe05c9119 | ||
|
|
e8e6a9bc5c | ||
|
|
c41eb4afa0 | ||
|
|
80c8294f5f | ||
|
|
fc58673abd | ||
|
|
ca831bc734 | ||
|
|
a76cf0fe9a | ||
|
|
688853c523 | ||
|
|
806dc8f017 | ||
|
|
89ab78a329 | ||
|
|
3a7cb5e020 | ||
|
|
d0f594065d | ||
|
|
10677040e0 | ||
|
|
c2624bbaaf | ||
|
|
33d4dd47bb | ||
|
|
ec92ab8b39 | ||
|
|
ff3234fcdd | ||
|
|
c32652394e | ||
|
|
580ba60762 | ||
|
|
0e7bf25de7 | ||
|
|
e218ced2c7 | ||
|
|
3cc4c0ea98 | ||
|
|
ac2a88d186 | ||
|
|
dff92beea1 | ||
|
|
62b808ad48 | ||
|
|
69e871eaad | ||
|
|
d759c676f7 | ||
|
|
12481cc491 | ||
|
|
43f11aaf0c | ||
|
|
f4842aa512 | ||
|
|
bcd3fd3266 | ||
|
|
67256c17cf | ||
|
|
d6106a44f7 | ||
|
|
eda1820773 | ||
|
|
c8856cfea4 | ||
|
|
217e0da4a6 | ||
|
|
96a8bb90c9 | ||
|
|
0ca3c496de | ||
|
|
0434e1c5d3 | ||
|
|
4c79701d22 | ||
|
|
5f49bedc42 | ||
|
|
d9fc825b0f | ||
|
|
17c691b1cf | ||
|
|
9fb46946b5 | ||
|
|
220fa79057 | ||
|
|
f1f4adf8a6 | ||
|
|
448dd979a2 | ||
|
|
3386947522 | ||
|
|
628ec0f2b5 | ||
|
|
e3b91c884a | ||
|
|
10bb935a42 | ||
|
|
6f136a90a2 | ||
|
|
acd9bcceeb | ||
|
|
3c2838df9e | ||
|
|
4b526f7242 | ||
|
|
61563c9359 | ||
|
|
e854bf59f8 | ||
|
|
393a3a87b6 | ||
|
|
888b2723e0 | ||
|
|
6ed03d0858 | ||
|
|
ee33666b38 | ||
|
|
07c406aa16 | ||
|
|
c578d5c1a3 | ||
|
|
2ea66ea8fc | ||
|
|
27440fc147 | ||
|
|
b1f5429db9 | ||
|
|
042b1ed6d7 | ||
|
|
a8645afbdb | ||
|
|
25b85f17a3 | ||
|
|
cf691118b9 | ||
|
|
0dcb9d4b69 | ||
|
|
2d2571cff5 | ||
|
|
ec8d5c0f4d | ||
|
|
85d63c9d7f | ||
|
|
19f70f5a79 | ||
|
|
80955cad8b | ||
|
|
01ba712d33 | ||
|
|
e0985d3b68 | ||
|
|
7181d2c91a | ||
|
|
e66d8616ce | ||
|
|
656dd91004 | ||
|
|
d88b3a7799 | ||
|
|
7cdbc4acca | ||
|
|
de68e6630e | ||
|
|
de89da20b2 | ||
|
|
17a06621f5 | ||
|
|
b3de840e04 | ||
|
|
539b8ef973 | ||
|
|
710170ef2d | ||
|
|
fb22cf05eb | ||
|
|
adff391e45 | ||
|
|
4a05837b01 | ||
|
|
a0014fda12 | ||
|
|
04190af340 | ||
|
|
4b10904b97 | ||
|
|
bbb25acff3 | ||
|
|
fcfa022232 | ||
|
|
220ee30d35 | ||
|
|
812bc0d8c4 | ||
|
|
d712839c25 | ||
|
|
eee705b371 | ||
|
|
77bdf6e444 | ||
|
|
0a858c040c | ||
|
|
eea5b69b6c | ||
|
|
6759917a2f | ||
|
|
aa3bd80ab2 | ||
|
|
ea8d7fb3b9 | ||
|
|
b4ddf38116 | ||
|
|
5c9f028103 | ||
|
|
937d4cc884 | ||
|
|
2c3e1f4232 | ||
|
|
ddc681fe77 | ||
|
|
0fba32853b | ||
|
|
2b71b31cfa | ||
|
|
ed144e995b | ||
|
|
7e3a2d3c0a | ||
|
|
152285043d | ||
|
|
ce52201e45 | ||
|
|
45ea776090 | ||
|
|
2ae16d8bb1 | ||
|
|
23fc6c8b49 | ||
|
|
0db4b193e1 | ||
|
|
82d520d808 | ||
|
|
5201d39adf | ||
|
|
f02c33d95a | ||
|
|
43ab4f7d3b | ||
|
|
6341f9fcb4 | ||
|
|
66ffd1e0d9 | ||
|
|
e65c854e6a | ||
|
|
9f5d9bceaa | ||
|
|
4eca960a4c | ||
|
|
69bceb43f8 | ||
|
|
6a8807b0fa | ||
|
|
e49549117b | ||
|
|
2f9efae457 | ||
|
|
5e9b439591 | ||
|
|
42306055ee | ||
|
|
ce2fc6f251 | ||
|
|
0b2bab6549 | ||
|
|
eb619adf4a | ||
|
|
4d05b152f0 | ||
|
|
bd345ae041 | ||
|
|
c908552174 | ||
|
|
f1bbdc177f | ||
|
|
9591b6fdef | ||
|
|
8f0a8b6f56 | ||
|
|
d1c2a0491c | ||
|
|
d19039e3e5 | ||
|
|
22d5cb8068 | ||
|
|
5f0d3a4018 | ||
|
|
889e288524 | ||
|
|
06805057d4 | ||
|
|
6e1e355a61 | ||
|
|
9843e8048d | ||
|
|
29d8ab43f2 | ||
|
|
1440e81ea4 | ||
|
|
bfd8773efa | ||
|
|
3a3d880d81 | ||
|
|
089c5fb095 | ||
|
|
f1fb109d40 | ||
|
|
47e6a039ef | ||
|
|
b8c8b1eb69 | ||
|
|
8a396db80e | ||
|
|
6a90b57ced | ||
|
|
a75b90fcef | ||
|
|
9981af67d5 | ||
|
|
cf60a5f3bd | ||
|
|
a04742085e | ||
|
|
b75a78f3d3 | ||
|
|
45bea50c91 | ||
|
|
5ba1e67ea0 | ||
|
|
1064a79e1d | ||
|
|
3803bc631b | ||
|
|
0b39b3e7b4 | ||
|
|
2f480fcec2 | ||
|
|
a8b1badd8a | ||
|
|
f8f214ca90 | ||
|
|
595f5a35e0 | ||
|
|
9f271b1f44 | ||
|
|
7292245b55 | ||
|
|
9ffca6ad66 | ||
|
|
376c93bd3b | ||
|
|
204f9d2e31 | ||
|
|
e4353e489f | ||
|
|
b88af1d682 | ||
|
|
9d2f83d8d6 | ||
|
|
ea4f34cb0f | ||
|
|
b7eaae88a8 | ||
|
|
e70d18f046 | ||
|
|
5a83b791bb | ||
|
|
eaa426dd66 | ||
|
|
fc43ef9308 | ||
|
|
8b4ac3893e | ||
|
|
a0f412f255 | ||
|
|
0a2e3f98f9 | ||
|
|
6cc29712e2 | ||
|
|
fae24beaed | ||
|
|
394775fb9a | ||
|
|
5d9209ce80 | ||
|
|
aff3103f36 | ||
|
|
6f2529c243 | ||
|
|
e976224258 | ||
|
|
050b6046d7 | ||
|
|
f0c78751bf | ||
|
|
2870d2d69e | ||
|
|
fbabbe69c0 | ||
|
|
b63c54b657 | ||
|
|
3c914de690 | ||
|
|
307d6a0628 | ||
|
|
61d4f102ba | ||
|
|
0a38e6f690 | ||
|
|
23a592ec01 | ||
|
|
396a96d604 | ||
|
|
0504a1d4bf | ||
|
|
fa905b8844 | ||
|
|
7f58847f88 | ||
|
|
5f674b86f8 | ||
|
|
cccd61e050 | ||
|
|
bf03a000d1 | ||
|
|
fc63c16ee0 | ||
|
|
1bb4e44b71 | ||
|
|
147884f76d | ||
|
|
240af75ff7 | ||
|
|
c54dcdba24 | ||
|
|
9db07faf49 | ||
|
|
aefc82e47c | ||
|
|
957f62ffbb | ||
|
|
8a001a2438 | ||
|
|
f8d4e22b13 | ||
|
|
243e6e3b99 | ||
|
|
69e3481a32 | ||
|
|
daa0d0c859 | ||
|
|
72402052ae | ||
|
|
5ee1e738f4 | ||
|
|
382ad0079c | ||
|
|
8dc4ff26d6 | ||
|
|
755a3f0154 | ||
|
|
b51dccc737 | ||
|
|
620fc9af64 | ||
|
|
991283182c | ||
|
|
1413bd2f05 | ||
|
|
faa8c727c3 | ||
|
|
65d2bdaf2b | ||
|
|
17ca9ec43d | ||
|
|
289971557a | ||
|
|
d1a0b735d9 | ||
|
|
bc0f2b59da | ||
|
|
98bb3fba9c | ||
|
|
b405a610bb | ||
|
|
3e3df0b493 | ||
|
|
c1749057d9 | ||
|
|
150f7a9fd9 | ||
|
|
6411fd80aa | ||
|
|
0b953a237d | ||
|
|
48f6d338a6 | ||
|
|
afc575d080 | ||
|
|
384b9b4704 | ||
|
|
ce329d7fb3 | ||
|
|
287615b0a1 | ||
|
|
b96692f2d9 | ||
|
|
1b8aea2e6d | ||
|
|
97ce377b9c | ||
|
|
f1973b14c7 | ||
|
|
73bd2cdcc3 | ||
|
|
9038310150 | ||
|
|
07fb09b4cc | ||
|
|
ef38051826 | ||
|
|
445037b614 | ||
|
|
44ec969203 | ||
|
|
444cde1ee9 | ||
|
|
cf12cbbcf4 | ||
|
|
bb2f4da6b6 | ||
|
|
4bca6cc1a5 | ||
|
|
544ae24b64 | ||
|
|
8fc80a285c | ||
|
|
6ed86cb3c7 | ||
|
|
84f45ebb48 | ||
|
|
90fb17b89f | ||
|
|
d54e846f91 | ||
|
|
ee71819bb2 | ||
|
|
2ee313a795 | ||
|
|
b924e8511b | ||
|
|
15e9d756b7 | ||
|
|
8be879465a | ||
|
|
5e0b333cfd | ||
|
|
efa243386c | ||
|
|
ae6ee5688c | ||
|
|
9f3eaac3df | ||
|
|
c938983ff5 | ||
|
|
172ce3a054 | ||
|
|
69ca48287e | ||
|
|
a6726f4e96 | ||
|
|
b6c91b5062 | ||
|
|
fe47245b73 | ||
|
|
d687e1203a | ||
|
|
0280fcb2da | ||
|
|
4354d09c20 | ||
|
|
e3c4d06b2b | ||
|
|
6327c8492f | ||
|
|
e7412d0d46 | ||
|
|
6a181abdcb | ||
|
|
65a9b1a78a | ||
|
|
5ce644718e | ||
|
|
a7add6bc13 | ||
|
|
d2a046c8b4 | ||
|
|
33080a4e1c | ||
|
|
dae6cc8e20 | ||
|
|
a2159d62e5 | ||
|
|
a092a0ba94 | ||
|
|
33faf5c9b0 | ||
|
|
d927207b67 | ||
|
|
b9f0da7d27 | ||
|
|
1c36bf3300 | ||
|
|
cca137d526 | ||
|
|
24da012903 | ||
|
|
0eb7a5aed6 | ||
|
|
5cbf1eef5f | ||
|
|
ed4fba330d | ||
|
|
9046eb500b | ||
|
|
011b7427e2 | ||
|
|
13caaf6fa7 | ||
|
|
a98677dbda | ||
|
|
6c1f0d3711 | ||
|
|
e1e6a08eb2 | ||
|
|
7b21b0401d | ||
|
|
4c935fc447 | ||
|
|
3d221dcda4 | ||
|
|
ac6c413fb8 | ||
|
|
17a07ba85e | ||
|
|
ca6f7003a5 | ||
|
|
d402ba61cc | ||
|
|
081fae98c4 | ||
|
|
014d3b3a99 | ||
|
|
19fe29ad1e | ||
|
|
8bcbd0231e | ||
|
|
01c0e321b5 | ||
|
|
5f721b544e | ||
|
|
57d4a79496 | ||
|
|
9541a45451 | ||
|
|
bba4c09195 | ||
|
|
06c62029c5 | ||
|
|
6f251b64f1 | ||
|
|
551b6b88d2 | ||
|
|
07cbc47fb2 | ||
|
|
fe6ca97f21 | ||
|
|
1b481c6765 | ||
|
|
1c5e0b4d68 | ||
|
|
bc849daccb | ||
|
|
f5b4de023f | ||
|
|
6dc7a7788e | ||
|
|
0e51a73149 | ||
|
|
44a092cd94 | ||
|
|
7000b6cda2 | ||
|
|
7a17f7d253 | ||
|
|
821e73c1d3 | ||
|
|
784bc52d6d | ||
|
|
4338e34734 | ||
|
|
61147536e5 | ||
|
|
6b9737eb3f | ||
|
|
fe54372a53 | ||
|
|
21e9c0b7c1 | ||
|
|
8bf977060e | ||
|
|
074ec333cf | ||
|
|
d505ec4f9f | ||
|
|
4d127acb9a | ||
|
|
df900c9e64 | ||
|
|
93a090c56e | ||
|
|
8b43d93259 | ||
|
|
053662d0af | ||
|
|
af943a8253 | ||
|
|
8151444671 | ||
|
|
f32147d9d5 | ||
|
|
515e0364f7 | ||
|
|
09239f8180 | ||
|
|
0d9f233e33 | ||
|
|
e034437c63 | ||
|
|
72be046f34 | ||
|
|
3ba8824eb0 | ||
|
|
b51a261bd1 | ||
|
|
38602dd141 | ||
|
|
cdbec60da0 | ||
|
|
2b41012c5b | ||
|
|
6bb87d0a64 | ||
|
|
b16f9edd2c | ||
|
|
ce4b1e09ed | ||
|
|
01658286af | ||
|
|
aa90c8b7cd | ||
|
|
eba1011fd6 | ||
|
|
96a424c25a | ||
|
|
f4dd100345 | ||
|
|
cd4205c361 | ||
|
|
b81bcf8c6d | ||
|
|
4259764b70 | ||
|
|
8f761f7dff | ||
|
|
cbbaf2aa2f | ||
|
|
dd9b84646a | ||
|
|
94131fd705 | ||
|
|
6d8914e6c9 | ||
|
|
63ee687cee | ||
|
|
ab779dc850 | ||
|
|
c2f35ae46f | ||
|
|
199e0e5ed3 | ||
|
|
a8155b4b0b | ||
|
|
fdd78cf110 | ||
|
|
afff6395d1 | ||
|
|
4d3d48e962 | ||
|
|
36290e4e53 | ||
|
|
fd6923dd28 | ||
|
|
9c64067d49 | ||
|
|
f4d2ea7923 | ||
|
|
ce3d3bb244 | ||
|
|
fa71e7d84f | ||
|
|
b0115b8b4c | ||
|
|
3902b2db3b | ||
|
|
4ff61f96df | ||
|
|
f998dce614 | ||
|
|
2b9084d2f3 | ||
|
|
b3605546ac | ||
|
|
96097ab726 | ||
|
|
be142d79bc | ||
|
|
0fd241a9ba | ||
|
|
7b192f17e8 | ||
|
|
cc015846d2 | ||
|
|
e785bd13f5 | ||
|
|
eb6c0a39ea | ||
|
|
86525f98ec | ||
|
|
94bf703dde | ||
|
|
14bb0a0a80 | ||
|
|
1ee6e04f00 | ||
|
|
ee6796d5e2 | ||
|
|
81d7f3c319 | ||
|
|
9822962d98 | ||
|
|
ce606f826b | ||
|
|
4c4bc8058b | ||
|
|
f0210f7c5f | ||
|
|
aef84eceb8 | ||
|
|
a6ea9ed3a6 | ||
|
|
0815e3c195 | ||
|
|
a1c03eb601 | ||
|
|
1e43563cc3 | ||
|
|
63f3f9123a | ||
|
|
4860d3bd18 | ||
|
|
7fa6593bdc | ||
|
|
e1dd580df8 | ||
|
|
f19e63d6e9 | ||
|
|
130873d91d | ||
|
|
9611cb9057 | ||
|
|
023aa78d8b | ||
|
|
39a231eae0 | ||
|
|
aca6922be0 | ||
|
|
1a52537d0c | ||
|
|
479b4e3349 | ||
|
|
a1e2b018a2 | ||
|
|
aa0f664cda | ||
|
|
2e2f4aee1b | ||
|
|
18474d872c | ||
|
|
44327c009a | ||
|
|
de554655a5 | ||
|
|
bd0c7b9391 | ||
|
|
8d32db5206 | ||
|
|
a6954aa719 | ||
|
|
b4d203ab99 | ||
|
|
bb924ad83f | ||
|
|
79da32cc60 | ||
|
|
c7fe9c3171 | ||
|
|
d70da4f37d | ||
|
|
ccc1b04e81 | ||
|
|
352e428890 | ||
|
|
4679e12588 | ||
|
|
6861bfd4e6 | ||
|
|
0dd4834e18 | ||
|
|
da58988f01 | ||
|
|
b2f3880722 | ||
|
|
0293a76702 | ||
|
|
6a13e94c4f | ||
|
|
79d448e5f4 | ||
|
|
264b3db63c | ||
|
|
c8cd4b5f28 | ||
|
|
c9e81897a5 | ||
|
|
c738007538 | ||
|
|
da8bf6b1b3 | ||
|
|
1501d721e7 | ||
|
|
482d874af2 | ||
|
|
7dcd7384f1 | ||
|
|
2a5ef35794 | ||
|
|
0f09a46540 | ||
|
|
a6d4708ccf | ||
|
|
77303b4a62 | ||
|
|
0ffbb0c151 | ||
|
|
e05010c9d2 | ||
|
|
d0a1c241a4 | ||
|
|
4ea8f23fc7 | ||
|
|
54da0d24a3 | ||
|
|
58ebd5f9a6 | ||
|
|
d60a0bee9e | ||
|
|
e9e26c981a | ||
|
|
5f12f04e87 | ||
|
|
7b7be32ca7 | ||
|
|
a14166b1e2 | ||
|
|
166eb97c3f | ||
|
|
920ce745c2 | ||
|
|
c931cde3ae | ||
|
|
f7a577e163 | ||
|
|
9bf3a041d4 | ||
|
|
85eb7d8043 | ||
|
|
b338dcc9de | ||
|
|
7d9b8ee4f3 | ||
|
|
0f61aaafb8 | ||
|
|
0927e0e017 | ||
|
|
783a7cedc3 | ||
|
|
b1ee23ad50 | ||
|
|
9118e0b368 | ||
|
|
5a0ccac0a1 | ||
|
|
c8419dc362 | ||
|
|
9127ba2fce | ||
|
|
36858ca219 | ||
|
|
30469e2de2 | ||
|
|
79c433b14d | ||
|
|
bc419cfd1a | ||
|
|
09fbf675ec | ||
|
|
2ee119fc64 | ||
|
|
83265fcb54 | ||
|
|
e8b4f4d2b6 | ||
|
|
714c6773c3 | ||
|
|
2fac594315 | ||
|
|
4bec49de5b | ||
|
|
4eaa6e20c3 | ||
|
|
315cc26525 | ||
|
|
794a761243 | ||
|
|
5da14fcb3f | ||
|
|
1047d4ade9 | ||
|
|
0b8fa3ffe3 | ||
|
|
498e4e2d6c | ||
|
|
850c414e8f | ||
|
|
d5a8ed5cb1 | ||
|
|
dd8406c39a | ||
|
|
13469053b9 | ||
|
|
c4c85b4f49 | ||
|
|
af0c3bbd5c | ||
|
|
2fcf9ace64 | ||
|
|
47e1c67bd8 | ||
|
|
7e3aa6efdd | ||
|
|
7a2f26ef62 | ||
|
|
b64154e3b3 | ||
|
|
26256e7155 | ||
|
|
6599736e00 | ||
|
|
343bb20bd8 | ||
|
|
518fa1c74d | ||
|
|
0b72a8b4b3 | ||
|
|
c013d1e0d9 | ||
|
|
fe51220e3c | ||
|
|
44d757347b | ||
|
|
c136182e17 | ||
|
|
a1a9b4e6b9 | ||
|
|
f49df63183 | ||
|
|
96414b37f3 | ||
|
|
544168ff45 | ||
|
|
e0a618a791 | ||
|
|
3333797144 | ||
|
|
f7f003c0f9 | ||
|
|
236d02cb47 | ||
|
|
6e97fe2210 | ||
|
|
6741666c24 | ||
|
|
fcadf68c90 | ||
|
|
65cd6a92d3 | ||
|
|
a09bb0d538 | ||
|
|
2bf475d840 | ||
|
|
76cdaaace6 | ||
|
|
ce59ef559f | ||
|
|
fc3f183dce | ||
|
|
6b6eea2d8c | ||
|
|
e54652941b | ||
|
|
867c01ff86 | ||
|
|
87a9e67ba8 | ||
|
|
bf076f6246 | ||
|
|
75b54dfaec | ||
|
|
71a2219b07 | ||
|
|
ccc3de2d7c | ||
|
|
af11e64cec | ||
|
|
2c3dc5d6b1 | ||
|
|
71482cc984 | ||
|
|
3329db1dae | ||
|
|
926e2d5620 | ||
|
|
d2de8828e7 | ||
|
|
9fcae6560e | ||
|
|
2e8fdd43ee | ||
|
|
27e39c8083 | ||
|
|
a8f373d568 | ||
|
|
71491a7922 | ||
|
|
170c2d35c2 | ||
|
|
bc49b2d5ba | ||
|
|
f58b6b41cb | ||
|
|
ac1ac50158 | ||
|
|
d4103a924d | ||
|
|
bd64f73842 | ||
|
|
cac653ddd9 | ||
|
|
04ff365890 | ||
|
|
54ed6ce5a5 | ||
|
|
32ac46c8a9 | ||
|
|
7ab2cd2a45 | ||
|
|
a07fae6cdd | ||
|
|
3f6af51713 | ||
|
|
8c4e778506 | ||
|
|
65902d556e | ||
|
|
aada9731a6 | ||
|
|
49658078b9 | ||
|
|
bcd097c6cb | ||
|
|
cfec67f1f9 | ||
|
|
aaaf0f8839 | ||
|
|
ee83471bf6 | ||
|
|
610fe6439f | ||
|
|
bd1dcff385 | ||
|
|
226ede7ba2 | ||
|
|
89fb5cecd5 | ||
|
|
a75317cc2c | ||
|
|
ee6df270ce | ||
|
|
e09541151f | ||
|
|
74e0552be0 | ||
|
|
909ab553eb | ||
|
|
866408aece | ||
|
|
2215f170df | ||
|
|
a5601fd89a | ||
|
|
fa8f2632f5 | ||
|
|
52d8d271f1 | ||
|
|
b240e8420a | ||
|
|
25024b58de | ||
|
|
ba31d209c9 | ||
|
|
7974d9135b | ||
|
|
a5a795a22c | ||
|
|
416b5b66d2 | ||
|
|
88e41f37b1 | ||
|
|
7cfa837604 | ||
|
|
6b7aca3081 | ||
|
|
580af2ab06 | ||
|
|
d144d30890 | ||
|
|
ecac546c6d | ||
|
|
76297e8176 | ||
|
|
d90f391b5e | ||
|
|
d80ae57964 | ||
|
|
74d7483b3c | ||
|
|
b3c580e657 | ||
|
|
8050b69f2f | ||
|
|
459720c348 | ||
|
|
a73f5c1359 | ||
|
|
71cb0f6d36 | ||
|
|
0d15225b1d | ||
|
|
826f3788d0 | ||
|
|
2133ab39b7 | ||
|
|
558c14a375 | ||
|
|
882ac41291 | ||
|
|
66c7a3f513 | ||
|
|
5904441a7e | ||
|
|
c465228531 | ||
|
|
81b22019dd | ||
|
|
3e47d485f9 | ||
|
|
701bc772a8 | ||
|
|
3ae05b7348 | ||
|
|
2e186019f5 | ||
|
|
4c6f321cff | ||
|
|
c72eb3e195 | ||
|
|
a4237bf1f9 | ||
|
|
e767e34b92 | ||
|
|
8ac82ebe2a | ||
|
|
0ed6ccab71 | ||
|
|
bf25d7328e | ||
|
|
a47b0c0581 | ||
|
|
596849c7e6 | ||
|
|
76914b7859 | ||
|
|
3dbbe053d7 | ||
|
|
c474cdb1f8 | ||
|
|
3de02cbf21 | ||
|
|
26fefc70f0 | ||
|
|
4086c9f4b5 | ||
|
|
c947c77853 | ||
|
|
9be44c0371 | ||
|
|
5412fa6cfd | ||
|
|
6e7320b954 | ||
|
|
fbb2d37634 | ||
|
|
7afe16fc10 | ||
|
|
b19f241d81 | ||
|
|
583ce80003 | ||
|
|
195c33407e | ||
|
|
600c5b77ad | ||
|
|
f1084fab76 | ||
|
|
bd65e32407 | ||
|
|
e4416f424a | ||
|
|
73ec110b22 | ||
|
|
0bce801a3f | ||
|
|
e8e00e8dfb | ||
|
|
cc4335e48e | ||
|
|
5427911da3 | ||
|
|
c808d5a42d | ||
|
|
3b46dbd6a1 | ||
|
|
e63b2f1bf1 | ||
|
|
d32e822057 | ||
|
|
2b672998e1 | ||
|
|
e18dc7c7e7 | ||
|
|
16dcd2f44d | ||
|
|
eb9f755b54 | ||
|
|
29a9e6e1d1 | ||
|
|
1f52f706ed | ||
|
|
bf12763a10 | ||
|
|
963641a818 | ||
|
|
3e94d92fbd | ||
|
|
a72040f83d | ||
|
|
84d8f826ff | ||
|
|
70d216b29f | ||
|
|
66356d5334 | ||
|
|
d9625dfe78 | ||
|
|
6d847577d8 | ||
|
|
8fd687f9d7 | ||
|
|
f7a9380b9d | ||
|
|
5617c595b2 | ||
|
|
8770524679 | ||
|
|
a8ddb2fcf1 | ||
|
|
76c4ca9ba6 | ||
|
|
ed2b0f0bb9 | ||
|
|
6702b44b3e | ||
|
|
c486d8241e | ||
|
|
d2bb8c374e | ||
|
|
530cecea5b | ||
|
|
266e2dada9 | ||
|
|
ce73d34627 | ||
|
|
11af0a7aac | ||
|
|
46c2d8f7c7 | ||
|
|
38127011fb | ||
|
|
89b5ce4b63 | ||
|
|
4fe9c180d5 | ||
|
|
f094e83e4d | ||
|
|
5b6c9fc348 | ||
|
|
3f1ee100bf | ||
|
|
41b1106c72 | ||
|
|
b27d95a615 | ||
|
|
5b8a83853d | ||
|
|
d0548b2715 | ||
|
|
bffeb9c862 | ||
|
|
dbd760fbcb | ||
|
|
a84b3bfc7a | ||
|
|
e8d3bf509c | ||
|
|
b2583773d5 | ||
|
|
9ecd24c755 | ||
|
|
f1bacd6210 | ||
|
|
a21ec54d4f | ||
|
|
0b4efb24ae | ||
|
|
c473914d05 | ||
|
|
90a1fa8337 | ||
|
|
99cb7f5142 | ||
|
|
4026b850f8 | ||
|
|
aac7ebf6dd | ||
|
|
8d481ba394 | ||
|
|
24fa75c24e | ||
|
|
cf38d593b8 | ||
|
|
36f608c63c | ||
|
|
1d88564a72 | ||
|
|
503f2fb197 | ||
|
|
bb000c4e3f | ||
|
|
4868ed7560 | ||
|
|
7017e9e2ea | ||
|
|
a18eb90702 | ||
|
|
9d1d4fe0d9 | ||
|
|
1a430dc2cf | ||
|
|
e37a09a1c8 | ||
|
|
d0d8b12fb8 | ||
|
|
9a29f9ce57 | ||
|
|
42513e4b56 | ||
|
|
67fa91abe8 | ||
|
|
d8348ad292 | ||
|
|
6faa7344aa | ||
|
|
299540725e | ||
|
|
0ef08142fd | ||
|
|
c0761c0eef | ||
|
|
8694d926c4 | ||
|
|
46f8829951 | ||
|
|
4c4bce3561 | ||
|
|
68e8717b5c | ||
|
|
b484e6fa3f | ||
|
|
aa8773a67e | ||
|
|
a822d3ef05 | ||
|
|
311cf81e8a | ||
|
|
bf9ee918f3 | ||
|
|
92ba76e7a1 | ||
|
|
3326339263 | ||
|
|
52cafbc7aa | ||
|
|
efb316de14 | ||
|
|
3cf944398f | ||
|
|
d2bfd47039 | ||
|
|
920cb6556b | ||
|
|
cd3ae2a7f5 | ||
|
|
b12fedb2d9 | ||
|
|
1cae7ad6b1 | ||
|
|
7dd881aa9a | ||
|
|
c7ad235110 | ||
|
|
a989547976 | ||
|
|
fa75880626 | ||
|
|
529895f970 | ||
|
|
3d5de440fd | ||
|
|
568bb1b0e8 | ||
|
|
b9ae8306dd | ||
|
|
4aededff46 | ||
|
|
ed8f9863e3 | ||
|
|
e85de55c8f | ||
|
|
adbf927270 | ||
|
|
dfe171a5c2 | ||
|
|
b55e449398 | ||
|
|
62b11c0a8a | ||
|
|
90cb11f55e | ||
|
|
40a66b0306 | ||
|
|
8c899698e0 | ||
|
|
58fa1571f3 | ||
|
|
2cbe77aa04 | ||
|
|
a0c2935580 | ||
|
|
798f25ff81 | ||
|
|
57b2e360ca | ||
|
|
ee23d59e11 | ||
|
|
04e7da9b73 | ||
|
|
5382d265f2 | ||
|
|
0e1534613c | ||
|
|
d799fac688 | ||
|
|
913247996e | ||
|
|
dc3bab26de | ||
|
|
5c1cf050e2 | ||
|
|
747bee41b7 | ||
|
|
246c00c773 | ||
|
|
272dd79426 | ||
|
|
b953da0341 | ||
|
|
c2a6445c9e | ||
|
|
b177ae7ee6 | ||
|
|
22bd5be5a9 | ||
|
|
90fa347fc2 | ||
|
|
68a9a1439a | ||
|
|
8947eff3b1 | ||
|
|
06b3c5ddb5 | ||
|
|
5fb8a1d3d1 | ||
|
|
b4d307d4cc | ||
|
|
306bd18a40 | ||
|
|
1968f47fc9 | ||
|
|
9b42aa3634 | ||
|
|
9faa0ddc62 | ||
|
|
6a2cd9d3ba | ||
|
|
9028564c10 | ||
|
|
8f2b23f8f9 | ||
|
|
b471d7419e | ||
|
|
5179cfc5ba | ||
|
|
784b2f541d | ||
|
|
735cf47c35 | ||
|
|
056742479e | ||
|
|
840b7e6987 | ||
|
|
a87772c98c | ||
|
|
c15f1e8276 | ||
|
|
49148dfb7a | ||
|
|
177f5de2bd | ||
|
|
96360ddb24 | ||
|
|
f5f2e4970e | ||
|
|
742256c130 | ||
|
|
b4a622d319 | ||
|
|
b0c4752397 | ||
|
|
bf78a4dfad | ||
|
|
8d7841b069 | ||
|
|
396eaa148c | ||
|
|
2a244f1e53 | ||
|
|
847181ada4 | ||
|
|
f274f5a0ef | ||
|
|
bb41883070 | ||
|
|
fca5457ab9 | ||
|
|
4f355ed4a2 | ||
|
|
b1452c714a | ||
|
|
aba48cca53 | ||
|
|
772d5fb0cc | ||
|
|
6b6f8cadb2 | ||
|
|
82ab79e915 | ||
|
|
863471b5f1 | ||
|
|
314f280400 | ||
|
|
b75f4bf9a9 | ||
|
|
253d67ce78 | ||
|
|
1753bc18c1 | ||
|
|
eceba13164 | ||
|
|
3c6c640f50 | ||
|
|
30e3018966 | ||
|
|
5ab0bb3c0d | ||
|
|
0de1517bd8 | ||
|
|
39c6d81b9e | ||
|
|
1c1fbe83ec | ||
|
|
ccd56e0368 | ||
|
|
38c7f226cb | ||
|
|
f5446cc415 | ||
|
|
aa2e680568 | ||
|
|
bc651cb774 | ||
|
|
20b03d0004 | ||
|
|
b005ce8e6b | ||
|
|
979b8b2663 | ||
|
|
69b1decbba | ||
|
|
d32c92cbde | ||
|
|
cef88cde20 | ||
|
|
a5b9885767 | ||
|
|
2daedecf92 | ||
|
|
db24822d2f | ||
|
|
aa3833915b | ||
|
|
59320d9b85 | ||
|
|
0c0bbeff27 | ||
|
|
ceda14096c | ||
|
|
9dfcef6356 | ||
|
|
d5b393d6bd | ||
|
|
ae3fc14b52 | ||
|
|
e2cdd6a7f9 | ||
|
|
261d02e67b | ||
|
|
f8681d179d | ||
|
|
f23630064e | ||
|
|
a6ce4694fc | ||
|
|
bec7f9be96 | ||
|
|
09e94eaa8e | ||
|
|
14bc65468a | ||
|
|
56d109bf0a | ||
|
|
a965859095 | ||
|
|
5f29bb3e7f | ||
|
|
1ad6a0d5b5 | ||
|
|
863ae447b9 | ||
|
|
f727e71eaf | ||
|
|
4dd922f1b5 | ||
|
|
14f006c3a5 | ||
|
|
f95dc40f4c | ||
|
|
200211c186 | ||
|
|
81786f7a7c | ||
|
|
1381d8d94c | ||
|
|
5ca214534d | ||
|
|
85ea21e83b | ||
|
|
1dca02517e | ||
|
|
7d572d748b | ||
|
|
fbcae10f96 | ||
|
|
b109fc7420 | ||
|
|
c74c01271d | ||
|
|
a4495ce80a | ||
|
|
f5478f6169 | ||
|
|
ae1e229619 | ||
|
|
bc5982b994 | ||
|
|
702b916948 | ||
|
|
8ed2431f37 | ||
|
|
e971d5d43f | ||
|
|
ee9519d891 | ||
|
|
58bb209158 | ||
|
|
23dc97ad5e | ||
|
|
84b580b001 | ||
|
|
227b303669 | ||
|
|
712a0a3905 | ||
|
|
76427b8ecb | ||
|
|
8b6d621d20 | ||
|
|
7898b24bac | ||
|
|
39648c5dc6 | ||
|
|
83e6b2fdfe | ||
|
|
816727d65b | ||
|
|
0e012adb6c | ||
|
|
539b0e64c8 | ||
|
|
258700ee7b | ||
|
|
1da72ba473 | ||
|
|
c2c69f243e | ||
|
|
dffbb8e4c8 | ||
|
|
c45cbebcce | ||
|
|
bebdede33b | ||
|
|
251110c4f8 | ||
|
|
50d37bb311 | ||
|
|
bbb73008ac | ||
|
|
c324f11a96 | ||
|
|
c4eb6be0fe | ||
|
|
64200030d2 | ||
|
|
4d7e74365b | ||
|
|
b9b25e7e6b | ||
|
|
8a4f48f08d | ||
|
|
ae9ab03e51 | ||
|
|
02478ee887 | ||
|
|
57f238de7d | ||
|
|
77938a77e8 | ||
|
|
d41aa5f9ae | ||
|
|
0ef3386ebf | ||
|
|
9703de86d3 | ||
|
|
764e8d7daa | ||
|
|
18f5c129a4 | ||
|
|
807d6a0cf4 | ||
|
|
a0ab2a8ba7 | ||
|
|
90d0fb7efb | ||
|
|
fe4290b218 | ||
|
|
cc04342358 | ||
|
|
66da826eab | ||
|
|
2afdaa1ac9 | ||
|
|
d4947c3c47 | ||
|
|
35efd9293b | ||
|
|
d89aa887fb | ||
|
|
801727dca6 | ||
|
|
44963fa4c7 | ||
|
|
a2534a8227 | ||
|
|
4f9268e571 | ||
|
|
e343756e44 | ||
|
|
9480f0d2bc | ||
|
|
fb2a808f5c | ||
|
|
24c0ec905e | ||
|
|
bca6a580e3 | ||
|
|
1d0413f159 | ||
|
|
72d8863862 | ||
|
|
c15dac3582 | ||
|
|
efe06264bd | ||
|
|
d5e155d77f | ||
|
|
bf68afdda3 | ||
|
|
a61b82748c | ||
|
|
245b2483ab | ||
|
|
87dbf1dbba | ||
|
|
101f7cb7e2 | ||
|
|
c795913259 | ||
|
|
64eabf71f2 | ||
|
|
2760354943 | ||
|
|
28c2586452 | ||
|
|
21d8c11cfe | ||
|
|
862746038d | ||
|
|
2bd81b08c2 | ||
|
|
16aee33bdf | ||
|
|
f4161ed61c | ||
|
|
bfa0861065 | ||
|
|
86d1512e5b | ||
|
|
5c83ee2648 | ||
|
|
7ba987e7f7 | ||
|
|
b22e93d6d0 | ||
|
|
70b74d39fc | ||
|
|
0236cb35d9 | ||
|
|
b0066a93ca | ||
|
|
e25bf9f077 | ||
|
|
147df1ffb2 | ||
|
|
4c96759ed5 | ||
|
|
8e2df3a030 | ||
|
|
58a5720b6b | ||
|
|
eedf993d7a | ||
|
|
d058cbf501 | ||
|
|
d2413e1677 | ||
|
|
3cb1984892 | ||
|
|
17207d44e6 | ||
|
|
36cfcbbbe3 | ||
|
|
1a6c0cd4d9 | ||
|
|
5a97c512f7 | ||
|
|
57a3330200 | ||
|
|
07ce0a47f7 | ||
|
|
b9f7a05e2a | ||
|
|
7f73b4554a | ||
|
|
f2e02794b8 | ||
|
|
0a2e45b64b | ||
|
|
a017e14a48 | ||
|
|
5ef03ba1d5 | ||
|
|
6a402b4a2b | ||
|
|
5daaaf5282 | ||
|
|
6f7729e34e | ||
|
|
043d6ffd20 | ||
|
|
a8404a7286 | ||
|
|
58d9134286 | ||
|
|
f25786635b | ||
|
|
6d1130d2c3 | ||
|
|
d9effc4a29 | ||
|
|
cf2765e017 | ||
|
|
06dd07dbc6 | ||
|
|
14daf2ce85 | ||
|
|
f9a3a3b78b | ||
|
|
2ba0e6ada6 | ||
|
|
943b75455b | ||
|
|
2b56d68f7d | ||
|
|
93217a3ae3 | ||
|
|
ba5c8ffaa6 | ||
|
|
9c5274dde4 | ||
|
|
002c678b4a | ||
|
|
038533c33f | ||
|
|
50d4b5b4ed | ||
|
|
7632d667c9 | ||
|
|
5aa78cd478 | ||
|
|
84cd4b1acb | ||
|
|
b705279153 | ||
|
|
d854750ee8 | ||
|
|
653861107d | ||
|
|
4502adda28 | ||
|
|
a98c5d7d99 | ||
|
|
c81a00268a | ||
|
|
dd47e20070 | ||
|
|
f05613147e | ||
|
|
6ed8d617cd | ||
|
|
b228f4c6fb | ||
|
|
70f8d1d4ae | ||
|
|
0d7131413a | ||
|
|
b5a4e65fbf | ||
|
|
7c51106d27 | ||
|
|
1e9786d5b9 | ||
|
|
4b8c85f8a6 | ||
|
|
aed8dae175 | ||
|
|
8db26af36c | ||
|
|
cfa874982c | ||
|
|
2a674cb869 | ||
|
|
fb971301a4 | ||
|
|
3bb16de67e | ||
|
|
033da7e737 | ||
|
|
14650f93c5 | ||
|
|
e5184efdaa | ||
|
|
d95a72f2cc | ||
|
|
16e3fd9305 | ||
|
|
4fb6c71174 | ||
|
|
12bbd57a24 | ||
|
|
689dc74330 | ||
|
|
6caae889b7 | ||
|
|
ce0e8b4cd1 | ||
|
|
737c632227 | ||
|
|
04e87c9810 | ||
|
|
57c0613843 | ||
|
|
f5d0143b09 | ||
|
|
237f1846d3 | ||
|
|
f6dee1ecb7 | ||
|
|
f808fc9802 | ||
|
|
8385bc35ed | ||
|
|
80d6d7fd58 | ||
|
|
b56cdcda52 | ||
|
|
ea81cd76ca | ||
|
|
c3a3670785 | ||
|
|
e4045e1343 | ||
|
|
5a52cea415 | ||
|
|
933b295c40 | ||
|
|
ce6ec00a89 | ||
|
|
b53f3925a4 | ||
|
|
e93fd596ff | ||
|
|
57b60c734b | ||
|
|
c74ccaafbf | ||
|
|
f6891feb64 | ||
|
|
2675852dbe | ||
|
|
0302c6f14b | ||
|
|
a0dd43244c | ||
|
|
3ccb0c74c6 | ||
|
|
f9270a7ed0 | ||
|
|
d79d56c2f9 | ||
|
|
a8f09a7fe9 | ||
|
|
94bf8d4bbd | ||
|
|
5e2f40a322 | ||
|
|
17161fd576 | ||
|
|
d3db551cc9 | ||
|
|
72058c792a | ||
|
|
ef5e3ab06e | ||
|
|
71e7f0a04c | ||
|
|
bae34e5b80 | ||
|
|
1ab3e61984 | ||
|
|
e81b6d4d96 | ||
|
|
83f14b10bb | ||
|
|
7fecd1a5dd | ||
|
|
0ce4107d56 | ||
|
|
66769365d0 | ||
|
|
e3cb164723 | ||
|
|
903b1b16a4 | ||
|
|
e81d0a0b1b | ||
|
|
51243f0981 | ||
|
|
fad5a6deac | ||
|
|
355443e440 | ||
|
|
45e4239b26 | ||
|
|
a83074e773 | ||
|
|
f854d886d1 | ||
|
|
73d4e9bbb9 | ||
|
|
232644feb0 | ||
|
|
1c80950a70 | ||
|
|
0bd46e88a5 | ||
|
|
b054e9dbe8 | ||
|
|
3ddf6b2335 | ||
|
|
1a1686b7c3 | ||
|
|
dd08b2c825 | ||
|
|
a2a60e9847 | ||
|
|
13505a052f | ||
|
|
f2dcdda9b3 | ||
|
|
dc6389c46f | ||
|
|
7dc89b0190 | ||
|
|
5b395ce3da | ||
|
|
40da7b3734 | ||
|
|
842e50adb9 | ||
|
|
96da078219 | ||
|
|
4a1951b027 | ||
|
|
83348e6b3c | ||
|
|
a1778f401f | ||
|
|
9c93d3a474 | ||
|
|
cbc8a6d45b | ||
|
|
382c7e7888 | ||
|
|
ae200a56b0 | ||
|
|
c50af5acfd | ||
|
|
527691a2ec | ||
|
|
a182c22d36 | ||
|
|
aac0d623fa | ||
|
|
604ef2bb64 | ||
|
|
6ca7f47bf9 | ||
|
|
a1b71219cb | ||
|
|
d59c7cb7a8 | ||
|
|
d121ca182f | ||
|
|
2aee91be10 | ||
|
|
99da815f49 | ||
|
|
ebd3ce42d0 | ||
|
|
fdee1b9453 | ||
|
|
472e89239c | ||
|
|
5692e79e02 | ||
|
|
52246e41c8 | ||
|
|
2da3222115 | ||
|
|
4d0bfce712 | ||
|
|
cb153e039b | ||
|
|
8aa5a6756a | ||
|
|
23286dd8b8 | ||
|
|
30408384c6 | ||
|
|
e11e3dfd86 | ||
|
|
2c39cd06ed | ||
|
|
75a224cef1 | ||
|
|
0373f1875f | ||
|
|
fffd016008 | ||
|
|
f286c400a3 | ||
|
|
c0e0f8dc2a | ||
|
|
ffb044ffc6 | ||
|
|
1c4f029bf4 | ||
|
|
6812d2ba7d | ||
|
|
c0b5d60715 | ||
|
|
c814874cb6 | ||
|
|
cd3aef47a5 | ||
|
|
338fdb509a | ||
|
|
660efe5e16 | ||
|
|
58a2965fea | ||
|
|
c614d7ec6a | ||
|
|
e017238aca | ||
|
|
c37a5ba956 | ||
|
|
da5969c2fd | ||
|
|
990107a1fa | ||
|
|
42eb86b624 | ||
|
|
b65a199e54 | ||
|
|
88e3bcdf63 | ||
|
|
0fbfa32e6b | ||
|
|
20405716bc | ||
|
|
8da7406e8f | ||
|
|
97fd3df8f7 | ||
|
|
b9b33b5351 | ||
|
|
19ecb1bbb3 | ||
|
|
f6043f4ac6 | ||
|
|
ed1941abdb | ||
|
|
24d24728dc | ||
|
|
77db4cd19f | ||
|
|
adbb03e5cb | ||
|
|
f0226f1ea7 | ||
|
|
be5df2677b | ||
|
|
3d4a856bb2 | ||
|
|
1b1233d26a | ||
|
|
c4b0e0a810 | ||
|
|
1dee8ef355 | ||
|
|
8cee173f92 | ||
|
|
19e0e6d962 | ||
|
|
ef8fd70475 | ||
|
|
6df05f4b7f | ||
|
|
4e1491a0cc | ||
|
|
55091154c4 | ||
|
|
a0b1cb2993 | ||
|
|
7617081637 | ||
|
|
96e7f37799 | ||
|
|
a0bf22de86 | ||
|
|
9a1aecc002 | ||
|
|
ad941fcbb2 | ||
|
|
e5ca30dc26 | ||
|
|
a23eadf5cf | ||
|
|
82417f4f85 | ||
|
|
af788133c2 | ||
|
|
a6dc156a79 | ||
|
|
25bebdc172 | ||
|
|
b55d96169f | ||
|
|
1a809fa7a3 | ||
|
|
313a5fddbe | ||
|
|
732d806820 | ||
|
|
11ed8a2f21 | ||
|
|
3aa8f51015 | ||
|
|
85b038dada | ||
|
|
dd25527a62 | ||
|
|
ac372bc6fc | ||
|
|
63ce4fe0bd | ||
|
|
398169f68e | ||
|
|
46a24af373 | ||
|
|
0cd9bb658f | ||
|
|
b0678fd259 | ||
|
|
9cb4a1779e |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto
|
||||
35
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
35
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Please file a separate report for each issue
|
||||
title: Please add a brief but descriptive title
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Some information
|
||||
Operating system:
|
||||
Java version:
|
||||
Minecraft version:
|
||||
Baritone version:
|
||||
Other mods (if used):
|
||||
|
||||
## Exception, error or logs
|
||||
Please find your `latest.log` or `debug.log` in this folder and attach it to the issue
|
||||
|
||||
Linux: `~/.minecraft/logs/`
|
||||
|
||||
Windows: `%appdata%/.minecraft/logs/`
|
||||
|
||||
Mac: `/Library/Application\ Support/minecraft/logs/`
|
||||
|
||||
## How to reproduce
|
||||
Add your steps to reproduce the issue/bug experienced here.
|
||||
|
||||
## Modified settings
|
||||
To get the modified settings run `#modified` in game
|
||||
|
||||
## Final checklist
|
||||
- [x] I know how to properly use check boxes
|
||||
- [ ] I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
|
||||
- [ ] I have included logs, exceptions and / or steps to reproduce the issue.
|
||||
- [ ] I have not used any OwO's or UwU's in this issue.
|
||||
14
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: Question
|
||||
about: Please file a separate report for each question
|
||||
title: Please add a brief but descriptive title
|
||||
labels: question
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## What do you need help with?
|
||||
With as much detail as possible, describe your question and what you may need help with.
|
||||
|
||||
## Final checklist
|
||||
- [x] I know how to properly use check boxes
|
||||
- [ ] I have not used any OwO's or UwU's in this issue.
|
||||
20
.github/ISSUE_TEMPLATE/suggestion.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/suggestion.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Suggestion
|
||||
about: Please file a separate report for each suggestion
|
||||
title: Please add a brief but descriptive title
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Describe your suggestion
|
||||
With as much detail as possible, describe what your suggestion would do for Baritone.
|
||||
|
||||
## Settings
|
||||
If applicable, what settings/customizability should be offered to tweak the functionality of your suggestion.
|
||||
|
||||
## Context
|
||||
Describe how your suggestion would improve Baritone, or the reason behind it being added.
|
||||
|
||||
## Final checklist
|
||||
- [x] I know how to properly use check boxes
|
||||
- [ ] I have not used any OwO's or UwU's in this issue.
|
||||
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<!-- No UwU's or OwO's allowed -->
|
||||
39
.github/workflows/gradle_build.yml
vendored
Normal file
39
.github/workflows/gradle_build.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
# This workflow will build a Java project with Gradle
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Java CI with Gradle
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Archive Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Artifacts
|
||||
path: dist/
|
||||
|
||||
- name: Archive mapping.txt
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Mappings
|
||||
path: build/tmp/proguard/mapping.txt
|
||||
26
.github/workflows/run_tests.yml
vendored
Normal file
26
.github/workflows/run_tests.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Executing tests
|
||||
run: ./gradlew test
|
||||
|
||||
13
.gitignore
vendored
13
.gitignore
vendored
@@ -14,8 +14,19 @@ classes/
|
||||
# IntelliJ Files
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
/logs/
|
||||
|
||||
# Eclipse Files
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
baritone_Client.launch
|
||||
|
||||
# Copyright Files
|
||||
!/.idea/copyright/Baritone.xml
|
||||
!/.idea/copyright/profiles_settings.xml
|
||||
!/.idea/copyright/profiles_settings.xml
|
||||
|
||||
.vscode/launch.json
|
||||
|
||||
|
||||
31
.gitmessage
Normal file
31
.gitmessage
Normal file
@@ -0,0 +1,31 @@
|
||||
<emoji> <title> (<ticket>)
|
||||
|
||||
# 📝 Update README.md (WD-1234)
|
||||
# ✅ Add unit test for inputs (WD-1234)
|
||||
|
||||
# <emoji> can be:
|
||||
# 🎨 :art: when improving structure of the code
|
||||
# ⚡️ :zap: when improving performance
|
||||
# 🔥 :fire: when removing code or files
|
||||
# ✨ :sparkles: when introducing new features
|
||||
# 🚧 :construction: when work in progress
|
||||
# 🔨 :hammer: when refactoring code
|
||||
# 📝 :memo: when writing docs
|
||||
# 💄 :lipstick: when updating the UI and style files
|
||||
# 📈 :chart_with_upwards_trend: when adding analytics or tracking code
|
||||
# 🌐 :globe_with_meridians: when adding internationalization and localization
|
||||
# ✏️ :pencil2: when fixing typos
|
||||
# 🚚 :truck: when moving or renaming files
|
||||
# ✅ :white_check_mark: when adding tests
|
||||
|
||||
# 👌 :ok_hand: when updating code due to code review changes
|
||||
# 🐛 :bug: when fixing a bug
|
||||
# 🚑 :ambulance: when doing a critical hotfix
|
||||
# 🚨 :rotating_light: when removing linter warnings
|
||||
|
||||
# 🔀 :twisted_rightwards_arrows: when merging branches
|
||||
# ⬆️ :arrow_up: when upgrading dependencies
|
||||
# ⬇️ :arrow_down: when downgrading dependencies
|
||||
# 🔧 :wrench: when changing configuration files
|
||||
# 🔖 :bookmark: when releasing / version tagging
|
||||
# 💚 :green_heart: when fixing the CI build
|
||||
28
.travis.yml
28
.travis.yml
@@ -1,28 +0,0 @@
|
||||
language: java
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
install:
|
||||
- travis_retry docker build -t cabaletta/baritone .
|
||||
|
||||
script:
|
||||
- docker run --name baritone cabaletta/baritone /bin/sh -c "set -e; /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 128x128x24 -ac +extension GLX +render; DISPLAY=:99 BARITONE_AUTO_TEST=true ./gradlew runClient"
|
||||
- docker 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
|
||||
83
CODE_OF_CONDUCT.md
Normal file
83
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,83 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* No Anime (including uwu's or owo's)
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Giving and gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* Anime
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* ~~Trolling, insulting/derogatory comments, and personal or political attacks~~
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission or consent
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
Project maintainers have the right and responsibility to immediately remove
|
||||
without any sort of dispute any issues or pull requests that do not align
|
||||
with their corresponding templates. Absolutely no leniancy shall be accepted
|
||||
with these terms.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at complaints@leijurv.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
15
Dockerfile
15
Dockerfile
@@ -1,24 +1,15 @@
|
||||
FROM debian:jessie
|
||||
|
||||
RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/jessie-backports.list
|
||||
FROM debian:stretch
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt update -y
|
||||
|
||||
RUN apt install --target-release jessie-backports \
|
||||
RUN apt install \
|
||||
openjdk-8-jdk \
|
||||
ca-certificates-java \
|
||||
--assume-yes
|
||||
|
||||
RUN apt install -qq --force-yes mesa-utils libgl1-mesa-glx libxcursor1 libxrandr2 libxxf86vm1 x11-xserver-utils xfonts-base xserver-common
|
||||
|
||||
COPY . /code
|
||||
|
||||
# this .deb is specially patched to support lwjgl
|
||||
# source: https://github.com/tectonicus/tectonicus/issues/60#issuecomment-154239173
|
||||
RUN dpkg -i /code/scripts/xvfb_1.16.4-1_amd64.deb
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
RUN ./gradlew build
|
||||
RUN ./gradlew build
|
||||
|
||||
10
FEATURES.md
10
FEATURES.md
@@ -4,13 +4,14 @@
|
||||
- **Block breaking** Baritone considers breaking blocks as part of its path. It also takes into account your current tool set and hot bar. For example, if you have a Eff V diamond pick, it may choose to mine through a stone barrier, while if you only had a wood pick it might be faster to climb over it.
|
||||
- **Block placing** Baritone considers placing blocks as part of its path. This includes sneak-back-placing, pillaring, etc. It has a configurable penalty of placing a block (set to 1 second by default), to conserve its resources. The list of acceptable throwaway blocks is also configurable, and is cobble, dirt, or netherrack by default. <a href="https://www.youtube.com/watch?v=F6FbI1L9UmU">Example</a>
|
||||
- **Falling** Baritone will fall up to 3 blocks onto solid ground (configurable, if you have Feather Falling and/or don't mind taking a little damage). If you have a water bucket on your hotbar, it will fall up to 23 blocks and place the bucket beneath it. It will fall an unlimited distance into existing still water.
|
||||
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`).
|
||||
- **Vines and ladders** Baritone understands how to climb and descend vines and ladders. There is experimental support for more advanced maneuvers, like strafing to a different ladder / vine column in midair (off by default, setting named `allowVines`). Baritone can break its fall by grabbing ladders / vines midair, and understands when that is and isn't possible.
|
||||
- **Opening fence gates and doors**
|
||||
- **Slabs and stairs**
|
||||
- **Falling blocks** Baritone understands the costs of breaking blocks with falling blocks on top, and includes all of their break costs. Additionally, since it avoids breaking any blocks touching a liquid, it won't break the bottom of a gravel stack below a lava lake (anymore).
|
||||
- **Avoiding dangerous blocks** Obviously, it knows not to walk through fire or on magma, not to corner over lava (that deals some damage), not to break any blocks touching a liquid (it might drown), etc.
|
||||
- **Parkour** Sprint jumping over 1, 2, or 3 block gaps
|
||||
- **Parkour place** Sprint jumping over a 3 block gap and placing the block to land on while executing the jump. It's really cool.
|
||||
- **Pigs** It can sort of control pigs. I wouldn't rely on it though.
|
||||
|
||||
# Pathing method
|
||||
Baritone uses A*, with some modifications:
|
||||
@@ -21,9 +22,9 @@ Baritone uses A*, with some modifications:
|
||||
- **Backtrack cost favoring** While calculating the next segment, Baritone favors backtracking its current segment. The cost is decreased heavily, but is still positive (this won't cause it to backtrack if it doesn't need to). This allows it to splice and jump onto the next segment as early as possible, if the next segment begins with a backtrack of the current one. <a href="https://www.youtube.com/watch?v=CGiMcb8-99Y">Example</a>
|
||||
- **Backtrack detection and pausing** While path calculation happens on a separate thread, the main game thread has access to the latest node considered, and the best path so far (those are rendered light blue and dark blue respectively). When the current best path (rendered dark blue) passes through the player's current position on the current path segment, path execution is paused (if it's safe to do so), because there's no point continuing forward if we're about to turn around and go back that same way. Note that the current best path as reported by the path calculation thread takes into account the incremental cost backoff system, so it's accurate to what the path calculation thread will actually pick once it finishes.
|
||||
|
||||
# Configuring Baritone
|
||||
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>.
|
||||
To change a boolean setting, just say its name in chat (for example saying `allowBreak` toggles whether Baritone will consider breaking blocks). For a numeric setting, say its name then the new value (like `pathTimeoutMS 250`). It's case insensitive.
|
||||
# Chat control
|
||||
|
||||
- [Baritone chat control usage](USAGE.md)
|
||||
|
||||
# Goals
|
||||
The pathing goal can be set to any of these options:
|
||||
@@ -46,7 +47,6 @@ Things it doesn't have yet
|
||||
See <a href="https://github.com/cabaletta/baritone/issues">issues</a> for more.
|
||||
|
||||
Things it may not ever have, from most likely to least likely =(
|
||||
- Pigs
|
||||
- Boats
|
||||
- Horses (2x3 path instead of 1x2)
|
||||
- Elytra
|
||||
|
||||
98
INSTALL.md
98
INSTALL.md
@@ -1,98 +0,0 @@
|
||||
# Integration between Baritone and Impact
|
||||
Impact 4.4 has Baritone included.
|
||||
|
||||
These instructions apply to Impact 4.3 (and potentially other hacked clients).
|
||||
|
||||
|
||||
## An Introduction
|
||||
There are some basic steps to getting Baritone setup with Impact.
|
||||
- Acquiring a build of Baritone
|
||||
- Placing Baritone in the libraries directory
|
||||
- Modifying the Impact Profile JSON to run baritone
|
||||
- How to use Baritone
|
||||
|
||||
## Acquiring a build of Baritone
|
||||
There are 3 methods of acquiring a build of Baritone (While it is still in development)
|
||||
|
||||
### Official Release (Not always up to date)
|
||||
https://github.com/cabaletta/baritone/releases
|
||||
|
||||
For Impact 4.3, there is no Baritone integration yet, so you will want `baritone-standalone-X.Y.Z.jar`.
|
||||
|
||||
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`.
|
||||
|
||||
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone . && docker run --rm cabaletta/baritone cat /code/dist/checksums.txt` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
|
||||
|
||||
### Building Baritone yourself
|
||||
There are a few steps to this
|
||||
- Clone this repository
|
||||
- Setup the project as instructed in the README
|
||||
- Run the ``build`` gradle task. You can either do this using IntelliJ's gradle UI or through a
|
||||
command line
|
||||
- Windows: ``gradlew build``
|
||||
- Mac/Linux: ``./gradlew build``
|
||||
- The build should be exported into ``/build/libs/baritone-X.Y.Z.jar``
|
||||
|
||||
### Cutting Edge Release
|
||||
If you want to trust @Plutie#9079, you can download an automatically generated build of the latest commit
|
||||
from his Jenkins server, found <a href="https://plutiejenkins.leijurv.com/job/baritone/lastSuccessfulBuild/">here</a>.
|
||||
|
||||
## Placing Baritone in the libraries directory
|
||||
``/libraries`` is a neat directory in your <a href="https://minecraft.gamepedia.com/.minecraft">Minecraft Installation Directory</a>
|
||||
that contains all of the dependencies that are required from the game and some mods. This is where we will be
|
||||
putting baritone.
|
||||
- Locate the ``libraries`` folder, it should be in the Minecraft Installation Directory
|
||||
- Create 3 new subdirectories starting from ``libraries``
|
||||
- ``cabaletta``
|
||||
- ``baritone``
|
||||
- ``X.Y.Z``
|
||||
- Copy the build of Baritone that was acquired earlier, and place it into the ``X.Y.Z`` folder
|
||||
- The full path should look like ``<Minecraft>/libraries/cabaletta/baritone/X.Y.Z/baritone-X.Y.Z.jar``
|
||||
|
||||
## Modifying the Impact Profile JSON to run baritone
|
||||
The final step is "registering" the Baritone library with Impact, so that it loads on launch.
|
||||
- Ensure your Minecraft launcher is closed
|
||||
- Navigate back to the Minecraft Installation Directory
|
||||
- Find the ``versions`` directory, and open in
|
||||
- In here there should be a ``1.12.2-Impact_4.3`` folder.
|
||||
- If you don't have any Impact folder or have a version older than 4.3, you can download Impact <a href="https://impactdevelopment.github.io">here</a>.
|
||||
- Open the folder and inside there should be a file called ``1.12.2-Impact_4.3.json``
|
||||
- Open the JSON file with a text editor that supports your system's line endings
|
||||
- For example, Notepad on Windows likely will NOT work for this. You should instead use a Text Editor like
|
||||
<a href="https://notepad-plus-plus.org/">Notepad++</a> if you're on Windows. (For other systems, I'm not sure
|
||||
what would work the best so you may have to do some research.)
|
||||
- Find the ``libraries`` array in the JSON. It should look something like this.
|
||||
```
|
||||
"libraries": [
|
||||
{
|
||||
"name": "net.minecraft:launchwrapper:1.12"
|
||||
},
|
||||
{
|
||||
"name": "com.github.ImpactDevelopment:Impact:4.3-1.12.2",
|
||||
"url": "https://impactdevelopment.github.io/maven/"
|
||||
},
|
||||
{
|
||||
"name": "com.github.ImpactDeveloment:ClientAPI:3.0.2",
|
||||
"url": "https://impactdevelopment.github.io/maven/"
|
||||
},
|
||||
...
|
||||
```
|
||||
- Create 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.1",
|
||||
"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>.
|
||||
BIN
LICENSE-Part-2.jpg
Normal file
BIN
LICENSE-Part-2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
148
README.md
148
README.md
@@ -1,73 +1,137 @@
|
||||
# Baritone
|
||||
[](https://travis-ci.com/cabaletta/baritone)
|
||||
[](LICENSE)
|
||||
[](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade)
|
||||
<p align="center">
|
||||
<a href="https://github.com/cabaletta/baritone/releases/"><img src="https://img.shields.io/github/downloads/cabaletta/baritone/total.svg" alt="GitHub All Releases"/></a>
|
||||
</p>
|
||||
|
||||
<!-- Unofficial Jenkins: [](https://plutiejenkins.leijurv.com/job/baritone/lastSuccessfulBuild/) -->
|
||||
<p align="center">
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.12.2-brightgreen.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.13.2-yellow.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.14.4-yellow.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.15.2-yellow.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.16.5-brightgreen.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.17.1-yellow.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.18.2-brightgreen.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.2-brightgreen.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.19.4-brightgreen.svg" alt="Minecraft"/></a>
|
||||
<a href="#Baritone"><img src="https://img.shields.io/badge/MC-1.20.1-brightgreen.svg" alt="Minecraft"/></a>
|
||||
</p>
|
||||
|
||||
A Minecraft pathfinder bot. This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/),
|
||||
the original version of the bot for Minecraft 1.8, rebuilt for 1.12.2. Baritone focuses on reliability and particularly performance (it's over [29x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.com/cabaletta/baritone/"><img src="https://travis-ci.com/cabaletta/baritone.svg?branch=master" alt="Build Status"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/releases/"><img src="https://img.shields.io/github/release/cabaletta/baritone.svg" alt="Release"/></a>
|
||||
<a href="LICENSE"><img src="https://img.shields.io/badge/license-LGPL--3.0%20with%20anime%20exception-green.svg" alt="License"/></a>
|
||||
<a href="https://www.codacy.com/gh/cabaletta/baritone/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/cadab857dab049438b6e28b3cfc5570e" alt="Codacy Badge"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/blob/master/CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat" alt="Code of Conduct"/></a>
|
||||
<a href="https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle"><img src="https://snyk.io/test/github/cabaletta/baritone/badge.svg?targetFile=build.gradle" alt="Known Vulnerabilities"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/issues/"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="Contributions welcome"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/issues/"><img src="https://img.shields.io/github/issues/cabaletta/baritone.svg" alt="Issues"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/issues?q=is%3Aissue+is%3Aclosed"><img src="https://img.shields.io/github/issues-closed/cabaletta/baritone.svg" alt="GitHub issues-closed"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/pulls/"><img src="https://img.shields.io/github/issues-pr/cabaletta/baritone.svg" alt="Pull Requests"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/graphs/contributors/"><img src="https://img.shields.io/github/contributors/cabaletta/baritone.svg" alt="GitHub contributors"/></a>
|
||||
<a href="https://github.com/cabaletta/baritone/commit/"><img src="https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg" alt="GitHub commits"/></a>
|
||||
<img src="https://img.shields.io/github/languages/code-size/cabaletta/baritone.svg" alt="Code size"/>
|
||||
<img src="https://img.shields.io/github/repo-size/cabaletta/baritone.svg" alt="GitHub repo size"/>
|
||||
<img src="https://tokei.rs/b1/github/cabaletta/baritone?category=code" alt="Lines of Code"/>
|
||||
</p>
|
||||
|
||||
Baritone is the pathfinding system used in [Impact](https://impactdevelopment.github.io/) since 4.4.
|
||||
<p align="center">
|
||||
<a href="https://impactclient.net/"><img src="https://img.shields.io/badge/Impact%20integration-v1.2.14%20/%20v1.3.8%20/%20v1.4.6%20/%20v1.5.3%20/%20v1.6.3-brightgreen.svg" alt="Impact integration"/></a>
|
||||
<a href="https://github.com/lambda-client/lambda"><img src="https://img.shields.io/badge/Lambda%20integration-v1.2.17-brightgreen.svg" alt="Lambda integration"/></a>
|
||||
<a href="https://github.com/fr1kin/ForgeHax/"><img src="https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg" alt="ForgeHax integration"/></a>
|
||||
<a href="https://aristois.net/"><img src="https://img.shields.io/badge/Aristois%20add--on%20integration-v1.6.3-green.svg" alt="Aristois add-on integration"/></a>
|
||||
<a href="https://rootnet.dev/"><img src="https://img.shields.io/badge/rootNET%20integration-v1.2.14-green.svg" alt="rootNET integration"/></a>
|
||||
<a href="https://futureclient.net/"><img src="https://img.shields.io/badge/Future%20integration-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red" alt="Future integration"/></a>
|
||||
<a href="https://rusherhack.org/"><img src="https://img.shields.io/badge/RusherHack%20integration-v1.2.14-green" alt="RusherHack integration"/></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="http://forthebadge.com/"><img src="https://forthebadge.com/images/badges/built-with-swag.svg" alt="forthebadge"/></a>
|
||||
<a href="http://forthebadge.com/"><img src="https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg" alt="forthebadge"/></a>
|
||||
</p>
|
||||
|
||||
A Minecraft pathfinder bot.
|
||||
|
||||
Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do.
|
||||
|
||||
[**Baritone Discord Server**](http://discord.gg/s6fRBAUpmr)
|
||||
|
||||
**Quick download links:**
|
||||
|
||||
| Forge | Fabric |
|
||||
|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
|
||||
| [1.12.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.2.17/baritone-api-forge-1.2.17.jar) | |
|
||||
| [1.16.5 Forge](https://github.com/cabaletta/baritone/releases/download/v1.6.4/baritone-api-forge-1.6.4.jar) | [1.16.5 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.6.4/baritone-api-fabric-1.6.4.jar) |
|
||||
| [1.17.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-forge-1.7.3.jar) | [1.17.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.7.3/baritone-api-fabric-1.7.3.jar) |
|
||||
| [1.18.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.8.4/baritone-api-forge-1.8.4.jar) | [1.18.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.8.4/baritone-api-fabric-1.8.4.jar) |
|
||||
| [1.19.2 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-forge-1.9.4.jar) | [1.19.2 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.4/baritone-api-fabric-1.9.4.jar) |
|
||||
| [1.19.3 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-forge-1.9.1.jar) | [1.19.3 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.1/baritone-api-fabric-1.9.1.jar) |
|
||||
| [1.19.4 Forge](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-forge-1.9.3.jar) | [1.19.4 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.9.3/baritone-api-fabric-1.9.3.jar) |
|
||||
| [1.20.1 Forge](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-forge-1.10.1.jar) | [1.20.1 Fabric](https://github.com/cabaletta/baritone/releases/download/v1.10.1/baritone-api-fabric-1.10.1.jar) |
|
||||
|
||||
**How to immediately get started:** Type `#goto 1000 500` in chat to go to x=1000 z=500. Type `#mine diamond_ore` to mine diamond ore. Type `#stop` to stop. For more, read [the usage page](USAGE.md) and/or watch this [tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa)
|
||||
|
||||
For other versions of Minecraft or more complicated situations or for development, see [Installation & setup](SETUP.md). Also consider just installing [Impact](https://impactclient.net/), which comes with Baritone and is easier to install than wrangling with version JSONs and zips. For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#6313 on Baritone which I recommend.
|
||||
|
||||
This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/),
|
||||
the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 onwards. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths).
|
||||
|
||||
Have committed at least once a day from Aug 1, 2018, to Aug 1, 2019.
|
||||
|
||||
1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2
|
||||
|
||||
# Getting Started
|
||||
|
||||
Here are some links to help to get started:
|
||||
|
||||
- [Features](FEATURES.md)
|
||||
|
||||
- [Installation](INSTALL.md)
|
||||
- [Installation & setup](SETUP.md)
|
||||
|
||||
There's also some useful information down below
|
||||
- [API Javadocs](https://baritone.leijurv.com/)
|
||||
|
||||
# Setup
|
||||
- [Settings](https://baritone.leijurv.com/baritone/api/Settings.html#field.detail)
|
||||
|
||||
## IntelliJ's Gradle UI
|
||||
- Open the project in IntelliJ as a Gradle project
|
||||
- Run the Gradle task `setupDecompWorkspace`
|
||||
- Run the Gradle task `genIntellijRuns`
|
||||
- Refresh the Gradle project (or just restart IntelliJ)
|
||||
- Select the "Minecraft Client" launch config and run
|
||||
- [Usage (chat control)](USAGE.md)
|
||||
|
||||
## Command Line
|
||||
On Mac OSX and Linux, use `./gradlew` instead of `gradlew`.
|
||||
## Stars over time
|
||||
|
||||
Running Baritone:
|
||||
[](https://starchart.cc/cabaletta/baritone)
|
||||
|
||||
```
|
||||
$ gradlew run
|
||||
```
|
||||
# API
|
||||
|
||||
Setting up for IntelliJ:
|
||||
```
|
||||
$ gradlew setupDecompWorkspace
|
||||
$ gradlew --refresh-dependencies
|
||||
$ gradlew genIntellijRuns
|
||||
```
|
||||
The API is heavily documented, you can find the Javadocs for the latest release [here](https://baritone.leijurv.com/).
|
||||
Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release
|
||||
jar.
|
||||
|
||||
# Chat control
|
||||
[Defined Here](src/main/java/baritone/utils/ExampleBaritoneControl.java)
|
||||
Below is an example of basic usage for changing some settings, and then pathing to an X/Z goal.
|
||||
|
||||
Quick start example: `thisway 1000` or `goal 70` to set the goal, `path` to actually start pathing. Also try `mine diamond_ore`. `cancel` to cancel.
|
||||
|
||||
# API example
|
||||
|
||||
```
|
||||
```java
|
||||
BaritoneAPI.getSettings().allowSprint.value = true;
|
||||
BaritoneAPI.getSettings().pathTimeoutMS.value = 2000L;
|
||||
BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L;
|
||||
|
||||
BaritoneAPI.getPathingBehavior().setGoal(new GoalXZ(10000, 20000));
|
||||
BaritoneAPI.getPathingBehavior().path();
|
||||
BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalXZ(10000, 20000));
|
||||
```
|
||||
|
||||
# FAQ
|
||||
|
||||
## Can I use Baritone as a library in my hacked client?
|
||||
## Can I use Baritone as a library in my custom utility client?
|
||||
|
||||
Sure! (As long as usage is in compliance with the LGPL 3 License)
|
||||
That's what it's for, sure! (As long as usage complies with the LGPL 3.0 License)
|
||||
|
||||
## How is it so fast?
|
||||
|
||||
Magic. (Hours of [Leijurv](https://github.com/leijurv) enduring excruciating pain)
|
||||
Magic. (Hours of [leijurv](https://github.com/leijurv/) enduring excruciating pain)
|
||||
|
||||
### Additional Special Thanks To:
|
||||
|
||||

|
||||
|
||||
YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications.
|
||||
|
||||
YourKit is the creator of the [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/).
|
||||
|
||||
We thank them for granting Baritone an OSS license so that we can make our software the best it can be.
|
||||
|
||||
## Why is it called Baritone?
|
||||
|
||||
It's named for FitMC's deep sultry voice.
|
||||
It's named for FitMC's deep sultry voice.
|
||||
|
||||
78
SETUP.md
Normal file
78
SETUP.md
Normal file
@@ -0,0 +1,78 @@
|
||||
# Installation
|
||||
|
||||
The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone.
|
||||
|
||||
You can also use a custom version json for Minecraft, with the [1.14.4](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1) version or the [1.15.2](https://www.dropbox.com/s/8rx6f0kts9hvd4f/1.15.2-Baritone.zip?dl=1) version or the [1.16.5](https://www.dropbox.com/s/i6f292o2i7o9acp/1.16.5-Baritone.zip?dl=1) version.
|
||||
|
||||
Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it.
|
||||
|
||||
## Prebuilt official releases
|
||||
These releases are not always completely up to date with latest features, and are only released from `master`. (so if you want `backfill-2` branch for example, you'll have to build it yourself)
|
||||
|
||||
Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases)
|
||||
|
||||
v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.5, v1.7.* is for 1.17.1, v1.8.* is for 1.18.1
|
||||
|
||||
Any official release will be GPG signed by leijurv (44A3EA646EADAC6A). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by that public keys of `checksums.txt`.
|
||||
|
||||
The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too).
|
||||
|
||||
|
||||
## Artifacts
|
||||
|
||||
Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases).
|
||||
|
||||
**The Forge and Fabric releases can simply be added as a Forge/Fabric mods.**
|
||||
|
||||
If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar`
|
||||
|
||||
- **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features.
|
||||
- **Forge/Fabric API**: Same as API, but packaged for Forge/Fabric. This should be used where another mod has a Baritone integration.
|
||||
- **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features.
|
||||
- **Forge/Fabric Standalone**: Same as Standalone, but packaged for Forge/Fabric. This should be used when Baritone is your only Forge/Fabric mod, or none of your other Forge/Fabric mods integrate with Baritone.
|
||||
- **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production.
|
||||
- **Forge/Fabric Unoptimized**: Same as Unoptimized, but packaged for Forge/Fabric.
|
||||
|
||||
## Build it yourself
|
||||
- Clone or download Baritone
|
||||
|
||||

|
||||
- 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`.
|
||||
|
||||
If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8 for 1.12.2-1.16.5, JDK 16+ for 1.17.1, and JDK 17+ for 1.18.1.
|
||||
|
||||
To check which java you are using do
|
||||
`java -version` in a command prompt or terminal.
|
||||
If you are using anything above OpenJDK 8 for 1.12.2-1.16.5, it might not work because the Java distributions above JDK 8 using may not have the needed javax classes.
|
||||
|
||||
Download java: https://adoptium.net/
|
||||
#### macOS guide
|
||||
In order to get JDK 8, Try running the following command:
|
||||
`% /usr/libexec/java_home -V`
|
||||
If it doesn't work try this guide: https://stackoverflow.com/questions/46513639/how-to-downgrade-java-from-9-to-8-on-a-macos-eclipse-is-not-running-with-java-9
|
||||
|
||||
If you see something like
|
||||
|
||||
`% 1.8.0_VERSION, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_VERSION.jdk/Contents/Home`
|
||||
|
||||
in the list then you've got JDK 8 installed.
|
||||
In order to get JDK 8 running in the **current terminal window** you will have to run this command:
|
||||
|
||||
`% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)`
|
||||
|
||||
To add OpenJDK 8 to your PATH add the export line to the end of your `.zshrc / .bashrc` if you want it to apply to each new terminal. If you're using bash change the .bachrc and if you're using zsh change the .zshrc
|
||||
|
||||
### Building Baritone
|
||||
|
||||
These tasks depend on the minecraft version, but are (for the most part) standard for building mods.
|
||||
|
||||
for more details, see [the build ci action](/.github/workflows/gradle_build.yml)
|
||||
|
||||
## IntelliJ
|
||||
- Open the project in IntelliJ as a Gradle project
|
||||
- Refresh the Gradle project (or, to be safe, just restart IntelliJ)
|
||||
- depending on the minecraft version, you may need to run `setupDecompWorkspace` or `genIntellijRuns` in order to get everything working
|
||||
107
USAGE.md
Normal file
107
USAGE.md
Normal file
@@ -0,0 +1,107 @@
|
||||
(assuming you already have Baritone [set up](SETUP.md))
|
||||
|
||||
# Prefix
|
||||
|
||||
Baritone's chat control prefix is `#` by default. In Impact, you can also use `.b` as a prefix. (for example, `.b click` instead of `#click`)
|
||||
|
||||
Baritone commands can also by default be typed in the chatbox. However if you make a typo, like typing "gola 10000 10000" instead of "goal" it goes into public chat, which is bad, so using `#` is suggested.
|
||||
|
||||
To disable direct chat control (with no prefix), turn off the `chatControl` setting. To disable chat control with the `#` prefix, turn off the `prefixControl` setting. In Impact, `.b` cannot be disabled. Be careful that you don't leave yourself with all control methods disabled (if you do, reset your settings by deleting the file `minecraft/baritone/settings.txt` and relaunching).
|
||||
|
||||
# For Baritone 1.2.10+, 1.3.5+, 1.4.2+
|
||||
|
||||
Lots of the commands have changed, BUT `#help` is improved vastly (its clickable! commands have tab completion! oh my!).
|
||||
|
||||
Try `#help` I promise it won't just send you back here =)
|
||||
|
||||
"wtf where is cleararea" -> look at `#help sel`
|
||||
|
||||
"wtf where is goto death, goto waypoint" -> look at `#help wp`
|
||||
|
||||
just look at `#help` lmao
|
||||
|
||||
Watch this [showcase video](https://youtu.be/CZkLXWo4Fg4)!
|
||||
|
||||
# Commands
|
||||
|
||||
[Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa)
|
||||
|
||||
**All** of these commands may need a prefix before them, as above ^.
|
||||
|
||||
`help`
|
||||
|
||||
To toggle a boolean setting, just say its name in chat (for example saying `allowBreak` toggles whether Baritone will consider breaking blocks). For a numeric setting, say its name then the new value (like `primaryTimeoutMS 250`). It's case insensitive. To reset a setting to its default value, say `acceptableThrowawayItems reset`. To reset all settings, say `reset`. To see all settings that have been modified from their default values, say `modified`.
|
||||
|
||||
Commands in Baritone:
|
||||
- `thisway 1000` then `path` to go in the direction you're facing for a thousand blocks
|
||||
- `goal x y z` or `goal x z` or `goal y`, then `path` to set a goal to a certain coordinate then path to it
|
||||
- `goto x y z` or `goto x z` or `goto y` to go to a certain coordinate (in a single step, starts going immediately)
|
||||
- `goal` to set the goal to your player's feet
|
||||
- `goal clear` to clear the goal
|
||||
- `cancel` or `stop` to stop everything, `forcecancel` is also an option
|
||||
- `goto portal` or `goto ender_chest` or `goto block_type` to go to a block. (in Impact, `.goto` is an alias for `.b goto` for the most part)
|
||||
- `mine diamond_ore iron_ore` to mine diamond ore or iron ore (turn on the setting `legitMine` to only mine ores that it can actually see. It will explore randomly around y=11 until it finds them.) An amount of blocks can also be specified, for example, `mine 64 diamond_ore`.
|
||||
- `click` to click your destination on the screen. Right click path to on top of the block, left click to path into it (either at foot level or eye level), and left click and drag to select an area (`#help sel` to see what you can do with that selection).
|
||||
- `follow player playerName` to follow a player. `follow players` to follow any players in range (combine with Kill Aura for a fun time). `follow entities` to follow any entities. `follow entity pig` to follow entities of a specific type.
|
||||
- `wp` for waypoints. A "tag" is like "home" (created automatically on right clicking a bed) or "death" (created automatically on death) or "user" (has to be created manually). So you might want `#wp save user coolbiome`, then to set the goal `#wp goal coolbiome` then `#path` to path to it. For death, `#wp goal death` will list waypoints under the "death" tag (remember stuff is clickable!)
|
||||
- `build` to build a schematic. `build blah.schematic` will load `schematics/blah.schematic` and build it with the origin being your player feet. `build blah.schematic x y z` to set the origin. Any of those can be relative to your player (`~ 69 ~-420` would build at x=player x, y=69, z=player z-420).
|
||||
- `schematica` to build the schematic that is currently open in schematica
|
||||
- `tunnel` to dig and make a tunnel, 1x2. It will only deviate from the straight line if necessary such as to avoid lava. For a dumber tunnel that is really just cleararea, you can `tunnel 3 2 100`, to clear an area 3 high, 2 wide, and 100 deep.
|
||||
- `farm` to automatically harvest, replant, or bone meal crops. Use `farm <range>` or `farm <range> <waypoint>` to limit the max distance from the starting point or a waypoint.
|
||||
- `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120).
|
||||
- `explore x z` to explore the world from the origin of x,z. Leave out x and z to default to player feet. This will continually path towards the closest chunk to the origin that it's never seen before. `explorefilter filter.json` with optional invert can be used to load in a list of chunks to load.
|
||||
- `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start.
|
||||
- `come` tells Baritone to head towards your camera, useful when freecam doesn't move your player position.
|
||||
- `blacklist` will stop baritone from going to the closest block so it won't attempt to get to it.
|
||||
- `eta` to get information about the estimated time until the next segment and the goal, be aware that the ETA to your goal is really unprecise.
|
||||
- `proc` to view miscellaneous information about the process currently controlling Baritone.
|
||||
- `repack` to re-cache the chunks around you.
|
||||
- `gc` to call `System.gc()` which may free up some memory.
|
||||
- `render` to fix glitched chunk rendering without having to reload all of them.
|
||||
- `reloadall` to reload Baritone's world cache or `saveall` to save Baritone's world cache.
|
||||
- `find` to search through Baritone's cache and attempt to find the location of the block.
|
||||
- `surface` or `top` to tell Baritone to head towards the closest surface-like area, this can be the surface or highest available air space.
|
||||
- `version` to get the version of Baritone you're running
|
||||
- `damn` daniel
|
||||
|
||||
All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>. If you find HTML easier to read than Javadoc, you can look <a href="https://baritone.leijurv.com/baritone/api/Settings.html#field.detail">here</a>.
|
||||
|
||||
There are about a hundred settings, but here are some fun / interesting / important ones that you might want to look at changing in normal usage of Baritone. The documentation for each can be found at the above links.
|
||||
- `allowBreak`
|
||||
- `allowSprint`
|
||||
- `allowPlace`
|
||||
- `allowParkour`
|
||||
- `allowParkourPlace`
|
||||
- `blockPlacementPenalty`
|
||||
- `renderCachedChunks` (and `cachedChunksOpacity`) <-- very fun but you need a beefy computer
|
||||
- `avoidance` (avoidance of mobs / mob spawners)
|
||||
- `legitMine`
|
||||
- `followRadius`
|
||||
- `backfill` (fill in tunnels behind you)
|
||||
- `buildInLayers`
|
||||
- `buildRepeatDistance` and `buildRepeatDirection`
|
||||
- `worldExploringChunkOffset`
|
||||
- `acceptableThrowawayItems`
|
||||
- `blocksToAvoidBreaking`
|
||||
- `mineScanDroppedItems`
|
||||
- `allowDiagonalAscend`
|
||||
|
||||
|
||||
|
||||
|
||||
# Troubleshooting / common issues
|
||||
|
||||
## Why doesn't Baritone respond to any of my chat commands?
|
||||
This could be one of many things.
|
||||
|
||||
First, make sure it's actually installed. An easy way to check is seeing if it created the folder `baritone` in your Minecraft folder.
|
||||
|
||||
Second, make sure that you're using the prefix properly, and that chat control is enabled in the way you expect.
|
||||
|
||||
For example, Impact disables direct chat control. (i.e. anything typed in chat without a prefix will be ignored and sent publicly). **This is a saved setting**, so if you run Impact once, `chatControl` will be off from then on, **even in other clients**.
|
||||
So you'll need to use the `#` prefix or edit `baritone/settings.txt` in your Minecraft folder to undo that (specifically, remove the line `chatControl false` then restart your client).
|
||||
|
||||
|
||||
## Why can I do `.goto x z` in Impact but nowhere else? Why can I do `-path to x z` in KAMI but nowhere else?
|
||||
These are custom commands that they added; those aren't from Baritone.
|
||||
The equivalent you're looking for is `goto x z`.
|
||||
284
build.gradle
284
build.gradle
@@ -1,115 +1,169 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
group 'baritone'
|
||||
version '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'forge'
|
||||
url = 'http://files.minecraftforge.net/maven'
|
||||
}
|
||||
maven {
|
||||
name = 'SpongePowered'
|
||||
url = 'http://repo.spongepowered.org/maven'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import baritone.gradle.task.CreateDistTask
|
||||
import baritone.gradle.task.ProguardTask
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
launch {
|
||||
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = '1.12.2'
|
||||
mappings = 'snapshot_20180731'
|
||||
tweakClass = 'baritone.launch.BaritoneTweaker'
|
||||
runDir = 'run'
|
||||
|
||||
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
|
||||
makeObfSourceJar = true
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name = 'spongepowered-repo'
|
||||
url = 'http://repo.spongepowered.org/maven/'
|
||||
}
|
||||
|
||||
maven {
|
||||
name = 'impactdevelopment-repo'
|
||||
url = 'https://impactdevelopment.github.io/maven/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
runtime launchCompile('com.github.ImpactDevelopment:SimpleTweaker:1.2')
|
||||
runtime launchCompile('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
|
||||
// Mixin includes a lot of dependencies that are too up-to-date
|
||||
exclude module: 'launchwrapper'
|
||||
exclude module: 'guava'
|
||||
exclude module: 'gson'
|
||||
exclude module: 'commons-io'
|
||||
exclude module: 'log4j-core'
|
||||
}
|
||||
testImplementation 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
mixin {
|
||||
defaultObfuscationEnv notch
|
||||
add sourceSets.launch, 'mixins.baritone.refmap.json'
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.launch.output, sourceSets.api.output
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
task proguard(type: ProguardTask) {
|
||||
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
|
||||
extract 'proguard6.0.3/lib/proguard.jar'
|
||||
versionManifest 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
|
||||
}
|
||||
|
||||
task createDist(type: CreateDistTask, dependsOn: proguard)
|
||||
|
||||
build.finalizedBy(createDist)
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
group 'baritone'
|
||||
version '1.2.17'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'forge'
|
||||
url = 'http://files.minecraftforge.net/maven'
|
||||
}
|
||||
maven {
|
||||
name = 'SpongePowered'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public/'
|
||||
}
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import baritone.gradle.task.CreateDistTask
|
||||
import baritone.gradle.task.ProguardTask
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
options.encoding = "UTF-8" // allow emoji in comments :^)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
launch {
|
||||
compileClasspath += main.compileClasspath + main.runtimeClasspath + main.output
|
||||
}
|
||||
|
||||
schematica_api {
|
||||
compileClasspath += main.compileClasspath
|
||||
}
|
||||
|
||||
main {
|
||||
compileClasspath += schematica_api.output
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = '1.12.2'
|
||||
mappings = 'stable_39'
|
||||
tweakClass = 'baritone.launch.BaritoneTweaker'
|
||||
runDir = 'run'
|
||||
|
||||
// The sources jar should use SRG names not MCP to ensure compatibility with all mappings
|
||||
makeObfSourceJar = true
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
name = 'spongepowered-repo'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public/'
|
||||
}
|
||||
|
||||
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'
|
||||
exclude module: 'guava'
|
||||
exclude module: 'gson'
|
||||
exclude module: 'commons-io'
|
||||
exclude module: 'log4j-core'
|
||||
}
|
||||
testImplementation 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
mixin {
|
||||
defaultObfuscationEnv searge
|
||||
add sourceSets.launch, 'mixins.baritone.refmap.json'
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error
|
||||
options.linkSource true
|
||||
options.encoding "UTF-8" // allow emoji in comments :^)
|
||||
source = sourceSets.api.allJava
|
||||
classpath += sourceSets.api.compileClasspath
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.launch.output, sourceSets.api.output
|
||||
|
||||
if (!getProject().hasProperty("baritone.forge_build")) {
|
||||
exclude "**/BaritoneForgeModXD.class"
|
||||
exclude "**/mods.toml"
|
||||
}
|
||||
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
|
||||
manifest {
|
||||
attributes(
|
||||
'MixinConfigs': 'mixins.baritone.json',
|
||||
|
||||
'Implementation-Title': 'Baritone',
|
||||
'Implementation-Version': version
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
task proguard(type: ProguardTask) {
|
||||
url 'https://downloads.sourceforge.net/project/proguard/proguard/6.0/proguard6.0.3.zip'
|
||||
extract 'proguard6.0.3/lib/proguard.jar'
|
||||
}
|
||||
|
||||
task createDist(type: CreateDistTask, dependsOn: proguard)
|
||||
|
||||
build.finalizedBy(createDist)
|
||||
|
||||
install {
|
||||
def jarApiName = String.format("%s-api-%s", rootProject.name, version.toString())
|
||||
def jarApiForgeName = String.format("%s-api-forge-%s", rootProject.name, version.toString())
|
||||
def jarSAName = String.format("%s-standalone-%s", rootProject.name, version.toString())
|
||||
def jarSAForgeName = String.format("%s-standalone-forge-%s", rootProject.name, version.toString())
|
||||
|
||||
artifacts {
|
||||
archives file("$buildDir/libs/"+jarApiName+".jar")
|
||||
archives file("$buildDir/libs/"+jarApiForgeName+".jar")
|
||||
archives file("$buildDir/libs/"+jarSAName+".jar")
|
||||
archives file("$buildDir/libs/"+jarSAForgeName+".jar")
|
||||
}
|
||||
repositories.mavenInstaller {
|
||||
addFilter('api') { artifact, file -> artifact.name == "baritone-api" }
|
||||
addFilter('api-forge') { artifact, file -> artifact.name == "baritone-api-forge" }
|
||||
addFilter('standalone') { artifact, file -> artifact.name == "baritone-standalone" }
|
||||
addFilter('standalone-forge') { artifact, file -> artifact.name == "baritone-standalone-forge" }
|
||||
}
|
||||
}
|
||||
|
||||
install.dependsOn(build)
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
package baritone.gradle.task;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import org.gradle.api.DefaultTask;
|
||||
|
||||
import java.io.File;
|
||||
@@ -26,7 +24,6 @@ import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
@@ -34,9 +31,7 @@ import java.util.List;
|
||||
*/
|
||||
class BaritoneGradleTask extends DefaultTask {
|
||||
|
||||
static final JsonParser PARSER = new JsonParser();
|
||||
|
||||
static final String
|
||||
protected static final String
|
||||
PROGUARD_ZIP = "proguard.zip",
|
||||
PROGUARD_JAR = "proguard.jar",
|
||||
PROGUARD_CONFIG_TEMPLATE = "scripts/proguard.pro",
|
||||
@@ -45,58 +40,56 @@ class BaritoneGradleTask extends DefaultTask {
|
||||
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_STANDARD = "%s-%s.jar",
|
||||
ARTIFACT_UNOPTIMIZED = "%s-unoptimized-%s.jar",
|
||||
ARTIFACT_API = "%s-api-%s.jar",
|
||||
ARTIFACT_STANDALONE = "%s-standalone-%s.jar",
|
||||
ARTIFACT_FORGE_API = "%s-api-forge-%s.jar",
|
||||
ARTIFACT_FORGE_STANDALONE = "%s-standalone-forge-%s.jar";
|
||||
|
||||
String artifactName, artifactVersion;
|
||||
Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, proguardOut;
|
||||
protected String artifactName, artifactVersion;
|
||||
protected Path artifactPath, artifactUnoptimizedPath, artifactApiPath, artifactStandalonePath, artifactForgeApiPath, artifactForgeStandalonePath, proguardOut;
|
||||
|
||||
void verifyArtifacts() throws Exception {
|
||||
protected void verifyArtifacts() throws IllegalStateException {
|
||||
this.artifactName = getProject().getName();
|
||||
this.artifactVersion = getProject().getVersion().toString();
|
||||
|
||||
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
||||
this.artifactPath = this.getBuildFile(formatVersion(ARTIFACT_STANDARD));
|
||||
this.artifactUnoptimizedPath = this.getBuildFile(formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
this.artifactApiPath = this.getBuildFile(formatVersion(ARTIFACT_API));
|
||||
this.artifactStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_STANDALONE));
|
||||
this.artifactForgeApiPath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_API));
|
||||
this.artifactForgeStandalonePath = this.getBuildFile(formatVersion(ARTIFACT_FORGE_STANDALONE));
|
||||
|
||||
this.proguardOut = this.getTemporaryFile(PROGUARD_EXPORT_PATH);
|
||||
|
||||
if (!Files.exists(this.artifactPath)) {
|
||||
throw new Exception("Artifact not found! Run build first!");
|
||||
throw new IllegalStateException("Artifact not found! Run build first!");
|
||||
}
|
||||
}
|
||||
|
||||
void write(InputStream stream, Path file) throws Exception {
|
||||
protected void write(InputStream stream, Path file) throws Exception {
|
||||
if (Files.exists(file)) {
|
||||
Files.delete(file);
|
||||
}
|
||||
Files.copy(stream, file);
|
||||
}
|
||||
|
||||
String formatVersion(String string) {
|
||||
protected String formatVersion(String string) {
|
||||
return String.format(string, this.artifactName, this.artifactVersion);
|
||||
}
|
||||
|
||||
Path getRelativeFile(String file) {
|
||||
protected Path getRelativeFile(String file) {
|
||||
return Paths.get(new File(file).getAbsolutePath());
|
||||
}
|
||||
|
||||
Path getTemporaryFile(String file) {
|
||||
protected Path getTemporaryFile(String file) {
|
||||
return Paths.get(new File(getTemporaryDir(), file).getAbsolutePath());
|
||||
}
|
||||
|
||||
Path getBuildFile(String file) {
|
||||
protected Path getBuildFile(String file) {
|
||||
return getRelativeFile("build/libs/" + file);
|
||||
}
|
||||
|
||||
JsonElement readJson(List<String> lines) {
|
||||
return PARSER.parse(String.join("\n", lines));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,11 @@ public class CreateDistTask extends BaritoneGradleTask {
|
||||
super.verifyArtifacts();
|
||||
|
||||
// Define the distribution file paths
|
||||
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
|
||||
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
|
||||
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
Path api = getRelativeFile("dist/" + formatVersion(ARTIFACT_API));
|
||||
Path standalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_STANDALONE));
|
||||
Path unoptimized = getRelativeFile("dist/" + formatVersion(ARTIFACT_UNOPTIMIZED));
|
||||
Path forgeApi = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_API));
|
||||
Path forgeStandalone = getRelativeFile("dist/" + formatVersion(ARTIFACT_FORGE_STANDALONE));
|
||||
|
||||
// NIO will not automatically create directories
|
||||
Path dir = getRelativeFile("dist/");
|
||||
@@ -53,15 +55,19 @@ public class CreateDistTask extends BaritoneGradleTask {
|
||||
}
|
||||
|
||||
// Copy build jars to dist/
|
||||
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactApiPath, api, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactStandalonePath, standalone, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactUnoptimizedPath, unoptimized, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactForgeApiPath, forgeApi, REPLACE_EXISTING);
|
||||
Files.copy(this.artifactForgeStandalonePath, forgeStandalone, REPLACE_EXISTING);
|
||||
|
||||
// Calculate all checksums and format them like "shasum"
|
||||
List<String> shasum = Stream.of(api, standalone, unoptimized)
|
||||
List<String> shasum = Stream.of(api, forgeApi, standalone, forgeStandalone, unoptimized)
|
||||
.map(path -> sha1(path) + " " + path.getFileName().toString())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
shasum.forEach(System.out::println);
|
||||
|
||||
// Write the checksums to a file
|
||||
Files.write(getRelativeFile("dist/checksums.txt"), shasum);
|
||||
}
|
||||
@@ -74,7 +80,7 @@ public class CreateDistTask extends BaritoneGradleTask {
|
||||
return DatatypeConverter.printHexBinary(SHA1_DIGEST.digest(Files.readAllBytes(path))).toLowerCase();
|
||||
} catch (Exception e) {
|
||||
// haha no thanks
|
||||
throw new RuntimeException(e);
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +18,34 @@
|
||||
package baritone.gradle.task;
|
||||
|
||||
import baritone.gradle.util.Determinizer;
|
||||
import com.google.gson.*;
|
||||
import baritone.gradle.util.MappingType;
|
||||
import baritone.gradle.util.ReobfWrapper;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.gradle.api.JavaVersion;
|
||||
import org.gradle.api.NamedDomainObjectContainer;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.internal.file.IdentityFileResolver;
|
||||
import org.gradle.api.internal.plugins.DefaultConvention;
|
||||
import org.gradle.api.tasks.Input;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.api.tasks.TaskCollection;
|
||||
import org.gradle.api.tasks.compile.ForkOptions;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.internal.Pair;
|
||||
import org.gradle.internal.jvm.Jvm;
|
||||
import org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector;
|
||||
import org.gradle.process.internal.DefaultExecActionFactory;
|
||||
|
||||
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;
|
||||
|
||||
@@ -52,12 +65,10 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
@Input
|
||||
private String extract;
|
||||
|
||||
@Input
|
||||
private String versionManifest;
|
||||
|
||||
private Map<String, String> versionDownloadMap;
|
||||
private List<String> requiredLibraries;
|
||||
|
||||
private File mixin;
|
||||
|
||||
@TaskAction
|
||||
protected void exec() throws Exception {
|
||||
super.verifyArtifacts();
|
||||
@@ -67,7 +78,6 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
downloadProguard();
|
||||
extractProguard();
|
||||
generateConfigs();
|
||||
downloadVersionManifest();
|
||||
acquireDependencies();
|
||||
proguardApi();
|
||||
proguardStandalone();
|
||||
@@ -79,7 +89,7 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
Files.delete(this.artifactUnoptimizedPath);
|
||||
}
|
||||
|
||||
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString());
|
||||
Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), Optional.empty());
|
||||
}
|
||||
|
||||
private void downloadProguard() throws Exception {
|
||||
@@ -99,16 +109,111 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
}
|
||||
}
|
||||
|
||||
private String getJavaBinPathForProguard() throws Exception {
|
||||
String path;
|
||||
try {
|
||||
path = findJavaPathByGradleConfig();
|
||||
if (path != null) return path;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
System.err.println("Unable to find java by javaCompile options");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
path = findJavaByJavaHome();
|
||||
if (path != null) return path;
|
||||
}
|
||||
catch(Exception ex) {
|
||||
System.err.println("Unable to find java by JAVA_HOME");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
path = findJavaByGradleCurrentRuntime();
|
||||
if (path != null) return path;
|
||||
|
||||
throw new Exception("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," +
|
||||
" JAVA_HOME environment variable, or make sure to run Gradle with the correct JDK (a v1.8 only)");
|
||||
}
|
||||
|
||||
private String findJavaByGradleCurrentRuntime() {
|
||||
String path = Jvm.current().getJavaExecutable().getAbsolutePath();
|
||||
|
||||
if (this.validateJavaVersion(path)) {
|
||||
System.out.println("Using Gradle's runtime Java for ProGuard");
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String findJavaByJavaHome() {
|
||||
final String javaHomeEnv = System.getenv("JAVA_HOME");
|
||||
if (javaHomeEnv != null) {
|
||||
|
||||
String path = Jvm.forHome(new File(javaHomeEnv)).getJavaExecutable().getAbsolutePath();
|
||||
if (this.validateJavaVersion(path)) {
|
||||
System.out.println("Detected Java path by JAVA_HOME");
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String findJavaPathByGradleConfig() {
|
||||
final TaskCollection<JavaCompile> javaCompiles = super.getProject().getTasks().withType(JavaCompile.class);
|
||||
|
||||
final JavaCompile compileTask = javaCompiles.iterator().next();
|
||||
final ForkOptions forkOptions = compileTask.getOptions().getForkOptions();
|
||||
|
||||
if (forkOptions != null) {
|
||||
String javacPath = forkOptions.getExecutable();
|
||||
if (javacPath != null) {
|
||||
File javacFile = new File(javacPath);
|
||||
if (javacFile.exists()) {
|
||||
File[] maybeJava = javacFile.getParentFile().listFiles(new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.equals("java");
|
||||
}
|
||||
});
|
||||
|
||||
if (maybeJava != null && maybeJava.length > 0) {
|
||||
String path = maybeJava[0].getAbsolutePath();
|
||||
if (this.validateJavaVersion(path)) {
|
||||
System.out.println("Detected Java path by forkOptions");
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean validateJavaVersion(String java) {
|
||||
final JavaVersion javaVersion = new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())).getJavaVersion(java);
|
||||
|
||||
if (!javaVersion.getMajorVersion().equals("8")) {
|
||||
System.out.println("Failed to validate Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
|
||||
// throw new RuntimeException("Java version incorrect: " + javaVersion.getMajorVersion() + " for " + java);
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.println("Validated Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars");
|
||||
return true;
|
||||
}
|
||||
|
||||
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));
|
||||
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();
|
||||
Process p = new ProcessBuilder(this.getJavaBinPathForProguard(), "-verbose").start();
|
||||
String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", "");
|
||||
template.add(2, "-libraryjars '" + out + "'");
|
||||
|
||||
@@ -132,20 +237,6 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
});
|
||||
}
|
||||
|
||||
private void downloadVersionManifest() throws Exception {
|
||||
Path manifestJson = getTemporaryFile(VERSION_MANIFEST);
|
||||
write(new URL(this.versionManifest).openStream(), manifestJson);
|
||||
|
||||
// Place all the versions in the map with their download URL
|
||||
this.versionDownloadMap = new HashMap<>();
|
||||
JsonObject json = readJson(Files.readAllLines(manifestJson)).getAsJsonObject();
|
||||
JsonArray versions = json.getAsJsonArray("versions");
|
||||
versions.forEach(element -> {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
this.versionDownloadMap.put(object.get("id").getAsString(), object.get("url").getAsString());
|
||||
});
|
||||
}
|
||||
|
||||
private void acquireDependencies() throws Exception {
|
||||
|
||||
// Create a map of all of the dependencies that we are able to access in this project
|
||||
@@ -163,15 +254,13 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
|
||||
// Iterate the required libraries to copy them to tempLibraries
|
||||
for (String lib : this.requiredLibraries) {
|
||||
// Download the version jar from the URL acquired from the version manifest
|
||||
if (lib.startsWith("minecraft")) {
|
||||
String version = lib.split("-")[1];
|
||||
Path versionJar = getTemporaryFile("tempLibraries/" + lib + ".jar");
|
||||
if (!Files.exists(versionJar)) {
|
||||
JsonObject versionJson = PARSER.parse(new InputStreamReader(new URL(this.versionDownloadMap.get(version)).openStream())).getAsJsonObject();
|
||||
String url = versionJson.getAsJsonObject("downloads").getAsJsonObject("client").getAsJsonPrimitive("url").getAsString();
|
||||
write(new URL(url).openStream(), versionJar);
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -189,20 +278,111 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
// 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());
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Optional.empty());
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeApiPath.toString(), Optional.of(mixin));
|
||||
}
|
||||
|
||||
private void proguardStandalone() throws Exception {
|
||||
runProguard(getTemporaryFile(PROGUARD_STANDALONE_CONFIG));
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString());
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Optional.empty());
|
||||
Determinizer.determinize(this.proguardOut.toString(), this.artifactForgeStandalonePath.toString(), Optional.of(mixin));
|
||||
}
|
||||
|
||||
private void cleanup() {
|
||||
@@ -219,40 +399,42 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
this.extract = extract;
|
||||
}
|
||||
|
||||
public void setVersionManifest(String versionManifest) {
|
||||
this.versionManifest = versionManifest;
|
||||
}
|
||||
|
||||
private void runProguard(Path config) throws Exception {
|
||||
// Delete the existing proguard output file. Proguard probably handles this already, but why not do it ourselves
|
||||
if (Files.exists(this.proguardOut)) {
|
||||
Files.delete(this.proguardOut);
|
||||
}
|
||||
|
||||
Path proguardJar = getTemporaryFile(PROGUARD_JAR);
|
||||
// Make paths relative to work directory; fixes spaces in path to config, @"" doesn't work
|
||||
Path workingDirectory = getTemporaryFile("");
|
||||
Path proguardJar = workingDirectory.relativize(getTemporaryFile(PROGUARD_JAR));
|
||||
config = workingDirectory.relativize(config);
|
||||
|
||||
// Honestly, if you still have spaces in your path at this point, you're SOL.
|
||||
|
||||
Process p = new ProcessBuilder("java", "-jar", proguardJar.toString(), "@" + config.toString())
|
||||
.directory(getTemporaryFile("").toFile()) // Set the working directory to the temporary folder]
|
||||
.directory(workingDirectory.toFile()) // Set the working directory to the temporary folder]
|
||||
.start();
|
||||
|
||||
// We can't do output inherit process I/O with gradle for some reason and have it work, so we have to do this
|
||||
this.printOutputLog(p.getInputStream());
|
||||
this.printOutputLog(p.getErrorStream());
|
||||
this.printOutputLog(p.getInputStream(), System.out);
|
||||
this.printOutputLog(p.getErrorStream(), System.err);
|
||||
|
||||
// Halt the current thread until the process is complete, if the exit code isn't 0, throw an exception
|
||||
int exitCode = p.waitFor();
|
||||
if (exitCode != 0) {
|
||||
throw new Exception("Proguard exited with code " + exitCode);
|
||||
throw new IllegalStateException("Proguard exited with code " + exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
private void printOutputLog(InputStream stream) {
|
||||
private void printOutputLog(InputStream stream, PrintStream outerr) {
|
||||
new Thread(() -> {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
outerr.println(line);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
||||
@@ -22,24 +22,21 @@ import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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 0.
|
||||
* Make a .jar file deterministic by sorting all entries by name, and setting all the last modified times to 42069.
|
||||
* This makes the build 100% reproducible since the timestamp when you built it no longer affects the final file.
|
||||
*
|
||||
* @author leijurv
|
||||
*/
|
||||
public class Determinizer {
|
||||
|
||||
public static void determinize(String inputPath, String outputPath) throws IOException {
|
||||
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);
|
||||
@@ -66,10 +63,30 @@ public class Determinizer {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
29
buildSrc/src/main/java/baritone/gradle/util/MappingType.java
Normal file
29
buildSrc/src/main/java/baritone/gradle/util/MappingType.java
Normal 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
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
gradle/wrapper/gradle-wrapper.properties
vendored
12
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Tue Jul 31 21:56:56 PDT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
||||
#Tue Jul 31 21:56:56 PDT 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
||||
|
||||
168
gradlew.bat
vendored
168
gradlew.bat
vendored
@@ -1,84 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
||||
78
scripts/proguard.pro
vendored
78
scripts/proguard.pro
vendored
@@ -1,5 +1,6 @@
|
||||
-keepattributes Signature
|
||||
-keepattributes *Annotation*
|
||||
-keepattributes InnerClasses
|
||||
|
||||
-optimizationpasses 5
|
||||
-verbose
|
||||
@@ -12,10 +13,25 @@
|
||||
-flattenpackagehierarchy
|
||||
-repackageclasses 'baritone'
|
||||
|
||||
# lwjgl is weird
|
||||
-dontwarn org.lwjgl.**
|
||||
|
||||
-keep class baritone.api.** { *; } # this is the keep api
|
||||
|
||||
# service provider needs these class names
|
||||
-keep class baritone.BaritoneProvider
|
||||
-keep class baritone.api.IBaritoneProvider
|
||||
|
||||
-keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect
|
||||
-keepname class baritone.api.utils.BlockOptionalMeta # this name is exposed to the user, so we need to keep it in all builds
|
||||
|
||||
# Keep any class or member annotated with @KeepName so we dont have to put everything in the script
|
||||
-keep,allowobfuscation @interface baritone.KeepName
|
||||
-keep @baritone.KeepName class *
|
||||
-keepclassmembers class * {
|
||||
@baritone.KeepName *;
|
||||
}
|
||||
|
||||
# setting names are reflected from field names, so keep field names
|
||||
-keepclassmembers class baritone.api.Settings {
|
||||
public <fields>;
|
||||
@@ -24,9 +40,17 @@
|
||||
# need to keep mixin names
|
||||
-keep class baritone.launch.** { *; }
|
||||
|
||||
#try to keep usage of schematica in separate classes
|
||||
-keep class baritone.utils.schematic.schematica.**
|
||||
-keep class baritone.utils.schematic.litematica.**
|
||||
#proguard doesnt like it when it cant find our fake schematica classes
|
||||
-dontwarn baritone.utils.schematic.schematica.**
|
||||
-dontwarn baritone.utils.schematic.litematica.**
|
||||
|
||||
# copy all necessary libraries into tempLibraries to build
|
||||
|
||||
-libraryjars 'tempLibraries/minecraft-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'
|
||||
|
||||
@@ -61,7 +85,7 @@
|
||||
|
||||
-libraryjars 'tempLibraries/netty-all-4.1.9.Final.jar'
|
||||
-libraryjars 'tempLibraries/oshi-core-1.1.jar'
|
||||
-libraryjars 'tempLibraries/patchy-1.1.jar'
|
||||
-libraryjars 'tempLibraries/patchy-1.3.9.jar'
|
||||
-libraryjars 'tempLibraries/platform-3.4.0.jar'
|
||||
-libraryjars 'tempLibraries/realms-1.10.22.jar'
|
||||
-libraryjars 'tempLibraries/soundsystem-20120107.jar'
|
||||
@@ -168,19 +192,19 @@
|
||||
-assumenosideeffects public class java.lang.* extends java.lang.Number {
|
||||
public static java.lang.String toString(byte);
|
||||
public static java.lang.Byte valueOf(byte);
|
||||
public static byte parseByte(java.lang.String);
|
||||
public static byte parseByte(java.lang.String,int);
|
||||
public static java.lang.Byte valueOf(java.lang.String,int);
|
||||
public static java.lang.Byte valueOf(java.lang.String);
|
||||
public static java.lang.Byte decode(java.lang.String);
|
||||
# public static byte parseByte(java.lang.String);
|
||||
# public static byte parseByte(java.lang.String,int);
|
||||
# public static java.lang.Byte valueOf(java.lang.String,int);
|
||||
# public static java.lang.Byte valueOf(java.lang.String);
|
||||
# public static java.lang.Byte decode(java.lang.String);
|
||||
public int compareTo(java.lang.Byte);
|
||||
public static java.lang.String toString(short);
|
||||
public static short parseShort(java.lang.String);
|
||||
public static short parseShort(java.lang.String,int);
|
||||
public static java.lang.Short valueOf(java.lang.String,int);
|
||||
public static java.lang.Short valueOf(java.lang.String);
|
||||
# public static short parseShort(java.lang.String);
|
||||
# public static short parseShort(java.lang.String,int);
|
||||
# public static java.lang.Short valueOf(java.lang.String,int);
|
||||
# public static java.lang.Short valueOf(java.lang.String);
|
||||
public static java.lang.Short valueOf(short);
|
||||
public static java.lang.Short decode(java.lang.String);
|
||||
# public static java.lang.Short decode(java.lang.String);
|
||||
public static short reverseBytes(short);
|
||||
public int compareTo(java.lang.Short);
|
||||
public static java.lang.String toString(int,int);
|
||||
@@ -188,10 +212,10 @@
|
||||
public static java.lang.String toOctalString(int);
|
||||
public static java.lang.String toBinaryString(int);
|
||||
public static java.lang.String toString(int);
|
||||
public static int parseInt(java.lang.String,int);
|
||||
public static int parseInt(java.lang.String);
|
||||
public static java.lang.Integer valueOf(java.lang.String,int);
|
||||
public static java.lang.Integer valueOf(java.lang.String);
|
||||
# public static int parseInt(java.lang.String,int);
|
||||
# public static int parseInt(java.lang.String);
|
||||
# public static java.lang.Integer valueOf(java.lang.String,int);
|
||||
# public static java.lang.Integer valueOf(java.lang.String);
|
||||
public static java.lang.Integer valueOf(int);
|
||||
public static java.lang.Integer getInteger(java.lang.String);
|
||||
public static java.lang.Integer getInteger(java.lang.String,int);
|
||||
@@ -213,12 +237,12 @@
|
||||
public static java.lang.String toOctalString(long);
|
||||
public static java.lang.String toBinaryString(long);
|
||||
public static java.lang.String toString(long);
|
||||
public static long parseLong(java.lang.String,int);
|
||||
public static long parseLong(java.lang.String);
|
||||
public static java.lang.Long valueOf(java.lang.String,int);
|
||||
public static java.lang.Long valueOf(java.lang.String);
|
||||
# public static long parseLong(java.lang.String,int);
|
||||
# public static long parseLong(java.lang.String);
|
||||
# public static java.lang.Long valueOf(java.lang.String,int);
|
||||
# public static java.lang.Long valueOf(java.lang.String);
|
||||
public static java.lang.Long valueOf(long);
|
||||
public static java.lang.Long decode(java.lang.String);
|
||||
# public static java.lang.Long decode(java.lang.String);
|
||||
public static java.lang.Long getLong(java.lang.String);
|
||||
public static java.lang.Long getLong(java.lang.String,long);
|
||||
public static java.lang.Long getLong(java.lang.String,java.lang.Long);
|
||||
@@ -235,9 +259,9 @@
|
||||
public int compareTo(java.lang.Long);
|
||||
public static java.lang.String toString(float);
|
||||
public static java.lang.String toHexString(float);
|
||||
public static java.lang.Float valueOf(java.lang.String);
|
||||
# public static java.lang.Float valueOf(java.lang.String);
|
||||
public static java.lang.Float valueOf(float);
|
||||
public static float parseFloat(java.lang.String);
|
||||
# public static float parseFloat(java.lang.String);
|
||||
public static boolean isNaN(float);
|
||||
public static boolean isInfinite(float);
|
||||
public static int floatToIntBits(float);
|
||||
@@ -249,9 +273,9 @@
|
||||
public int compareTo(java.lang.Float);
|
||||
public static java.lang.String toString(double);
|
||||
public static java.lang.String toHexString(double);
|
||||
public static java.lang.Double valueOf(java.lang.String);
|
||||
public static java.lang.Double valueOf(double);
|
||||
public static double parseDouble(java.lang.String);
|
||||
# public static java.lang.Double valueOf(java.lang.String);
|
||||
# public static java.lang.Double valueOf(double);
|
||||
# public static double parseDouble(java.lang.String);
|
||||
public static boolean isNaN(double);
|
||||
public static boolean isInfinite(double);
|
||||
public static long doubleToLongBits(double);
|
||||
@@ -361,3 +385,5 @@
|
||||
public java.lang.String substring(int);
|
||||
public java.lang.String substring(int,int);
|
||||
}
|
||||
|
||||
-printmapping mapping.txt
|
||||
|
||||
Binary file not shown.
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
rootProject.name = 'baritone'
|
||||
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
rootProject.name = 'baritone'
|
||||
|
||||
|
||||
@@ -17,70 +17,36 @@
|
||||
|
||||
package baritone.api;
|
||||
|
||||
import baritone.api.behavior.*;
|
||||
import baritone.api.cache.IWorldProvider;
|
||||
import baritone.api.cache.IWorldScanner;
|
||||
import baritone.api.event.listener.IGameEventListener;
|
||||
import baritone.api.utils.SettingsUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* API exposure for various things implemented in Baritone.
|
||||
* <p>
|
||||
* W.I.P
|
||||
* Exposes the {@link IBaritoneProvider} instance and the {@link Settings} instance for API usage.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 9/23/2018
|
||||
*/
|
||||
public final class BaritoneAPI {
|
||||
|
||||
private static final IBaritoneProvider baritone;
|
||||
private static final IBaritoneProvider provider;
|
||||
private static final Settings settings;
|
||||
|
||||
static {
|
||||
settings = new Settings();
|
||||
SettingsUtil.readAndApply(settings, SettingsUtil.SETTINGS_DEFAULT_NAME);
|
||||
|
||||
ServiceLoader<IBaritoneProvider> baritoneLoader = ServiceLoader.load(IBaritoneProvider.class);
|
||||
Iterator<IBaritoneProvider> instances = baritoneLoader.iterator();
|
||||
baritone = instances.next();
|
||||
|
||||
settings = new Settings();
|
||||
SettingsUtil.readAndApply(settings);
|
||||
provider = instances.next();
|
||||
}
|
||||
|
||||
public static IFollowBehavior getFollowBehavior() {
|
||||
return baritone.getFollowBehavior();
|
||||
}
|
||||
|
||||
public static ILookBehavior getLookBehavior() {
|
||||
return baritone.getLookBehavior();
|
||||
}
|
||||
|
||||
public static IMemoryBehavior getMemoryBehavior() {
|
||||
return baritone.getMemoryBehavior();
|
||||
}
|
||||
|
||||
public static IMineBehavior getMineBehavior() {
|
||||
return baritone.getMineBehavior();
|
||||
}
|
||||
|
||||
public static IPathingBehavior getPathingBehavior() {
|
||||
return baritone.getPathingBehavior();
|
||||
public static IBaritoneProvider getProvider() {
|
||||
return BaritoneAPI.provider;
|
||||
}
|
||||
|
||||
public static Settings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
public static IWorldProvider getWorldProvider() {
|
||||
return baritone.getWorldProvider();
|
||||
}
|
||||
|
||||
public static IWorldScanner getWorldScanner() {
|
||||
return baritone.getWorldScanner();
|
||||
}
|
||||
|
||||
public static void registerEventListener(IGameEventListener listener) {
|
||||
baritone.registerEventListener(listener);
|
||||
return BaritoneAPI.settings;
|
||||
}
|
||||
}
|
||||
|
||||
140
src/api/java/baritone/api/IBaritone.java
Normal file
140
src/api/java/baritone/api/IBaritone.java
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* 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.command.manager.ICommandManager;
|
||||
import baritone.api.event.listener.IEventBus;
|
||||
import baritone.api.pathing.calc.IPathingControlManager;
|
||||
import baritone.api.process.*;
|
||||
import baritone.api.selection.ISelectionManager;
|
||||
import baritone.api.utils.IInputOverrideHandler;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/29/2018
|
||||
*/
|
||||
public interface IBaritone {
|
||||
|
||||
/**
|
||||
* @return The {@link IPathingBehavior} instance
|
||||
* @see IPathingBehavior
|
||||
*/
|
||||
IPathingBehavior getPathingBehavior();
|
||||
|
||||
/**
|
||||
* @return The {@link ILookBehavior} instance
|
||||
* @see ILookBehavior
|
||||
*/
|
||||
ILookBehavior getLookBehavior();
|
||||
|
||||
/**
|
||||
* @return The {@link IFollowProcess} instance
|
||||
* @see IFollowProcess
|
||||
*/
|
||||
IFollowProcess getFollowProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IMineProcess} instance
|
||||
* @see IMineProcess
|
||||
*/
|
||||
IMineProcess getMineProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IBuilderProcess} instance
|
||||
* @see IBuilderProcess
|
||||
*/
|
||||
IBuilderProcess getBuilderProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IExploreProcess} instance
|
||||
* @see IExploreProcess
|
||||
*/
|
||||
IExploreProcess getExploreProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IFarmProcess} instance
|
||||
* @see IFarmProcess
|
||||
*/
|
||||
IFarmProcess getFarmProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link ICustomGoalProcess} instance
|
||||
* @see ICustomGoalProcess
|
||||
*/
|
||||
ICustomGoalProcess getCustomGoalProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IGetToBlockProcess} instance
|
||||
* @see IGetToBlockProcess
|
||||
*/
|
||||
IGetToBlockProcess getGetToBlockProcess();
|
||||
|
||||
/**
|
||||
* @return The {@link IWorldProvider} instance
|
||||
* @see IWorldProvider
|
||||
*/
|
||||
IWorldProvider getWorldProvider();
|
||||
|
||||
/**
|
||||
* Returns the {@link IPathingControlManager} for this {@link IBaritone} instance, which is responsible
|
||||
* for managing the {@link IBaritoneProcess}es which control the {@link IPathingBehavior} state.
|
||||
*
|
||||
* @return The {@link IPathingControlManager} instance
|
||||
* @see IPathingControlManager
|
||||
*/
|
||||
IPathingControlManager getPathingControlManager();
|
||||
|
||||
/**
|
||||
* @return The {@link IInputOverrideHandler} instance
|
||||
* @see IInputOverrideHandler
|
||||
*/
|
||||
IInputOverrideHandler getInputOverrideHandler();
|
||||
|
||||
/**
|
||||
* @return The {@link IPlayerContext} instance
|
||||
* @see IPlayerContext
|
||||
*/
|
||||
IPlayerContext getPlayerContext();
|
||||
|
||||
/**
|
||||
* @return The {@link IEventBus} instance
|
||||
* @see IEventBus
|
||||
*/
|
||||
IEventBus getGameEventHandler();
|
||||
|
||||
/**
|
||||
* @return The {@link ISelectionManager} instance
|
||||
* @see ISelectionManager
|
||||
*/
|
||||
ISelectionManager getSelectionManager();
|
||||
|
||||
/**
|
||||
* @return The {@link ICommandManager} instance
|
||||
* @see ICommandManager
|
||||
*/
|
||||
ICommandManager getCommandManager();
|
||||
|
||||
/**
|
||||
* Open click
|
||||
*/
|
||||
void openClick();
|
||||
}
|
||||
@@ -17,70 +17,107 @@
|
||||
|
||||
package baritone.api;
|
||||
|
||||
import baritone.api.behavior.*;
|
||||
import baritone.api.cache.IWorldProvider;
|
||||
import baritone.api.cache.IWorldScanner;
|
||||
import baritone.api.event.listener.IGameEventListener;
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.ICommandSystem;
|
||||
import baritone.api.schematic.ISchematicSystem;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/29/2018
|
||||
* Provides the present {@link IBaritone} instances, as well as non-baritone instance related APIs.
|
||||
*
|
||||
* @author leijurv
|
||||
*/
|
||||
public interface IBaritoneProvider {
|
||||
|
||||
/**
|
||||
* @see IFollowBehavior
|
||||
* Returns the primary {@link IBaritone} instance. This instance is persistent, and
|
||||
* is represented by the local player that is created by the game itself, not a "bot"
|
||||
* player through Baritone.
|
||||
*
|
||||
* @return The {@link IFollowBehavior} instance
|
||||
* @return The primary {@link IBaritone} instance.
|
||||
*/
|
||||
IFollowBehavior getFollowBehavior();
|
||||
IBaritone getPrimaryBaritone();
|
||||
|
||||
/**
|
||||
* @see ILookBehavior
|
||||
* Returns all of the active {@link IBaritone} instances. This includes the local one
|
||||
* returned by {@link #getPrimaryBaritone()}.
|
||||
*
|
||||
* @return The {@link ILookBehavior} instance
|
||||
* @return All active {@link IBaritone} instances.
|
||||
* @see #getBaritoneForPlayer(EntityPlayerSP)
|
||||
*/
|
||||
ILookBehavior getLookBehavior();
|
||||
List<IBaritone> getAllBaritones();
|
||||
|
||||
/**
|
||||
* @see IMemoryBehavior
|
||||
* Provides the {@link IBaritone} instance for a given {@link EntityPlayerSP}.
|
||||
*
|
||||
* @return The {@link IMemoryBehavior} instance
|
||||
* @param player The player
|
||||
* @return The {@link IBaritone} instance.
|
||||
*/
|
||||
IMemoryBehavior getMemoryBehavior();
|
||||
default IBaritone getBaritoneForPlayer(EntityPlayerSP player) {
|
||||
for (IBaritone baritone : this.getAllBaritones()) {
|
||||
if (Objects.equals(player, baritone.getPlayerContext().player())) {
|
||||
return baritone;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IMineBehavior
|
||||
* Provides the {@link IBaritone} instance for a given {@link Minecraft}.
|
||||
*
|
||||
* @return The {@link IMineBehavior} instance
|
||||
* @param minecraft The minecraft
|
||||
* @return The {@link IBaritone} instance.
|
||||
*/
|
||||
IMineBehavior getMineBehavior();
|
||||
default IBaritone getBaritoneForMinecraft(Minecraft minecraft) {
|
||||
for (IBaritone baritone : this.getAllBaritones()) {
|
||||
if (Objects.equals(minecraft, baritone.getPlayerContext().minecraft())) {
|
||||
return baritone;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IPathingBehavior
|
||||
* Creates and registers a new {@link IBaritone} instance using the specified {@link Minecraft}. The existing
|
||||
* instance is returned if already registered.
|
||||
*
|
||||
* @return The {@link IPathingBehavior} instance
|
||||
* @param minecraft The minecraft
|
||||
* @return The {@link IBaritone} instance
|
||||
*/
|
||||
IPathingBehavior getPathingBehavior();
|
||||
IBaritone createBaritone(Minecraft minecraft);
|
||||
|
||||
/**
|
||||
* @see IWorldProvider
|
||||
* Destroys and removes the specified {@link IBaritone} instance. If the specified instance is the
|
||||
* {@link #getPrimaryBaritone() primary baritone}, this operation has no effect and will return {@code false}.
|
||||
*
|
||||
* @return The {@link IWorldProvider} instance
|
||||
* @param baritone The baritone instance to remove
|
||||
* @return Whether the baritone instance was removed
|
||||
*/
|
||||
IWorldProvider getWorldProvider();
|
||||
boolean destroyBaritone(IBaritone baritone);
|
||||
|
||||
/**
|
||||
* @see IWorldScanner
|
||||
* 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
|
||||
* @return The {@link IWorldScanner} instance.
|
||||
*/
|
||||
IWorldScanner getWorldScanner();
|
||||
|
||||
/**
|
||||
* Registers a {@link IGameEventListener} with Baritone's "event bus".
|
||||
* Returns the {@link ICommandSystem} instance. This is not bound to a specific {@link IBaritone}
|
||||
* instance because {@link ICommandSystem} itself controls global behavior for {@link ICommand}s.
|
||||
*
|
||||
* @param listener The listener
|
||||
* @return The {@link ICommandSystem} instance.
|
||||
*/
|
||||
void registerEventListener(IGameEventListener listener);
|
||||
ICommandSystem getCommandSystem();
|
||||
|
||||
/**
|
||||
* @return The {@link ISchematicSystem} instance.
|
||||
*/
|
||||
ISchematicSystem getSchematicSystem();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,10 +18,13 @@
|
||||
package baritone.api.behavior;
|
||||
|
||||
import baritone.api.event.listener.AbstractGameEventListener;
|
||||
import baritone.api.utils.interfaces.Toggleable;
|
||||
import baritone.api.event.listener.IGameEventListener;
|
||||
|
||||
/**
|
||||
* A behavior is simply a type that is able to listen to events.
|
||||
*
|
||||
* @author Brady
|
||||
* @see IGameEventListener
|
||||
* @since 9/23/2018
|
||||
*/
|
||||
public interface IBehavior extends AbstractGameEventListener, Toggleable {}
|
||||
public interface IBehavior extends AbstractGameEventListener {}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package baritone.api.behavior;
|
||||
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.behavior.look.IAimProcessor;
|
||||
import baritone.api.utils.Rotation;
|
||||
|
||||
/**
|
||||
@@ -26,14 +28,23 @@ import baritone.api.utils.Rotation;
|
||||
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};
|
||||
* Updates the current {@link ILookBehavior} target to target the specified rotations on the next tick. If any sort
|
||||
* of block interaction is required, {@code blockInteract} should be {@code true}. It is not guaranteed that the
|
||||
* rotations set by the caller will be the exact rotations expressed by the client (This is due to settings like
|
||||
* {@link Settings#randomLooking}). If the rotations produced by this behavior are required, then the
|
||||
* {@link #getAimProcessor() aim processor} should be used.
|
||||
*
|
||||
* @param rotation The target rotations
|
||||
* @param force Whether or not to "force" the rotations
|
||||
* @param rotation The target rotations
|
||||
* @param blockInteract Whether the target rotations are needed for a block interaction
|
||||
*/
|
||||
void updateTarget(Rotation rotation, boolean force);
|
||||
void updateTarget(Rotation rotation, boolean blockInteract);
|
||||
|
||||
/**
|
||||
* The aim processor instance for this {@link ILookBehavior}, which is responsible for applying additional,
|
||||
* deterministic transformations to the target rotation set by {@link #updateTarget}.
|
||||
*
|
||||
* @return The aim processor
|
||||
* @see IAimProcessor#fork
|
||||
*/
|
||||
IAimProcessor getAimProcessor();
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.behavior;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/23/2018
|
||||
*/
|
||||
public interface IMineBehavior extends IBehavior {
|
||||
|
||||
/**
|
||||
* 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, 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 mine(String... blocks) {
|
||||
this.mine(0, blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin to search for and mine the specified blocks.
|
||||
*
|
||||
* @param blocks The blocks to mine
|
||||
*/
|
||||
default void mine(Block... blocks) {
|
||||
this.mine(0, blocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the current mining task
|
||||
*/
|
||||
void cancel();
|
||||
}
|
||||
@@ -37,14 +37,35 @@ public interface IPathingBehavior extends IBehavior {
|
||||
*
|
||||
* @return The estimated remaining ticks in the current segment.
|
||||
*/
|
||||
Optional<Double> ticksRemainingInSegment();
|
||||
default Optional<Double> ticksRemainingInSegment() {
|
||||
return ticksRemainingInSegment(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pathing goal.
|
||||
* Returns the estimated remaining ticks in the current pathing
|
||||
* segment. Given that the return type is an optional, {@link Optional#empty()}
|
||||
* will be returned in the case that there is no current segment being pathed.
|
||||
*
|
||||
* @param goal The pathing goal
|
||||
* @param includeCurrentMovement whether or not to include the entirety of the cost of the currently executing movement in the total
|
||||
* @return The estimated remaining ticks in the current segment.
|
||||
*/
|
||||
void setGoal(Goal goal);
|
||||
default Optional<Double> ticksRemainingInSegment(boolean includeCurrentMovement) {
|
||||
IPathExecutor current = getCurrent();
|
||||
if (current == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
int start = includeCurrentMovement ? current.getPosition() : current.getPosition() + 1;
|
||||
return Optional.of(current.getPath().ticksRemainingFrom(start));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the estimated remaining ticks to the current goal.
|
||||
* Given that the return type is an optional, {@link Optional#empty()}
|
||||
* will be returned in the case that there is no current goal.
|
||||
*
|
||||
* @return The estimated remaining ticks to the current goal.
|
||||
*/
|
||||
Optional<Double> estimatedTicksToGoal();
|
||||
|
||||
/**
|
||||
* @return The current pathing goal
|
||||
@@ -52,22 +73,36 @@ public interface IPathingBehavior extends IBehavior {
|
||||
Goal getGoal();
|
||||
|
||||
/**
|
||||
* Begins pathing. Calculation will start in a new thread, and once completed,
|
||||
* movement will commence. Returns whether or not the operation was successful.
|
||||
*
|
||||
* @return Whether or not the operation was successful
|
||||
*/
|
||||
boolean path();
|
||||
|
||||
/**
|
||||
* @return Whether or not a path is currently being executed.
|
||||
* @return Whether or not a path is currently being executed. This will be false if there's currently a pause.
|
||||
* @see #hasPath()
|
||||
*/
|
||||
boolean isPathing();
|
||||
|
||||
/**
|
||||
* Cancels the pathing behavior or the current path calculation.
|
||||
* @return If there is a current path. Note that the path is not necessarily being executed, for example when there
|
||||
* is a pause in effect.
|
||||
* @see #isPathing()
|
||||
*/
|
||||
void cancel();
|
||||
default boolean hasPath() {
|
||||
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();
|
||||
|
||||
/**
|
||||
* PLEASE never call this
|
||||
* <p>
|
||||
* If cancelEverything was like "kill" this is "sudo kill -9". Or shutting off your computer.
|
||||
*/
|
||||
void forceCancel();
|
||||
|
||||
/**
|
||||
* Returns the current path, from the current path executor, if there is one.
|
||||
@@ -81,7 +116,7 @@ public interface IPathingBehavior extends IBehavior {
|
||||
/**
|
||||
* @return The current path finder being executed
|
||||
*/
|
||||
Optional<IPathFinder> getPathFinder();
|
||||
Optional<? extends IPathFinder> getInProgress();
|
||||
|
||||
/**
|
||||
* @return The current path executor
|
||||
|
||||
45
src/api/java/baritone/api/behavior/look/IAimProcessor.java
Normal file
45
src/api/java/baritone/api/behavior/look/IAimProcessor.java
Normal 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.behavior.look;
|
||||
|
||||
import baritone.api.utils.Rotation;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
*/
|
||||
public interface IAimProcessor {
|
||||
|
||||
/**
|
||||
* Returns the actual rotation that will be used when the desired rotation is requested. The returned rotation
|
||||
* always reflects what would happen in the upcoming tick. In other words, it is a pure function, and no internal
|
||||
* state changes. If simulation of the rotation states beyond the next tick is required, then a
|
||||
* {@link IAimProcessor#fork fork} should be created.
|
||||
*
|
||||
* @param desired The desired rotation to set
|
||||
* @return The actual rotation
|
||||
*/
|
||||
Rotation peekRotation(Rotation desired);
|
||||
|
||||
/**
|
||||
* Returns a copy of this {@link IAimProcessor} which has its own internal state and is manually tickable.
|
||||
*
|
||||
* @return The forked processor
|
||||
* @see ITickableAimProcessor
|
||||
*/
|
||||
ITickableAimProcessor fork();
|
||||
}
|
||||
@@ -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.behavior.look;
|
||||
|
||||
import baritone.api.utils.Rotation;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
*/
|
||||
public interface ITickableAimProcessor extends IAimProcessor {
|
||||
|
||||
/**
|
||||
* Advances the internal state of this aim processor by a single tick.
|
||||
*/
|
||||
void tick();
|
||||
|
||||
/**
|
||||
* Calls {@link #tick()} the specified number of times.
|
||||
*
|
||||
* @param ticks The number of calls
|
||||
*/
|
||||
void advance(int ticks);
|
||||
|
||||
/**
|
||||
* Returns the actual rotation as provided by {@link #peekRotation(Rotation)}, and then automatically advances the
|
||||
* internal state by one {@link #tick() tick}.
|
||||
*
|
||||
* @param rotation The desired rotation to set
|
||||
* @return The actual rotation
|
||||
*/
|
||||
Rotation nextRotation(Rotation rotation);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 8/4/2018 2:01 AM
|
||||
* @since 8/4/2018
|
||||
*/
|
||||
public interface IBlockTypeAccess {
|
||||
|
||||
|
||||
@@ -29,21 +29,20 @@ public interface ICachedRegion extends IBlockTypeAccess {
|
||||
* however, the block coordinates should in on a scale from 0 to 511 (inclusive)
|
||||
* because region sizes are 512x512 blocks.
|
||||
*
|
||||
* @see ICachedWorld#isCached(int, int)
|
||||
*
|
||||
* @param blockX The block X coordinate
|
||||
* @param blockZ The block Z coordinate
|
||||
* @return Whether or not the specified XZ location is cached
|
||||
* @see ICachedWorld#isCached(int, int)
|
||||
*/
|
||||
boolean isCached(int blockX, int blockZ);
|
||||
|
||||
/**
|
||||
* The X coordinate of this region
|
||||
* @return The X coordinate of this region
|
||||
*/
|
||||
int getX();
|
||||
|
||||
/**
|
||||
* The Z coordinate of this region
|
||||
* @return The Z coordinate of this region
|
||||
*/
|
||||
int getZ();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package baritone.api.cache;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
@@ -61,12 +61,14 @@ public interface ICachedWorld {
|
||||
* information that is returned by this method may not be up to date, because
|
||||
* older cached chunks can contain data that is much more likely to have changed.
|
||||
*
|
||||
* @param block The special block to search for
|
||||
* @param maximum The maximum number of position results to receive
|
||||
* @param block The special block to search for
|
||||
* @param maximum The maximum number of position results to receive
|
||||
* @param centerX The x block coordinate center of the search
|
||||
* @param centerZ The z block coordinate center of the search
|
||||
* @param maxRegionDistanceSq The maximum region distance, squared
|
||||
* @return The locations found that match the special block
|
||||
*/
|
||||
LinkedList<BlockPos> getLocationsOf(String block, int maximum, int maxRegionDistanceSq);
|
||||
ArrayList<BlockPos> getLocationsOf(String block, int maximum, int centerX, int centerZ, int maxRegionDistanceSq);
|
||||
|
||||
/**
|
||||
* Reloads all of the cached regions in this world from disk. Anything that is not saved
|
||||
|
||||
51
src/api/java/baritone/api/cache/IWaypoint.java
vendored
51
src/api/java/baritone/api/cache/IWaypoint.java
vendored
@@ -17,12 +17,9 @@
|
||||
|
||||
package baritone.api.cache;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A marker for a position in the world.
|
||||
@@ -60,7 +57,7 @@ public interface IWaypoint {
|
||||
*
|
||||
* @return The block position of this waypoint
|
||||
*/
|
||||
BlockPos getLocation();
|
||||
BetterBlockPos getLocation();
|
||||
|
||||
enum Tag {
|
||||
|
||||
@@ -92,20 +89,48 @@ public interface IWaypoint {
|
||||
/**
|
||||
* The names for the tag, anything that the tag can be referred to as.
|
||||
*/
|
||||
private final String[] names;
|
||||
public 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}
|
||||
* @return A name that can be passed to {@link #getByName(String)} to retrieve this tag
|
||||
*/
|
||||
public static Tag fromString(String name) {
|
||||
return TAG_LIST.stream().filter(tag -> ArrayUtils.contains(tag.names, name.toLowerCase())).findFirst().orElse(null);
|
||||
public String getName() {
|
||||
return names[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a tag by one of its names.
|
||||
*
|
||||
* @param name The name to search for.
|
||||
* @return The tag, if found, or null.
|
||||
*/
|
||||
public static Tag getByName(String name) {
|
||||
for (Tag action : Tag.values()) {
|
||||
for (String alias : action.names) {
|
||||
if (alias.equalsIgnoreCase(name)) {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return All tag names.
|
||||
*/
|
||||
public static String[] getAllNames() {
|
||||
Set<String> names = new HashSet<>();
|
||||
|
||||
for (Tag tag : Tag.values()) {
|
||||
names.addAll(Arrays.asList(tag.names));
|
||||
}
|
||||
|
||||
return names.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,19 +50,17 @@ public interface IWaypointCollection {
|
||||
/**
|
||||
* Gets all of the waypoints that have the specified tag
|
||||
*
|
||||
* @see IWaypointCollection#getAllWaypoints()
|
||||
*
|
||||
* @param tag The tag
|
||||
* @return All of the waypoints with the specified tag
|
||||
* @see IWaypointCollection#getAllWaypoints()
|
||||
*/
|
||||
Set<IWaypoint> getByTag(IWaypoint.Tag tag);
|
||||
|
||||
/**
|
||||
* Gets all of the waypoints in this collection, regardless of the tag.
|
||||
*
|
||||
* @see IWaypointCollection#getByTag(IWaypoint.Tag)
|
||||
*
|
||||
* @return All of the waypoints in this collection
|
||||
* @see IWaypointCollection#getByTag(IWaypoint.Tag)
|
||||
*/
|
||||
Set<IWaypoint> getAllWaypoints();
|
||||
}
|
||||
|
||||
@@ -27,13 +27,14 @@ public interface IWorldData {
|
||||
* Returns the cached world for this world. A cached world is a simplified format
|
||||
* of a regular world, intended for use on multiplayer servers where chunks are not
|
||||
* traditionally stored to disk, allowing for long distance pathing with minimal disk usage.
|
||||
*
|
||||
* @return The cached world for this world
|
||||
*/
|
||||
ICachedWorld getCachedWorld();
|
||||
|
||||
/**
|
||||
* Returns the waypoint collection for this world.
|
||||
*
|
||||
* @return The waypoint collection for this world
|
||||
*/
|
||||
IWaypointCollection getWaypoints();
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package baritone.api.cache;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/24/2018
|
||||
@@ -29,4 +31,11 @@ public interface IWorldProvider {
|
||||
* @return The current world data
|
||||
*/
|
||||
IWorldData getCurrentWorld();
|
||||
|
||||
default void ifWorldLoaded(Consumer<IWorldData> callback) {
|
||||
final IWorldData currentWorld = this.getCurrentWorld();
|
||||
if (currentWorld != null) {
|
||||
callback.accept(currentWorld);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
|
||||
package baritone.api.cache;
|
||||
|
||||
import baritone.api.utils.BlockOptionalMetaLookup;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,12 +34,63 @@ public interface IWorldScanner {
|
||||
/**
|
||||
* Scans the world, up to the specified max chunk radius, for the specified blocks.
|
||||
*
|
||||
* @param blocks The blocks to scan for
|
||||
* @param ctx The {@link IPlayerContext} containing player and world info that the scan is based upon
|
||||
* @param filter 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 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(List<Block> blocks, int max, int yLevelThreshold, int maxSearchRadius);
|
||||
List<BlockPos> scanChunkRadius(IPlayerContext ctx, BlockOptionalMetaLookup filter, int max, int yLevelThreshold, int maxSearchRadius);
|
||||
|
||||
default List<BlockPos> scanChunkRadius(IPlayerContext ctx, List<Block> filter, int max, int yLevelThreshold, int maxSearchRadius) {
|
||||
return scanChunkRadius(ctx, new BlockOptionalMetaLookup(filter.toArray(new Block[0])), max, yLevelThreshold, 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 filter 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, BlockOptionalMetaLookup filter, ChunkPos pos, int max, int yLevelThreshold);
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
default List<BlockPos> scanChunk(IPlayerContext ctx, List<Block> blocks, ChunkPos pos, int max, int yLevelThreshold) {
|
||||
return scanChunk(ctx, new BlockOptionalMetaLookup(blocks), pos, max, yLevelThreshold);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overload of {@link #repack(IPlayerContext, int)} where the value of the {@code range} parameter is {@code 40}.
|
||||
*
|
||||
* @param ctx The player, describing the origin
|
||||
* @return The amount of chunks successfully queued for repacking
|
||||
*/
|
||||
int repack(IPlayerContext ctx);
|
||||
|
||||
/**
|
||||
* Queues the chunks in a square formation around the specified player, using the specified
|
||||
* range, which represents 1/2 the square's dimensions, where the player is in the center.
|
||||
*
|
||||
* @param ctx The player, describing the origin
|
||||
* @param range The range to repack
|
||||
* @return The amount of chunks successfully queued for repacking
|
||||
*/
|
||||
int repack(IPlayerContext ctx, int range);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.cache;
|
||||
package baritone.api.cache;
|
||||
|
||||
import baritone.api.cache.IWaypoint;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -32,9 +31,9 @@ public class Waypoint implements IWaypoint {
|
||||
private final String name;
|
||||
private final Tag tag;
|
||||
private final long creationTimestamp;
|
||||
private final BlockPos location;
|
||||
private final BetterBlockPos location;
|
||||
|
||||
public Waypoint(String name, Tag tag, BlockPos location) {
|
||||
public Waypoint(String name, Tag tag, BetterBlockPos location) {
|
||||
this(name, tag, location, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@@ -42,12 +41,12 @@ public class Waypoint implements IWaypoint {
|
||||
* Constructor called when a Waypoint is read from disk, adds the creationTimestamp
|
||||
* as a parameter so that it is reserved after a waypoint is wrote to the disk.
|
||||
*
|
||||
* @param name The waypoint name
|
||||
* @param tag The waypoint tag
|
||||
* @param location The waypoint location
|
||||
* @param name The waypoint name
|
||||
* @param tag The waypoint tag
|
||||
* @param location The waypoint location
|
||||
* @param creationTimestamp When the waypoint was created
|
||||
*/
|
||||
Waypoint(String name, Tag tag, BlockPos location, long creationTimestamp) {
|
||||
public Waypoint(String name, Tag tag, BetterBlockPos location, long creationTimestamp) {
|
||||
this.name = name;
|
||||
this.tag = tag;
|
||||
this.location = location;
|
||||
@@ -56,7 +55,7 @@ public class Waypoint implements IWaypoint {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode() + tag.hashCode() + location.hashCode(); //lol
|
||||
return name.hashCode() ^ tag.hashCode() ^ location.hashCode() ^ Long.hashCode(creationTimestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,13 +74,18 @@ public class Waypoint implements IWaypoint {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getLocation() {
|
||||
public BetterBlockPos getLocation() {
|
||||
return this.location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + " " + location.toString() + " " + new Date(creationTimestamp).toString();
|
||||
return String.format(
|
||||
"%s %s %s",
|
||||
name,
|
||||
BetterBlockPos.from(location).toString(),
|
||||
new Date(creationTimestamp).toString()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
67
src/api/java/baritone/api/command/Command.java
Normal file
67
src/api/java/baritone/api/command/Command.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.command;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A default implementation of {@link ICommand} which provides easy access to the
|
||||
* command's bound {@link IBaritone} instance, {@link IPlayerContext} and an easy
|
||||
* way to provide multiple valid command execution names through the default constructor.
|
||||
* <p>
|
||||
* So basically, you should use it because it provides a small amount of boilerplate,
|
||||
* but you're not forced to use it.
|
||||
*
|
||||
* @author LoganDark
|
||||
* @see ICommand
|
||||
*/
|
||||
public abstract class Command implements ICommand {
|
||||
|
||||
protected IBaritone baritone;
|
||||
protected IPlayerContext ctx;
|
||||
|
||||
/**
|
||||
* The names of this command. This is what you put after the command prefix.
|
||||
*/
|
||||
protected final List<String> names;
|
||||
|
||||
/**
|
||||
* Creates a new Baritone control command.
|
||||
*
|
||||
* @param names The names of this command. This is what you put after the command prefix.
|
||||
*/
|
||||
protected Command(IBaritone baritone, String... names) {
|
||||
this.names = Collections.unmodifiableList(Stream.of(names)
|
||||
.map(s -> s.toLowerCase(Locale.US))
|
||||
.collect(Collectors.toList()));
|
||||
this.baritone = baritone;
|
||||
this.ctx = baritone.getPlayerContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<String> getNames() {
|
||||
return this.names;
|
||||
}
|
||||
}
|
||||
42
src/api/java/baritone/api/command/IBaritoneChatControl.java
Normal file
42
src/api/java/baritone/api/command/IBaritoneChatControl.java
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.command;
|
||||
|
||||
import baritone.api.Settings;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/26/2019
|
||||
*/
|
||||
public interface IBaritoneChatControl {
|
||||
|
||||
/**
|
||||
* In certain cases chat components need to execute commands for you. For example, the paginator automatically runs
|
||||
* commands when you click the forward and back arrows to show you the previous/next page.
|
||||
* <p>
|
||||
* If the prefix is changed in the meantime, then the command will go to chat. That's no good. So here's a permanent
|
||||
* prefix that forces a command to run, regardless of the current prefix, chat/prefix control being enabled, etc.
|
||||
* <p>
|
||||
* If used right (by both developers and users), it should be impossible to expose a command accidentally to the
|
||||
* server. As a rule of thumb, if you have a clickable chat component, always use this prefix. If you're suggesting
|
||||
* a command (a component that puts text into your text box, or something else), use {@link Settings#prefix}.
|
||||
*/
|
||||
String FORCE_COMMAND_PREFIX = String.format("<<%s>>", UUID.randomUUID().toString());
|
||||
}
|
||||
67
src/api/java/baritone/api/command/ICommand.java
Normal file
67
src/api/java/baritone/api/command/ICommand.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.command;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.utils.Helper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The base for a command.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 10/7/2019
|
||||
*/
|
||||
public interface ICommand extends Helper {
|
||||
|
||||
/**
|
||||
* Called when this command is executed.
|
||||
*/
|
||||
void execute(String label, IArgConsumer args) throws CommandException;
|
||||
|
||||
/**
|
||||
* Called when the command needs to tab complete. Return a Stream representing the entries to put in the completions
|
||||
* list.
|
||||
*/
|
||||
Stream<String> tabComplete(String label, IArgConsumer args) throws CommandException;
|
||||
|
||||
/**
|
||||
* @return A <b>single-line</b> string containing a short description of this command's purpose.
|
||||
*/
|
||||
String getShortDesc();
|
||||
|
||||
/**
|
||||
* @return A list of lines that will be printed by the help command when the user wishes to view them.
|
||||
*/
|
||||
List<String> getLongDesc();
|
||||
|
||||
/**
|
||||
* @return A list of the names that can be accepted to have arguments passed to this command
|
||||
*/
|
||||
List<String> getNames();
|
||||
|
||||
/**
|
||||
* @return {@code true} if this command should be hidden from the help menu
|
||||
*/
|
||||
default boolean hiddenFromHelp() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
29
src/api/java/baritone/api/command/ICommandSystem.java
Normal file
29
src/api/java/baritone/api/command/ICommandSystem.java
Normal 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.api.command;
|
||||
|
||||
import baritone.api.command.argparser.IArgParserManager;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 10/4/2019
|
||||
*/
|
||||
public interface ICommandSystem {
|
||||
|
||||
IArgParserManager getParserManager();
|
||||
}
|
||||
60
src/api/java/baritone/api/command/argparser/IArgParser.java
Normal file
60
src/api/java/baritone/api/command/argparser/IArgParser.java
Normal 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.command.argparser;
|
||||
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
|
||||
public interface IArgParser<T> {
|
||||
|
||||
/**
|
||||
* @return the class of this parser.
|
||||
*/
|
||||
Class<T> getTarget();
|
||||
|
||||
/**
|
||||
* A stateless argument parser is just that. It takes a {@link ICommandArgument} and outputs its type.
|
||||
*/
|
||||
interface Stateless<T> extends IArgParser<T> {
|
||||
|
||||
/**
|
||||
* @param arg The argument to parse.
|
||||
* @return What it was parsed into.
|
||||
* @throws RuntimeException if you want the parsing to fail. The exception will be caught and turned into an
|
||||
* appropriate error.
|
||||
*/
|
||||
T parseArg(ICommandArgument arg) throws Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* A stated argument parser is similar to a stateless one. It also takes a {@link ICommandArgument}, but it also
|
||||
* takes a second argument that can be any type, referred to as the state.
|
||||
*/
|
||||
interface Stated<T, S> extends IArgParser<T> {
|
||||
|
||||
Class<S> getStateType();
|
||||
|
||||
/**
|
||||
* @param arg The argument to parse.
|
||||
* @param state Can be anything.
|
||||
* @return What it was parsed into.
|
||||
* @throws RuntimeException if you want the parsing to fail. The exception will be caught and turned into an
|
||||
* appropriate error.
|
||||
*/
|
||||
T parseArg(ICommandArgument arg, S state) throws Exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.command.argparser;
|
||||
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import baritone.api.command.registry.Registry;
|
||||
|
||||
/**
|
||||
* Used to retrieve {@link IArgParser} instances from the registry, by their target class.
|
||||
* It can be assumed that a {@link IArgParser} exists for {@link Integer}, {@link Long},
|
||||
* {@link Float}, {@link Double} and {@link Boolean}.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 10/4/2019
|
||||
*/
|
||||
public interface IArgParserManager {
|
||||
|
||||
/**
|
||||
* @param type The type trying to be parsed
|
||||
* @return A parser that can parse arguments into this class, if found.
|
||||
*/
|
||||
<T> IArgParser.Stateless<T> getParserStateless(Class<T> type);
|
||||
|
||||
/**
|
||||
* @param type The type trying to be parsed
|
||||
* @return A parser that can parse arguments into this class, if found.
|
||||
*/
|
||||
<T, S> IArgParser.Stated<T, S> getParserStated(Class<T> type, Class<S> stateKlass);
|
||||
|
||||
/**
|
||||
* Attempt to parse the specified argument with a stateless {@link IArgParser} that outputs the specified class.
|
||||
*
|
||||
* @param type The type to try and parse the argument into.
|
||||
* @param arg The argument to parse.
|
||||
* @return An instance of the specified class.
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
*/
|
||||
<T> T parseStateless(Class<T> type, ICommandArgument arg) throws CommandInvalidTypeException;
|
||||
|
||||
/**
|
||||
* Attempt to parse the specified argument with a stated {@link IArgParser} that outputs the specified class.
|
||||
*
|
||||
* @param type The type to try and parse the argument into.
|
||||
* @param arg The argument to parse.
|
||||
* @param state The state to pass to the {@link IArgParser.Stated}.
|
||||
* @return An instance of the specified class.
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
* @see IArgParser.Stated
|
||||
*/
|
||||
<T, S> T parseStated(Class<T> type, Class<S> stateKlass, ICommandArgument arg, S state) throws CommandInvalidTypeException;
|
||||
|
||||
Registry<IArgParser> getRegistry();
|
||||
}
|
||||
594
src/api/java/baritone/api/command/argument/IArgConsumer.java
Normal file
594
src/api/java/baritone/api/command/argument/IArgConsumer.java
Normal file
@@ -0,0 +1,594 @@
|
||||
/*
|
||||
* 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.command.argument;
|
||||
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.argparser.IArgParser;
|
||||
import baritone.api.command.datatypes.IDatatype;
|
||||
import baritone.api.command.datatypes.IDatatypeFor;
|
||||
import baritone.api.command.datatypes.IDatatypePost;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import baritone.api.command.exception.CommandNotEnoughArgumentsException;
|
||||
import baritone.api.command.exception.CommandTooManyArgumentsException;
|
||||
import baritone.api.utils.Helper;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The {@link IArgConsumer} is how {@link ICommand}s read the arguments passed to them. This class has many benefits:
|
||||
*
|
||||
* <ul>
|
||||
* <li>Mutability. The whole concept of the {@link IArgConsumer}} is to let you gradually consume arguments in any way
|
||||
* you'd like. You can change your consumption based on earlier arguments, for subcommands for example.</li>
|
||||
* <li>You don't need to keep track of your consumption. The {@link IArgConsumer}} keeps track of the arguments you
|
||||
* consume so that it can throw detailed exceptions whenever something is out of the ordinary. Additionally, if you
|
||||
* need to retrieve an argument after you've already consumed it - look no further than {@link #consumed()}!</li>
|
||||
* <li>Easy retrieval of many different types. If you need to retrieve an instance of an int or float for example,
|
||||
* look no further than {@link #getAs(Class)}. If you need a more powerful way of retrieving data, try out the many
|
||||
* {@code getDatatype...} methods.</li>
|
||||
* <li>It's very easy to throw detailed exceptions. The {@link IArgConsumer}} has many different methods that can
|
||||
* enforce the number of arguments, the type of arguments, and more, throwing different types of
|
||||
* {@link CommandException}s if something seems off. You're recommended to do all validation and store all needed
|
||||
* data in variables BEFORE logging any data to chat via {@link Helper#logDirect(String)}, so that the error
|
||||
* handlers can do their job and log the error to chat.</li>
|
||||
* </ul>
|
||||
*/
|
||||
public interface IArgConsumer {
|
||||
|
||||
LinkedList<ICommandArgument> getArgs();
|
||||
|
||||
Deque<ICommandArgument> getConsumed();
|
||||
|
||||
/**
|
||||
* @param num The number of arguments to check for
|
||||
* @return {@code true} if there are <i>at least</i> {@code num} arguments left in this {@link IArgConsumer}}
|
||||
* @see #hasAny()
|
||||
* @see #hasAtMost(int)
|
||||
* @see #hasExactly(int)
|
||||
*/
|
||||
boolean has(int num);
|
||||
|
||||
/**
|
||||
* @return {@code true} if there is <i>at least</i> 1 argument left in this {@link IArgConsumer}}
|
||||
* @see #has(int)
|
||||
* @see #hasAtMostOne()
|
||||
* @see #hasExactlyOne()
|
||||
*/
|
||||
boolean hasAny();
|
||||
|
||||
/**
|
||||
* @param num The number of arguments to check for
|
||||
* @return {@code true} if there are <i>at most</i> {@code num} arguments left in this {@link IArgConsumer}}
|
||||
* @see #has(int)
|
||||
* @see #hasAtMost(int)
|
||||
* @see #hasExactly(int)
|
||||
*/
|
||||
boolean hasAtMost(int num);
|
||||
|
||||
/**
|
||||
* @return {@code true} if there is <i>at most</i> 1 argument left in this {@link IArgConsumer}}
|
||||
* @see #hasAny()
|
||||
* @see #hasAtMostOne()
|
||||
* @see #hasExactlyOne()
|
||||
*/
|
||||
boolean hasAtMostOne();
|
||||
|
||||
/**
|
||||
* @param num The number of arguments to check for
|
||||
* @return {@code true} if there are <i>exactly</i> {@code num} arguments left in this {@link IArgConsumer}}
|
||||
* @see #has(int)
|
||||
* @see #hasAtMost(int)
|
||||
*/
|
||||
boolean hasExactly(int num);
|
||||
|
||||
/**
|
||||
* @return {@code true} if there is <i>exactly</i> 1 argument left in this {@link IArgConsumer}}
|
||||
* @see #hasAny()
|
||||
* @see #hasAtMostOne()
|
||||
*/
|
||||
boolean hasExactlyOne();
|
||||
|
||||
/**
|
||||
* @param index The index to peek
|
||||
* @return The argument at index {@code index} in this {@link IArgConsumer}}, with 0 being the next one. This does not
|
||||
* mutate the {@link IArgConsumer}}
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than {@code index + 1} arguments left
|
||||
* @see #peek()
|
||||
* @see #peekString(int)
|
||||
* @see #peekAs(Class, int)
|
||||
* @see #get()
|
||||
*/
|
||||
ICommandArgument peek(int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @return The next argument in this {@link IArgConsumer}}. This does not mutate the {@link IArgConsumer}}
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than one argument left
|
||||
* @see #peek(int)
|
||||
* @see #peekString()
|
||||
* @see #peekAs(Class)
|
||||
* @see #get()
|
||||
*/
|
||||
ICommandArgument peek() throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param index The index to peek
|
||||
* @param type The type to check for
|
||||
* @return If an ArgParser.Stateless for the specified {@code type} would succeed in parsing the next
|
||||
* argument
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than {@code index + 1} arguments left
|
||||
* @see #peek()
|
||||
* @see #getAs(Class)
|
||||
*/
|
||||
boolean is(Class<?> type, int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param type The type to check for
|
||||
* @return If an ArgParser.Stateless for the specified {@code type} would succeed in parsing the next
|
||||
* argument
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than one argument left
|
||||
* @see #peek()
|
||||
* @see #getAs(Class)
|
||||
*/
|
||||
boolean is(Class<?> type) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param index The index to peek
|
||||
* @return The value of the argument at index {@code index} in this {@link IArgConsumer}}, with 0 being the next one
|
||||
* This does not mutate the {@link IArgConsumer}}
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than {@code index + 1} arguments left
|
||||
* @see #peek()
|
||||
* @see #peekString()
|
||||
*/
|
||||
String peekString(int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @return The value of the next argument in this {@link IArgConsumer}}. This does not mutate the {@link IArgConsumer}}
|
||||
* @throws CommandNotEnoughArgumentsException If there is less than one argument left
|
||||
* @see #peekString(int)
|
||||
* @see #getString()
|
||||
*/
|
||||
String peekString() throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param index The index to peek
|
||||
* @param enumClass The class to search
|
||||
* @return From the specified enum class, an enum constant of that class. The enum constant's name will match the
|
||||
* next argument's value
|
||||
* @throws java.util.NoSuchElementException If the constant couldn't be found
|
||||
* @see #peekEnumOrNull(Class)
|
||||
* @see #getEnum(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E peekEnum(Class<E> enumClass, int index) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param enumClass The class to search
|
||||
* @return From the specified enum class, an enum constant of that class. The enum constant's name will match the
|
||||
* next argument's value
|
||||
* @throws CommandInvalidTypeException If the constant couldn't be found
|
||||
* @see #peekEnumOrNull(Class)
|
||||
* @see #getEnum(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E peekEnum(Class<E> enumClass) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param index The index to peek
|
||||
* @param enumClass The class to search
|
||||
* @return From the specified enum class, an enum constant of that class. The enum constant's name will match the
|
||||
* next argument's value. If no constant could be found, null
|
||||
* @see #peekEnum(Class)
|
||||
* @see #getEnumOrNull(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E peekEnumOrNull(Class<E> enumClass, int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param enumClass The class to search
|
||||
* @return From the specified enum class, an enum constant of that class. The enum constant's name will match the
|
||||
* next argument's value. If no constant could be found, null
|
||||
* @see #peekEnum(Class)
|
||||
* @see #getEnumOrNull(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E peekEnumOrNull(Class<E> enumClass) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
|
||||
* class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @param index The index to peek
|
||||
* @return An instance of the specified type
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
* @see IArgParser
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
*/
|
||||
<T> T peekAs(Class<T> type, int index) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @return An instance of the specified type
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
* @see IArgParser
|
||||
* @see #peekAs(Class, int)
|
||||
* @see #peekAsOrDefault(Class, Object)
|
||||
* @see #peekAsOrNull(Class)
|
||||
*/
|
||||
<T> T peekAs(Class<T> type) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
|
||||
* class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @param def The value to return if the argument can't be parsed
|
||||
* @param index The index to peek
|
||||
* @return An instance of the specified type, or {@code def} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #peekAsOrDefault(Class, Object)
|
||||
* @see #peekAs(Class, int)
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
*/
|
||||
<T> T peekAsOrDefault(Class<T> type, T def, int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @param def The value to return if the argument can't be parsed
|
||||
* @return An instance of the specified type, or {@code def} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrNull(Class)
|
||||
*/
|
||||
<T> T peekAsOrDefault(Class<T> type, T def) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the argument at the specified index into the specified
|
||||
* class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @param index The index to peek
|
||||
* @return An instance of the specified type, or {@code null} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #peekAsOrNull(Class)
|
||||
* @see #peekAs(Class, int)
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
*/
|
||||
<T> T peekAsOrNull(Class<T> type, int index) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @return An instance of the specified type, or {@code null} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrDefault(Class, Object)
|
||||
*/
|
||||
<T> T peekAsOrNull(Class<T> type) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
<T> T peekDatatype(IDatatypeFor<T> datatype) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, O> T peekDatatype(IDatatypePost<T, O> datatype) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, O> T peekDatatype(IDatatypePost<T, O> datatype, O original) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T> T peekDatatypeOrNull(IDatatypeFor<T> datatype);
|
||||
|
||||
<T, O> T peekDatatypeOrNull(IDatatypePost<T, O> datatype);
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T peekDatatypePost(D datatype, O original) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T peekDatatypePostOrDefault(D datatype, O original, T def);
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T peekDatatypePostOrNull(D datatype, O original);
|
||||
|
||||
/**
|
||||
* Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
* <p>
|
||||
* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method.
|
||||
*
|
||||
* @param datatype The datatype to get
|
||||
* @return The datatype instance
|
||||
* @see IDatatype
|
||||
* @see IDatatypeFor
|
||||
*/
|
||||
<T, D extends IDatatypeFor<T>> T peekDatatypeFor(Class<D> datatype);
|
||||
|
||||
/**
|
||||
* Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
* <p>
|
||||
* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method.
|
||||
*
|
||||
* @param datatype The datatype to get
|
||||
* @param def The default value
|
||||
* @return The datatype instance, or {@code def} if it throws an exception
|
||||
* @see IDatatype
|
||||
* @see IDatatypeFor
|
||||
*/
|
||||
<T, D extends IDatatypeFor<T>> T peekDatatypeForOrDefault(Class<D> datatype, T def);
|
||||
|
||||
/**
|
||||
* Attempts to get the specified {@link IDatatypeFor} from this ArgConsumer
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
* <p>
|
||||
* Since this is a peek operation, this ArgConsumer will not be mutated by any call to this method.
|
||||
*
|
||||
* @param datatype The datatype to get
|
||||
* @return The datatype instance, or {@code null} if it throws an exception
|
||||
* @see IDatatype
|
||||
* @see IDatatypeFor
|
||||
*/
|
||||
<T, D extends IDatatypeFor<T>> T peekDatatypeForOrNull(Class<D> datatype);
|
||||
|
||||
/**
|
||||
* Gets the next argument and returns it. This consumes the first argument so that subsequent calls will return
|
||||
* later arguments
|
||||
*
|
||||
* @return The next argument
|
||||
* @throws CommandNotEnoughArgumentsException If there's less than one argument left
|
||||
*/
|
||||
ICommandArgument get() throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Gets the value of the next argument and returns it. This consumes the first argument so that subsequent calls
|
||||
* will return later arguments
|
||||
*
|
||||
* @return The value of the next argument
|
||||
* @throws CommandNotEnoughArgumentsException If there's less than one argument left
|
||||
*/
|
||||
String getString() throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Gets an enum value from the enum class with the same name as the next argument's value
|
||||
* <p>
|
||||
* For example if you getEnum as an {@link EnumFacing}, and the next argument's value is "up", this will return
|
||||
* {@link EnumFacing#UP}
|
||||
*
|
||||
* @param enumClass The enum class to search
|
||||
* @return An enum constant of that class with the same name as the next argument's value
|
||||
* @throws CommandInvalidTypeException If the constant couldn't be found
|
||||
* @see #peekEnum(Class)
|
||||
* @see #getEnumOrNull(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E getEnum(Class<E> enumClass) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Gets an enum value from the enum class with the same name as the next argument's value
|
||||
* <p>
|
||||
* For example if you getEnum as an {@link EnumFacing}, and the next argument's value is "up", this will return
|
||||
* {@link EnumFacing#UP}
|
||||
*
|
||||
* @param enumClass The enum class to search
|
||||
* @param def The default value
|
||||
* @return An enum constant of that class with the same name as the next argument's value, or {@code def} if it
|
||||
* couldn't be found
|
||||
* @see #getEnum(Class)
|
||||
* @see #getEnumOrNull(Class)
|
||||
* @see #peekEnumOrNull(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E getEnumOrDefault(Class<E> enumClass, E def) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Gets an enum value from the enum class with the same name as the next argument's value
|
||||
* <p>
|
||||
* For example if you getEnum as an {@link EnumFacing}, and the next argument's value is "up", this will return
|
||||
* {@link EnumFacing#UP}
|
||||
*
|
||||
* @param enumClass The enum class to search
|
||||
* @return An enum constant of that class with the same name as the next argument's value, or {@code null} if it
|
||||
* couldn't be found
|
||||
* @see #getEnum(Class)
|
||||
* @see #getEnumOrDefault(Class, Enum)
|
||||
* @see #peekEnumOrNull(Class)
|
||||
* @see ICommandArgument#getEnum(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E getEnumOrNull(Class<E> enumClass) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @return An instance of the specified type
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
* @see IArgParser
|
||||
* @see #get()
|
||||
* @see #getAsOrDefault(Class, Object)
|
||||
* @see #getAsOrNull(Class)
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
*/
|
||||
<T> T getAs(Class<T> type) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @param def The default value
|
||||
* @return An instance of the specified type, or {@code def} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #get()
|
||||
* @see #getAs(Class)
|
||||
* @see #getAsOrNull(Class)
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
*/
|
||||
<T> T getAsOrDefault(Class<T> type, T def) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse the next argument into the specified class
|
||||
* <p>
|
||||
* A critical difference between {@link IDatatype}s and {@link IArgParser}s is how many arguments they can take.
|
||||
* While {@link IArgParser}s always operate on a single argument's value, {@link IDatatype}s get access to the entire
|
||||
* {@link IArgConsumer}}.
|
||||
*
|
||||
* @param type The type to peek as
|
||||
* @return An instance of the specified type, or {@code null} if it couldn't be parsed
|
||||
* @see IArgParser
|
||||
* @see #get()
|
||||
* @see #getAs(Class)
|
||||
* @see #getAsOrDefault(Class, Object)
|
||||
* @see #peekAs(Class)
|
||||
* @see #peekAsOrDefault(Class, Object, int)
|
||||
* @see #peekAsOrNull(Class, int)
|
||||
*/
|
||||
<T> T getAsOrNull(Class<T> type) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T getDatatypePost(D datatype, O original) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T getDatatypePostOrDefault(D datatype, O original, T _default);
|
||||
|
||||
<T, O, D extends IDatatypePost<T, O>> T getDatatypePostOrNull(D datatype, O original);
|
||||
|
||||
<T, D extends IDatatypeFor<T>> T getDatatypeFor(D datatype) throws CommandInvalidTypeException, CommandNotEnoughArgumentsException;
|
||||
|
||||
<T, D extends IDatatypeFor<T>> T getDatatypeForOrDefault(D datatype, T def);
|
||||
|
||||
<T, D extends IDatatypeFor<T>> T getDatatypeForOrNull(D datatype);
|
||||
|
||||
<T extends IDatatype> Stream<String> tabCompleteDatatype(T datatype);
|
||||
|
||||
/**
|
||||
* Returns the "raw rest" of the string. For example, from a string <code>arg1 arg2 arg3</code>, split
|
||||
* into three {@link ICommandArgument}s {@code "arg1"}, {@code "arg2"}, and {@code "arg3"}:
|
||||
*
|
||||
* <ul>
|
||||
* <li>{@code rawRest()} would return <code>arg1 arg2 arg3</code></li>
|
||||
* <li>After calling {@link #get()}, {@code rawRest()} would return <code>arg2 arg3</code> (note the
|
||||
* double space - it is preserved!)</li>
|
||||
* <li>After calling {@link #get()} again, {@code rawRest()} would return {@code "arg3"}</li>
|
||||
* <li>After calling {@link #get()} one last time, {@code rawRest()} would return {@code ""}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return The "raw rest" of the string.
|
||||
*/
|
||||
String rawRest();
|
||||
|
||||
/**
|
||||
* @param min The minimum amount of arguments to require.
|
||||
* @throws CommandNotEnoughArgumentsException If there are less than {@code min} arguments left.
|
||||
* @see #requireMax(int)
|
||||
* @see #requireExactly(int)
|
||||
*/
|
||||
void requireMin(int min) throws CommandNotEnoughArgumentsException;
|
||||
|
||||
/**
|
||||
* @param max The maximum amount of arguments allowed.
|
||||
* @throws CommandTooManyArgumentsException If there are more than {@code max} arguments left.
|
||||
* @see #requireMin(int)
|
||||
* @see #requireExactly(int)
|
||||
*/
|
||||
void requireMax(int max) throws CommandTooManyArgumentsException;
|
||||
|
||||
/**
|
||||
* @param args The exact amount of arguments to require.
|
||||
* @throws CommandNotEnoughArgumentsException If there are less than {@code args} arguments left.
|
||||
* @throws CommandTooManyArgumentsException If there are more than {@code args} arguments left.
|
||||
* @see #requireMin(int)
|
||||
* @see #requireMax(int)
|
||||
*/
|
||||
void requireExactly(int args) throws CommandException;
|
||||
|
||||
/**
|
||||
* @return If this {@link IArgConsumer}} has consumed at least one argument.
|
||||
* @see #consumed()
|
||||
* @see #consumedString()
|
||||
*/
|
||||
boolean hasConsumed();
|
||||
|
||||
/**
|
||||
* @return The last argument this {@link IArgConsumer}} has consumed, or an "unknown" argument, indicated by a
|
||||
* comamnd argument index that has a value of {@code -1}, if no arguments have been consumed yet.
|
||||
* @see #consumedString()
|
||||
* @see #hasConsumed()
|
||||
*/
|
||||
ICommandArgument consumed();
|
||||
|
||||
/**
|
||||
* @return The value of thelast argument this {@link IArgConsumer}} has consumed, or an empty string if no arguments
|
||||
* have been consumed yet
|
||||
* @see #consumed()
|
||||
* @see #hasConsumed()
|
||||
*/
|
||||
String consumedString();
|
||||
|
||||
/**
|
||||
* @return A copy of this {@link IArgConsumer}}. It has the same arguments (both consumed and not), but does not
|
||||
* affect or mutate this instance. Useful for the various {@code peek} functions
|
||||
*/
|
||||
IArgConsumer copy();
|
||||
}
|
||||
101
src/api/java/baritone/api/command/argument/ICommandArgument.java
Normal file
101
src/api/java/baritone/api/command/argument/ICommandArgument.java
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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.command.argument;
|
||||
|
||||
import baritone.api.command.argparser.IArgParser;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* A {@link ICommandArgument} is an immutable object representing one command argument. It contains data on the index of
|
||||
* that argument, its value, and the rest of the string that argument was found in
|
||||
* <p>
|
||||
* You're recommended to use {@link IArgConsumer}}s to handle these.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 10/2/2019
|
||||
*/
|
||||
public interface ICommandArgument {
|
||||
|
||||
/**
|
||||
* @return The index of this command argument in the list of command arguments generated
|
||||
*/
|
||||
int getIndex();
|
||||
|
||||
/**
|
||||
* @return The raw value of just this argument
|
||||
*/
|
||||
String getValue();
|
||||
|
||||
/**
|
||||
* @return The raw value of the remaining arguments after this one was captured
|
||||
*/
|
||||
String getRawRest();
|
||||
|
||||
/**
|
||||
* Gets an enum value from the enum class with the same name as this argument's value
|
||||
* <p>
|
||||
* For example if you getEnum as an {@link EnumFacing}, and this argument's value is "up", it will return {@link
|
||||
* EnumFacing#UP}
|
||||
*
|
||||
* @param enumClass The enum class to search
|
||||
* @return An enum constant of that class with the same name as this argument's value
|
||||
* @throws CommandInvalidTypeException If the constant couldn't be found
|
||||
* @see IArgConsumer#peekEnum(Class)
|
||||
* @see IArgConsumer#peekEnum(Class, int)
|
||||
* @see IArgConsumer#peekEnumOrNull(Class)
|
||||
* @see IArgConsumer#peekEnumOrNull(Class, int)
|
||||
* @see IArgConsumer#getEnum(Class)
|
||||
* @see IArgConsumer#getEnumOrNull(Class)
|
||||
*/
|
||||
<E extends Enum<?>> E getEnum(Class<E> enumClass) throws CommandInvalidTypeException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse this argument into the specified class
|
||||
*
|
||||
* @param type The class to parse this argument into
|
||||
* @return An instance of the specified type
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
*/
|
||||
<T> T getAs(Class<T> type) throws CommandInvalidTypeException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stateless</b> {@link IArgParser} to parse this argument into the specified class
|
||||
*
|
||||
* @param type The class to parse this argument into
|
||||
* @return If the parser succeeded
|
||||
*/
|
||||
<T> boolean is(Class<T> type);
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stated</b> {@link IArgParser} to parse this argument into the specified class
|
||||
*
|
||||
* @param type The class to parse this argument into
|
||||
* @return An instance of the specified type
|
||||
* @throws CommandInvalidTypeException If the parsing failed
|
||||
*/
|
||||
<T, S> T getAs(Class<T> type, Class<S> stateType, S state) throws CommandInvalidTypeException;
|
||||
|
||||
/**
|
||||
* Tries to use a <b>stated</b> {@link IArgParser} to parse this argument into the specified class
|
||||
*
|
||||
* @param type The class to parse this argument into
|
||||
* @return If the parser succeeded
|
||||
*/
|
||||
<T, S> boolean is(Class<T> type, Class<S> stateType, S state);
|
||||
}
|
||||
65
src/api/java/baritone/api/command/datatypes/BlockById.java
Normal file
65
src/api/java/baritone/api/command/datatypes/BlockById.java
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum BlockById implements IDatatypeFor<Block> {
|
||||
INSTANCE;
|
||||
|
||||
/**
|
||||
* Matches (domain:)?name? where domain and name are [a-z0-9_.-]+ and [a-z0-9/_.-]+ respectively.
|
||||
*/
|
||||
private static Pattern PATTERN = Pattern.compile("(?:[a-z0-9_.-]+:)?[a-z0-9/_.-]*");
|
||||
|
||||
@Override
|
||||
public Block get(IDatatypeContext ctx) throws CommandException {
|
||||
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
|
||||
Block block;
|
||||
if ((block = Block.REGISTRY.getObject(id)) == Blocks.AIR) {
|
||||
throw new IllegalArgumentException("no block found by that id");
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
String arg = ctx.getConsumer().getString();
|
||||
|
||||
if (!PATTERN.matcher(arg).matches()) {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
return new TabCompleteHelper()
|
||||
.append(
|
||||
Block.REGISTRY.getKeys()
|
||||
.stream()
|
||||
.map(Object::toString)
|
||||
)
|
||||
.filterPrefixNamespaced(arg)
|
||||
.sortAlphabetically()
|
||||
.stream();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum EntityClassById implements IDatatypeFor<Class<? extends Entity>> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public Class<? extends Entity> get(IDatatypeContext ctx) throws CommandException {
|
||||
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
|
||||
Class<? extends Entity> entity;
|
||||
try {
|
||||
entity = EntityList.REGISTRY.getObject(id);
|
||||
} catch (NoSuchFieldError e) {
|
||||
// Forge removes EntityList.REGISTRY field and provides the getClass method as a replacement
|
||||
// See https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/patches/minecraft/net/minecraft/entity/EntityList.java.patch
|
||||
try {
|
||||
entity = (Class<? extends Entity>) EntityList.class.getMethod("getClass", ResourceLocation.class).invoke(null, id);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("EntityList.REGISTRY does not exist and failed to call the Forge-replacement method", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (entity == null) {
|
||||
throw new IllegalArgumentException("no entity found by that id");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
return new TabCompleteHelper()
|
||||
.append(EntityList.getEntityNameList().stream().map(Object::toString))
|
||||
.filterPrefixNamespaced(ctx.getConsumer().getString())
|
||||
.sortAlphabetically()
|
||||
.stream();
|
||||
}
|
||||
}
|
||||
43
src/api/java/baritone/api/command/datatypes/ForAxis.java
Normal file
43
src/api/java/baritone/api/command/datatypes/ForAxis.java
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum ForAxis implements IDatatypeFor<EnumFacing.Axis> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public EnumFacing.Axis get(IDatatypeContext ctx) throws CommandException {
|
||||
return EnumFacing.Axis.valueOf(ctx.getConsumer().getString().toUpperCase(Locale.US));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
return new TabCompleteHelper()
|
||||
.append(Stream.of(EnumFacing.Axis.values())
|
||||
.map(EnumFacing.Axis::getName).map(String::toLowerCase))
|
||||
.filterPrefix(ctx.getConsumer().getString())
|
||||
.stream();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import baritone.api.utils.BlockOptionalMeta;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum ForBlockOptionalMeta implements IDatatypeFor<BlockOptionalMeta> {
|
||||
INSTANCE;
|
||||
|
||||
/**
|
||||
* Matches (domain:)?name([(property=value)*])? but the input can be truncated at any position.
|
||||
* domain and name are [a-z0-9_.-]+ and [a-z0-9/_.-]+ because that's what mc 1.13+ accepts.
|
||||
* property and value use the same format as domain.
|
||||
*/
|
||||
// Good luck reading this.
|
||||
private static Pattern PATTERN = Pattern.compile("(?:[a-z0-9_.-]+:)?(?:[a-z0-9/_.-]+(?:\\[(?:(?:[a-z0-9_.-]+=[a-z0-9_.-]+,)*(?:[a-z0-9_.-]+(?:=(?:[a-z0-9_.-]+(?:\\])?)?)?)?|\\])?)?)?");
|
||||
|
||||
@Override
|
||||
public BlockOptionalMeta get(IDatatypeContext ctx) throws CommandException {
|
||||
return new BlockOptionalMeta(ctx.getConsumer().getString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
String arg = ctx.getConsumer().peekString();
|
||||
|
||||
if (!PATTERN.matcher(arg).matches()) {
|
||||
// Invalid format; we can't complete this.
|
||||
ctx.getConsumer().getString();
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
if (arg.endsWith("]")) {
|
||||
// We are already done.
|
||||
ctx.getConsumer().getString();
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
if (!arg.contains("[")) {
|
||||
// no properties so we are completing the block id
|
||||
return ctx.getConsumer().tabCompleteDatatype(BlockById.INSTANCE);
|
||||
}
|
||||
|
||||
ctx.getConsumer().getString();
|
||||
|
||||
// destructuring assignment? Please?
|
||||
String blockId, properties;
|
||||
{
|
||||
String[] parts = splitLast(arg, '[');
|
||||
blockId = parts[0];
|
||||
properties = parts[1];
|
||||
}
|
||||
|
||||
Block block = Block.REGISTRY.getObject(new ResourceLocation(blockId));
|
||||
if (block == null) {
|
||||
// This block doesn't exist so there's no properties to complete.
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
String leadingProperties, lastProperty;
|
||||
{
|
||||
String[] parts = splitLast(properties, ',');
|
||||
leadingProperties = parts[0];
|
||||
lastProperty = parts[1];
|
||||
}
|
||||
|
||||
if (!lastProperty.contains("=")) {
|
||||
// The last property-value pair doesn't have a value yet so we are completing its name
|
||||
Set<String> usedProps = Stream.of(leadingProperties.split(","))
|
||||
.map(pair -> pair.split("=")[0])
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
String prefix = arg.substring(0, arg.length() - lastProperty.length());
|
||||
return new TabCompleteHelper()
|
||||
.append(
|
||||
block.getBlockState()
|
||||
.getProperties()
|
||||
.stream()
|
||||
.map(IProperty::getName)
|
||||
)
|
||||
.filter(prop -> !usedProps.contains(prop))
|
||||
.filterPrefix(lastProperty)
|
||||
.sortAlphabetically()
|
||||
.map(prop -> prefix + prop)
|
||||
.stream();
|
||||
}
|
||||
|
||||
String lastName, lastValue;
|
||||
{
|
||||
String[] parts = splitLast(lastProperty, '=');
|
||||
lastName = parts[0];
|
||||
lastValue = parts[1];
|
||||
}
|
||||
|
||||
// We are completing the value of a property
|
||||
String prefix = arg.substring(0, arg.length() - lastValue.length());
|
||||
|
||||
IProperty<?> property = block.getBlockState().getProperty(lastName);
|
||||
if (property == null) {
|
||||
// The property does not exist so there's no values to complete
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
return new TabCompleteHelper()
|
||||
.append(getValues(property))
|
||||
.filterPrefix(lastValue)
|
||||
.sortAlphabetically()
|
||||
.map(val -> prefix + val)
|
||||
.stream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Always returns exactly two strings.
|
||||
* If the separator is not found the FIRST returned string is empty.
|
||||
*/
|
||||
private static String[] splitLast(String string, char chr) {
|
||||
int idx = string.lastIndexOf(chr);
|
||||
if (idx == -1) {
|
||||
return new String[]{"", string};
|
||||
}
|
||||
return new String[]{string.substring(0, idx), string.substring(idx + 1)};
|
||||
}
|
||||
|
||||
// this shouldn't need to be a separate method?
|
||||
private static <T extends Comparable<T>> Stream<String> getValues(IProperty<T> property) {
|
||||
return property.getAllowedValues().stream().map(property::getName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum ForEnumFacing implements IDatatypeFor<EnumFacing> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public EnumFacing get(IDatatypeContext ctx) throws CommandException {
|
||||
return EnumFacing.valueOf(ctx.getConsumer().getString().toUpperCase(Locale.US));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
return new TabCompleteHelper()
|
||||
.append(Stream.of(EnumFacing.values())
|
||||
.map(EnumFacing::getName).map(String::toLowerCase))
|
||||
.filterPrefix(ctx.getConsumer().getString())
|
||||
.stream();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.cache.IWaypoint;
|
||||
import baritone.api.cache.IWaypointCollection;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum ForWaypoints implements IDatatypeFor<IWaypoint[]> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public IWaypoint[] get(IDatatypeContext ctx) throws CommandException {
|
||||
final String input = ctx.getConsumer().getString();
|
||||
final IWaypoint.Tag tag = IWaypoint.Tag.getByName(input);
|
||||
|
||||
// If the input doesn't resolve to a valid tag, resolve by name
|
||||
return tag == null
|
||||
? getWaypointsByName(ctx.getBaritone(), input)
|
||||
: getWaypointsByTag(ctx.getBaritone(), tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
return new TabCompleteHelper()
|
||||
.append(getWaypointNames(ctx.getBaritone()))
|
||||
.sortAlphabetically()
|
||||
.prepend(IWaypoint.Tag.getAllNames())
|
||||
.filterPrefix(ctx.getConsumer().getString())
|
||||
.stream();
|
||||
}
|
||||
|
||||
public static IWaypointCollection waypoints(IBaritone baritone) {
|
||||
return baritone.getWorldProvider().getCurrentWorld().getWaypoints();
|
||||
}
|
||||
|
||||
public static IWaypoint[] getWaypoints(IBaritone baritone) {
|
||||
return waypoints(baritone).getAllWaypoints().stream()
|
||||
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
||||
.toArray(IWaypoint[]::new);
|
||||
}
|
||||
|
||||
public static String[] getWaypointNames(IBaritone baritone) {
|
||||
return Stream.of(getWaypoints(baritone))
|
||||
.map(IWaypoint::getName)
|
||||
.filter(name -> !name.isEmpty())
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
public static IWaypoint[] getWaypointsByTag(IBaritone baritone, IWaypoint.Tag tag) {
|
||||
return waypoints(baritone).getByTag(tag).stream()
|
||||
.sorted(Comparator.comparingLong(IWaypoint::getCreationTimestamp).reversed())
|
||||
.toArray(IWaypoint[]::new);
|
||||
}
|
||||
|
||||
public static IWaypoint[] getWaypointsByName(IBaritone baritone, String name) {
|
||||
return Stream.of(getWaypoints(baritone))
|
||||
.filter(waypoint -> waypoint.getName().equalsIgnoreCase(name))
|
||||
.toArray(IWaypoint[]::new);
|
||||
}
|
||||
}
|
||||
56
src/api/java/baritone/api/command/datatypes/IDatatype.java
Normal file
56
src/api/java/baritone/api/command/datatypes/IDatatype.java
Normal 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argparser.IArgParser;
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* An {@link IDatatype} is similar to an {@link IArgParser} in the sense that it is capable of consuming an argument
|
||||
* to transform it into a usable form as the code desires.
|
||||
* <p>
|
||||
* A fundamental difference is that an {@link IDatatype} is capable of consuming multiple arguments. For example,
|
||||
* {@link RelativeBlockPos} is an {@link IDatatypePost} which requires at least 3 {@link RelativeCoordinate} arguments
|
||||
* to be specified.
|
||||
* <p>
|
||||
* Another difference is that an {@link IDatatype} can be tab-completed, providing comprehensive auto completion
|
||||
* that can substitute based on existing input or provide possibilities for the next piece of input.
|
||||
*
|
||||
* @see IDatatypeContext
|
||||
* @see IDatatypeFor
|
||||
* @see IDatatypePost
|
||||
*/
|
||||
public interface IDatatype {
|
||||
|
||||
/**
|
||||
* Attempts to complete missing or partial input provided through the {@link IArgConsumer}} provided by
|
||||
* {@link IDatatypeContext#getConsumer()} in order to aide the user in executing commands.
|
||||
* <p>
|
||||
* One benefit over datatypes over {@link IArgParser}s is that instead of each command trying to guess what values
|
||||
* the datatype will accept, or simply not tab completing at all, datatypes that support tab completion can provide
|
||||
* accurate information using the same methods used to parse arguments in the first place.
|
||||
*
|
||||
* @param ctx The argument consumer to tab complete
|
||||
* @return A stream representing the strings that can be tab completed. DO NOT INCLUDE SPACES IN ANY STRINGS.
|
||||
* @see IArgConsumer#tabCompleteDatatype(IDatatype)
|
||||
*/
|
||||
Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException;
|
||||
}
|
||||
@@ -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.command.datatypes;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
|
||||
/**
|
||||
* Provides an {@link IDatatype} with contextual information so
|
||||
* that it can perform the desired operation on the target level.
|
||||
*
|
||||
* @author Brady
|
||||
* @see IDatatype
|
||||
* @since 9/26/2019
|
||||
*/
|
||||
public interface IDatatypeContext {
|
||||
|
||||
/**
|
||||
* Provides the {@link IBaritone} instance that is associated with the action relating to datatype handling.
|
||||
*
|
||||
* @return The context {@link IBaritone} instance.
|
||||
*/
|
||||
IBaritone getBaritone();
|
||||
|
||||
/**
|
||||
* Provides the {@link IArgConsumer}} to fetch input information from.
|
||||
*
|
||||
* @return The context {@link IArgConsumer}}.
|
||||
*/
|
||||
IArgConsumer getConsumer();
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* An {@link IDatatype} which acts as a {@link Supplier}, in essence. The only difference
|
||||
* is that it requires an {@link IDatatypeContext} to be provided due to the expectation that
|
||||
* implementations of {@link IDatatype} are singletons.
|
||||
*/
|
||||
public interface IDatatypeFor<T> extends IDatatype {
|
||||
|
||||
/**
|
||||
* Consumes the desired amount of arguments from the specified {@link IDatatypeContext}, and
|
||||
* then returns the parsed value. This method will more than likely return a {@link IllegalArgumentException}
|
||||
* if the expected input does not conform to a parseable value. As far as a {@link CommandException} being
|
||||
* thrown is concerned, see the note below for specifics.
|
||||
*
|
||||
* @param ctx The context
|
||||
* @return The parsed data-type
|
||||
* @throws CommandException If there was an issue parsing using another type or arguments could not be polled.
|
||||
* @see IDatatypeContext
|
||||
*/
|
||||
T get(IDatatypeContext ctx) throws CommandException;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* An {@link IDatatype} which acts as a {@link Function}, in essence. The only difference
|
||||
* is that it requires an {@link IDatatypeContext} to be provided due to the expectation that
|
||||
* implementations of {@link IDatatype} are singletons.
|
||||
*/
|
||||
public interface IDatatypePost<T, O> extends IDatatype {
|
||||
|
||||
/**
|
||||
* Takes the expected input and transforms it based on the value held by {@code original}. If {@code original}
|
||||
* is null, it is expected that the implementation of this method has a case to handle it, such that a
|
||||
* {@link NullPointerException} will never be thrown as a result.
|
||||
*
|
||||
* @param ctx The datatype context
|
||||
* @param original The transformable value
|
||||
* @return The transformed value
|
||||
*/
|
||||
T apply(IDatatypeContext ctx, O original) throws CommandException;
|
||||
}
|
||||
@@ -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.api.command.datatypes;
|
||||
|
||||
import baritone.api.command.exception.CommandException;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/26/2019
|
||||
*/
|
||||
public interface IDatatypePostFunction<T, O> {
|
||||
|
||||
T apply(O original) throws CommandException;
|
||||
}
|
||||
@@ -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.command.datatypes;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.helpers.TabCompleteHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* An {@link IDatatype} used to resolve nearby players, those within
|
||||
* render distance of the target {@link IBaritone} instance.
|
||||
*/
|
||||
public enum NearbyPlayer implements IDatatypeFor<EntityPlayer> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public EntityPlayer get(IDatatypeContext ctx) throws CommandException {
|
||||
final String username = ctx.getConsumer().getString();
|
||||
return getPlayers(ctx).stream()
|
||||
.filter(s -> s.getName().equalsIgnoreCase(username))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
return new TabCompleteHelper()
|
||||
.append(getPlayers(ctx).stream().map(EntityPlayer::getName))
|
||||
.filterPrefix(ctx.getConsumer().getString())
|
||||
.sortAlphabetically()
|
||||
.stream();
|
||||
}
|
||||
|
||||
private static List<EntityPlayer> getPlayers(IDatatypeContext ctx) {
|
||||
return ctx.getBaritone().getPlayerContext().world().playerEntities;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeBlockPos implements IDatatypePost<BetterBlockPos, BetterBlockPos> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public BetterBlockPos apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = BetterBlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
return new BetterBlockPos(
|
||||
consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.x),
|
||||
consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.y),
|
||||
consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.z)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
if (consumer.hasAny() && !consumer.has(4)) {
|
||||
while (consumer.has(2)) {
|
||||
if (consumer.peekDatatypeOrNull(RelativeCoordinate.INSTANCE) == null) {
|
||||
break;
|
||||
}
|
||||
consumer.get();
|
||||
}
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.INSTANCE);
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeCoordinate implements IDatatypePost<Double, Double> {
|
||||
INSTANCE;
|
||||
private static String ScalesAliasRegex = "[kKmM]";
|
||||
private static Pattern PATTERN = Pattern.compile("^(~?)([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(" + ScalesAliasRegex + "?)|)$");
|
||||
|
||||
@Override
|
||||
public Double apply(IDatatypeContext ctx, Double origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = 0.0D;
|
||||
}
|
||||
|
||||
Matcher matcher = PATTERN.matcher(ctx.getConsumer().getString());
|
||||
if (!matcher.matches()) {
|
||||
throw new IllegalArgumentException("pattern doesn't match");
|
||||
}
|
||||
|
||||
boolean isRelative = !matcher.group(1).isEmpty();
|
||||
|
||||
double offset = matcher.group(2).isEmpty() ? 0 : Double.parseDouble(matcher.group(2).replaceAll(ScalesAliasRegex, ""));
|
||||
|
||||
if (matcher.group(2).toLowerCase().contains("k")) {
|
||||
offset *= 1000;
|
||||
}
|
||||
if (matcher.group(2).toLowerCase().contains("m")) {
|
||||
offset *= 1000000;
|
||||
}
|
||||
|
||||
|
||||
if (isRelative) {
|
||||
return origin + offset;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
if (!consumer.has(2) && consumer.getString().matches("^(~|$)")) {
|
||||
return Stream.of("~");
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
110
src/api/java/baritone/api/command/datatypes/RelativeFile.java
Normal file
110
src/api/java/baritone/api/command/datatypes/RelativeFile.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.utils.Helper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public enum RelativeFile implements IDatatypePost<File, File> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public File apply(IDatatypeContext ctx, File original) throws CommandException {
|
||||
if (original == null) {
|
||||
original = new File("./");
|
||||
}
|
||||
|
||||
Path path;
|
||||
try {
|
||||
path = FileSystems.getDefault().getPath(ctx.getConsumer().getString());
|
||||
} catch (InvalidPathException e) {
|
||||
throw new IllegalArgumentException("invalid path");
|
||||
}
|
||||
return getCanonicalFileUnchecked(original.toPath().resolve(path).toFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Seriously
|
||||
*
|
||||
* @param file File
|
||||
* @return Canonical file of file
|
||||
* @author LoganDark
|
||||
*/
|
||||
private static File getCanonicalFileUnchecked(File file) {
|
||||
try {
|
||||
return file.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Stream<String> tabComplete(IArgConsumer consumer, File base0) throws CommandException {
|
||||
// I will not make the caller deal with this, seriously
|
||||
// Tab complete code is beautiful and I'm not going to bloat it with dumb ass checked exception bullshit -LoganDark
|
||||
|
||||
// lol owned -Brady
|
||||
|
||||
File base = getCanonicalFileUnchecked(base0);
|
||||
String currentPathStringThing = consumer.getString();
|
||||
Path currentPath = FileSystems.getDefault().getPath(currentPathStringThing);
|
||||
Path basePath = currentPath.isAbsolute() ? currentPath.getRoot() : base.toPath();
|
||||
boolean useParent = !currentPathStringThing.isEmpty() && !currentPathStringThing.endsWith(File.separator);
|
||||
File currentFile = currentPath.isAbsolute() ? currentPath.toFile() : new File(base, currentPathStringThing);
|
||||
return Stream.of(Objects.requireNonNull(getCanonicalFileUnchecked(
|
||||
useParent
|
||||
? currentFile.getParentFile()
|
||||
: currentFile
|
||||
).listFiles()))
|
||||
.map(f -> (currentPath.isAbsolute() ? f : basePath.relativize(f.toPath()).toString()) +
|
||||
(f.isDirectory() ? File.separator : ""))
|
||||
.filter(s -> s.toLowerCase(Locale.US).startsWith(currentPathStringThing.toLowerCase(Locale.US)))
|
||||
.filter(s -> !s.contains(" "));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static File gameDir() {
|
||||
return gameDir(Helper.mc);
|
||||
}
|
||||
|
||||
public static File gameDir(Minecraft mc) {
|
||||
File gameDir = mc.gameDir.getAbsoluteFile();
|
||||
if (gameDir.getName().equals(".")) {
|
||||
return gameDir.getParentFile();
|
||||
}
|
||||
return gameDir;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.pathing.goals.Goal;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.pathing.goals.GoalXZ;
|
||||
import baritone.api.pathing.goals.GoalYLevel;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeGoal implements IDatatypePost<Goal, BetterBlockPos> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public Goal apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = BetterBlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
|
||||
GoalBlock goalBlock = consumer.peekDatatypePostOrNull(RelativeGoalBlock.INSTANCE, origin);
|
||||
if (goalBlock != null) {
|
||||
return goalBlock;
|
||||
}
|
||||
|
||||
GoalXZ goalXZ = consumer.peekDatatypePostOrNull(RelativeGoalXZ.INSTANCE, origin);
|
||||
if (goalXZ != null) {
|
||||
return goalXZ;
|
||||
}
|
||||
|
||||
GoalYLevel goalYLevel = consumer.peekDatatypePostOrNull(RelativeGoalYLevel.INSTANCE, origin);
|
||||
if (goalYLevel != null) {
|
||||
return goalYLevel;
|
||||
}
|
||||
|
||||
// when the user doesn't input anything, default to the origin
|
||||
return new GoalBlock(origin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) {
|
||||
return ctx.getConsumer().tabCompleteDatatype(RelativeCoordinate.INSTANCE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeGoalBlock implements IDatatypePost<GoalBlock, BetterBlockPos> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public GoalBlock apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = BetterBlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
return new GoalBlock(
|
||||
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.x)),
|
||||
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.y)),
|
||||
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.z))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) {
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
if (consumer.hasAtMost(3)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.INSTANCE);
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
@@ -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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.pathing.goals.GoalXZ;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeGoalXZ implements IDatatypePost<GoalXZ, BetterBlockPos> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public GoalXZ apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = BetterBlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
return new GoalXZ(
|
||||
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.x)),
|
||||
MathHelper.floor(consumer.getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.z))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) {
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
if (consumer.hasAtMost(2)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.INSTANCE);
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
@@ -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.command.datatypes;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.pathing.goals.GoalYLevel;
|
||||
import baritone.api.utils.BetterBlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public enum RelativeGoalYLevel implements IDatatypePost<GoalYLevel, BetterBlockPos> {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public GoalYLevel apply(IDatatypeContext ctx, BetterBlockPos origin) throws CommandException {
|
||||
if (origin == null) {
|
||||
origin = BetterBlockPos.ORIGIN;
|
||||
}
|
||||
|
||||
return new GoalYLevel(
|
||||
MathHelper.floor(ctx.getConsumer().getDatatypePost(RelativeCoordinate.INSTANCE, (double) origin.y))
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> tabComplete(IDatatypeContext ctx) {
|
||||
final IArgConsumer consumer = ctx.getConsumer();
|
||||
if (consumer.hasAtMost(1)) {
|
||||
return consumer.tabCompleteDatatype(RelativeCoordinate.INSTANCE);
|
||||
}
|
||||
return Stream.empty();
|
||||
}
|
||||
}
|
||||
@@ -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.api.command.exception;
|
||||
|
||||
public abstract class CommandErrorMessageException extends CommandException {
|
||||
|
||||
protected CommandErrorMessageException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
|
||||
protected CommandErrorMessageException(String reason, Throwable cause) {
|
||||
super(reason, cause);
|
||||
}
|
||||
}
|
||||
@@ -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.api.command.exception;
|
||||
|
||||
public abstract class CommandException extends Exception implements ICommandException {
|
||||
|
||||
protected CommandException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
|
||||
protected CommandException(String reason, Throwable cause) {
|
||||
super(reason, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
|
||||
public abstract class CommandInvalidArgumentException extends CommandErrorMessageException {
|
||||
|
||||
public final ICommandArgument arg;
|
||||
|
||||
protected CommandInvalidArgumentException(ICommandArgument arg, String message) {
|
||||
super(formatMessage(arg, message));
|
||||
this.arg = arg;
|
||||
}
|
||||
|
||||
protected CommandInvalidArgumentException(ICommandArgument arg, String message, Throwable cause) {
|
||||
super(formatMessage(arg, message), cause);
|
||||
this.arg = arg;
|
||||
}
|
||||
|
||||
private static String formatMessage(ICommandArgument arg, String message) {
|
||||
return String.format(
|
||||
"Error at argument #%s: %s",
|
||||
arg.getIndex() == -1 ? "<unknown>" : Integer.toString(arg.getIndex() + 1),
|
||||
message
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
public class CommandInvalidStateException extends CommandErrorMessageException {
|
||||
|
||||
public CommandInvalidStateException(String reason) {
|
||||
super(reason);
|
||||
}
|
||||
}
|
||||
@@ -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.command.exception;
|
||||
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
|
||||
public class CommandInvalidTypeException extends CommandInvalidArgumentException {
|
||||
|
||||
public CommandInvalidTypeException(ICommandArgument arg, String expected) {
|
||||
super(arg, String.format("Expected %s", expected));
|
||||
}
|
||||
|
||||
public CommandInvalidTypeException(ICommandArgument arg, String expected, Throwable cause) {
|
||||
super(arg, String.format("Expected %s", expected), cause);
|
||||
}
|
||||
|
||||
public CommandInvalidTypeException(ICommandArgument arg, String expected, String got) {
|
||||
super(arg, String.format("Expected %s, but got %s instead", expected, got));
|
||||
}
|
||||
|
||||
public CommandInvalidTypeException(ICommandArgument arg, String expected, String got, Throwable cause) {
|
||||
super(arg, String.format("Expected %s, but got %s instead", expected, got), cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
public class CommandNoParserForTypeException extends CommandUnhandledException {
|
||||
|
||||
public CommandNoParserForTypeException(Class<?> klass) {
|
||||
super(String.format("Could not find a handler for type %s", klass.getSimpleName()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
public class CommandNotEnoughArgumentsException extends CommandErrorMessageException {
|
||||
|
||||
public CommandNotEnoughArgumentsException(int minArgs) {
|
||||
super(String.format("Not enough arguments (expected at least %d)", minArgs));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public class CommandNotFoundException extends CommandException {
|
||||
|
||||
public final String command;
|
||||
|
||||
public CommandNotFoundException(String command) {
|
||||
super(String.format("Command not found: %s", command));
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ICommand command, List<ICommandArgument> args) {
|
||||
HELPER.logDirect(getMessage());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.command.exception;
|
||||
|
||||
public class CommandTooManyArgumentsException extends CommandErrorMessageException {
|
||||
|
||||
public CommandTooManyArgumentsException(int maxArgs) {
|
||||
super(String.format("Too many arguments (expected at most %d)", maxArgs));
|
||||
}
|
||||
}
|
||||
@@ -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.command.exception;
|
||||
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
public class CommandUnhandledException extends RuntimeException implements ICommandException {
|
||||
|
||||
public CommandUnhandledException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CommandUnhandledException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(ICommand command, List<ICommandArgument> args) {
|
||||
HELPER.logDirect("An unhandled exception occurred. " +
|
||||
"The error is in your game's log, please report this at https://github.com/cabaletta/baritone/issues",
|
||||
TextFormatting.RED);
|
||||
|
||||
this.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -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.command.exception;
|
||||
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static baritone.api.utils.Helper.HELPER;
|
||||
|
||||
/**
|
||||
* The base for a Baritone Command Exception, checked or unchecked. Provides a
|
||||
* {@link #handle(ICommand, List)} method that is used to provide useful output
|
||||
* to the user for diagnosing issues that may have occurred during execution.
|
||||
* <p>
|
||||
* Anything implementing this interface should be assignable to {@link Exception}.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 9/20/2019
|
||||
*/
|
||||
public interface ICommandException {
|
||||
|
||||
/**
|
||||
* @return The exception details
|
||||
* @see Exception#getMessage()
|
||||
*/
|
||||
String getMessage();
|
||||
|
||||
/**
|
||||
* Called when this exception is thrown, to handle the exception.
|
||||
*
|
||||
* @param command The command that threw it.
|
||||
* @param args The arguments the command was called with.
|
||||
*/
|
||||
default void handle(ICommand command, List<ICommandArgument> args) {
|
||||
HELPER.logDirect(this.getMessage(), TextFormatting.RED);
|
||||
}
|
||||
}
|
||||
184
src/api/java/baritone/api/command/helpers/Paginator.java
Normal file
184
src/api/java/baritone/api/command/helpers/Paginator.java
Normal file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* 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.command.helpers;
|
||||
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.exception.CommandException;
|
||||
import baritone.api.command.exception.CommandInvalidTypeException;
|
||||
import baritone.api.utils.Helper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.event.ClickEvent;
|
||||
import net.minecraft.util.text.event.HoverEvent;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Paginator<E> implements Helper {
|
||||
|
||||
public final List<E> entries;
|
||||
public int pageSize = 8;
|
||||
public int page = 1;
|
||||
|
||||
public Paginator(List<E> entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public Paginator(E... entries) {
|
||||
this.entries = Arrays.asList(entries);
|
||||
}
|
||||
|
||||
public Paginator<E> setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMaxPage() {
|
||||
return (entries.size() - 1) / pageSize + 1;
|
||||
}
|
||||
|
||||
public boolean validPage(int page) {
|
||||
return page > 0 && page <= getMaxPage();
|
||||
}
|
||||
|
||||
public Paginator<E> skipPages(int pages) {
|
||||
page += pages;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void display(Function<E, ITextComponent> transform, String commandPrefix) {
|
||||
int offset = (page - 1) * pageSize;
|
||||
for (int i = offset; i < offset + pageSize; i++) {
|
||||
if (i < entries.size()) {
|
||||
logDirect(transform.apply(entries.get(i)));
|
||||
} else {
|
||||
logDirect("--", TextFormatting.DARK_GRAY);
|
||||
}
|
||||
}
|
||||
boolean hasPrevPage = commandPrefix != null && validPage(page - 1);
|
||||
boolean hasNextPage = commandPrefix != null && validPage(page + 1);
|
||||
ITextComponent prevPageComponent = new TextComponentString("<<");
|
||||
if (hasPrevPage) {
|
||||
prevPageComponent.getStyle()
|
||||
.setClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format("%s %d", commandPrefix, page - 1)
|
||||
))
|
||||
.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponentString("Click to view previous page")
|
||||
));
|
||||
} else {
|
||||
prevPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||
}
|
||||
ITextComponent nextPageComponent = new TextComponentString(">>");
|
||||
if (hasNextPage) {
|
||||
nextPageComponent.getStyle()
|
||||
.setClickEvent(new ClickEvent(
|
||||
ClickEvent.Action.RUN_COMMAND,
|
||||
String.format("%s %d", commandPrefix, page + 1)
|
||||
))
|
||||
.setHoverEvent(new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new TextComponentString("Click to view next page")
|
||||
));
|
||||
} else {
|
||||
nextPageComponent.getStyle().setColor(TextFormatting.DARK_GRAY);
|
||||
}
|
||||
ITextComponent pagerComponent = new TextComponentString("");
|
||||
pagerComponent.getStyle().setColor(TextFormatting.GRAY);
|
||||
pagerComponent.appendSibling(prevPageComponent);
|
||||
pagerComponent.appendText(" | ");
|
||||
pagerComponent.appendSibling(nextPageComponent);
|
||||
pagerComponent.appendText(String.format(" %d/%d", page, getMaxPage()));
|
||||
logDirect(pagerComponent);
|
||||
}
|
||||
|
||||
public void display(Function<E, ITextComponent> transform) {
|
||||
display(transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, Paginator<T> pagi, Runnable pre, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
int page = 1;
|
||||
consumer.requireMax(1);
|
||||
if (consumer.hasAny()) {
|
||||
page = consumer.getAs(Integer.class);
|
||||
if (!pagi.validPage(page)) {
|
||||
throw new CommandInvalidTypeException(
|
||||
consumer.consumed(),
|
||||
String.format(
|
||||
"a valid page (1-%d)",
|
||||
pagi.getMaxPage()
|
||||
),
|
||||
consumer.consumed().getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
pagi.skipPages(page - pagi.page);
|
||||
if (pre != null) {
|
||||
pre.run();
|
||||
}
|
||||
pagi.display(transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, List<T> elems, Runnable pre, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
paginate(consumer, new Paginator<>(elems), pre, transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, T[] elems, Runnable pre, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
paginate(consumer, Arrays.asList(elems), pre, transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, Paginator<T> pagi, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
paginate(consumer, pagi, null, transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, List<T> elems, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
paginate(consumer, new Paginator<>(elems), null, transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, T[] elems, Function<T, ITextComponent> transform, String commandPrefix) throws CommandException {
|
||||
paginate(consumer, Arrays.asList(elems), null, transform, commandPrefix);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, Paginator<T> pagi, Runnable pre, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, pagi, pre, transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, List<T> elems, Runnable pre, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, new Paginator<>(elems), pre, transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, T[] elems, Runnable pre, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, Arrays.asList(elems), pre, transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, Paginator<T> pagi, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, pagi, null, transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, List<T> elems, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, new Paginator<>(elems), null, transform, null);
|
||||
}
|
||||
|
||||
public static <T> void paginate(IArgConsumer consumer, T[] elems, Function<T, ITextComponent> transform) throws CommandException {
|
||||
paginate(consumer, Arrays.asList(elems), null, transform, null);
|
||||
}
|
||||
}
|
||||
287
src/api/java/baritone/api/command/helpers/TabCompleteHelper.java
Normal file
287
src/api/java/baritone/api/command/helpers/TabCompleteHelper.java
Normal file
@@ -0,0 +1,287 @@
|
||||
/*
|
||||
* 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.command.helpers;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.Settings;
|
||||
import baritone.api.command.argument.IArgConsumer;
|
||||
import baritone.api.command.manager.ICommandManager;
|
||||
import baritone.api.event.events.TabCompleteEvent;
|
||||
import baritone.api.utils.SettingsUtil;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* The {@link TabCompleteHelper} is a <b>single-use</b> object that helps you handle tab completion. It includes helper
|
||||
* methods for appending and prepending streams, sorting, filtering by prefix, and so on.
|
||||
* <p>
|
||||
* The recommended way to use this class is:
|
||||
* <ul>
|
||||
* <li>Create a new instance with the empty constructor</li>
|
||||
* <li>Use {@code append}, {@code prepend} or {@code add<something>} methods to add completions</li>
|
||||
* <li>Sort using {@link #sort(Comparator)} or {@link #sortAlphabetically()} and then filter by prefix using
|
||||
* {@link #filterPrefix(String)}</li>
|
||||
* <li>Get the stream using {@link #stream()}</li>
|
||||
* <li>Pass it up to whatever's calling your tab complete function (i.e.
|
||||
* {@link ICommandManager#tabComplete(String)} or {@link IArgConsumer}#tabCompleteDatatype(IDatatype)})</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* For advanced users: if you're intercepting {@link TabCompleteEvent}s directly, use {@link #build()} instead for an
|
||||
* array.
|
||||
*/
|
||||
public class TabCompleteHelper {
|
||||
|
||||
private Stream<String> stream;
|
||||
|
||||
public TabCompleteHelper(String[] base) {
|
||||
stream = Stream.of(base);
|
||||
}
|
||||
|
||||
public TabCompleteHelper(List<String> base) {
|
||||
stream = base.stream();
|
||||
}
|
||||
|
||||
public TabCompleteHelper() {
|
||||
stream = Stream.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified stream to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param source The stream to append
|
||||
* @return This {@link TabCompleteHelper} after having appended the stream
|
||||
* @see #append(String...)
|
||||
* @see #append(Class)
|
||||
*/
|
||||
public TabCompleteHelper append(Stream<String> source) {
|
||||
stream = Stream.concat(stream, source);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified strings to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param source The stream to append
|
||||
* @return This {@link TabCompleteHelper} after having appended the strings
|
||||
* @see #append(Stream)
|
||||
* @see #append(Class)
|
||||
*/
|
||||
public TabCompleteHelper append(String... source) {
|
||||
return append(Stream.of(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends all values of the specified enum to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param num The enum to append the values of
|
||||
* @return This {@link TabCompleteHelper} after having appended the values
|
||||
* @see #append(Stream)
|
||||
* @see #append(String...)
|
||||
*/
|
||||
public TabCompleteHelper append(Class<? extends Enum<?>> num) {
|
||||
return append(
|
||||
Stream.of(num.getEnumConstants())
|
||||
.map(Enum::name)
|
||||
.map(String::toLowerCase)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepends the specified stream to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param source The stream to prepend
|
||||
* @return This {@link TabCompleteHelper} after having prepended the stream
|
||||
* @see #prepend(String...)
|
||||
* @see #prepend(Class)
|
||||
*/
|
||||
public TabCompleteHelper prepend(Stream<String> source) {
|
||||
stream = Stream.concat(source, stream);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepends the specified strings to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param source The stream to prepend
|
||||
* @return This {@link TabCompleteHelper} after having prepended the strings
|
||||
* @see #prepend(Stream)
|
||||
* @see #prepend(Class)
|
||||
*/
|
||||
public TabCompleteHelper prepend(String... source) {
|
||||
return prepend(Stream.of(source));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepends all values of the specified enum to this {@link TabCompleteHelper} and returns it for chaining
|
||||
*
|
||||
* @param num The enum to prepend the values of
|
||||
* @return This {@link TabCompleteHelper} after having prepended the values
|
||||
* @see #prepend(Stream)
|
||||
* @see #prepend(String...)
|
||||
*/
|
||||
public TabCompleteHelper prepend(Class<? extends Enum<?>> num) {
|
||||
return prepend(
|
||||
Stream.of(num.getEnumConstants())
|
||||
.map(Enum::name)
|
||||
.map(String::toLowerCase)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the specified {@code transform} to every element <b>currently</b> in this {@link TabCompleteHelper} and
|
||||
* return this object for chaining
|
||||
*
|
||||
* @param transform The transform to apply
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper map(Function<String, String> transform) {
|
||||
stream = stream.map(transform);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the specified {@code filter} to every element <b>currently</b> in this {@link TabCompleteHelper} and return
|
||||
* this object for chaining
|
||||
*
|
||||
* @param filter The filter to apply
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper filter(Predicate<String> filter) {
|
||||
stream = stream.filter(filter);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the specified {@code sort} to every element <b>currently</b> in this {@link TabCompleteHelper} and return
|
||||
* this object for chaining
|
||||
*
|
||||
* @param comparator The comparator to use
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper sort(Comparator<String> comparator) {
|
||||
stream = stream.sorted(comparator);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort every element <b>currently</b> in this {@link TabCompleteHelper} alphabetically and return this object for
|
||||
* chaining
|
||||
*
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper sortAlphabetically() {
|
||||
return sort(String.CASE_INSENSITIVE_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out any element that doesn't start with {@code prefix} and return this object for chaining
|
||||
*
|
||||
* @param prefix The prefix to filter for
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper filterPrefix(String prefix) {
|
||||
return filter(x -> x.toLowerCase(Locale.US).startsWith(prefix.toLowerCase(Locale.US)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter out any element that doesn't start with {@code prefix} and return this object for chaining
|
||||
* <p>
|
||||
* Assumes every element in this {@link TabCompleteHelper} is a {@link ResourceLocation}
|
||||
*
|
||||
* @param prefix The prefix to filter for
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper filterPrefixNamespaced(String prefix) {
|
||||
return filterPrefix(new ResourceLocation(prefix).toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return An array containing every element in this {@link TabCompleteHelper}
|
||||
* @see #stream()
|
||||
*/
|
||||
public String[] build() {
|
||||
return stream.toArray(String[]::new);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A stream containing every element in this {@link TabCompleteHelper}
|
||||
* @see #build()
|
||||
*/
|
||||
public Stream<String> stream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends every command in the specified {@link ICommandManager} to this {@link TabCompleteHelper}
|
||||
*
|
||||
* @param manager A command manager
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper addCommands(ICommandManager manager) {
|
||||
return append(manager.getRegistry().descendingStream()
|
||||
.flatMap(command -> command.getNames().stream())
|
||||
.distinct()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends every setting in the {@link Settings} to this {@link TabCompleteHelper}
|
||||
*
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper addSettings() {
|
||||
return append(
|
||||
BaritoneAPI.getSettings().allSettings.stream()
|
||||
.filter(s -> !s.isJavaOnly())
|
||||
.map(Settings.Setting::getName)
|
||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends every modified setting in the {@link Settings} to this {@link TabCompleteHelper}
|
||||
*
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper addModifiedSettings() {
|
||||
return append(
|
||||
SettingsUtil.modifiedSettings(BaritoneAPI.getSettings()).stream()
|
||||
.map(Settings.Setting::getName)
|
||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends every {@link Boolean} setting in the {@link Settings} to this {@link TabCompleteHelper}
|
||||
*
|
||||
* @return This {@link TabCompleteHelper}
|
||||
*/
|
||||
public TabCompleteHelper addToggleableSettings() {
|
||||
return append(
|
||||
BaritoneAPI.getSettings().getAllValuesByType(Boolean.class).stream()
|
||||
.map(Settings.Setting::getName)
|
||||
.sorted(String.CASE_INSENSITIVE_ORDER)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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.command.manager;
|
||||
|
||||
import baritone.api.IBaritone;
|
||||
import baritone.api.command.ICommand;
|
||||
import baritone.api.command.argument.ICommandArgument;
|
||||
import baritone.api.command.registry.Registry;
|
||||
import net.minecraft.util.Tuple;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 9/21/2019
|
||||
*/
|
||||
public interface ICommandManager {
|
||||
|
||||
IBaritone getBaritone();
|
||||
|
||||
Registry<ICommand> getRegistry();
|
||||
|
||||
/**
|
||||
* @param name The command name to search for.
|
||||
* @return The command, if found.
|
||||
*/
|
||||
ICommand getCommand(String name);
|
||||
|
||||
boolean execute(String string);
|
||||
|
||||
boolean execute(Tuple<String, List<ICommandArgument>> expanded);
|
||||
|
||||
Stream<String> tabComplete(Tuple<String, List<ICommandArgument>> expanded);
|
||||
|
||||
Stream<String> tabComplete(String prefix);
|
||||
}
|
||||
135
src/api/java/baritone/api/command/registry/Registry.java
Normal file
135
src/api/java/baritone/api/command/registry/Registry.java
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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.command.registry;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* This registry class allows for registration and unregistration of a certain type. This is mainly designed for use by
|
||||
* event handlers where newly registered ones are encountered first during iteration and can therefore override older
|
||||
* ones. In Baritone, this is used for commands and argument parsers so that mods and addons can extend Baritone's
|
||||
* functionality without resorting to hacks, wrappers, or mixins.
|
||||
*
|
||||
* @param <V> The entry type that will be stored in this registry. This can be anything, really - preferably anything
|
||||
* that works as a HashMap key, as that's what's used to keep track of which entries are registered or not.
|
||||
*/
|
||||
public class Registry<V> {
|
||||
|
||||
/**
|
||||
* An internal linked list of all the entries that are currently registered. This is a linked list so that entries
|
||||
* can be inserted at the beginning, which means that newer entries are encountered first during iteration. This is
|
||||
* an important property of the registry that makes it more useful than a simple list, and also the reason it does
|
||||
* not just use a map.
|
||||
*/
|
||||
private final Deque<V> _entries = new LinkedList<>();
|
||||
/**
|
||||
* A HashSet containing every entry currently registered. Entries are added to this set when something is registered
|
||||
* and removed from the set when they are unregistered. An entry being present in this set indicates that it is
|
||||
* currently registered, can be removed, and should not be reregistered until it is removed.
|
||||
*/
|
||||
private final Set<V> registered = new HashSet<>();
|
||||
/**
|
||||
* The collection of entries that are currently in this registry. This is a collection (and not a list) because,
|
||||
* internally, entries are stored in a linked list, which is not the same as a normal list.
|
||||
*/
|
||||
public final Collection<V> entries = Collections.unmodifiableCollection(_entries);
|
||||
|
||||
/**
|
||||
* @param entry The entry to check.
|
||||
* @return If this entry is currently registered in this registry.
|
||||
*/
|
||||
public boolean registered(V entry) {
|
||||
return registered.contains(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the entry {@code entry} is registered.
|
||||
*
|
||||
* @param entry The entry to register.
|
||||
* @return A boolean indicating whether or not this is a new registration. No matter the value of this boolean, the
|
||||
* entry is always guaranteed to now be in this registry. This boolean simply indicates if the entry was <i>not</i>
|
||||
* in the map prior to this method call.
|
||||
*/
|
||||
public boolean register(V entry) {
|
||||
if (!registered(entry)) {
|
||||
_entries.addFirst(entry);
|
||||
registered.add(entry);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this entry from this registry. After this method call, the entry is guaranteed to be removed from the
|
||||
* registry, since each entry only ever appears once.
|
||||
*
|
||||
* @param entry The entry to unregister.
|
||||
*/
|
||||
public void unregister(V entry) {
|
||||
if (!registered(entry)) {
|
||||
return;
|
||||
}
|
||||
_entries.remove(entry);
|
||||
registered.remove(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over each entry in this registry, with the newest elements iterated over first.
|
||||
* Internally, as new elements are prepended to the registry rather than appended to the end, this order is the best
|
||||
* way to search through the registry if you want to discover newer items first.
|
||||
*/
|
||||
public Iterator<V> iterator() {
|
||||
return _entries.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator that iterates over each entry in this registry, in the order they were added. Internally,
|
||||
* this iterates through the registry backwards, as new elements are prepended to the registry rather than appended
|
||||
* to the end. You should only do this when you need to, for example, list elements in order - it is almost always
|
||||
* fine to simply use {@link Iterable#forEach(Consumer) forEach} on the {@link #entries} collection instead.
|
||||
*/
|
||||
public Iterator<V> descendingIterator() {
|
||||
return _entries.descendingIterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream that contains each entry in this registry, with the newest elements ordered first. Internally,
|
||||
* as new elements are prepended to the registry rather than appended to the end, this order is the best way to
|
||||
* search through the registry if you want to discover newer items first.
|
||||
*/
|
||||
public Stream<V> stream() {
|
||||
return _entries.stream();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a stream that returns each entry in this registry, in the order they were added. Internally, this orders
|
||||
* the registry backwards, as new elements are prepended to the registry rather than appended to the end. You should
|
||||
* only use this when you need to, for example, list elements in order - it is almost always fine to simply use the
|
||||
* regular {@link #stream()} method instead.
|
||||
*/
|
||||
public Stream<V> descendingStream() {
|
||||
return StreamSupport.stream(Spliterators.spliterator(
|
||||
descendingIterator(),
|
||||
_entries.size(),
|
||||
Spliterator.SIZED | Spliterator.SUBSIZED
|
||||
), false);
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ package baritone.api.event.events;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
* Called when the local player interacts with a block, can be either {@link Type#BREAK} or {@link Type#USE}.
|
||||
* Called when the local player interacts with a block, can be either {@link Type#START_BREAK} or {@link Type#USE}.
|
||||
*
|
||||
* @author Brady
|
||||
* @since 8/22/2018
|
||||
@@ -59,9 +59,9 @@ public final class BlockInteractEvent {
|
||||
public enum Type {
|
||||
|
||||
/**
|
||||
* We're breaking the target block.
|
||||
* We're starting to break the target block.
|
||||
*/
|
||||
BREAK,
|
||||
START_BREAK,
|
||||
|
||||
/**
|
||||
* We're right clicking on the target block. Either placing or interacting with.
|
||||
|
||||
@@ -17,22 +17,20 @@
|
||||
|
||||
package baritone.api.event.events;
|
||||
|
||||
import baritone.api.event.events.type.ManagedPlayerEvent;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import baritone.api.event.events.type.Cancellable;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 8/1/2018 6:39 PM
|
||||
* @since 8/1/2018
|
||||
*/
|
||||
public final class ChatEvent extends ManagedPlayerEvent.Cancellable {
|
||||
public final class ChatEvent extends Cancellable {
|
||||
|
||||
/**
|
||||
* The message being sent
|
||||
*/
|
||||
private final String message;
|
||||
|
||||
public ChatEvent(EntityPlayerSP player, String message) {
|
||||
super(player);
|
||||
public ChatEvent(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.network.Packet;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 8/6/2018 9:31 PM
|
||||
* @since 8/6/2018
|
||||
*/
|
||||
public final class PacketEvent {
|
||||
|
||||
|
||||
@@ -18,22 +18,19 @@
|
||||
package baritone.api.event.events;
|
||||
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import baritone.api.event.events.type.ManagedPlayerEvent;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 8/21/2018
|
||||
*/
|
||||
public final class PlayerUpdateEvent extends ManagedPlayerEvent {
|
||||
public final class PlayerUpdateEvent {
|
||||
|
||||
/**
|
||||
* The state of the event
|
||||
*/
|
||||
private final EventState state;
|
||||
|
||||
public PlayerUpdateEvent(EntityPlayerSP player, EventState state) {
|
||||
super(player);
|
||||
public PlayerUpdateEvent(EventState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
|
||||
package baritone.api.event.events;
|
||||
|
||||
import baritone.api.event.events.type.EventState;
|
||||
import baritone.api.event.events.type.ManagedPlayerEvent;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import baritone.api.utils.Rotation;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
@@ -27,35 +25,72 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
* @author Brady
|
||||
* @since 8/21/2018
|
||||
*/
|
||||
public final class RotationMoveEvent extends ManagedPlayerEvent {
|
||||
public final class RotationMoveEvent {
|
||||
|
||||
/**
|
||||
* The type of event
|
||||
*/
|
||||
private final Type type;
|
||||
|
||||
/**
|
||||
* The state of the event
|
||||
*/
|
||||
private final EventState state;
|
||||
private final Rotation original;
|
||||
|
||||
public RotationMoveEvent(EntityPlayerSP player, EventState state, Type type) {
|
||||
super(player);
|
||||
this.state = state;
|
||||
/**
|
||||
* The yaw rotation
|
||||
*/
|
||||
private float yaw;
|
||||
|
||||
/**
|
||||
* The pitch rotation
|
||||
*/
|
||||
private float pitch;
|
||||
|
||||
public RotationMoveEvent(Type type, float yaw, float pitch) {
|
||||
this.type = type;
|
||||
this.original = new Rotation(yaw, pitch);
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
public Rotation getOriginal() {
|
||||
return this.original;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The state of the event
|
||||
* Set the yaw movement rotation
|
||||
*
|
||||
* @param yaw Yaw rotation
|
||||
*/
|
||||
public final EventState getState() {
|
||||
return this.state;
|
||||
public void setYaw(float yaw) {
|
||||
this.yaw = yaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The yaw rotation
|
||||
*/
|
||||
public float getYaw() {
|
||||
return this.yaw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the pitch movement rotation
|
||||
*
|
||||
* @param pitch Pitch rotation
|
||||
*/
|
||||
public void setPitch(float pitch) {
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The pitch rotation
|
||||
*/
|
||||
public float getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The type of the event
|
||||
*/
|
||||
public final Type getType() {
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
|
||||
35
src/api/java/baritone/api/event/events/SprintStateEvent.java
Normal file
35
src/api/java/baritone/api/event/events/SprintStateEvent.java
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of Baritone.
|
||||
*
|
||||
* Baritone is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Baritone is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Baritone. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package baritone.api.event.events;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
* @since 1/18/2019
|
||||
*/
|
||||
public final class SprintStateEvent {
|
||||
|
||||
private Boolean state;
|
||||
|
||||
public final void setState(boolean state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public final Boolean getState() {
|
||||
return this.state;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user