mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-27 12:36:24 -04:00
Compare commits
989
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78dfb30759 | ||
|
|
db10ae2183 | ||
|
|
548b8522a8 | ||
|
|
4791b146dc | ||
|
|
b7a9931393 | ||
|
|
9a35a11440 | ||
|
|
6d4a50cee2 | ||
|
|
818a637897 | ||
|
|
4c96ab9b28 | ||
|
|
d5a316b9ae | ||
|
|
87e32f0e9b | ||
|
|
53372e5400 | ||
|
|
2fbb1f354c | ||
|
|
bf06476558 | ||
|
|
2e3a742477 | ||
|
|
94c7542d2c | ||
|
|
fa2b6b5996 | ||
|
|
8e77dc70f6 | ||
|
|
51e3748adb | ||
|
|
d8cf2701c7 | ||
|
|
31b7c83369 | ||
|
|
a170123e2c | ||
|
|
c3c17a228e | ||
|
|
41d607ad56 | ||
|
|
58b3596948 | ||
|
|
ed4456d756 | ||
|
|
481734e6b1 | ||
|
|
636792fa1f | ||
|
|
ad65002b19 | ||
|
|
903f3b6d5a | ||
|
|
4456743e97 | ||
|
|
d0989e5ece | ||
|
|
ce3f703de2 | ||
|
|
180229db61 | ||
|
|
b6e10c016e | ||
|
|
8ed68742df | ||
|
|
ce09236dab | ||
|
|
0bb968dd73 | ||
|
|
f3d4cb34e0 | ||
|
|
16aa930735 | ||
|
|
55733e8ad5 | ||
|
|
67591efdad | ||
|
|
5d300c8157 | ||
|
|
3b6e1bd429 | ||
|
|
c77198a845 | ||
|
|
bd32c07cc1 | ||
|
|
1eb7354fc0 | ||
|
|
52ad6a3250 | ||
|
|
aa57bbbf34 | ||
|
|
26278eeb46 | ||
|
|
99cfc4f147 | ||
|
|
89281a1f6d | ||
|
|
ad044fb05c | ||
|
|
7088ce3828 | ||
|
|
fc6a712906 | ||
|
|
1d0397c399 | ||
|
|
8ad443a4c5 | ||
|
|
0d1f9a0093 | ||
|
|
7587344cb4 | ||
|
|
f0926d7524 | ||
|
|
7c3b17d841 | ||
|
|
263e3cd79f | ||
|
|
2ba8062915 | ||
|
|
edc298bf64 | ||
|
|
aa1158fcfe | ||
|
|
ab40ae81c4 | ||
|
|
b5df1878ed | ||
|
|
800965cb40 | ||
|
|
b00f1d9352 | ||
|
|
a588cfadf8 | ||
|
|
2eb4062f67 | ||
|
|
43321d8872 | ||
|
|
a5ea584b75 | ||
|
|
6a9edc2e67 | ||
|
|
12377deff7 | ||
|
|
583377d39b | ||
|
|
2c1da8df06 | ||
|
|
737ddd973b | ||
|
|
d749b04261 | ||
|
|
93deb3a669 | ||
|
|
dca45a95e9 | ||
|
|
0412f16460 | ||
|
|
efd4a72287 | ||
|
|
a62e5a6571 | ||
|
|
0ec337ee6c | ||
|
|
76df0a429d | ||
|
|
08ea9378de | ||
|
|
c2bd21ab96 | ||
|
|
5db8ccfad4 | ||
|
|
aa206d386a | ||
|
|
bba8a12a2a | ||
|
|
a235af6c01 | ||
|
|
a666a74a32 | ||
|
|
c285120ff4 | ||
|
|
dbd2890120 | ||
|
|
a5db46cdc5 | ||
|
|
765cf9b96a | ||
|
|
efe7952869 | ||
|
|
9e434de285 | ||
|
|
712fe2c250 | ||
|
|
5db5a2ed35 | ||
|
|
49c96e6fc8 | ||
|
|
d56c9a3f5a | ||
|
|
6c4c973ed8 | ||
|
|
a117303147 | ||
|
|
dbf248a508 | ||
|
|
56d75b14fa | ||
|
|
87311e2d7d | ||
|
|
1b525ca3a5 | ||
|
|
78ec9d3723 | ||
|
|
afa5d22c8e | ||
|
|
1cdf664dce | ||
|
|
bd63fb686d | ||
|
|
0f9a422d44 | ||
|
|
32d18b47f9 | ||
|
|
c618bf95fa | ||
|
|
18a8aa12d1 | ||
|
|
308ca6369d | ||
|
|
79fd9f4e04 | ||
|
|
38219bbca2 | ||
|
|
87de288777 | ||
|
|
b6f1d6c62e | ||
|
|
a7bd70e334 | ||
|
|
43310d3a3b | ||
|
|
d12bdc3745 | ||
|
|
08c8623951 | ||
|
|
6ae375cf4e | ||
|
|
29c65c18ff | ||
|
|
b90384fe08 | ||
|
|
d2ff7e3748 | ||
|
|
ea6452287b | ||
|
|
b1f7731563 | ||
|
|
5ad881235f | ||
|
|
05796998e8 | ||
|
|
aaf1aad9a4 | ||
|
|
b315fdcadc | ||
|
|
5b95f0a1c7 | ||
|
|
7641a839c2 | ||
|
|
6ed6ca6937 | ||
|
|
be106a465e | ||
|
|
e7c0374c83 | ||
|
|
7fd1a443ac | ||
|
|
31359077ed | ||
|
|
7f683bd618 | ||
|
|
012f15878e | ||
|
|
2ea5eb2823 | ||
|
|
f406b9695d | ||
|
|
f6dbe40246 | ||
|
|
a1f6e47f42 | ||
|
|
04f5dbfca0 | ||
|
|
fd940b5549 | ||
|
|
3e37c1af32 | ||
|
|
8b6b9ffede | ||
|
|
329a13867c | ||
|
|
e109b0fc9f | ||
|
|
5de7f96fef | ||
|
|
5c6632c3fb | ||
|
|
ebde125895 | ||
|
|
c45c74c508 | ||
|
|
cd6bc23825 | ||
|
|
3df95df1f9 | ||
|
|
ad3ee75c22 | ||
|
|
ce3935950a | ||
|
|
e1380df7d1 | ||
|
|
cf8cfb8dad | ||
|
|
3729728124 | ||
|
|
1f62f447b5 | ||
|
|
3092abfdd0 | ||
|
|
3150f33e9e | ||
|
|
40d7e7bccb | ||
|
|
cdbe61843f | ||
|
|
b13c168347 | ||
|
|
f77fa82e4f | ||
|
|
2e2b10311d | ||
|
|
2af5de8ce4 | ||
|
|
674e1df96d | ||
|
|
a4a2ae6133 | ||
|
|
66eea576f3 | ||
|
|
53a516266f | ||
|
|
f732442133 | ||
|
|
34cad13f57 | ||
|
|
e879a755a4 | ||
|
|
2ac9c827d4 | ||
|
|
a0ef46a18c | ||
|
|
9dc15c9096 | ||
|
|
346e2cd094 | ||
|
|
f7794d50dd | ||
|
|
3b8d67ce64 | ||
|
|
105d3a7d90 | ||
|
|
8a685cefc0 | ||
|
|
3ff536dc02 | ||
|
|
638ec03244 | ||
|
|
37438c9fdd | ||
|
|
cbc4b52193 | ||
|
|
9a760d8eae | ||
|
|
b7d26d99cd | ||
|
|
04c8b1e95b | ||
|
|
e4149b2a5e | ||
|
|
b446af166d | ||
|
|
3cdaa513f8 | ||
|
|
75e0da38c4 | ||
|
|
ca43fcf3a2 | ||
|
|
4f71e11383 | ||
|
|
5b56a5758a | ||
|
|
424889e820 | ||
|
|
6d3f00cd58 | ||
|
|
1d375bdffa | ||
|
|
e563bbee49 | ||
|
|
e2ccb20402 | ||
|
|
8fe2dc8304 | ||
|
|
4ddc167254 | ||
|
|
e3502ec320 | ||
|
|
d8d0ade350 | ||
|
|
e2ac4449b3 | ||
|
|
ecec7ccee3 | ||
|
|
228282f083 | ||
|
|
3bc7d39800 | ||
|
|
3dc5873642 | ||
|
|
a5c3d2f800 | ||
|
|
00d2bbbe42 | ||
|
|
8d6291c4c2 | ||
|
|
2b77d030e8 | ||
|
|
029927af6a | ||
|
|
bf791dc4d1 | ||
|
|
56ad481304 | ||
|
|
cc7a9ae44a | ||
|
|
664f79f3a7 | ||
|
|
9a2ed78b0d | ||
|
|
558907eb5c | ||
|
|
370b689ab4 | ||
|
|
e2740babc5 | ||
|
|
3393ab17d8 | ||
|
|
645029a9c7 | ||
|
|
f168744ccd | ||
|
|
67210cb5f9 | ||
|
|
779fbb4f38 | ||
|
|
ce04f546e7 | ||
|
|
a36437ea16 | ||
|
|
aa5af84283 | ||
|
|
e3031d2618 | ||
|
|
9e44ba1fb1 | ||
|
|
1af66d4175 | ||
|
|
144213cee8 | ||
|
|
cc95b4450e | ||
|
|
4bda306a3b | ||
|
|
2ee556dc31 | ||
|
|
4457df9aba | ||
|
|
6dfb073242 | ||
|
|
e1bd0d688f | ||
|
|
0bce2d8645 | ||
|
|
dfe240f1d3 | ||
|
|
f1ac0fe99f | ||
|
|
c2f575bf22 | ||
|
|
5f76966678 | ||
|
|
beddea1ecb | ||
|
|
04236fcf33 | ||
|
|
05e87b7faf | ||
|
|
e9d298834a | ||
|
|
ce113cbb80 | ||
|
|
61ebe7124a | ||
|
|
462c0b35b8 | ||
|
|
0b55c88ec4 | ||
|
|
942da6b2f6 | ||
|
|
224c38e0a7 | ||
|
|
056917f7df | ||
|
|
2aa9379987 | ||
|
|
3a6a3253a3 | ||
|
|
1580a06a8e | ||
|
|
e2bfdd3e76 | ||
|
|
1d24565aa6 | ||
|
|
2d80402688 | ||
|
|
40b351a303 | ||
|
|
dc32bd1845 | ||
|
|
a096485155 | ||
|
|
f1ae7c4476 | ||
|
|
bcfac2f68a | ||
|
|
ff1902770c | ||
|
|
ebb01d4fcc | ||
|
|
20614b6b07 | ||
|
|
b32b5a66a4 | ||
|
|
ad92804fce | ||
|
|
ca93955134 | ||
|
|
01d99676f9 | ||
|
|
2c8fd29cf1 | ||
|
|
a9eec5f568 | ||
|
|
e54eaa728b | ||
|
|
4e550151e5 | ||
|
|
67f5259742 | ||
|
|
eb783e13ba | ||
|
|
68237e7161 | ||
|
|
ec9f7665e2 | ||
|
|
f19ae0120e | ||
|
|
d674ff1d40 | ||
|
|
37d6f58536 | ||
|
|
2ce23e072d | ||
|
|
d37dfee032 | ||
|
|
ee567a63b6 | ||
|
|
868dd9cc44 | ||
|
|
3f9b0002a9 | ||
|
|
e07b15c8fc | ||
|
|
44c5c21fb5 | ||
|
|
9d13e86487 | ||
|
|
afa395cfeb | ||
|
|
831903b8e3 | ||
|
|
d382f48e2d | ||
|
|
2b2b44a535 | ||
|
|
ac9d85929e | ||
|
|
88c981bd6a | ||
|
|
f0baa21b1f | ||
|
|
1d5d78b953 | ||
|
|
2a62b49eab | ||
|
|
f771248936 | ||
|
|
35850ea996 | ||
|
|
caaccf0e67 | ||
|
|
e5de8bd26f | ||
|
|
9528d375f4 | ||
|
|
9aac7dc8e3 | ||
|
|
0bebd2a71e | ||
|
|
55874e6a84 | ||
|
|
cda0e10524 | ||
|
|
153f888cf5 | ||
|
|
6972b7d49d | ||
|
|
d7f442e2d0 | ||
|
|
cc15c0a487 | ||
|
|
a37828e288 | ||
|
|
91d00cb864 | ||
|
|
4ee628ea7a | ||
|
|
64c0001aff | ||
|
|
320b2ff528 | ||
|
|
cf8a1f5447 | ||
|
|
696d98f7cd | ||
|
|
909b90aea1 | ||
|
|
04296ae04e | ||
|
|
025dea4201 | ||
|
|
0b392c66eb | ||
|
|
5733074bd8 | ||
|
|
a0630ff738 | ||
|
|
5b5de641cb | ||
|
|
5a8101e535 | ||
|
|
054c841ec7 | ||
|
|
b02ac04fe3 | ||
|
|
57b4159691 | ||
|
|
41e3b61657 | ||
|
|
f48cd648fc | ||
|
|
76c457dcbc | ||
|
|
cae828dc48 | ||
|
|
39aa9d3ff1 | ||
|
|
43d4b127ae | ||
|
|
008c75d591 | ||
|
|
c32d8a5389 | ||
|
|
24bbfdf038 | ||
|
|
b3590eb49b | ||
|
|
0b51e0fe48 | ||
|
|
88ff4e37b8 | ||
|
|
68c144e366 | ||
|
|
506b0e8c70 | ||
|
|
5091abc8ef | ||
|
|
2a7503db06 | ||
|
|
1480bd97c2 | ||
|
|
11239ff856 | ||
|
|
eaca59a420 | ||
|
|
6e5a09d74d | ||
|
|
35b7a80501 | ||
|
|
91949414cc | ||
|
|
79d6f4de1f | ||
|
|
3e212a8eb1 | ||
|
|
1084f40282 | ||
|
|
e82609176f | ||
|
|
169464ca47 | ||
|
|
3a3a505e92 | ||
|
|
df727d8619 | ||
|
|
c44e2f43f8 | ||
|
|
7223bd77d9 | ||
|
|
59cb3017a2 | ||
|
|
1f00890cec | ||
|
|
c7e01ae07b | ||
|
|
f0fa87e06a | ||
|
|
b4c211ac08 | ||
|
|
82da0e8337 | ||
|
|
75bb5d8ac7 | ||
|
|
2ae3da859a | ||
|
|
ef3e49529b | ||
|
|
121afaf478 | ||
|
|
a6128cd36a | ||
|
|
c8cd9adb4f | ||
|
|
b2d5b9d6a2 | ||
|
|
ab6051f88a | ||
|
|
98800f695a | ||
|
|
fdebf4db73 | ||
|
|
5f21a50e7e | ||
|
|
0d233f109d | ||
|
|
467a6901c7 | ||
|
|
d4cd6b0ac6 | ||
|
|
ee7e0b2e91 | ||
|
|
1da1cdcb10 | ||
|
|
35c5e2fec6 | ||
|
|
efa1a9f383 | ||
|
|
6bb749d806 | ||
|
|
104755343b | ||
|
|
9e0ab5363f | ||
|
|
19d5903e2c | ||
|
|
dbd55b9382 | ||
|
|
3bb5ecd2b6 | ||
|
|
def44930e4 | ||
|
|
3d7b95d7fe | ||
|
|
0f44b40d21 | ||
|
|
987c1e2244 | ||
|
|
1b184af306 | ||
|
|
fc37cf403b | ||
|
|
ae160cca80 | ||
|
|
ea21596460 | ||
|
|
32233737c1 | ||
|
|
f0ab01ed0c | ||
|
|
3a8354fb1f | ||
|
|
25493b521e | ||
|
|
df5407e200 | ||
|
|
2bdc29873a | ||
|
|
6ca89e1091 | ||
|
|
92c488861c | ||
|
|
259bf693b6 | ||
|
|
43dbfc772e | ||
|
|
ab8dd5f477 | ||
|
|
f1d2145359 | ||
|
|
52a74bd182 | ||
|
|
ef9f84d127 | ||
|
|
d27a30d5f1 | ||
|
|
c1b4d98b6d | ||
|
|
e14e44a1c5 | ||
|
|
eb64aa3207 | ||
|
|
46cc276e2e | ||
|
|
d663461c51 | ||
|
|
8c1d4f9790 | ||
|
|
82bf374cad | ||
|
|
5c9c42705a | ||
|
|
4c77dba0b5 | ||
|
|
dcd431c699 | ||
|
|
165b137de2 | ||
|
|
e40a2386c2 | ||
|
|
8933bab24f | ||
|
|
b7b58019cd | ||
|
|
edffb938d6 | ||
|
|
3a074bff8a | ||
|
|
0e33023517 | ||
|
|
3874e21c65 | ||
|
|
10bfe3b29d | ||
|
|
ff88a3c756 | ||
|
|
5132b47427 | ||
|
|
526b1d145b | ||
|
|
70659cd818 | ||
|
|
acdd6692c8 | ||
|
|
5607eb0bd8 | ||
|
|
5634b94c35 | ||
|
|
272209c268 | ||
|
|
f26b3242d5 | ||
|
|
b6ea8f728e | ||
|
|
e76818d7d8 | ||
|
|
bcf379f218 | ||
|
|
6cb0f296ce | ||
|
|
433f4f6ca5 | ||
|
|
dc8d55a7d2 | ||
|
|
4d47cb8385 | ||
|
|
219bbbe077 | ||
|
|
70704b6330 | ||
|
|
7f511a391c | ||
|
|
8aba2bc279 | ||
|
|
932f366c83 | ||
|
|
434218dda3 | ||
|
|
e4dbba026c | ||
|
|
db1834f6bc | ||
|
|
dbbf96bb36 | ||
|
|
3a23f7a239 | ||
|
|
9f6de64089 | ||
|
|
e86ee8a7d4 | ||
|
|
7829e83ba0 | ||
|
|
ab3747a0c4 | ||
|
|
501d81e4a6 | ||
|
|
f62b566610 | ||
|
|
fe91e912d0 | ||
|
|
32a847af34 | ||
|
|
1d28672978 | ||
|
|
74a2a2b0ee | ||
|
|
354ef66d2a | ||
|
|
a6f1182f02 | ||
|
|
8825e7af3d | ||
|
|
bcf119bf5d | ||
|
|
d9cb59ca37 | ||
|
|
e33960effb | ||
|
|
a20eae7cd8 | ||
|
|
4adf40c5ec | ||
|
|
a27e0ffc7f | ||
|
|
3bea35eea2 | ||
|
|
3db7ecd71f | ||
|
|
723eccc88a | ||
|
|
75785e0706 | ||
|
|
f21da15591 | ||
|
|
1be44c75d5 | ||
|
|
cfea52f488 | ||
|
|
53e94365ad | ||
|
|
e393fd7a47 | ||
|
|
63eb0a1d9c | ||
|
|
680bc1d205 | ||
|
|
7a5908a0d3 | ||
|
|
c234291e8c | ||
|
|
b97115f1bd | ||
|
|
8720a682c3 | ||
|
|
fd0d811b47 | ||
|
|
520341dfd3 | ||
|
|
d66b8d04c7 | ||
|
|
5418407d1e | ||
|
|
4606d9e1c5 | ||
|
|
4f839a2589 | ||
|
|
257c362765 | ||
|
|
009a8c34e5 | ||
|
|
7e0ddb5b79 | ||
|
|
8b5ef32d93 | ||
|
|
6acf2655b8 | ||
|
|
0e40f0f3ad | ||
|
|
dfb2e21721 | ||
|
|
67cda56be5 | ||
|
|
b15545148b | ||
|
|
b37a70c5db | ||
|
|
0b9e0ac9c7 | ||
|
|
f5383665f8 | ||
|
|
35bef5a008 | ||
|
|
17c25def97 | ||
|
|
5f9088dbf5 | ||
|
|
8748ef6884 | ||
|
|
ee270f59e1 | ||
|
|
a2c5866026 | ||
|
|
ab408c4246 | ||
|
|
9e9a98b6f7 | ||
|
|
0b5fbb4d55 | ||
|
|
d7a8e0fe92 | ||
|
|
3bd5867143 | ||
|
|
c8ab370720 | ||
|
|
4a0ab9f092 | ||
|
|
a565f1cdb7 | ||
|
|
3a2075d00c | ||
|
|
9ef3caef53 | ||
|
|
c449b84fff | ||
|
|
bcf429589a | ||
|
|
4282445359 | ||
|
|
3e449ae1f5 | ||
|
|
8510290e87 | ||
|
|
c854fc5745 | ||
|
|
1a3a6443d8 | ||
|
|
b461dbce62 | ||
|
|
86e33b3ffd | ||
|
|
78c34fb7d0 | ||
|
|
2ce993718b | ||
|
|
eee3296120 | ||
|
|
9cf8b57457 | ||
|
|
208937defc | ||
|
|
3e9b6cffdb | ||
|
|
2cf253a1fe | ||
|
|
29bb481363 | ||
|
|
1f3589a592 | ||
|
|
66d697aa69 | ||
|
|
f93ebf19b0 | ||
|
|
b7a30d8f62 | ||
|
|
e75e54e7ff | ||
|
|
65707cbfde | ||
|
|
680bc25983 | ||
|
|
d0c4bd5a16 | ||
|
|
500069e5d8 | ||
|
|
f4a1e67f9b | ||
|
|
c269a808ea | ||
|
|
dbec251408 | ||
|
|
1f9466412b | ||
|
|
aa6038c704 | ||
|
|
0d5c84c396 | ||
|
|
dd9bc0d1d5 | ||
|
|
8aa00c1c31 | ||
|
|
eaec3ea2c8 | ||
|
|
efd32d2eee | ||
|
|
49580bd65b | ||
|
|
7b761bfa8e | ||
|
|
f7a82a5725 | ||
|
|
04384bb4f2 | ||
|
|
9cd8a492a5 | ||
|
|
f340a5193a | ||
|
|
d7a444d884 | ||
|
|
eb632362e9 | ||
|
|
01fff25f39 | ||
|
|
2ef1c7b855 | ||
|
|
caa46e8bbf | ||
|
|
eeca593427 | ||
|
|
13ae174c66 | ||
|
|
dee15861f0 | ||
|
|
a1df2788be | ||
|
|
23d29c7309 | ||
|
|
71312fd22b | ||
|
|
02c7be92dc | ||
|
|
047172e30f | ||
|
|
923d6f2a4d | ||
|
|
f7afdf6808 | ||
|
|
0c92fbf952 | ||
|
|
21646d4646 | ||
|
|
da29055309 | ||
|
|
66e4390c79 | ||
|
|
0fbb97a9b9 | ||
|
|
93242c3025 | ||
|
|
11f7158e8e | ||
|
|
5d503a90f7 | ||
|
|
116db0aa7c | ||
|
|
b90e700538 | ||
|
|
7074b310e6 | ||
|
|
9a23eab208 | ||
|
|
b035cc7ca7 | ||
|
|
f1b9a3dc00 | ||
|
|
57372335b3 | ||
|
|
8563d27429 | ||
|
|
0b284b8b9a | ||
|
|
cd06bc9903 | ||
|
|
a2531d359a | ||
|
|
1ee12c592b | ||
|
|
f52e31c770 | ||
|
|
f5debdb14f | ||
|
|
25544681ae | ||
|
|
3bf777c2a9 | ||
|
|
529df4e8b4 | ||
|
|
d2bc8613c9 | ||
|
|
1706b7c516 | ||
|
|
c1263ad674 | ||
|
|
738a3e9446 | ||
|
|
e18347ea75 | ||
|
|
d064927715 | ||
|
|
32ef93d79d | ||
|
|
5a06602503 | ||
|
|
24a68fefa7 | ||
|
|
b0dec54576 | ||
|
|
fb7712a5ce | ||
|
|
752941a5da | ||
|
|
c6d63c42d2 | ||
|
|
975cba482a | ||
|
|
8a580ac75b | ||
|
|
bc5a858fe9 | ||
|
|
bc40b101f1 | ||
|
|
b5174686b4 | ||
|
|
26a7bc29b3 | ||
|
|
2b6fa0a38e | ||
|
|
b1e9cddaa3 | ||
|
|
9983f44449 | ||
|
|
6aa2a0db3d | ||
|
|
384afd77ca | ||
|
|
d9b2a88040 | ||
|
|
88010bac6a | ||
|
|
b59b64153c | ||
|
|
db61586f0f | ||
|
|
07aca28b10 | ||
|
|
9a2737722e | ||
|
|
7210ed8ad3 | ||
|
|
62e3f30eba | ||
|
|
84c2beb5c8 | ||
|
|
5204704e47 | ||
|
|
6eac615a67 | ||
|
|
c791b8a16d | ||
|
|
0360e2eb88 | ||
|
|
5ecd69b3ce | ||
|
|
05cd37eb38 | ||
|
|
3489389d79 | ||
|
|
4e417c0b19 | ||
|
|
7aba5dc962 | ||
|
|
a5126f2158 | ||
|
|
3ac3fcbcda | ||
|
|
0ca9f3a3ad | ||
|
|
c5c10e0eec | ||
|
|
274ce14e0f | ||
|
|
a08bb419dc | ||
|
|
fa07b93d54 | ||
|
|
9ad9c4643b | ||
|
|
a7065e5c06 | ||
|
|
edf74d9ef4 | ||
|
|
c5547c9041 | ||
|
|
8be9088888 | ||
|
|
27b3884f27 | ||
|
|
15e8f46702 | ||
|
|
e91b1061d3 | ||
|
|
a0e66c4bf6 | ||
|
|
f0fb3fa946 | ||
|
|
da444f401b | ||
|
|
eb0365d7ce | ||
|
|
97c2b46192 | ||
|
|
847e5d7647 | ||
|
|
43e05ef7e7 | ||
|
|
b14eed17eb | ||
|
|
069d9df3be | ||
|
|
7c40d4298d | ||
|
|
1a2c5851f4 | ||
|
|
f042d167d1 | ||
|
|
5bf962897f | ||
|
|
c1a18e91c3 | ||
|
|
881e57cbd2 | ||
|
|
08c49d36db | ||
|
|
74cd758a0b | ||
|
|
9af0879359 | ||
|
|
c42e6bb963 | ||
|
|
c12e6fd3ed | ||
|
|
78f97984c7 | ||
|
|
eff3bd91d7 | ||
|
|
984d8c3e9d | ||
|
|
ef3623534c | ||
|
|
e4554faa4f | ||
|
|
0e32b20bbd | ||
|
|
b1135e334c | ||
|
|
6cdeea39c3 | ||
|
|
5150de74c8 | ||
|
|
8cf58d22f9 | ||
|
|
50cb670eee | ||
|
|
cfd3eb6c4c | ||
|
|
6eccc0e3e3 | ||
|
|
efa8f6a81e | ||
|
|
46b9eccfb1 | ||
|
|
1391bfee01 | ||
|
|
1936c8a0be | ||
|
|
99b99a803c | ||
|
|
9081dc3a19 | ||
|
|
c2b6421ff9 | ||
|
|
99af478165 | ||
|
|
873028d8e8 | ||
|
|
2db8728560 | ||
|
|
d0dbbe7850 | ||
|
|
a6280d223a | ||
|
|
4187b31daf | ||
|
|
ea33d86dbd | ||
|
|
8dc5c19210 | ||
|
|
e8b6bee139 | ||
|
|
d37a928630 | ||
|
|
3499111c92 | ||
|
|
28cd404bef | ||
|
|
d2e6be2c5f | ||
|
|
407c4baff2 | ||
|
|
d0653c5b13 | ||
|
|
3faa5913ad | ||
|
|
56927a7af5 | ||
|
|
a98bc80005 | ||
|
|
06d25a043c | ||
|
|
a1aff7b457 | ||
|
|
6aa3b8b92f | ||
|
|
7381b47830 | ||
|
|
b2a704fa12 | ||
|
|
41ed476c00 | ||
|
|
44ddf097d6 | ||
|
|
cb1386fdb3 | ||
|
|
0dafe79032 | ||
|
|
51cd929d1c | ||
|
|
5468d5e888 | ||
|
|
0174b8bc67 | ||
|
|
e3b8fbb973 | ||
|
|
7103df0116 | ||
|
|
42fba85241 | ||
|
|
f9f11c7137 | ||
|
|
a51acead21 | ||
|
|
7a3ab17e57 | ||
|
|
d4e741c614 | ||
|
|
bee1797ff5 | ||
|
|
72fa7d42d5 | ||
|
|
7a4bf4cc5d | ||
|
|
ab66e13c8c | ||
|
|
eaeea493a1 | ||
|
|
0bfaedbf6e | ||
|
|
52f9f45608 | ||
|
|
dfa9dc1e2b | ||
|
|
c8f5538ae8 | ||
|
|
5af5a59ff1 | ||
|
|
a1d3e4577f | ||
|
|
eb37ecbe56 | ||
|
|
d7b528aef1 | ||
|
|
12212605cd | ||
|
|
2908ca3a89 | ||
|
|
aa04dc077b | ||
|
|
c1c064e657 | ||
|
|
c0a509820f | ||
|
|
aa0b71aad7 | ||
|
|
55c5dfddc4 | ||
|
|
b40c69a1d9 | ||
|
|
ca20f432b3 | ||
|
|
63fe61b913 | ||
|
|
7605b526c8 | ||
|
|
189f39f1c1 | ||
|
|
8c718069c7 | ||
|
|
c2facdf5ce | ||
|
|
0c5dcb26f6 | ||
|
|
b88634691b | ||
|
|
df9dcdd622 | ||
|
|
15943fae47 | ||
|
|
78a71ba252 | ||
|
|
7f1acd16b5 | ||
|
|
be038d2348 | ||
|
|
b3b11012f4 | ||
|
|
82963f273a | ||
|
|
88c5c1e224 | ||
|
|
d8b661ed0b | ||
|
|
03c1d560bc | ||
|
|
095c466b89 | ||
|
|
4c3cd6fdc4 | ||
|
|
2379b22135 | ||
|
|
f36fa861da | ||
|
|
3b4f9d0fba | ||
|
|
42dabbf16a | ||
|
|
07abff7583 | ||
|
|
dbd9bfacc5 | ||
|
|
6ed1ea0cad | ||
|
|
02c347d22f | ||
|
|
5384fec57e | ||
|
|
1868bcf4d7 | ||
|
|
42059b9931 | ||
|
|
24890225a2 | ||
|
|
e4e32769dc | ||
|
|
3420422a4b | ||
|
|
18564baec7 | ||
|
|
b0c6d83913 | ||
|
|
5016b2b227 | ||
|
|
4727321d47 | ||
|
|
6e96e92d33 | ||
|
|
a8c92ce641 | ||
|
|
032d2e5c95 | ||
|
|
ec9d7d9dae | ||
|
|
217dab4dea | ||
|
|
452a92daa9 | ||
|
|
fb364deff9 | ||
|
|
ac824ce39c | ||
|
|
d296194cc7 | ||
|
|
57daf3e860 | ||
|
|
fa74a1c45a | ||
|
|
1cce1d1a44 | ||
|
|
dfc130cf55 | ||
|
|
7a7eed9c45 | ||
|
|
b7f537e34c | ||
|
|
0311a8a4ef | ||
|
|
14ecc13cb3 | ||
|
|
5baca56d6d | ||
|
|
91c9692db1 | ||
|
|
bb7b1a8dee | ||
|
|
e6322e5fb7 | ||
|
|
3c5f04b52a | ||
|
|
5d78a5b573 | ||
|
|
4f58615065 | ||
|
|
32a4161a69 | ||
|
|
c5708145cd | ||
|
|
118f207adb | ||
|
|
a5826028b3 | ||
|
|
fa3f6053c3 | ||
|
|
bc60fe58b1 | ||
|
|
f9a5e9a9e4 | ||
|
|
6f6ee6f160 | ||
|
|
8a3dbd5e4a | ||
|
|
e052ad2281 | ||
|
|
8938ea13a4 | ||
|
|
907aed4c63 | ||
|
|
60798aae03 | ||
|
|
6f09957fbf | ||
|
|
6fc2344473 | ||
|
|
c82059ae72 | ||
|
|
a080db690f | ||
|
|
d82849ddd3 | ||
|
|
71a3fe6e48 | ||
|
|
5e934ac7a6 | ||
|
|
6aa5bde424 | ||
|
|
fee7488090 | ||
|
|
f5e5e3411e | ||
|
|
37c4d4c7fe | ||
|
|
2b5cac4361 | ||
|
|
818f9365ec | ||
|
|
f81db9df3d | ||
|
|
8162e3a30d | ||
|
|
5a00bbf02d | ||
|
|
ff7fff52ec | ||
|
|
087fab4065 | ||
|
|
bed2897950 | ||
|
|
d51f0711b7 | ||
|
|
728860332d | ||
|
|
fe0ca14b3b | ||
|
|
7e57c3c862 | ||
|
|
0f4fdfcedd | ||
|
|
1cb77f35b5 | ||
|
|
7232b2cd26 | ||
|
|
c19a94a2d3 | ||
|
|
fbe6328f97 | ||
|
|
9ac23be59b | ||
|
|
e469409a22 | ||
|
|
28db8e98d7 | ||
|
|
08bf3d4f8f | ||
|
|
88380bfb76 | ||
|
|
83d7cbbefa | ||
|
|
426d7c8e5e | ||
|
|
602d88db5e | ||
|
|
751d3be872 | ||
|
|
358a62d5b1 | ||
|
|
409814823b | ||
|
|
5d8f45b058 | ||
|
|
3001e8bf84 | ||
|
|
80de268987 | ||
|
|
b08004b6c6 | ||
|
|
2783a52495 | ||
|
|
3ae3f0db95 | ||
|
|
bb926e2dc8 | ||
|
|
d205650373 | ||
|
|
eb4fa676ca | ||
|
|
2ec6ba382c | ||
|
|
65203b6d57 | ||
|
|
a15f026739 | ||
|
|
bc8ed8bb38 | ||
|
|
e39564667e | ||
|
|
efa246272b | ||
|
|
d5bfaf2331 | ||
|
|
a1790120a1 | ||
|
|
0a4b6e08b5 | ||
|
|
9152ded2cb | ||
|
|
714666df1c | ||
|
|
e29d84a71a | ||
|
|
1f60d8f413 | ||
|
|
6c671b5e08 | ||
|
|
3ffd9ecc28 | ||
|
|
281131f5b3 | ||
|
|
3c67cd2a59 | ||
|
|
74f5c69bb5 | ||
|
|
8f82e1d960 | ||
|
|
c5497cfb2b | ||
|
|
94b6b3b948 | ||
|
|
8855c5ad7f | ||
|
|
5015a0a56c | ||
|
|
ec51fc0701 | ||
|
|
13287e6f76 | ||
|
|
a65dfcd3cd | ||
|
|
18183dd649 | ||
|
|
40c1f074bb | ||
|
|
5d1219e467 | ||
|
|
568773f1a8 | ||
|
|
f0c3cde213 | ||
|
|
7366e82bd1 | ||
|
|
def5d09903 | ||
|
|
1e573f80bb | ||
|
|
819630a8db | ||
|
|
583e4360cf | ||
|
|
7972662537 | ||
|
|
a4fd86fc95 | ||
|
|
47417a309f | ||
|
|
ad5e2ddc41 | ||
|
|
38cfd7eca8 | ||
|
|
2d2f92c7a7 | ||
|
|
d0293ad177 | ||
|
|
2ba2eea801 | ||
|
|
2bd4d1fb08 | ||
|
|
4c342c2047 | ||
|
|
4d11bd0ed8 | ||
|
|
24cee748d5 | ||
|
|
fbec6f03e7 | ||
|
|
8ab0288ab2 | ||
|
|
cc426a5ca9 | ||
|
|
e4f04b605a | ||
|
|
48441b1232 | ||
|
|
5a7da67d67 | ||
|
|
60feb21e49 | ||
|
|
00d7db6f48 | ||
|
|
5f7990a899 | ||
|
|
589d3614b8 | ||
|
|
fe386095de | ||
|
|
5640177c99 | ||
|
|
ff8c8b1bfa | ||
|
|
4bccd9b5aa | ||
|
|
4890e857f4 | ||
|
|
8c1c5ac957 | ||
|
|
a20ec4d1c5 | ||
|
|
12b4e58dea | ||
|
|
d112475c97 | ||
|
|
b652235791 | ||
|
|
940ec82182 | ||
|
|
67c01ce5f2 | ||
|
|
e603325eef | ||
|
|
afd09e93eb | ||
|
|
92775a4b8a | ||
|
|
6a2668171e | ||
|
|
5b7dc9f8f4 | ||
|
|
00e695a0e7 | ||
|
|
75dc76020f | ||
|
|
56289ce5bf | ||
|
|
e4ec7b0ae7 | ||
|
|
f38ef0b6b9 | ||
|
|
d5bb3e2d97 | ||
|
|
66f6555711 | ||
|
|
472ca9c748 | ||
|
|
054e4dffdc | ||
|
|
d933adfaf1 | ||
|
|
cb86c8d4dd | ||
|
|
be5ee8a6a3 | ||
|
|
44c27be590 | ||
|
|
a704972dea | ||
|
|
0b43342a5c |
@@ -6,6 +6,7 @@
|
|||||||
- Cat Pokémon (Meowth, Persian, etc.) intimidate Creepers and Phantoms.
|
- Cat Pokémon (Meowth, Persian, etc.) intimidate Creepers and Phantoms.
|
||||||
- Sleep-related Pokémon (Munsharna, Komala, etc.) intimidate Phantoms.
|
- Sleep-related Pokémon (Munsharna, Komala, etc.) intimidate Phantoms.
|
||||||
- Some Pokémon naturally hunt each other.
|
- Some Pokémon naturally hunt each other.
|
||||||
|
- Some Pokémon herd together.
|
||||||
- Added a Behaviour Editor to the NPC editing screen.
|
- Added a Behaviour Editor to the NPC editing screen.
|
||||||
- Added /behaviouredit command for opening the Behaviour Editor on Pokémon and NPCs.
|
- Added /behaviouredit command for opening the Behaviour Editor on Pokémon and NPCs.
|
||||||
- Editing variables for Pokémon is not yet supported.
|
- Editing variables for Pokémon is not yet supported.
|
||||||
@@ -14,6 +15,9 @@
|
|||||||
- baseScale in NPCs has been removed from classes and presets, and in the entity it is replaced with hitboxScale and renderScale.
|
- baseScale in NPCs has been removed from classes and presets, and in the entity it is replaced with hitboxScale and renderScale.
|
||||||
- Added `EntityCallbacks` to `NPCEntity` and `PokemonEntity`. You can trigger custom callback types by using `[Entity].callbacks.process(...)`
|
- Added `EntityCallbacks` to `NPCEntity` and `PokemonEntity`. You can trigger custom callback types by using `[Entity].callbacks.process(...)`
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
- Fixed Pokémon with a moving walk target frequently spinning in place as they re-calculate their path.
|
||||||
|
|
||||||
### MoLang & Datapacks
|
### MoLang & Datapacks
|
||||||
- Added a `behaviours` datapack folder which motivates the Behaviour Editor screen on NPCs and Pokémon.
|
- Added a `behaviours` datapack folder which motivates the Behaviour Editor screen on NPCs and Pokémon.
|
||||||
- Added "callback" support on PokemonEntity and NPCEntity that allows MoLang scripts to be executed in response to certain scenarios.
|
- Added "callback" support on PokemonEntity and NPCEntity that allows MoLang scripts to be executed in response to certain scenarios.
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
### Additions
|
### Additions
|
||||||
- Added functionality for marks.
|
- Added functionality for marks.
|
||||||
- Added data for all marks and all title ribbons from Pokémon.
|
- Added data for all marks and ribbons from the mainline Pokémon games.
|
||||||
|
- Implemented fishing, personality, weather, and time related marks, that can rarely be granted to a wild-spawned Pokémon.
|
||||||
- Added marks screen within the summary UI.
|
- Added marks screen within the summary UI.
|
||||||
- Added `/givemark <player> <partySlot> <mark>` command to give a mark to a Pokémon.
|
- Added `/givemark <player> <partySlot> <mark>` command to give a mark to a Pokémon.
|
||||||
- Added `/takemark <player> <partySlot> <mark>` command to remove a mark from a Pokémon.
|
- Added `/takemark <player> <partySlot> <mark>` command to remove a mark from a Pokémon.
|
||||||
|
|||||||
+11
-2
@@ -1,19 +1,28 @@
|
|||||||
### Additions
|
### Additions
|
||||||
- Added ability to rename PC Boxes by clicking on the name of a box.
|
- Added ability to rename PC Boxes by clicking on the name of a box.
|
||||||
- Added box options buttons for boxes, toggleable by clicking the right icon button in the bottom bar.
|
- Added box options buttons for boxes, toggleable by clicking the right icon button in the bottom bar.
|
||||||
- The button on the right allows for changing the box wallpaper.
|
|
||||||
- The option buttons on the left side allow for sorting the box by name, level, Pokédex number, gender, and type. Shift clicking allows for sorting in reverse order.
|
- The option buttons on the left side allow for sorting the box by name, level, Pokédex number, gender, and type. Shift clicking allows for sorting in reverse order.
|
||||||
|
- The button on the right allows for changing the box wallpaper.
|
||||||
|
- 10 additional color-based wallpapers have been added.
|
||||||
|
- 5 unlockable biome-based wallpapers have been added, which can be unlocked by visiting:
|
||||||
|
- Forest biome
|
||||||
|
- Ocean biome
|
||||||
|
- Cave Biome
|
||||||
|
- The End
|
||||||
|
- The Nether
|
||||||
- Added filter functionality in PC UI, which supports `PokemonProperties` (e.g. `shiny=yes` shows all shiny Pokémon).
|
- Added filter functionality in PC UI, which supports `PokemonProperties` (e.g. `shiny=yes` shows all shiny Pokémon).
|
||||||
- Names can be filtered by exact or partial matches, e.g. entering "cha" will show Charmander, Charmeleon, etc.
|
- Names can be filtered by exact or partial matches, e.g. entering "cha" will show Charmander, Charmeleon, etc.
|
||||||
- Added `/changewallpaper <player> <boxNumber> <wallpaper>` command to change a box wallpaper through commands.
|
- Added `/changewallpaper <player> <boxNumber> <wallpaper>` command to change a box wallpaper through commands.
|
||||||
- Added `/renamebox <player> <boxNumber> <name>` command to rename a PC box through commands.
|
- Added `/renamebox <player> <boxNumber> <name>` command to rename a PC box through commands.
|
||||||
- Added IVs and EVs stat displays in PC.
|
- Added IVs and EVs stat displays in PC.
|
||||||
- Added ability to change boxes by scrolling.
|
- The displays can be cycled through by scrolling when the display is hovered over.
|
||||||
|
- Added ability to cycle through boxes by scrolling when the box is hovered over.
|
||||||
- PC will now open to last box viewed within a session.
|
- PC will now open to last box viewed within a session.
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- Slots in pastures will now have darker backgrounds and italicised Pokémon names if the Pokémon is not owned by the player.
|
- Slots in pastures will now have darker backgrounds and italicised Pokémon names if the Pokémon is not owned by the player.
|
||||||
- The pasture slot will show the name of the Pokémon owner when hovered if the Pokémon is not owned.
|
- The pasture slot will show the name of the Pokémon owner when hovered if the Pokémon is not owned.
|
||||||
|
- Increased the default PC box count from 30 to 40 to accommodate the fact that we have way more Pokémon now. If you've changed this config option then you'll need to edit it again after starting up with 1.7!
|
||||||
|
|
||||||
### Developer
|
### Developer
|
||||||
- Added `RenamePCBoxEvent.Pre` and `RenamePCBoxEvent.Post` events to prevent players from renaming a box or changing their input.
|
- Added `RenamePCBoxEvent.Pre` and `RenamePCBoxEvent.Post` events to prevent players from renaming a box or changing their input.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Fixed the "enabled" property in spawn files not actually being respected. Where do they find these devs?
|
- Fixed the "enabled" property in spawn files not actually being respected. Where do they find these devs?
|
||||||
|
- Fixed Terralith's shrubland not counting as plains for spawning purposes the way it was intended to.
|
||||||
|
|
||||||
### Developer
|
### Developer
|
||||||
- Spawning Influences now have the context of what the other buckets are when adjusting bucket weights. This will break existing influences that do bucket weight adjustment.
|
- Spawning Influences now have the context of what the other buckets are when adjusting bucket weights. This will break existing influences that do bucket weight adjustment.
|
||||||
|
|||||||
+409
-17
@@ -2,6 +2,7 @@
|
|||||||
## [1.7.0 (Month xth, 2025)](#1-7-0)
|
## [1.7.0 (Month xth, 2025)](#1-7-0)
|
||||||
|
|
||||||
### Additions
|
### Additions
|
||||||
|
- Added `/npcdelete` uuid parameter support and usuable to console
|
||||||
- Added `/spectateBattle <player>` command to spectate battles without having to manually walk up to the target.
|
- Added `/spectateBattle <player>` command to spectate battles without having to manually walk up to the target.
|
||||||
- Added an in-game configuration screen, allowing all settings from `main.json` to be edited directly in-game.
|
- Added an in-game configuration screen, allowing all settings from `main.json` to be edited directly in-game.
|
||||||
- Added `/cobblemonconfig reload` command to reload `main.json` configuration. **Note:** Some settings require a server restart to take effect; use this command cautiously.
|
- Added `/cobblemonconfig reload` command to reload `main.json` configuration. **Note:** Some settings require a server restart to take effect; use this command cautiously.
|
||||||
@@ -11,11 +12,11 @@
|
|||||||
- Pokémon's held items can now be rendered, with a visibility toggle in the Summary screen.
|
- Pokémon's held items can now be rendered, with a visibility toggle in the Summary screen.
|
||||||
- Added cosmetic item functionality for Pokémon. Certain cosmetic items can be given to applicable Pokémon via the interact menu.
|
- Added cosmetic item functionality for Pokémon. Certain cosmetic items can be given to applicable Pokémon via the interact menu.
|
||||||
- Added the various log blocks as cosmetic items for Timburr and Komala.
|
- Added the various log blocks as cosmetic items for Timburr and Komala.
|
||||||
|
- Added cosmetics for Spoink, Gurdurr, Conkeldurr, Squirtle Line, Sneasler, Sandile line, Treecko line, Braixen, Delphox, and Dragonite.
|
||||||
|
- Added Gilded Chest cosmetics for Chest Gimmighoul and Gholdengo
|
||||||
- Added `visibility/hidden`, `visibility/hat` and `visibility/face` tags to control where and how certain items are rendered.
|
- Added `visibility/hidden`, `visibility/hat` and `visibility/face` tags to control where and how certain items are rendered.
|
||||||
- Added Pokémon markings, toggleable within the summary.
|
- Added Pokémon markings, toggleable within the summary.
|
||||||
- Added `/boxcount` command to change PC boxes amount
|
- Added `/boxcount` command to change PC boxes amount
|
||||||
- Added cosmetics for Gurdurr, Conkeldurr, Squirtle Line, Sneasler, Sandile line, Treecko line, Braixen, Delphox, and Dragonite.
|
|
||||||
- Added cosmetics for Gurdurr, Conkeldurr, Squirtle Line, Sneasler, Sandle line, Treecko line, Braixen, Delphox, and Dragonite.
|
|
||||||
- Added `/transformmodelpart (position|rotation|scale) <modelPart> <transform: x y z>` command that can add transformations to a pokemon's model part.
|
- Added `/transformmodelpart (position|rotation|scale) <modelPart> <transform: x y z>` command that can add transformations to a pokemon's model part.
|
||||||
- The player executing the command must be facing the target pokemon entity. Transformations are not persistent and will revert when resources are reloaded.
|
- The player executing the command must be facing the target pokemon entity. Transformations are not persistent and will revert when resources are reloaded.
|
||||||
- Added `legacy` and `special` sourced moves to Pokémon.
|
- Added `legacy` and `special` sourced moves to Pokémon.
|
||||||
@@ -23,7 +24,7 @@
|
|||||||
- Added `translucent_cull` boolean option into resolver's layer to allow for translucent textures with culling
|
- Added `translucent_cull` boolean option into resolver's layer to allow for translucent textures with culling
|
||||||
- Added [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) support for items held by Pokémon, evolution stone blocks, evolution stone items, Pokédex, Luminous Moss, Flame Orb, and Magmarizer.
|
- Added [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) support for items held by Pokémon, evolution stone blocks, evolution stone items, Pokédex, Luminous Moss, Flame Orb, and Magmarizer.
|
||||||
- Added the Clear Amulet, Grip Claw, Lagging Tail, Luminous Moss, Metal Alloy, Scroll of Darkness, Scroll of Waters
|
- Added the Clear Amulet, Grip Claw, Lagging Tail, Luminous Moss, Metal Alloy, Scroll of Darkness, Scroll of Waters
|
||||||
- Added Recipes for Masterpiece Cup, Eject Pack
|
- Added Recipes for Masterpiece Cup, Eject Pack.
|
||||||
- Added modification to Minecraft Creative Inventory search to account for item names that contain `poké` when input contains `poke`.
|
- Added modification to Minecraft Creative Inventory search to account for item names that contain `poké` when input contains `poke`.
|
||||||
- Added Campfire Pot as well as loads of new food items (Poke Puffs, Ponigiri, Sinister Tea, etc)
|
- Added Campfire Pot as well as loads of new food items (Poke Puffs, Ponigiri, Sinister Tea, etc)
|
||||||
- Added Hearty Grains, a new crop used in the new cooking mechanic
|
- Added Hearty Grains, a new crop used in the new cooking mechanic
|
||||||
@@ -39,21 +40,48 @@
|
|||||||
- Pokémon with the ability Volt Absorb are immune to lightning damage and receive Regeneration II for a short duration
|
- Pokémon with the ability Volt Absorb are immune to lightning damage and receive Regeneration II for a short duration
|
||||||
- Ground type Pokémon are immune to lightning damage
|
- Ground type Pokémon are immune to lightning damage
|
||||||
- Added functionality to Everstone when held by a Pokémon; suppresses evolution notification and hides evolve button in summary interface.
|
- Added functionality to Everstone when held by a Pokémon; suppresses evolution notification and hides evolve button in summary interface.
|
||||||
|
- Added optional `filePath` parameter to MoLang functions to allow for global stores (ex. `../global/`). Path must end in a forward slash.
|
||||||
- Added new optional property `attachment_options` for most EmitterShapes to be attached to the locator/entities scale, rotation, and/or position. Position is true by default.
|
- Added new optional property `attachment_options` for most EmitterShapes to be attached to the locator/entities scale, rotation, and/or position. Position is true by default.
|
||||||
- Galarica Nut bushes now generate on beaches.
|
- Galarica Nut bushes now generate on beaches.
|
||||||
- Some Pokémon now pitch their bodies in the direction they're moving.
|
- Some Pokémon now pitch their bodies in the direction they're moving.
|
||||||
- Added new advancements Didn't Stop To Think, We Need To Cook, and Pokémon Jockey!.
|
- Added new advancements Didn't Stop To Think, We Need To Cook, and Pokémon Jockey!.
|
||||||
- Berries can now be smelted into their respective dyes.
|
- Berries can now be smelted into their respective dyes.
|
||||||
|
- Added Syrupy Apples.
|
||||||
- Added `/runmolang <molang> [<npc>|<player>|<pokemon>]` command that executes a MoLang expression with the provided options as environment variables, as well as the entity (as `q.entity`) that executed the command.
|
- Added `/runmolang <molang> [<npc>|<player>|<pokemon>]` command that executes a MoLang expression with the provided options as environment variables, as well as the entity (as `q.entity`) that executed the command.
|
||||||
|
- Added bubble quirk to Kingler; like Krabby, Kingler will blows bubbles during dusk.
|
||||||
|
- Added `.Pre` and `.Post` to the following events:
|
||||||
|
- `PokemonRecallEvent`
|
||||||
|
- `TradeEvent`
|
||||||
|
- Added a new gamerule, 'healerHealsPC', when set to true a successful use of a healer will also heal all of the Pokemon in that player's PC.
|
||||||
|
|
||||||
### Pokémon Added
|
### Pokémon Added
|
||||||
|
|
||||||
#### Gen 2
|
#### Gen 2
|
||||||
|
- Marill
|
||||||
|
- Azumarill
|
||||||
|
- Hoppip
|
||||||
|
- Skiploom
|
||||||
|
- Jumpluff
|
||||||
- Dunsparce
|
- Dunsparce
|
||||||
|
- Togepi
|
||||||
|
- Togetic
|
||||||
|
- Unown
|
||||||
|
- Houndour
|
||||||
|
- Houndoom
|
||||||
|
- Ho-Oh
|
||||||
|
- Lugia
|
||||||
|
- Alola Bias Pichu (built-in resourcepack)
|
||||||
|
|
||||||
#### Gen 3
|
#### Gen 3
|
||||||
|
- Azurill
|
||||||
|
- Meditite
|
||||||
|
- Medicham
|
||||||
|
- Electrike
|
||||||
|
- Manectric
|
||||||
- Spoink
|
- Spoink
|
||||||
- Grumpig
|
- Grumpig
|
||||||
|
- Swablu
|
||||||
|
- Altaria
|
||||||
- Snorunt
|
- Snorunt
|
||||||
- Glalie
|
- Glalie
|
||||||
- Latias
|
- Latias
|
||||||
@@ -67,6 +95,9 @@
|
|||||||
- Froslass
|
- Froslass
|
||||||
- Glameow
|
- Glameow
|
||||||
- Purugly
|
- Purugly
|
||||||
|
- Skorupi
|
||||||
|
- Drapion
|
||||||
|
- Togekiss
|
||||||
|
|
||||||
#### Gen 5
|
#### Gen 5
|
||||||
- Pansage
|
- Pansage
|
||||||
@@ -89,25 +120,60 @@
|
|||||||
- Solosis
|
- Solosis
|
||||||
- Duosion
|
- Duosion
|
||||||
- Reuniclus
|
- Reuniclus
|
||||||
|
- Tynamo
|
||||||
|
- Eelektrik
|
||||||
|
- Eelektross
|
||||||
|
- Axew
|
||||||
|
- Fraxure
|
||||||
|
- Haxorus
|
||||||
- Mienfoo
|
- Mienfoo
|
||||||
- Mienshao
|
- Mienshao
|
||||||
|
- Sewaddle
|
||||||
|
- Swadloon
|
||||||
|
- Leavanny
|
||||||
|
- Druddigon
|
||||||
|
|
||||||
#### Gen 6
|
#### Gen 6
|
||||||
|
- Skiddo
|
||||||
|
- Gogoat
|
||||||
|
- Espurr
|
||||||
|
- Meowstic
|
||||||
- Inkay
|
- Inkay
|
||||||
- Malamar
|
- Malamar
|
||||||
- Hawlucha
|
- Hawlucha
|
||||||
- Dedenne
|
- Dedenne
|
||||||
- Noibat
|
- Noibat
|
||||||
- Noivern
|
- Noivern
|
||||||
|
- Furfrou
|
||||||
|
- You can change Furfrou's form by using shears on it while it holds a certain dye in its cosmetic slot.
|
||||||
|
|
||||||
#### Gen 7
|
#### Gen 7
|
||||||
|
- Yungoos
|
||||||
|
- Gumshoos
|
||||||
- Drampa
|
- Drampa
|
||||||
|
- Alolan Grimer
|
||||||
|
- Alolan Muk
|
||||||
|
- Togedemaru
|
||||||
|
|
||||||
#### Gen 8
|
#### Gen 8
|
||||||
|
- Skwovet
|
||||||
|
- Greedent
|
||||||
|
- Chewtle
|
||||||
|
- Drednaw
|
||||||
|
- Toxel
|
||||||
|
- Toxtricity
|
||||||
|
- Morpeko
|
||||||
- Silicobra
|
- Silicobra
|
||||||
- Sandaconda
|
- Sandaconda
|
||||||
- Sinistea
|
- Sinistea
|
||||||
- Polteageist
|
- Polteageist
|
||||||
|
- Galarian Corsola
|
||||||
|
- Cursola
|
||||||
|
- Mr. Rime
|
||||||
|
- Galarian Mr. Mime
|
||||||
|
- Clobbopus
|
||||||
|
- Grapploct
|
||||||
|
- Galarian Weezing
|
||||||
|
|
||||||
#### Gen 9
|
#### Gen 9
|
||||||
- Smoliv
|
- Smoliv
|
||||||
@@ -120,13 +186,24 @@
|
|||||||
- Cyclizar
|
- Cyclizar
|
||||||
- Poltchageist
|
- Poltchageist
|
||||||
- Sinistcha
|
- Sinistcha
|
||||||
|
- Capsakid
|
||||||
|
- Scovillain
|
||||||
|
- Tadbulb
|
||||||
|
- Bellibolt
|
||||||
|
- Toedscool
|
||||||
|
- Toedscruel
|
||||||
|
- Rellor
|
||||||
|
- Rabsca
|
||||||
|
- Bramblin
|
||||||
|
- Brambleghast
|
||||||
|
|
||||||
### Animation updates for the following Pokémon
|
### Animation updates for the following Pokémon
|
||||||
- Garchomp
|
- Garchomp
|
||||||
- Tropius
|
- Tropius
|
||||||
- Torpius
|
|
||||||
- Nosepass
|
- Nosepass
|
||||||
- Probopass
|
- Probopass
|
||||||
|
- Sneasel
|
||||||
|
- Weavile
|
||||||
- Sneasler
|
- Sneasler
|
||||||
- Braixen
|
- Braixen
|
||||||
- Delphox
|
- Delphox
|
||||||
@@ -141,8 +218,86 @@
|
|||||||
- Dratini
|
- Dratini
|
||||||
- Dragonair
|
- Dragonair
|
||||||
- Dragonite
|
- Dragonite
|
||||||
|
- G. Corsola
|
||||||
|
- Cursola
|
||||||
|
- Dunsparce
|
||||||
|
- Dudunsparce (both forms)
|
||||||
|
- Porygon
|
||||||
|
- Porygon2
|
||||||
|
- Porygon-Z
|
||||||
|
- Wattrel
|
||||||
|
- Kilowattrel
|
||||||
|
- Golurk
|
||||||
|
- Spinarak
|
||||||
|
- Ariados
|
||||||
|
- Wyrdeer
|
||||||
|
- Tyrantrum
|
||||||
|
- Pidove
|
||||||
|
- Tranquill
|
||||||
|
- Unfezant
|
||||||
|
- Beldum
|
||||||
|
- Metang
|
||||||
|
- Metagross
|
||||||
|
- Plusle
|
||||||
|
- Minun
|
||||||
|
- Murkrow
|
||||||
|
- Honchkrow
|
||||||
|
- Larvesta
|
||||||
|
- Volcarona
|
||||||
|
- Dwebble
|
||||||
|
- Crustle
|
||||||
|
- Mr. Mime
|
||||||
|
- Flygon
|
||||||
|
- Pichu
|
||||||
|
- Pikachu
|
||||||
|
- Raichu
|
||||||
|
- Alolan Raichu
|
||||||
|
- Espathra
|
||||||
|
- Abra
|
||||||
|
- Kadabra
|
||||||
|
- Alakazam
|
||||||
|
- Deino
|
||||||
|
- Zweilous
|
||||||
|
- Hydreigon
|
||||||
|
- Slaking
|
||||||
|
- Klink
|
||||||
|
- Klang
|
||||||
|
- Klinklang
|
||||||
|
- Baltoy
|
||||||
|
- Claydol
|
||||||
|
- Mamoswine
|
||||||
|
- Rufflet
|
||||||
|
- Braviary
|
||||||
|
- Girafarig
|
||||||
|
- Farigiraf
|
||||||
|
- Rookidee
|
||||||
|
- Corvisquire
|
||||||
|
- Corviknight
|
||||||
|
- Venipede
|
||||||
|
- Whirlipede
|
||||||
|
- Scolipede
|
||||||
|
- Venusaur
|
||||||
|
- Parasect
|
||||||
|
- Bastiodon
|
||||||
|
- Amaura
|
||||||
|
- Varoom
|
||||||
|
- Revavroom
|
||||||
|
- Bouffalant
|
||||||
|
- Lickilicky
|
||||||
|
- Blaziken
|
||||||
|
- Rhyhorn
|
||||||
|
- Rhydon
|
||||||
|
- Rhyperior
|
||||||
|
- Tauros
|
||||||
|
- Tauros - Paldea Aqua
|
||||||
|
- Tauros - Paldea Blaze
|
||||||
|
- Tauros - Paldea Combat
|
||||||
|
- Dewgong
|
||||||
|
|
||||||
### Model updates for the following Pokémon
|
### Model updates for the following Pokémon
|
||||||
|
- Cleffa
|
||||||
|
- Clefairy
|
||||||
|
- Clefable
|
||||||
- Gyarados
|
- Gyarados
|
||||||
- Dragonite
|
- Dragonite
|
||||||
- Eevee
|
- Eevee
|
||||||
@@ -188,12 +343,66 @@
|
|||||||
- Cacturne
|
- Cacturne
|
||||||
- Taillow
|
- Taillow
|
||||||
- Swellow
|
- Swellow
|
||||||
- Added Syrupy Apples.
|
|
||||||
- Seel
|
- Seel
|
||||||
- Dewgong
|
- Dewgong
|
||||||
- Honedge
|
- Honedge
|
||||||
- Doublade
|
- Doublade
|
||||||
- Aegislash
|
- Aegislash
|
||||||
|
- Drowzee
|
||||||
|
- Hypno
|
||||||
|
- Mudkip
|
||||||
|
- Marshtomp
|
||||||
|
- Swampert
|
||||||
|
- Shelmet
|
||||||
|
- Escavalier
|
||||||
|
- Klink
|
||||||
|
- Klank
|
||||||
|
- Klinklang
|
||||||
|
- Spinarak
|
||||||
|
- Ariados
|
||||||
|
- Pidove
|
||||||
|
- Tranquill
|
||||||
|
- Unfezant
|
||||||
|
- Sobble
|
||||||
|
- Drizzile
|
||||||
|
- Inteleon
|
||||||
|
- Plusle
|
||||||
|
- Minun
|
||||||
|
- Murkrow
|
||||||
|
- Zorua
|
||||||
|
- Zoroark
|
||||||
|
- Mime.Jr
|
||||||
|
- Mr. Mime
|
||||||
|
- Pichu
|
||||||
|
- Pikachu
|
||||||
|
- Raichu
|
||||||
|
- Alolan Raichu
|
||||||
|
- Dusknoir
|
||||||
|
- Deino
|
||||||
|
- Zweilous
|
||||||
|
- Hydreigon
|
||||||
|
- Dreepy
|
||||||
|
- Drakloak
|
||||||
|
- Dragapult
|
||||||
|
- Mamoswine
|
||||||
|
- Rookidee
|
||||||
|
- Corvisquire
|
||||||
|
- Corviknight
|
||||||
|
- Venipede
|
||||||
|
- Whirlipede
|
||||||
|
- Scolipede
|
||||||
|
- Farigiraf
|
||||||
|
- Staryu
|
||||||
|
- Starmie
|
||||||
|
- Gimmighoul
|
||||||
|
- Gholdengo
|
||||||
|
- Starly
|
||||||
|
- Staravia
|
||||||
|
- Staraptor
|
||||||
|
- Varoom
|
||||||
|
- Revavroom
|
||||||
|
- Nickit
|
||||||
|
- Thievul
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
- Changed pokemon caught and seen count to update based on the current pokedex being looked
|
- Changed pokemon caught and seen count to update based on the current pokedex being looked
|
||||||
@@ -249,6 +458,15 @@
|
|||||||
- MoLang `run_action_effect` now works on Pokémon.
|
- MoLang `run_action_effect` now works on Pokémon.
|
||||||
- Changed MoLang entity function `is_standing_on` to allow for block tags in the list.
|
- Changed MoLang entity function `is_standing_on` to allow for block tags in the list.
|
||||||
- Added entity (as `q.entity`) that executed the command to the `executemolangscript` command.
|
- Added entity (as `q.entity`) that executed the command to the `executemolangscript` command.
|
||||||
|
- Refactored the following events to `.Pre` and `.Post` for consistency:
|
||||||
|
- `PokemonSentEvent`
|
||||||
|
- `ExperienceGainedEvent`
|
||||||
|
- `BattleStartedEvent`
|
||||||
|
- Updated `PokemonSentEvent` parameters to include the Position and Level of the Pokémon being sent out.
|
||||||
|
- Updated `EvolutionCompleteEvent` parameters to include the Source Pokemon that evolved.
|
||||||
|
- Updated `HatchEggEvent.Post` to include the Pokemon that hatched.
|
||||||
|
- Roseli Berry Trees now naturally generate in their preferred biomes.
|
||||||
|
- Refactored dynamic lights compat to be more future proof. The dynamic light support is only tested with LambDynamicLights, on NeoForged use that mod in combination with Sinytra Connector
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- Fixed game crashing when removing national pokedex using datapacks
|
- Fixed game crashing when removing national pokedex using datapacks
|
||||||
@@ -292,8 +510,8 @@
|
|||||||
- Fix issue where locator X axis was not aligned with blockbench.
|
- Fix issue where locator X axis was not aligned with blockbench.
|
||||||
- Fix issue where particle effects that play on frame 1 on sendout would never play (Gastly)
|
- Fix issue where particle effects that play on frame 1 on sendout would never play (Gastly)
|
||||||
- The Wiglett line will now sink in water again.
|
- The Wiglett line will now sink in water again.
|
||||||
- Fixed the Sprigatito line's portraits being zoomed in too far.
|
- Fixed the Sprigatito line's portraits being zoomed in too far.
|
||||||
- Fixed Floragato's battle cry animation from breaking.
|
- Fixed Floragato's battle cry animation from breaking.
|
||||||
- Fixed the block texture name for the Pep-Up Flower being inaccurate
|
- Fixed the block texture name for the Pep-Up Flower being inaccurate
|
||||||
- Fixed issue where the restoration tank would not accept valid items from a hopper.
|
- Fixed issue where the restoration tank would not accept valid items from a hopper.
|
||||||
- Fixed energy root not being shearable
|
- Fixed energy root not being shearable
|
||||||
@@ -311,13 +529,28 @@
|
|||||||
- Improved flyers avoiding getting stuck on fence posts.
|
- Improved flyers avoiding getting stuck on fence posts.
|
||||||
- Fixed air balloon battle text not correctly displaying the Pokémon or item name
|
- Fixed air balloon battle text not correctly displaying the Pokémon or item name
|
||||||
- Fixed an issue where items retrieved from a Display case would disappear if a player's inventory is full
|
- Fixed an issue where items retrieved from a Display case would disappear if a player's inventory is full
|
||||||
|
- Fixed Pokédex Scanner not respecting the "Invert Mouse" option
|
||||||
|
- Fixed recoil eyes on Shellder & Cloyster.
|
||||||
|
- Fixed Shroomish spinning at lightning speed when fainting (no longer allowed to let it rip.)
|
||||||
- Fixed Pokédex Scanner not respecting the "Invert Mouse" option.
|
- Fixed Pokédex Scanner not respecting the "Invert Mouse" option.
|
||||||
- Fixed a crash due to a ConcurrentModificationException that could occur during world generation.
|
- Fixed a crash due to a ConcurrentModificationException that could occur during world generation.
|
||||||
|
- Fixed Quaxly's animations showing hidden wing sets
|
||||||
- Fixed Moon Ball moon phase logic to actually work correctly
|
- Fixed Moon Ball moon phase logic to actually work correctly
|
||||||
- Fixed `/pokedex printcalculations` to now show the correct percentage completed of the Pokedex
|
- Fixed `/pokedex printcalculations` to now show the correct percentage completed of the Pokedex
|
||||||
- Fixed mod incompatibility with the `Raised` mod
|
- Fixed mod incompatibility with the `Raised` mod
|
||||||
- Fixed a vulnerability that could cause party and PC rollbacks under specific circumstances.
|
- Fixed a vulnerability that could cause party and PC rollbacks under specific circumstances.
|
||||||
- Fixed a rare edge case where sorting your PC could be rolled back later.
|
- Fixed a rare edge case where sorting your PC could be rolled back later.
|
||||||
|
- Fixed BotanyPots built-in integration
|
||||||
|
- Fixed shading of berries on berry trees.
|
||||||
|
- Fixed static text cursor for nickname input in summary.
|
||||||
|
- Fixed Cobblemon brewing recipes placing result into all slots, and not just slots with correct ingredients inside the brewing stand.
|
||||||
|
- Fixed an issue where hoppers and brewing stands were not recognizing Cobblemon brewing recipes.
|
||||||
|
- Fixed global species features... not working. Since they were created. Oops.
|
||||||
|
- Fixed Pokémon with alternate forms being created with an incorrect 'forced' tag on their ability.
|
||||||
|
- Fixed busted abilities and moves in Pokémon data due to removed datapacks etc. causing storage corruption. It now just rerolls their ability / uses Tackle.
|
||||||
|
- Fixed singular Pokémon corruption causing entire storage corruption. Storages will now skip corrupted Pokémon and print an error to console.
|
||||||
|
- Fixed species additions not being able to properly mark a species as implemented.
|
||||||
|
- Fixed Pokémon item models not showing a glint when enchanted.
|
||||||
|
|
||||||
### Developer
|
### Developer
|
||||||
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
|
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
|
||||||
@@ -329,9 +562,8 @@
|
|||||||
- Renamed Cobblemon's creative tabs to start with "Cobblemon: " to distinguish Cobblemon's tabs from tabs for other mods.
|
- Renamed Cobblemon's creative tabs to start with "Cobblemon: " to distinguish Cobblemon's tabs from tabs for other mods.
|
||||||
- Various items now have a rarity value.
|
- Various items now have a rarity value.
|
||||||
- Reworked observable handling in `Pokemon.kt` to cut down on RAM usage and clarify the file.
|
- Reworked observable handling in `Pokemon.kt` to cut down on RAM usage and clarify the file.
|
||||||
- Note: This will break mods that used our observable functionality there or in MoveSet, IVs, EVs, or BenchedMoves.
|
- Note: This will break mods that used our observable functionality there or in MoveSet, IVs, EVs, or BenchedMoves.
|
||||||
- Using `Pokemon#onChange()` is now the way to mark a Pokémon as needing a save.
|
- Using `Pokemon#onChange()` is now the way to mark a Pokémon as needing a save.
|
||||||
- Using `[Pokemon].changeObservable` is now the way to get an `Observable` for any save-worthy changes.
|
|
||||||
- Updated NPCEntity beam positioning to properly account for the baseScale property.
|
- Updated NPCEntity beam positioning to properly account for the baseScale property.
|
||||||
- Updated NPCEntity pokeball throw positioning to properly account for the baseScale property.
|
- Updated NPCEntity pokeball throw positioning to properly account for the baseScale property.
|
||||||
- Fixed `[Pokemon].copyFrom` error causing forms, IVs, and EVs to not be applied properly when using `[Pokemon].loadFromJSON` or `[Pokemon].loadFromNBT`
|
- Fixed `[Pokemon].copyFrom` error causing forms, IVs, and EVs to not be applied properly when using `[Pokemon].loadFromJSON` or `[Pokemon].loadFromNBT`
|
||||||
@@ -360,7 +592,7 @@
|
|||||||
- Added `Pokemon#hyperTrainIV()` and `IVs#setHyperTrainedIV(Stat, Int)`
|
- Added `Pokemon#hyperTrainIV()` and `IVs#setHyperTrainedIV(Stat, Int)`
|
||||||
- `ElementalType` now implements `ShowdownIdentifiable` to ensure the communcation with showdown stays consistent (also in regards to TeraTypes)
|
- `ElementalType` now implements `ShowdownIdentifiable` to ensure the communcation with showdown stays consistent (also in regards to TeraTypes)
|
||||||
- Pokemon no longer have a change observable
|
- Pokemon no longer have a change observable
|
||||||
|
|
||||||
### MoLang & Datapacks
|
### MoLang & Datapacks
|
||||||
- The following usages for item predicates can now use item conditions like advancements do, you can learn about them in the [Minecraft wiki](https://minecraft.wiki/w/Advancement_definition#minecraft:filled_bucket)
|
- The following usages for item predicates can now use item conditions like advancements do, you can learn about them in the [Minecraft wiki](https://minecraft.wiki/w/Advancement_definition#minecraft:filled_bucket)
|
||||||
- The `requiredContext` for an item interaction evolution
|
- The `requiredContext` for an item interaction evolution
|
||||||
@@ -412,6 +644,166 @@
|
|||||||
- Added `is_included`, `to_lower`, `to_upper`, and `string_length` as available Molang functions.
|
- Added `is_included`, `to_lower`, `to_upper`, and `string_length` as available Molang functions.
|
||||||
- Fixed a crash that would occur during battles if the opponent wild Pokémon species comes from a namespace other than cobblemon
|
- Fixed a crash that would occur during battles if the opponent wild Pokémon species comes from a namespace other than cobblemon
|
||||||
- Fixed `clientActions` inside Dialogue pages being executed twice
|
- Fixed `clientActions` inside Dialogue pages being executed twice
|
||||||
|
- Added `q.split_string(<text>, <delimiter/comma>)` Outputs an array with the divided text.
|
||||||
|
- Added `q.spawn_npc(<x>, <y>, <z>, <npc>)` Spawns an NPC at the given coordinates and returns the NPC.
|
||||||
|
- Added `q.player.seen_credits` Returns whether the player has seen the end credits.
|
||||||
|
- Added `q.player.is_in_dialogue` Returns whether the player is currently in a dialogue.
|
||||||
|
- Added `q.player.active_dialogue` Returns the active dialogue of the player, or null if none.
|
||||||
|
- Added `q.player.is_spectator` Returns whether the player is in spectator mode.
|
||||||
|
- Added `q.player.is_adventure` Returns whether the player is in adventure mode.
|
||||||
|
- Added `q.player.is_creative` Returns whether the player is in creative mode.
|
||||||
|
- Added `q.player.is_survival` Returns whether the player is in survival mode.
|
||||||
|
- Added `q.player.set_battle_theme(<sound resource>)` Sets the player's battle theme to the given theme.
|
||||||
|
- Added `q.player.battle_music(<sound_resource>, <volume>, <pitch>)` Plays the given battle music for the player.
|
||||||
|
- Added `q.player.stop_battle_music()` Stops any currently playing battle music for the player. (With a fade out).
|
||||||
|
- Added `q.player.riding_pokemon` Returns the Pokémon the player is currently riding.
|
||||||
|
- Added `q.entity.is_player` Returns whether the entity is a player.
|
||||||
|
- Added `q.entity.is_pokemon` Returns whether the entity is a Pokémon.
|
||||||
|
- Added `q.entity.is_npc` Returns whether the entity is an NPC.
|
||||||
|
- Added `q.entity.is_mob` Returns whether the entity is a vanilla mob.
|
||||||
|
- Added `q.entity.is_animal` Returns whether the entity is an animal.
|
||||||
|
- Added `q.entity.is_hostile` Returns whether the entity is a hostile mob.
|
||||||
|
- Added `q.entity.is_baby` Returns whether the entity is a baby.
|
||||||
|
- Added `q.entity.is_adult` Returns whether the entity is an adult.
|
||||||
|
- Added `q.entity.is_tamable` Returns whether the entity is tamable.
|
||||||
|
- Added `q.entity.is_tamed` Returns whether the entity is tamed.
|
||||||
|
- Added `q.entity.add_effect(<effect>, <duration>, <amplifier>, <ambient> <show_particles>)` Adds a status effect to the entity.
|
||||||
|
- Added `q.entity.remove_effect(<effect>)` Removes a status effect from the entity.
|
||||||
|
- Added `q.entity.has_effect(<effect>)` Returns whether the entity has the given status effect.
|
||||||
|
- Added `q.entity.is_looking_at(<entity>)` Returns whether the entity is looking at the given entity.
|
||||||
|
- Added `q.entity.tags` Returns an array of the entity's tags.
|
||||||
|
- Added `q.entity.add_tag(<tag>)` Adds the given tag to the entity.
|
||||||
|
- Added `q.entity.remove_tag(<tag>)` Removes the given tag from the entity.
|
||||||
|
- Added `q.entity.has_tag(<tag>)` Returns whether the entity has the given tag.
|
||||||
|
- Added `q.entity.make_intangible(<true/false>)` Makes the entity intangible.
|
||||||
|
- Added `q.pokemon.force_evolve(<index>)` Forces the Pokémon at the given index.
|
||||||
|
- Added `q.pokemon.can_evolve` Returns whether the Pokémon at the given index can evolve.
|
||||||
|
- Added `q.pokemon.is_busy` Returns whether the Pokémon is busy.
|
||||||
|
- Added `q.pokemon.is_rideable` Returns whether the Pokémon is rideable.
|
||||||
|
- Fixed `background` field and added `textColor` field for dialogues.
|
||||||
|
- Added support to reload some data registries:
|
||||||
|
- MoLang scripts
|
||||||
|
- Callbacks
|
||||||
|
- Spawn Detail Presets
|
||||||
|
- Spawn Pools
|
||||||
|
- Spawn Rules
|
||||||
|
- Cosmetic Items
|
||||||
|
- Dialogues
|
||||||
|
- Fossils
|
||||||
|
- Natural Materials
|
||||||
|
- Action Effects
|
||||||
|
- Mechanics
|
||||||
|
- Unlockable Wallpapers
|
||||||
|
- Starter Data
|
||||||
|
|
||||||
|
### Particles
|
||||||
|
Added new/updated particles for the following moves:
|
||||||
|
- Absorb
|
||||||
|
- Acid
|
||||||
|
- Acid Spray
|
||||||
|
- Aerial Ace
|
||||||
|
- Amnesia
|
||||||
|
- Aurora Beam
|
||||||
|
- Bite
|
||||||
|
- Body Slam
|
||||||
|
- Bubble
|
||||||
|
- Bubble Beam
|
||||||
|
- Bulldoze
|
||||||
|
- Bullet Punch
|
||||||
|
- Close Combat
|
||||||
|
- Confusion
|
||||||
|
- Crunch
|
||||||
|
- Cotton Guard
|
||||||
|
- Double Team
|
||||||
|
- Dragon Claw
|
||||||
|
- Egg Bomb
|
||||||
|
- Ember
|
||||||
|
- Eruption
|
||||||
|
- Explosion
|
||||||
|
- Fire Blast
|
||||||
|
- Fire Punch
|
||||||
|
- Fire Spin
|
||||||
|
- Flame Burst
|
||||||
|
- Flame Charge
|
||||||
|
- Flamethrower
|
||||||
|
- Flame Wheel
|
||||||
|
- Frost Breath
|
||||||
|
- Frustration
|
||||||
|
- Giga Drain
|
||||||
|
- Growl
|
||||||
|
- Haze
|
||||||
|
- Hidden Power
|
||||||
|
- Horn Attack
|
||||||
|
- Hyper Fang
|
||||||
|
- Hypnosis
|
||||||
|
- Ice Beam
|
||||||
|
- Ice Punch
|
||||||
|
- Ice Shard
|
||||||
|
- Icy Wind
|
||||||
|
- Infestation
|
||||||
|
- Kinesis
|
||||||
|
- Lava Plume
|
||||||
|
- Leech Life
|
||||||
|
- Leech Seed
|
||||||
|
- Leer
|
||||||
|
- Lick
|
||||||
|
- Magical Leaf
|
||||||
|
- Mega Drain
|
||||||
|
- Minimize
|
||||||
|
- Mist
|
||||||
|
- Mud Bomb
|
||||||
|
- MudSport
|
||||||
|
- Mystical Fire
|
||||||
|
- Nasty Plot
|
||||||
|
- Poison Fang
|
||||||
|
- Poison Gas
|
||||||
|
- Poison Powder
|
||||||
|
- Population Bomb
|
||||||
|
- Pound
|
||||||
|
- Powder
|
||||||
|
- Powder Snow
|
||||||
|
- Present
|
||||||
|
- Protect
|
||||||
|
- Psybeam
|
||||||
|
- Psychic
|
||||||
|
- Pursuit
|
||||||
|
- Quick Attack
|
||||||
|
- Rage Powder
|
||||||
|
- Razor Leaf
|
||||||
|
- Return
|
||||||
|
- Rock Throw
|
||||||
|
- Sand Attack
|
||||||
|
- Scary Face
|
||||||
|
- Scratch
|
||||||
|
- Seed Bomb
|
||||||
|
- Seismic Toss
|
||||||
|
- Self Destruct
|
||||||
|
- Shadow Ball
|
||||||
|
- Shadow Claw
|
||||||
|
- Sing
|
||||||
|
- Sleep Powder
|
||||||
|
- Sludge Bomb
|
||||||
|
- Smokescreen
|
||||||
|
- Spike
|
||||||
|
- Spore
|
||||||
|
- Stomp
|
||||||
|
- String Shot
|
||||||
|
- Stun Spore
|
||||||
|
- Super Fang
|
||||||
|
- Swords Dance
|
||||||
|
- Tackle
|
||||||
|
- Tail Whip
|
||||||
|
- Thunder
|
||||||
|
- Thunder Punch
|
||||||
|
- Thunderbolt
|
||||||
|
- Thunder Shock
|
||||||
|
- Thunder Wave
|
||||||
|
- Toxic
|
||||||
|
- Water Gun
|
||||||
|
- Water Pulse
|
||||||
|
- Water Sport
|
||||||
|
- Will-O-Wisp
|
||||||
|
- Withdraw
|
||||||
|
|
||||||
## [1.6.1 (January 26th, 2025)](#1-6-1)
|
## [1.6.1 (January 26th, 2025)](#1-6-1)
|
||||||
|
|
||||||
@@ -424,7 +816,7 @@
|
|||||||
- Added optional box argument to the /pc command.
|
- Added optional box argument to the /pc command.
|
||||||
- Pokédex and Dialogue screens now close when the inventory keybind is pressed.
|
- Pokédex and Dialogue screens now close when the inventory keybind is pressed.
|
||||||
- Added config setting `maxPokedexScanningDetectionRange` to control from what distance the player can scan Pokémon using the Pokédex.
|
- Added config setting `maxPokedexScanningDetectionRange` to control from what distance the player can scan Pokémon using the Pokédex.
|
||||||
- Added config setting `hideUnimplementedPokemonInThePokedex` which hides unimplemented Pokémon from the Pokédex when set to true.
|
- Added config setting `hideUnimplementedPokemonInThePokedex` which hides unimplemented Pokémon from the Pokédex when set to true.
|
||||||
- Added debug renderer for posable entity locators.
|
- Added debug renderer for posable entity locators.
|
||||||
- Added crossover paintings from Close Combat, Premonition, Altar, Slumber, and Nomad.
|
- Added crossover paintings from Close Combat, Premonition, Altar, Slumber, and Nomad.
|
||||||
- Added optional box argument to the /pc command
|
- Added optional box argument to the /pc command
|
||||||
@@ -578,7 +970,7 @@
|
|||||||
- Fixed Vivichoke Dip and Leek & Potato Stew not returning a bowl upon consumption.
|
- Fixed Vivichoke Dip and Leek & Potato Stew not returning a bowl upon consumption.
|
||||||
- Fixed Fossil Restoration Tank not accepting Hay Bales as organic material.
|
- Fixed Fossil Restoration Tank not accepting Hay Bales as organic material.
|
||||||
- Fixed Potion items applying double their intended healing value.
|
- Fixed Potion items applying double their intended healing value.
|
||||||
- Fixed Fast Ball capture bonuses applying to all Pokémon, making it the Best Ball instead of the Mediocre Edge-Case Ball.
|
- Fixed Fast Ball capture bonuses applying to all Pokémon, making it the Best Ball instead of the Mediocre Edge-Case Ball.
|
||||||
- Fixed "learned new move" messages appearing for already-known moves on Pokémon evolutions.
|
- Fixed "learned new move" messages appearing for already-known moves on Pokémon evolutions.
|
||||||
- Fixed Pokémon Item Models breaking shadows nearby when being placed in Display Cases or Item Frames.
|
- Fixed Pokémon Item Models breaking shadows nearby when being placed in Display Cases or Item Frames.
|
||||||
- Fixed berries not giving bonus yields when planted in their preferred biomes. I'm sure we've fixed that 5 times now.
|
- Fixed berries not giving bonus yields when planted in their preferred biomes. I'm sure we've fixed that 5 times now.
|
||||||
@@ -587,7 +979,7 @@
|
|||||||
- Fixed players with shouldered Pokémon not being able to rejoin their 1.5.2 worlds using 1.6.
|
- Fixed players with shouldered Pokémon not being able to rejoin their 1.5.2 worlds using 1.6.
|
||||||
- Fixed `PokemonProperties` utilizing `ability=<some ability>` being treated as a forced ability even when it is a legal ability for the Pokémon.
|
- Fixed `PokemonProperties` utilizing `ability=<some ability>` being treated as a forced ability even when it is a legal ability for the Pokémon.
|
||||||
- Fixed type formatting in Pokédex scanner mode when dual types require two lines.
|
- Fixed type formatting in Pokédex scanner mode when dual types require two lines.
|
||||||
- Fixed trading sometimes crashing the game or server.
|
- Fixed trading sometimes crashing the game or server.
|
||||||
- Fixed Wild shiny sounds not respecting the `shinyNoticeParticlesDistance` config setting.
|
- Fixed Wild shiny sounds not respecting the `shinyNoticeParticlesDistance` config setting.
|
||||||
- Fixed Pokémon being able to evolve mid-battle.
|
- Fixed Pokémon being able to evolve mid-battle.
|
||||||
- Fixed NPC held items being able to be stolen by players. Don't be a thief!
|
- Fixed NPC held items being able to be stolen by players. Don't be a thief!
|
||||||
@@ -681,7 +1073,7 @@
|
|||||||
- Stonjourner Henge Ruins, Luna Henge Ruins, and Sol Henge Ruins.
|
- Stonjourner Henge Ruins, Luna Henge Ruins, and Sol Henge Ruins.
|
||||||
- Submerged Shipwreck Cove and Lush Shipwreck Cove.
|
- Submerged Shipwreck Cove and Lush Shipwreck Cove.
|
||||||
- Pokémon Centers to all 5 village types.
|
- Pokémon Centers to all 5 village types.
|
||||||
|
|
||||||
### Pokémon Added
|
### Pokémon Added
|
||||||
#### Gen 1
|
#### Gen 1
|
||||||
- Alola Bias Cubone (built-in resource pack)
|
- Alola Bias Cubone (built-in resource pack)
|
||||||
@@ -1004,7 +1396,7 @@
|
|||||||
- Big Roots and Energy Roots now share the same sounds as intended.
|
- Big Roots and Energy Roots now share the same sounds as intended.
|
||||||
- Fixed sounds made by blocks playing at a lower pitch than intended.
|
- Fixed sounds made by blocks playing at a lower pitch than intended.
|
||||||
- Fixed Chimchar and Monferno comically T posing whenever they sleep.
|
- Fixed Chimchar and Monferno comically T posing whenever they sleep.
|
||||||
- Fixed Cetitan's cry breaking its walk and sleep animations.
|
- Fixed Cetitan's cry breaking its walk and sleep animations.
|
||||||
- Fixed the Magby line not having any placeholder walk animations.
|
- Fixed the Magby line not having any placeholder walk animations.
|
||||||
- Fixed Duskull and Dusclops using skylight levels for their nether spawn data. There is no sun in the Nether!
|
- Fixed Duskull and Dusclops using skylight levels for their nether spawn data. There is no sun in the Nether!
|
||||||
- Fixed Hisuian Zoroark using base Zoroark stats.
|
- Fixed Hisuian Zoroark using base Zoroark stats.
|
||||||
@@ -1020,7 +1412,7 @@
|
|||||||
- Fixed Trevenant T-posing after 8 seconds of sleeping. I also do that.
|
- Fixed Trevenant T-posing after 8 seconds of sleeping. I also do that.
|
||||||
- Fixed Bewear T-posing for a bit if a wild one faints where you can see.
|
- Fixed Bewear T-posing for a bit if a wild one faints where you can see.
|
||||||
- Fixed Noctowl's placeholder fly animation.
|
- Fixed Noctowl's placeholder fly animation.
|
||||||
- Corrected Lotad blinking animation.
|
- Corrected Lotad blinking animation.
|
||||||
- Fixed reviving items causing errors when used in battle.
|
- Fixed reviving items causing errors when used in battle.
|
||||||
- Fixed messages for Focus Sash, Confusion, Mummy, Ice Face, Own Tempo, and Revive.
|
- Fixed messages for Focus Sash, Confusion, Mummy, Ice Face, Own Tempo, and Revive.
|
||||||
- Improve error handling when loading spawn-sets to ensure invalid configurations don't crash the server.
|
- Improve error handling when loading spawn-sets to ensure invalid configurations don't crash the server.
|
||||||
@@ -1110,7 +1502,7 @@
|
|||||||
- Added a new universal locator called "top".
|
- Added a new universal locator called "top".
|
||||||
- Added `eggs_collected` and `eggs_hatched` Advancement triggers.
|
- Added `eggs_collected` and `eggs_hatched` Advancement triggers.
|
||||||
- Added missing `minYaw` configuration to the `q.look()` function for JSON posers.
|
- Added missing `minYaw` configuration to the `q.look()` function for JSON posers.
|
||||||
- Some pose condition names have been changed:
|
- Some pose condition names have been changed:
|
||||||
- `isTouchingWaterOrRain` has been changed to `isInWaterOrRain`
|
- `isTouchingWaterOrRain` has been changed to `isInWaterOrRain`
|
||||||
- `isSubermegedInWater` has been changed to `isUnderWater`
|
- `isSubermegedInWater` has been changed to `isUnderWater`
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ repositories {
|
|||||||
maven(url = "${rootProject.projectDir}/deps")
|
maven(url = "${rootProject.projectDir}/deps")
|
||||||
maven(url = "https://api.modrinth.com/maven")
|
maven(url = "https://api.modrinth.com/maven")
|
||||||
maven(url = "https://maven.neoforged.net/releases")
|
maven(url = "https://maven.neoforged.net/releases")
|
||||||
|
maven(url = "https://maven.gegy.dev")
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,12 @@ dependencies {
|
|||||||
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
|
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
}
|
}
|
||||||
|
// LambDynamicLights is handled differently because we need the Mojang-mappings version of it.
|
||||||
|
modCompileOnly(libs.lambDynamicLights) {
|
||||||
|
capabilities {
|
||||||
|
requireCapability("dev.lambdaurora.lambdynamiclights:api-mojmap")
|
||||||
|
}
|
||||||
|
}
|
||||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||||
// modCompileOnly(libs.flywheelFabric)
|
// modCompileOnly(libs.flywheelFabric)
|
||||||
|
|
||||||
@@ -94,4 +101,4 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,102 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023 Cobblemon Contributors
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.cobblemon.mod.common.compat;
|
|
||||||
|
|
||||||
import com.cobblemon.mod.common.CobblemonEntities;
|
|
||||||
import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer;
|
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
|
||||||
import com.cobblemon.mod.common.item.PokedexItem;
|
|
||||||
import com.cobblemon.mod.common.pokemon.FormData;
|
|
||||||
import com.cobblemon.mod.common.pokemon.lighthing.LightingData;
|
|
||||||
import dev.lambdaurora.lambdynlights.LambDynLights;
|
|
||||||
import dev.lambdaurora.lambdynlights.api.DynamicLightHandler;
|
|
||||||
import dev.lambdaurora.lambdynlights.api.DynamicLightHandlers;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
|
|
||||||
// Java class due to relying on entrypoint on Fabric side
|
|
||||||
public class LambDynamicLightsCompat {
|
|
||||||
|
|
||||||
// This is all called on client side
|
|
||||||
// These things are checked every tick so try to keep it as free as possible
|
|
||||||
// That being said it's unlikely school Toshiba person is running dynamic lighting and shaders to enjoy this
|
|
||||||
// Make sure not to call anything Fabric specific :)
|
|
||||||
public static void hookCompat() {
|
|
||||||
// Pokémon entities
|
|
||||||
DynamicLightHandlers.registerDynamicLightHandler(
|
|
||||||
CobblemonEntities.POKEMON,
|
|
||||||
DynamicLightHandler.makeHandler(
|
|
||||||
LambDynamicLightsCompat::resolvedPokemonLightLevel,
|
|
||||||
pokemon -> false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Shouldered Pokémon
|
|
||||||
DynamicLightHandlers.registerDynamicLightHandler(
|
|
||||||
EntityType.PLAYER,
|
|
||||||
DynamicLightHandler.makeHandler(
|
|
||||||
LambDynamicLightsCompat::resolvedPlayerLightLevel,
|
|
||||||
player -> false
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int resolvedPokemonLightLevel(PokemonEntity pokemon) {
|
|
||||||
var underwater = !pokemon.level().getFluidState(BlockPos.containing(pokemon.getX(), pokemon.getEyeY(), pokemon.getZ())).isEmpty();
|
|
||||||
|
|
||||||
ItemStack item = pokemon.getShownItem();
|
|
||||||
int itemLightLevel = item.isEmpty()?0:LambDynLights.getLuminanceFromItemStack(item, underwater);
|
|
||||||
int formLightLevel = extractFormLightLevel(pokemon.getForm(), underwater).orElse(0);
|
|
||||||
|
|
||||||
return Math.max(itemLightLevel, formLightLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int resolvedPlayerLightLevel(Player player) {
|
|
||||||
var underwater = !player.level().getFluidState(BlockPos.containing(player.getX(), player.getEyeY(), player.getZ())).isEmpty();
|
|
||||||
final int leftShoulderLightLevel = extractShoulderLightLevel(PokemonOnShoulderRenderer.shoulderDataFrom(player.getShoulderEntityLeft()), underwater);
|
|
||||||
final int rightShoulderLightLevel = extractShoulderLightLevel(PokemonOnShoulderRenderer.shoulderDataFrom(player.getShoulderEntityRight()), underwater);
|
|
||||||
final int itemLightLevel = customHeldItemLightLevel(player.getMainHandItem(), player.getOffhandItem());
|
|
||||||
|
|
||||||
return Math.max(itemLightLevel, Math.max(leftShoulderLightLevel, rightShoulderLightLevel));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Optional<Integer> extractFormLightLevel(@NotNull FormData form, boolean underwater) {
|
|
||||||
if (form.getLightingData() == null || !liquidGlowModeSupport(form.getLightingData().getLiquidGlowMode(), underwater)) {
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
return Optional.of(form.getLightingData().getLightLevel());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int extractShoulderLightLevel(@Nullable PokemonOnShoulderRenderer.ShoulderData shoulderData, boolean underwater) {
|
|
||||||
if (shoulderData == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack item = shoulderData.getShownItem();
|
|
||||||
int itemLightLevel = item.isEmpty() ? 0 :LambDynLights.getLuminanceFromItemStack(item, underwater);
|
|
||||||
int formLightLevel = extractFormLightLevel(shoulderData.getForm(), underwater).orElse(0);
|
|
||||||
|
|
||||||
return Math.max(itemLightLevel, formLightLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int customHeldItemLightLevel(ItemStack mainhand, ItemStack offhand) {
|
|
||||||
return (mainhand.getItem() instanceof PokedexItem || offhand.getItem() instanceof PokedexItem) ? 13 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean liquidGlowModeSupport(@NotNull LightingData.LiquidGlowMode liquidGlowMode, boolean underwater) {
|
|
||||||
return underwater ? liquidGlowMode.getGlowsUnderwater() : liquidGlowMode.getGlowsInLand();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.compat.lambdynamiclights;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.pokemon.FormData;
|
||||||
|
import com.cobblemon.mod.common.pokemon.lighthing.LightingData;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public abstract class CustomLuminance {
|
||||||
|
protected static Optional<Integer> extractFormLightLevel(@NotNull FormData form, boolean underwater) {
|
||||||
|
if (form.getLightingData() == null || !liquidGlowModeSupport(form.getLightingData().getLiquidGlowMode(), underwater)) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
return Optional.of(form.getLightingData().getLightLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean liquidGlowModeSupport(@NotNull LightingData.LiquidGlowMode liquidGlowMode, boolean underwater) {
|
||||||
|
return underwater ? liquidGlowMode.getGlowsUnderwater() : liquidGlowMode.getGlowsInLand();
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.compat.lambdynamiclights;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.Cobblemon;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.DynamicLightsContext;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.DynamicLightsInitializer;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.entity.luminance.EntityLuminance;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.item.ItemLightSourceManager;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
|
||||||
|
public class LambDynamicLightsInitializer implements DynamicLightsInitializer {
|
||||||
|
public static final EntityLuminance.Type POKEMON_LUMINANCE = EntityLuminance.Type.registerSimple(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(Cobblemon.MODID, "pokemon"),
|
||||||
|
PokemonLuminance.INSTANCE
|
||||||
|
);
|
||||||
|
public static final EntityLuminance.Type PLAYER_LUMINANCE = EntityLuminance.Type.registerSimple(
|
||||||
|
ResourceLocation.fromNamespaceAndPath(Cobblemon.MODID, "shoulder"),
|
||||||
|
PlayerLuminance.INSTANCE
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitializeDynamicLights(DynamicLightsContext context) {
|
||||||
|
Cobblemon.LOGGER.info("Lamb Dynamic Lights compatibility enabled");
|
||||||
|
|
||||||
|
context.entityLightSourceManager().onRegisterEvent().register(ctx -> {
|
||||||
|
ctx.register(EntityType.PLAYER, PlayerLuminance.INSTANCE);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({"removal", "UnstableApiUsage"})
|
||||||
|
@Override
|
||||||
|
public void onInitializeDynamicLights(ItemLightSourceManager itemLightSourceManager) {}
|
||||||
|
}
|
||||||
|
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.compat.lambdynamiclights;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.Cobblemon;
|
||||||
|
import com.cobblemon.mod.common.client.render.layer.PokemonOnShoulderRenderer;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.entity.luminance.EntityLuminance;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.item.ItemLightSourceManager;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.tags.TagKey;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
|
public final class PlayerLuminance extends CustomLuminance implements EntityLuminance {
|
||||||
|
public static final PlayerLuminance INSTANCE = new PlayerLuminance();
|
||||||
|
private static final TagKey<Item> POKEDEX = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(Cobblemon.MODID, "pokedex"));
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Type type() {
|
||||||
|
return LambDynamicLightsInitializer.PLAYER_LUMINANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Range(from = 0L, to = 15L) int getLuminance(@NotNull ItemLightSourceManager itemLightSourceManager, @NotNull Entity entity) {
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
final int shoulderLightLevel = shoulderLuminance(itemLightSourceManager, player);
|
||||||
|
|
||||||
|
final int itemLightLevel = player.isHolding(stack -> stack.is(POKEDEX)) ? 13 : 0;
|
||||||
|
|
||||||
|
return Math.max(shoulderLightLevel, itemLightLevel);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private @Range(from = 0L, to = 15L) static int shoulderLuminance(@NotNull ItemLightSourceManager itemLightSourceManager, @NotNull Player player) {
|
||||||
|
final var leftShoulder = PokemonOnShoulderRenderer.shoulderDataFrom(player.getShoulderEntityLeft());
|
||||||
|
final var rightShoulder = PokemonOnShoulderRenderer.shoulderDataFrom(player.getShoulderEntityRight());
|
||||||
|
|
||||||
|
if (leftShoulder == null && rightShoulder == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int leftShoulderLightLevel = extractShoulderLightLevel(leftShoulder, itemLightSourceManager, player.isUnderWater());
|
||||||
|
final int rightShoulderLightLevel = extractShoulderLightLevel(rightShoulder, itemLightSourceManager, player.isUnderWater());
|
||||||
|
return Math.max(leftShoulderLightLevel, rightShoulderLightLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int extractShoulderLightLevel(@Nullable PokemonOnShoulderRenderer.ShoulderData shoulderData, @NotNull ItemLightSourceManager itemLightSourceManager, boolean underwater) {
|
||||||
|
if (shoulderData == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack item = shoulderData.getShownItem();
|
||||||
|
int itemLightLevel = item.isEmpty() ? 0 : itemLightSourceManager.getLuminance(item, underwater);
|
||||||
|
int formLightLevel = extractFormLightLevel(shoulderData.getForm(), underwater).orElse(0);
|
||||||
|
|
||||||
|
return Math.max(itemLightLevel, formLightLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.compat.lambdynamiclights;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.entity.luminance.EntityLuminance;
|
||||||
|
import dev.lambdaurora.lambdynlights.api.item.ItemLightSourceManager;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Range;
|
||||||
|
|
||||||
|
public final class PokemonLuminance extends CustomLuminance implements EntityLuminance {
|
||||||
|
public static final PokemonLuminance INSTANCE = new PokemonLuminance();
|
||||||
|
|
||||||
|
private PokemonLuminance() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Type type() {
|
||||||
|
return LambDynamicLightsInitializer.POKEMON_LUMINANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Range(from = 0L, to = 15L) int getLuminance(
|
||||||
|
@NotNull ItemLightSourceManager itemLightSourceManager,
|
||||||
|
@NotNull Entity entity
|
||||||
|
) {
|
||||||
|
if (entity instanceof PokemonEntity pokemon) {
|
||||||
|
boolean underwater = pokemon.isUnderWater();
|
||||||
|
ItemStack item = pokemon.getShownItem();
|
||||||
|
int itemLightLevel = item.isEmpty() ? 0 : itemLightSourceManager.getLuminance(item, underwater);
|
||||||
|
int formLightLevel = extractFormLightLevel(pokemon.getForm(), underwater).orElse(0);
|
||||||
|
|
||||||
|
return Math.max(itemLightLevel, formLightLevel);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.mixin;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.EnderpearlItem;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.AABB;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
@Mixin(EnderpearlItem.class)
|
||||||
|
public abstract class EnderPearlItemMixin {
|
||||||
|
@Inject(method = "use", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
private void cobblemon$use(Level level, Player player, InteractionHand usedHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir) {
|
||||||
|
double range = player.entityInteractionRange();
|
||||||
|
Entity closestEntity = level.getEntities(player, AABB.ofSize(player.position(), range, range, range)).stream()
|
||||||
|
.filter(entity -> isLookingAt(player, entity))
|
||||||
|
.min(Comparator.comparingDouble(entity -> entity.distanceTo(player)))
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (closestEntity instanceof PokemonEntity pokemonEntity) {
|
||||||
|
if (player.isCrouching() && pokemonEntity.getOwnerUUID() == player.getUUID()) {
|
||||||
|
cir.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLookingAt(Player player, Entity other) {
|
||||||
|
float maxDistance = 10F;
|
||||||
|
float stepDistance = 0.1F;
|
||||||
|
double step = stepDistance;
|
||||||
|
Vec3 startPos = player.getEyePosition();
|
||||||
|
Vec3 direction = player.getLookAngle();
|
||||||
|
|
||||||
|
while (step <= maxDistance) {
|
||||||
|
Vec3 location = startPos.add(direction.scale(step));
|
||||||
|
step += stepDistance;
|
||||||
|
|
||||||
|
if (other.getBoundingBox().contains(location)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.mixin;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
||||||
|
import com.cobblemon.mod.common.pokemon.ai.EntityBehaviour;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.Mob;
|
||||||
|
import net.minecraft.world.entity.ai.goal.AvoidEntityGoal;
|
||||||
|
import net.minecraft.world.entity.animal.Fox;
|
||||||
|
import net.minecraft.world.entity.monster.Creeper;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(Fox.class)
|
||||||
|
public class EntityFoxMixin extends Mob {
|
||||||
|
|
||||||
|
private EntityFoxMixin(net.minecraft.world.entity.EntityType<? extends Creeper> entityType, Level world) {
|
||||||
|
super(entityType, world);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "registerGoals", at = @At(value = "TAIL"), cancellable = false)
|
||||||
|
private void cobblemon$initGoals(CallbackInfo callbackInfo) {
|
||||||
|
final Fox fox = (Fox) (Object) this;
|
||||||
|
// Pokemon Entities
|
||||||
|
this.goalSelector.addGoal(
|
||||||
|
4,
|
||||||
|
new AvoidEntityGoal<>(
|
||||||
|
fox,
|
||||||
|
PokemonEntity.class,
|
||||||
|
8.0f,
|
||||||
|
1.6,
|
||||||
|
1.4,
|
||||||
|
entity -> ((PokemonEntity)entity).getBehaviour().getEntityInteract().getAvoidedByFox() && ((PokemonEntity)entity).getBeamMode() != 1
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Players with shoulder mounted Pokemon
|
||||||
|
this.goalSelector.addGoal(
|
||||||
|
3,
|
||||||
|
new AvoidEntityGoal<>(
|
||||||
|
fox,
|
||||||
|
ServerPlayer.class,
|
||||||
|
8.0f,
|
||||||
|
1.6,
|
||||||
|
1.4,
|
||||||
|
entity -> EntityBehaviour.Companion.hasFoxFearedShoulderMount((ServerPlayer)entity)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -58,11 +58,9 @@ public abstract class LivingEntityMixin extends Entity implements OrientationCon
|
|||||||
@Override
|
@Override
|
||||||
public @NotNull HitResult pick(double hitDistance, float partialTicks, boolean hitFluids) {
|
public @NotNull HitResult pick(double hitDistance, float partialTicks, boolean hitFluids) {
|
||||||
Entity vehicle = this.getVehicle();
|
Entity vehicle = this.getVehicle();
|
||||||
if (vehicle instanceof PokemonEntity pokemonEntity) {
|
if (vehicle instanceof PokemonEntity pokemonEntity && pokemonEntity.getDelegate() instanceof PokemonClientDelegate delegate) {
|
||||||
int seatIndex = pokemonEntity.getPassengers().indexOf(this);
|
int seatIndex = pokemonEntity.getPassengers().indexOf(this);
|
||||||
Seat seat = pokemonEntity.getSeats().get(seatIndex);
|
Seat seat = pokemonEntity.getSeats().get(seatIndex);
|
||||||
|
|
||||||
PokemonClientDelegate delegate = (PokemonClientDelegate) pokemonEntity.getDelegate();
|
|
||||||
MatrixWrapper locator = delegate.getLocatorStates().get(seat.getLocator());
|
MatrixWrapper locator = delegate.getLocatorStates().get(seat.getLocator());
|
||||||
|
|
||||||
Vec3 locatorOffset = new Vec3(locator.getMatrix().getTranslation(new Vector3f()));
|
Vec3 locatorOffset = new Vec3(locator.getMatrix().getTranslation(new Vector3f()));
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.mixin;
|
||||||
|
|
||||||
|
import com.bedrockk.molang.runtime.value.DoubleValue;
|
||||||
|
import com.cobblemon.mod.common.entity.MoLangScriptingEntity;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.level.block.PowderSnowBlock;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(PowderSnowBlock.class)
|
||||||
|
public abstract class PowderSnowBlockMixin {
|
||||||
|
@Inject(method = "canEntityWalkOnPowderSnow", at = @At(value = "RETURN"), cancellable = true)
|
||||||
|
private static void cobblemon$canEntityWalkOnPowderSnow(Entity entity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
|
if (ci.getReturnValue() == false && entity instanceof MoLangScriptingEntity) {
|
||||||
|
ci.setReturnValue(((MoLangScriptingEntity) entity).getConfig().getMap().getOrDefault("can_stand_on_powder_snow", DoubleValue.ZERO).asDouble() == 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.mixin;
|
||||||
|
|
||||||
|
import com.bedrockk.molang.runtime.value.DoubleValue;
|
||||||
|
import com.cobblemon.mod.common.entity.MoLangScriptingEntity;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.block.SweetBerryBushBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
|
||||||
|
@Mixin(SweetBerryBushBlock.class)
|
||||||
|
public abstract class SweetBerryBushBlockMixin {
|
||||||
|
|
||||||
|
@Inject(method = "entityInside", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
private void cobblemon$entityInside(BlockState state, Level level, BlockPos pos, Entity entity, CallbackInfo callbackInfo) {
|
||||||
|
if (entity instanceof MoLangScriptingEntity) {
|
||||||
|
if (((MoLangScriptingEntity) entity).getConfig().getMap().getOrDefault("immune_to_sweet_berry_bush_block", DoubleValue.ZERO).asDouble() == 1.0) {
|
||||||
|
callbackInfo.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,9 +25,9 @@ public class TargetingConditionsMixin {
|
|||||||
@Inject(method = "test", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "test", at = @At("HEAD"), cancellable = true)
|
||||||
public void test(@Nullable LivingEntity baseEntity, LivingEntity targetEntity, CallbackInfoReturnable<Boolean> ci) {
|
public void test(@Nullable LivingEntity baseEntity, LivingEntity targetEntity, CallbackInfoReturnable<Boolean> ci) {
|
||||||
if (targetEntity instanceof ServerPlayer player) {
|
if (targetEntity instanceof ServerPlayer player) {
|
||||||
boolean canTargetInBattle = player.level().getGameRules().getBoolean(CobblemonGameRules.MOB_TARGET_IN_BATTLE);
|
if (player.level().getGameRules().getBoolean(CobblemonGameRules.MOB_TARGET_IN_BATTLE)) return;
|
||||||
boolean targetInBattle = Cobblemon.INSTANCE.getBattleRegistry().getBattleByParticipatingPlayer(player) != null;
|
boolean targetInBattle = Cobblemon.INSTANCE.getBattleRegistry().getBattleByParticipatingPlayer(player) != null;
|
||||||
if (!canTargetInBattle && targetInBattle) ci.setReturnValue(false);
|
if (targetInBattle) ci.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-1
@@ -15,9 +15,11 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
|||||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.item.alchemy.PotionBrewing;
|
import net.minecraft.world.item.alchemy.PotionBrewing;
|
||||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
import net.minecraft.world.item.crafting.RecipeManager;
|
import net.minecraft.world.item.crafting.RecipeManager;
|
||||||
@@ -27,6 +29,8 @@ import net.minecraft.world.level.block.entity.BrewingStandBlockEntity;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -43,7 +47,9 @@ public class BrewingStandBlockEntityMixin {
|
|||||||
//copied from vanilla doBrew logic, but slightly tweaked to work for cobblemon, this was needed as replacing the loop was not quite possible inside doBrew
|
//copied from vanilla doBrew logic, but slightly tweaked to work for cobblemon, this was needed as replacing the loop was not quite possible inside doBrew
|
||||||
ItemStack itemStack = slots.get(3);
|
ItemStack itemStack = slots.get(3);
|
||||||
for(int i = 0; i < 3; ++i) {
|
for(int i = 0; i < 3; ++i) {
|
||||||
slots.set(i, recipe.getResult().copy());
|
if (!slots.get(i).isEmpty()){
|
||||||
|
slots.set(i, recipe.getResult().copy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
itemStack.shrink(1);
|
itemStack.shrink(1);
|
||||||
@@ -91,4 +97,35 @@ public class BrewingStandBlockEntityMixin {
|
|||||||
|
|
||||||
return recipeHolder.map(RecipeHolder::value).orElse(null);
|
return recipeHolder.map(RecipeHolder::value).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "canPlaceItem", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void cobblemon$canPlaceItem(int slot, ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (stack == null || stack.isEmpty()) return;
|
||||||
|
|
||||||
|
BrewingStandBlockEntity self = (BrewingStandBlockEntity) (Object) this;
|
||||||
|
Level level = self.getLevel();
|
||||||
|
|
||||||
|
if (level != null) {
|
||||||
|
|
||||||
|
var rm = level.getRecipeManager();
|
||||||
|
|
||||||
|
//Input slot
|
||||||
|
if (slot == 3) {
|
||||||
|
if (BrewingStandRecipe.Companion.isInput(stack, rm)) {
|
||||||
|
cir.setReturnValue(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Output slots
|
||||||
|
if (slot >= 0 && slot < 3) {
|
||||||
|
if (BrewingStandRecipe.Companion.isBottle(stack, rm)) {
|
||||||
|
if (self.getItem(slot).isEmpty()) {
|
||||||
|
cir.setReturnValue(true);
|
||||||
|
} else {
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+8
-7
@@ -31,14 +31,15 @@ public class AbstractClientPlayerMixin {
|
|||||||
PokedexUsageContext usageContext = CobblemonClient.INSTANCE.getPokedexUsageContext();
|
PokedexUsageContext usageContext = CobblemonClient.INSTANCE.getPokedexUsageContext();
|
||||||
if (usageContext.getScanningGuiOpen()) {
|
if (usageContext.getScanningGuiOpen()) {
|
||||||
cir.setReturnValue(usageContext.getFovMultiplier());
|
cir.setReturnValue(usageContext.getFovMultiplier());
|
||||||
}
|
} else {
|
||||||
|
// Only modify fov through riding if the pokedex is not open
|
||||||
|
LocalPlayer player = (LocalPlayer) (Object) this;
|
||||||
|
if (player != null && player.isPassenger() && player.getVehicle() instanceof PokemonEntity) {
|
||||||
|
PokemonEntity ride = (PokemonEntity) player.getVehicle();
|
||||||
|
|
||||||
LocalPlayer player = (LocalPlayer) (Object) this;
|
// Return custom fov mult for riding
|
||||||
if (player != null && player.isPassenger() && player.getVehicle() instanceof PokemonEntity) {
|
cir.setReturnValue(ride.rideFovMult());
|
||||||
PokemonEntity ride = (PokemonEntity) player.getVehicle();
|
}
|
||||||
|
|
||||||
//Return custom fov mult
|
|
||||||
cir.setReturnValue(ride.rideFovMult());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.mixin.client;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.client.render.player.MountedPlayerRenderer;
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
import net.minecraft.client.model.AgeableListModel;
|
||||||
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
|
import net.minecraft.client.model.Model;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This mixin adds to the head of the renderToBuffer function and allows us to detect if it is a HumanoidModel and
|
||||||
|
* is being rendered as part of a player in the world who is riding a PokemonEntity. If so we need to obey any
|
||||||
|
* root animations that have been applied earlier.
|
||||||
|
*
|
||||||
|
* @author Hiroku
|
||||||
|
* @since May 16, 2025
|
||||||
|
*/
|
||||||
|
@Mixin(AgeableListModel.class)
|
||||||
|
public class AgeableListModelMixin {
|
||||||
|
@Inject(method = "renderToBuffer", at = @At("HEAD"))
|
||||||
|
private void cobblemon$renderToBuffer(
|
||||||
|
PoseStack poseStack,
|
||||||
|
VertexConsumer vertexConsumer,
|
||||||
|
int packedLight,
|
||||||
|
int packedOverlay,
|
||||||
|
int colour,
|
||||||
|
CallbackInfo ci
|
||||||
|
) {
|
||||||
|
Model model = (Model) (Object) this;
|
||||||
|
if (model instanceof HumanoidModel<?> && MountedPlayerRenderer.shouldApplyRootAnimation) {
|
||||||
|
MountedPlayerRenderer.INSTANCE.animateRoot(poseStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ public abstract class CameraMixin {
|
|||||||
@Inject(method = "setRotation", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "setRotation", at = @At("HEAD"), cancellable = true)
|
||||||
|
|
||||||
public void cobblemon$setRotation(float f, float g, CallbackInfo ci) {
|
public void cobblemon$setRotation(float f, float g, CallbackInfo ci) {
|
||||||
if (!(this.entity instanceof OrientationControllable controllable) || Cobblemon.config.getDisableRoll()) return;
|
if (!(this.entity instanceof OrientationControllable controllable)) return;
|
||||||
var controller = controllable.getOrientationController();
|
var controller = controllable.getOrientationController();
|
||||||
if (!controller.isActive() && controller.getOrientation() != null) {
|
if (!controller.isActive() && controller.getOrientation() != null) {
|
||||||
if(this.returnTimer < 1) {
|
if(this.returnTimer < 1) {
|
||||||
|
|||||||
+19
-15
@@ -19,20 +19,17 @@ import net.minecraft.world.entity.LivingEntity;
|
|||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
@Mixin(HumanoidModel.class)
|
@Mixin(HumanoidModel.class)
|
||||||
public class HumanoidModelMixin {
|
public class HumanoidModelMixin {
|
||||||
@Unique HashMap<String, ModelPart> relevantPartsByName = new HashMap<>();
|
|
||||||
|
|
||||||
@Shadow @Final
|
@Shadow @Final
|
||||||
public ModelPart head;
|
public ModelPart head;
|
||||||
@Shadow @Final
|
@Shadow @Final
|
||||||
|
public ModelPart hat;
|
||||||
|
@Shadow @Final
|
||||||
public ModelPart rightArm;
|
public ModelPart rightArm;
|
||||||
@Shadow @Final
|
@Shadow @Final
|
||||||
public ModelPart leftArm;
|
public ModelPart leftArm;
|
||||||
@@ -40,6 +37,8 @@ public class HumanoidModelMixin {
|
|||||||
public ModelPart rightLeg;
|
public ModelPart rightLeg;
|
||||||
@Shadow @Final
|
@Shadow @Final
|
||||||
public ModelPart leftLeg;
|
public ModelPart leftLeg;
|
||||||
|
@Shadow @Final
|
||||||
|
public ModelPart body;
|
||||||
|
|
||||||
@Inject(method = "setupAnim*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/geom/ModelPart;copyFrom(Lnet/minecraft/client/model/geom/ModelPart;)V", shift = At.Shift.BEFORE))
|
@Inject(method = "setupAnim*", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/geom/ModelPart;copyFrom(Lnet/minecraft/client/model/geom/ModelPart;)V", shift = At.Shift.BEFORE))
|
||||||
public void cobblemon$animateRiders(
|
public void cobblemon$animateRiders(
|
||||||
@@ -51,19 +50,23 @@ public class HumanoidModelMixin {
|
|||||||
float headPitch,
|
float headPitch,
|
||||||
CallbackInfo ci
|
CallbackInfo ci
|
||||||
) {
|
) {
|
||||||
if (relevantPartsByName.isEmpty()) {
|
MountedPlayerRenderer.shouldApplyRootAnimation = false;
|
||||||
relevantPartsByName.put("arm_left", leftArm);
|
|
||||||
relevantPartsByName.put("arm_right", rightArm);
|
if (MountedPlayerRenderer.relevantPartsByName.size() <= 1) {
|
||||||
relevantPartsByName.put("leg_left", leftLeg);
|
MountedPlayerRenderer.relevantPartsByName.put("arm_left", leftArm);
|
||||||
relevantPartsByName.put("leg_right", rightLeg);
|
MountedPlayerRenderer.relevantPartsByName.put("arm_right", rightArm);
|
||||||
relevantPartsByName.put("head", head);
|
MountedPlayerRenderer.relevantPartsByName.put("leg_left", leftLeg);
|
||||||
|
MountedPlayerRenderer.relevantPartsByName.put("leg_right", rightLeg);
|
||||||
|
MountedPlayerRenderer.relevantPartsByName.put("head", head);
|
||||||
|
MountedPlayerRenderer.relevantPartsByName.put("hat", hat);
|
||||||
|
MountedPlayerRenderer.relevantPartsByName.put("torso", body);
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity vehicle = entity.getVehicle();
|
Entity vehicle = entity.getVehicle();
|
||||||
if (vehicle instanceof PokemonEntity pokemonEntity && entity instanceof OrientationControllable) {
|
if (vehicle instanceof PokemonEntity pokemonEntity && entity instanceof OrientationControllable) {
|
||||||
var shouldRotatePlayerHead = pokemonEntity.ifRidingAvailableSupply(false, (behaviour, settings, state) -> {
|
var shouldRotatePlayerHead = pokemonEntity.ifRidingAvailableSupply(false, (behaviour, settings, state) ->
|
||||||
return behaviour.shouldRotateRiderHead(settings, state, pokemonEntity);
|
behaviour.shouldRotateRiderHead(settings, state, pokemonEntity)
|
||||||
});
|
);
|
||||||
|
|
||||||
if (!shouldRotatePlayerHead) {
|
if (!shouldRotatePlayerHead) {
|
||||||
netHeadYaw = 0f;
|
netHeadYaw = 0f;
|
||||||
@@ -76,7 +79,8 @@ public class HumanoidModelMixin {
|
|||||||
|
|
||||||
if (!(entity instanceof AbstractClientPlayer player)) return;
|
if (!(entity instanceof AbstractClientPlayer player)) return;
|
||||||
|
|
||||||
MountedPlayerRenderer.INSTANCE.animate(pokemonEntity, player, relevantPartsByName, netHeadYaw, headPitch, ageInTicks, limbSwing, limbSwingAmount);
|
MountedPlayerRenderer.shouldApplyRootAnimation = true;
|
||||||
|
MountedPlayerRenderer.INSTANCE.animate((HumanoidModel<AbstractClientPlayer>)(Object)this, pokemonEntity, player, netHeadYaw, headPitch, ageInTicks, limbSwing, limbSwingAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +174,16 @@ public abstract class LocalPlayerMixin extends AbstractClientPlayer implements O
|
|||||||
return this.cobblemon$isDoubleJumping;
|
return this.cobblemon$isDoubleJumping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "isHandsBusy", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void cobblemon$isHandsBusy(CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
Entity vehicle = this.getVehicle();
|
||||||
|
if (vehicle instanceof PokemonEntity pokemonEntity) {
|
||||||
|
int seatIndex = pokemonEntity.getPassengers().indexOf(this);
|
||||||
|
Seat seat = pokemonEntity.getSeats().get(seatIndex);
|
||||||
|
cir.setReturnValue(seat.getHandsBusy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HitResult pick(double hitDistance, float partialTicks, boolean hitFluids) {
|
public HitResult pick(double hitDistance, float partialTicks, boolean hitFluids) {
|
||||||
Entity vehicle = this.getVehicle();
|
Entity vehicle = this.getVehicle();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.mixin.client;
|
package com.cobblemon.mod.common.mixin.client;
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.Cobblemon;
|
||||||
import com.cobblemon.mod.common.OrientationControllable;
|
import com.cobblemon.mod.common.OrientationControllable;
|
||||||
import com.cobblemon.mod.common.client.CobblemonClient;
|
import com.cobblemon.mod.common.client.CobblemonClient;
|
||||||
import com.cobblemon.mod.common.client.keybind.keybinds.PartySendBinding;
|
import com.cobblemon.mod.common.client.keybind.keybinds.PartySendBinding;
|
||||||
@@ -116,6 +117,8 @@ public abstract class MouseHandlerMixin {
|
|||||||
@Local(argsOnly = true) double d,
|
@Local(argsOnly = true) double d,
|
||||||
@Local(argsOnly = true) double movementTime
|
@Local(argsOnly = true) double movementTime
|
||||||
) {
|
) {
|
||||||
|
boolean returnValue = true;
|
||||||
|
|
||||||
PokedexUsageContext usageContext = CobblemonClient.INSTANCE.getPokedexUsageContext();
|
PokedexUsageContext usageContext = CobblemonClient.INSTANCE.getPokedexUsageContext();
|
||||||
if (usageContext.getScanningGuiOpen()) {
|
if (usageContext.getScanningGuiOpen()) {
|
||||||
this.smoothTurnY.reset();
|
this.smoothTurnY.reset();
|
||||||
@@ -126,7 +129,12 @@ public abstract class MouseHandlerMixin {
|
|||||||
var sensitivity = Mth.lerp(usageContext.getFovMultiplier(), spyglassSensitivity, lookSensitivity);
|
var sensitivity = Mth.lerp(usageContext.getFovMultiplier(), spyglassSensitivity, lookSensitivity);
|
||||||
var yRotationFlip = this.minecraft.options.invertYMouse().get() ? -1 : 1;
|
var yRotationFlip = this.minecraft.options.invertYMouse().get() ? -1 : 1;
|
||||||
player.turn(this.accumulatedDX * sensitivity, (this.accumulatedDY * sensitivity * yRotationFlip));
|
player.turn(this.accumulatedDX * sensitivity, (this.accumulatedDY * sensitivity * yRotationFlip));
|
||||||
return false;
|
returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clamp player rotation if riding and the vehicle demands it
|
||||||
|
if (player.isPassenger() && player.getVehicle() instanceof PokemonEntity vehicle) {
|
||||||
|
vehicle.clampPassengerRotation(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(player instanceof OrientationControllable controllable)) return true;
|
if (!(player instanceof OrientationControllable controllable)) return true;
|
||||||
@@ -137,35 +145,33 @@ public abstract class MouseHandlerMixin {
|
|||||||
pitchSmoother.reset();
|
pitchSmoother.reset();
|
||||||
rollSmoother.reset();
|
rollSmoother.reset();
|
||||||
yawSmoother.reset();
|
yawSmoother.reset();
|
||||||
return true;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send mouse input to be interpreted into rotation
|
// Send mouse input to be interpreted into rotation
|
||||||
//deltas by the ride controller
|
// deltas by the ride controller
|
||||||
Vec3 angVecMouse = cobblemon$getRideMouseRotation(cursorDeltaX, cursorDeltaY, movementTime);
|
Vec3 angVecMouse = cobblemon$getRideMouseRotation(cursorDeltaX, cursorDeltaY, movementTime);
|
||||||
|
|
||||||
//Perform Rotation using mouse influenced rotation deltas.
|
// Perform Rotation using mouse influenced rotation deltas.
|
||||||
controllable.getOrientationController().rotate(
|
controllable.getOrientationController().rotate(
|
||||||
(float) angVecMouse.x,
|
(float) angVecMouse.x,
|
||||||
(float) angVecMouse.y,
|
(float) angVecMouse.y,
|
||||||
(float) angVecMouse.z
|
(float) angVecMouse.z
|
||||||
);
|
);
|
||||||
|
|
||||||
//Gather and apply the current rotation deltas
|
// Gather and apply the current rotation deltas
|
||||||
var angRot = cobblemon$getAngularVelocity(movementTime);
|
var angRot = cobblemon$getAngularVelocity(movementTime);
|
||||||
|
|
||||||
//Apply smoothing if requested by the controller.
|
// Apply smoothing if requested by the controller.
|
||||||
//This Might be best if done by the controller itself?
|
// This Might be best if done by the controller itself?
|
||||||
if(cobblemon$shouldUseAngVelSmoothing())
|
if(cobblemon$shouldUseAngVelSmoothing()) {
|
||||||
{
|
|
||||||
var yaw = yawSmoother.getNewDeltaValue(angRot.x * 0.5f, d);
|
var yaw = yawSmoother.getNewDeltaValue(angRot.x * 0.5f, d);
|
||||||
var pitch = pitchSmoother.getNewDeltaValue(angRot.y * 0.5f, d);
|
var pitch = pitchSmoother.getNewDeltaValue(angRot.y * 0.5f, d);
|
||||||
var roll = rollSmoother.getNewDeltaValue(angRot.z * 0.5f, d);
|
var roll = rollSmoother.getNewDeltaValue(angRot.z * 0.5f, d);
|
||||||
controllable.getOrientationController().rotate((float) yaw, (float) pitch, (float) roll);
|
controllable.getOrientationController().rotate((float) yaw, (float) pitch, (float) roll);
|
||||||
}
|
}
|
||||||
//Otherwise simply apply the smoothing
|
// Otherwise simply apply the smoothing
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
controllable.getOrientationController().rotate((float) (angRot.x * 10 * d), (float) (angRot.y * 10 * d), (float) (angRot.z * 10 * d));
|
controllable.getOrientationController().rotate((float) (angRot.x * 10 * d), (float) (angRot.y * 10 * d), (float) (angRot.z * 10 * d));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -210,6 +216,18 @@ public abstract class MouseHandlerMixin {
|
|||||||
if (vehicle == null) return Vec3.ZERO;
|
if (vehicle == null) return Vec3.ZERO;
|
||||||
if (!(vehicle instanceof PokemonEntity pokemonEntity)) return Vec3.ZERO;
|
if (!(vehicle instanceof PokemonEntity pokemonEntity)) return Vec3.ZERO;
|
||||||
|
|
||||||
|
var invertYaw = Cobblemon.config.getInvertYaw();
|
||||||
|
var invertPitch = Cobblemon.config.getInvertPitch();
|
||||||
|
|
||||||
|
var xValue = mouseX * Cobblemon.config.getXAxisSensitivity();
|
||||||
|
var yValue = mouseY * Cobblemon.config.getYAxisSensitivity();
|
||||||
|
|
||||||
|
var swapXAndY = Cobblemon.config.getSwapXAndYAxes();
|
||||||
|
|
||||||
|
var yaw = (swapXAndY ? yValue : xValue) * (invertYaw? -1.0f : 1.0f);
|
||||||
|
|
||||||
|
var pitch = (swapXAndY ? xValue : yValue) * (invertPitch? -1.0f : 1.0f);
|
||||||
|
|
||||||
var sensitivity = cobblemon$getRidingSensitivity();
|
var sensitivity = cobblemon$getRidingSensitivity();
|
||||||
return pokemonEntity.ifRidingAvailableSupply(Vec3.ZERO, (behaviour, settings, state) -> {
|
return pokemonEntity.ifRidingAvailableSupply(Vec3.ZERO, (behaviour, settings, state) -> {
|
||||||
return behaviour.rotationOnMouseXY(
|
return behaviour.rotationOnMouseXY(
|
||||||
@@ -217,8 +235,8 @@ public abstract class MouseHandlerMixin {
|
|||||||
state,
|
state,
|
||||||
pokemonEntity,
|
pokemonEntity,
|
||||||
player,
|
player,
|
||||||
mouseY,
|
pitch,
|
||||||
mouseX,
|
yaw,
|
||||||
yMouseSmoother,
|
yMouseSmoother,
|
||||||
xMouseSmoother,
|
xMouseSmoother,
|
||||||
sensitivity,
|
sensitivity,
|
||||||
|
|||||||
+3
-4
@@ -10,8 +10,7 @@ package com.cobblemon.mod.common.mixin.client.snapshots;
|
|||||||
|
|
||||||
import com.cobblemon.mod.common.CobblemonBuildDetails;
|
import com.cobblemon.mod.common.CobblemonBuildDetails;
|
||||||
import com.cobblemon.mod.common.client.gui.snapshots.SnapshotWarningScreen;
|
import com.cobblemon.mod.common.client.gui.snapshots.SnapshotWarningScreen;
|
||||||
import com.cobblemon.mod.common.client.snapshots.SnapshotAcknowledgementData;
|
import com.cobblemon.mod.common.client.persisted.ClientPersistedData;
|
||||||
import com.cobblemon.mod.common.client.snapshots.SnapshotAcknowledgementReader;
|
|
||||||
import kotlin.Unit;
|
import kotlin.Unit;
|
||||||
import net.minecraft.SharedConstants;
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
@@ -42,7 +41,7 @@ public final class SnapshotWarningMixin {
|
|||||||
return Unit.INSTANCE;
|
return Unit.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SnapshotAcknowledgementReader.INSTANCE.write(new SnapshotAcknowledgementData(CobblemonBuildDetails.VERSION, dsa));
|
ClientPersistedData.INSTANCE.writeSnapshotsData(new ClientPersistedData.SnapshotAcknowledgementData(CobblemonBuildDetails.VERSION, dsa));
|
||||||
|
|
||||||
runnable.run();
|
runnable.run();
|
||||||
return Unit.INSTANCE;
|
return Unit.INSTANCE;
|
||||||
@@ -54,7 +53,7 @@ public final class SnapshotWarningMixin {
|
|||||||
@Unique
|
@Unique
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
private boolean cobblemon$isAcknowledged() {
|
private boolean cobblemon$isAcknowledged() {
|
||||||
SnapshotAcknowledgementData data = SnapshotAcknowledgementReader.INSTANCE.read();
|
ClientPersistedData.SnapshotAcknowledgementData data = ClientPersistedData.INSTANCE.readSnapshotsData();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,18 @@
|
|||||||
package com.cobblemon.mod.common.mixin.entity;
|
package com.cobblemon.mod.common.mixin.entity;
|
||||||
|
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
@@ -29,4 +35,27 @@ public abstract class EntityMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WrapOperation(
|
||||||
|
method = "collide(Lnet/minecraft/world/phys/Vec3;)Lnet/minecraft/world/phys/Vec3;",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/entity/Entity;onGround()Z"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
public boolean cobblemon$forceOnGroundForStepUp(Entity entity, Operation<Boolean> original) {
|
||||||
|
if (entity instanceof PokemonEntity && entity.hasControllingPassenger()) {
|
||||||
|
BlockPos below = entity.blockPosition().below();
|
||||||
|
Level level = entity.level();
|
||||||
|
var blockStateBelow = level.getBlockState(below);
|
||||||
|
boolean isAirOrLiquid = blockStateBelow.isAir() || !blockStateBelow.getFluidState().isEmpty();
|
||||||
|
boolean canSupportEntity = blockStateBelow.isFaceSturdy(level, below, Direction.UP);
|
||||||
|
boolean standingOnSolid = canSupportEntity && !isAirOrLiquid;
|
||||||
|
if (standingOnSolid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return original.call(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ import com.cobblemon.mod.common.config.starter.StarterConfig
|
|||||||
import com.cobblemon.mod.common.data.CobblemonDataProvider
|
import com.cobblemon.mod.common.data.CobblemonDataProvider
|
||||||
import com.cobblemon.mod.common.events.AdvancementHandler
|
import com.cobblemon.mod.common.events.AdvancementHandler
|
||||||
import com.cobblemon.mod.common.events.EntityCallbackHandler
|
import com.cobblemon.mod.common.events.EntityCallbackHandler
|
||||||
import com.cobblemon.mod.common.events.FlowHandler
|
import com.cobblemon.mod.common.events.CallbackHandler
|
||||||
import com.cobblemon.mod.common.events.PokedexHandler
|
import com.cobblemon.mod.common.events.PokedexHandler
|
||||||
import com.cobblemon.mod.common.events.ServerTickHandler
|
import com.cobblemon.mod.common.events.ServerTickHandler
|
||||||
import com.cobblemon.mod.common.net.messages.client.settings.ServerSettingsPacket
|
import com.cobblemon.mod.common.net.messages.client.settings.ServerSettingsPacket
|
||||||
@@ -313,7 +313,7 @@ object Cobblemon {
|
|||||||
|
|
||||||
CobblemonEvents.POKEMON_PROPERTY_INITIALISED.emit(Unit)
|
CobblemonEvents.POKEMON_PROPERTY_INITIALISED.emit(Unit)
|
||||||
|
|
||||||
FlowHandler.setup()
|
CallbackHandler.setup()
|
||||||
EntityCallbackHandler.setup()
|
EntityCallbackHandler.setup()
|
||||||
|
|
||||||
ifDedicatedServer {
|
ifDedicatedServer {
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
|||||||
@JvmField
|
@JvmField
|
||||||
val APRICORN_FENCE = this.create("apricorn_fence", FenceBlock(BlockBehaviour.Properties.of().mapColor(APRICORN_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
val APRICORN_FENCE = this.create("apricorn_fence", FenceBlock(BlockBehaviour.Properties.of().mapColor(APRICORN_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
||||||
@JvmField
|
@JvmField
|
||||||
val APRICORN_FENCE_GATE = this.create("apricorn_fence_gate", FenceGateBlock(APRICORN_WOOD_TYPE, BlockBehaviour.Properties.of().mapColor(APRICORN_PLANKS.defaultMapColor()).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
val APRICORN_FENCE_GATE = this.create("apricorn_fence_gate", FenceGateBlock(APRICORN_WOOD_TYPE, BlockBehaviour.Properties.of().mapColor(APRICORN_PLANKS.defaultMapColor()).strength(2.0f, 3.0f).sound(SoundType.WOOD).ignitedByLava().forceSolidOn()))
|
||||||
@JvmField
|
@JvmField
|
||||||
val APRICORN_BUTTON = this.create("apricorn_button", BlocksInvoker.createWoodenButtonBlock(APRICORN_BLOCK_SET_TYPE))
|
val APRICORN_BUTTON = this.create("apricorn_button", BlocksInvoker.createWoodenButtonBlock(APRICORN_BLOCK_SET_TYPE))
|
||||||
@JvmField
|
@JvmField
|
||||||
@@ -205,7 +205,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
|||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_FENCE = this.create("saccharine_fence", FenceBlock(BlockBehaviour.Properties.of().mapColor(SACCHARINE_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
val SACCHARINE_FENCE = this.create("saccharine_fence", FenceBlock(BlockBehaviour.Properties.of().mapColor(SACCHARINE_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_FENCE_GATE = this.create("saccharine_fence_gate", FenceGateBlock(SACCHARINE_WOOD_TYPE, BlockBehaviour.Properties.of().mapColor(SACCHARINE_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD)))
|
val SACCHARINE_FENCE_GATE = this.create("saccharine_fence_gate", FenceGateBlock(SACCHARINE_WOOD_TYPE, BlockBehaviour.Properties.of().mapColor(SACCHARINE_PLANKS.defaultMapColor()).instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0f).sound(SoundType.WOOD).ignitedByLava().forceSolidOn()))
|
||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_BUTTON = this.create("saccharine_button", BlocksInvoker.createWoodenButtonBlock(BlockSetType.OAK))
|
val SACCHARINE_BUTTON = this.create("saccharine_button", BlocksInvoker.createWoodenButtonBlock(BlockSetType.OAK))
|
||||||
@JvmField
|
@JvmField
|
||||||
@@ -213,7 +213,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, ResourceKey<Registry<
|
|||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_SIGN = this.create("saccharine_sign", CobblemonSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SIGN), SACCHARINE_WOOD_TYPE))
|
val SACCHARINE_SIGN = this.create("saccharine_sign", CobblemonSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SIGN), SACCHARINE_WOOD_TYPE))
|
||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_WALL_SIGN = this.create("saccharine_wall_sign", CobblemonWallSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_WALL_SIGN), SACCHARINE_WOOD_TYPE))
|
val SACCHARINE_WALL_SIGN = this.create("saccharine_wall_sign", CobblemonWallSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SIGN), SACCHARINE_WOOD_TYPE))
|
||||||
@JvmField
|
@JvmField
|
||||||
val SACCHARINE_HANGING_SIGN = this.create("saccharine_hanging_sign", CobblemonHangingSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_WALL_HANGING_SIGN), SACCHARINE_WOOD_TYPE))
|
val SACCHARINE_HANGING_SIGN = this.create("saccharine_hanging_sign", CobblemonHangingSignBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_WALL_HANGING_SIGN), SACCHARINE_WOOD_TYPE))
|
||||||
@JvmField
|
@JvmField
|
||||||
|
|||||||
+37
-31
@@ -18,72 +18,78 @@ import com.cobblemon.mod.common.api.molang.ExpressionLike
|
|||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
||||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||||
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
|
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
|
||||||
import com.cobblemon.mod.common.net.messages.client.data.FlowRegistrySyncPacket
|
import com.cobblemon.mod.common.net.messages.client.data.CallbackRegistrySyncPacket
|
||||||
import com.cobblemon.mod.common.util.asExpressionLike
|
import com.cobblemon.mod.common.util.asExpressionLike
|
||||||
import com.cobblemon.mod.common.util.cobblemonResource
|
import com.cobblemon.mod.common.util.cobblemonResource
|
||||||
import com.cobblemon.mod.common.util.endsWith
|
import com.cobblemon.mod.common.util.endsWith
|
||||||
import java.util.concurrent.ExecutionException
|
import java.util.concurrent.ExecutionException
|
||||||
|
import java.util.function.Predicate
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.server.level.ServerPlayer
|
import net.minecraft.server.level.ServerPlayer
|
||||||
import net.minecraft.server.packs.PackType
|
import net.minecraft.server.packs.PackType
|
||||||
import net.minecraft.server.packs.resources.ResourceManager
|
import net.minecraft.server.packs.resources.ResourceManager
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds all the flows that are loaded from the server's data packs. A flow is foldered under the event identifier,
|
* Holds all the callbacks that are loaded from the server's data packs. A callback is foldered under the event identifier,
|
||||||
* which can be Cobblemon's namespace but can also be minecraft or any other namespace someone has added hooks for.
|
* which can be Cobblemon's namespace but can also be minecraft or any other namespace someone has added hooks for.
|
||||||
* The value of the map is a list of MoLang scripts that will execute when that event occurs.
|
* The value of the map is a list of MoLang scripts that will execute when that event occurs.
|
||||||
*
|
*
|
||||||
* @author Hiroku
|
* @author Hiroku
|
||||||
* @since February 24th, 2024
|
* @since February 24th, 2024
|
||||||
*/
|
*/
|
||||||
object CobblemonFlows : DataRegistry {
|
object CobblemonCallbacks : DataRegistry {
|
||||||
override val id = cobblemonResource("flows")
|
override val id = cobblemonResource("callbacks")
|
||||||
override val observable = SimpleObservable<CobblemonFlows>()
|
override val observable = SimpleObservable<CobblemonCallbacks>()
|
||||||
override val type = PackType.SERVER_DATA
|
override val type = PackType.SERVER_DATA
|
||||||
override fun sync(player: ServerPlayer) {
|
override fun sync(player: ServerPlayer) {
|
||||||
player.sendPacket(FlowRegistrySyncPacket(clientFlows.entries))
|
player.sendPacket(CallbackRegistrySyncPacket(clientCallbacks.entries))
|
||||||
}
|
}
|
||||||
|
|
||||||
val runtime by lazy { MoLangRuntime().setup() } // Lazy for if someone adds to generalFunctions in MoLangFunctions
|
val runtime by lazy { MoLangRuntime().setup() } // Lazy for if someone adds to generalFunctions in MoLangFunctions
|
||||||
|
|
||||||
val clientFlows = hashMapOf<ResourceLocation, MutableList<ExpressionLike>>()
|
val clientCallbacks = hashMapOf<ResourceLocation, MutableList<ExpressionLike>>()
|
||||||
val flows = hashMapOf<ResourceLocation, MutableList<ExpressionLike>>()
|
val callbacks = hashMapOf<ResourceLocation, MutableList<ExpressionLike>>()
|
||||||
|
|
||||||
|
|
||||||
override fun reload(manager: ResourceManager) {
|
override fun reload(manager: ResourceManager) {
|
||||||
clientFlows.clear()
|
clientCallbacks.clear()
|
||||||
flows.clear()
|
callbacks.clear()
|
||||||
|
|
||||||
val unsortedFlows = mutableMapOf<ResourceLocation, MutableList<Pair<String, ExpressionLike>>>()
|
val unsortedCallbacks = mutableMapOf<ResourceLocation, MutableList<Pair<String, ExpressionLike>>>()
|
||||||
val folderBeforeNameRegex = ".*\\/([^\\/]+)\\/[^\\/]+\$".toRegex()
|
val folderBeforeNameRegex = ".*\\/([^\\/]+)\\/[^\\/]+\$".toRegex()
|
||||||
manager.listResources("flows") { path -> path.endsWith(CobblemonScripts.MOLANG_EXTENSION) }.forEach { (identifier, resource) ->
|
val predicate: Predicate<ResourceLocation> = Predicate { path -> path.endsWith(CobblemonScripts.MOLANG_EXTENSION) }
|
||||||
resource.openAsReader().use { stream ->
|
|
||||||
stream.buffered().use { reader ->
|
|
||||||
try {
|
|
||||||
val expression = reader.readText().asExpressionLike()
|
|
||||||
|
|
||||||
val event = folderBeforeNameRegex.find(identifier.path)?.groupValues?.get(1)
|
manager.listResources("callbacks", predicate)
|
||||||
?: throw IllegalArgumentException("Invalid flow path: $identifier. Should have a folder structure that includes the name of the event being flowed.")
|
.plus(manager.listResources("flows", predicate)) // old name
|
||||||
|
.forEach { (identifier, resource) ->
|
||||||
|
resource.openAsReader().use { stream ->
|
||||||
|
stream.buffered().use { reader ->
|
||||||
|
try {
|
||||||
|
val expression = reader.readText().asExpressionLike()
|
||||||
|
|
||||||
val flowKey = ResourceLocation.fromNamespaceAndPath(identifier.namespace, event)
|
val event = folderBeforeNameRegex.find(identifier.path)?.groupValues?.get(1)
|
||||||
unsortedFlows.putIfAbsent(flowKey, mutableListOf())
|
?: throw IllegalArgumentException("Invalid callback path: $identifier. Should have a folder structure that includes the name of the event to callback.")
|
||||||
unsortedFlows[flowKey]!!.add(identifier.path to expression)
|
|
||||||
} catch (exception: Exception) {
|
val callbackKey = ResourceLocation.fromNamespaceAndPath(identifier.namespace, event)
|
||||||
throw ExecutionException("Error loading MoLang script for flow: $identifier", exception)
|
unsortedCallbacks.putIfAbsent(callbackKey, mutableListOf())
|
||||||
|
unsortedCallbacks[callbackKey]!!.add(identifier.path to expression)
|
||||||
|
} catch (exception: Exception) {
|
||||||
|
throw ExecutionException("Error loading MoLang script for callback: $identifier", exception)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsortedFlows.forEach { (key, value) ->
|
unsortedCallbacks.forEach { (key, value) ->
|
||||||
value.sortBy { it.first }
|
value.sortBy { it.first }
|
||||||
if (key.path.startsWith("flows/client/")) {
|
if (key.path.startsWith("flows/client/") || key.path.startsWith("callbacks/client/")) {
|
||||||
clientFlows.getOrPut(key) { mutableListOf() }.addAll(value.map { it.second })
|
clientCallbacks.getOrPut(key) { mutableListOf() }.addAll(value.map { it.second })
|
||||||
} else {
|
} else {
|
||||||
flows.getOrPut(key) { mutableListOf() }.addAll(value.map { it.second })
|
callbacks.getOrPut(key) { mutableListOf() }.addAll(value.map { it.second })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cobblemon.LOGGER.info("Loaded ${flows.size} flows and ${clientFlows.size} client flows")
|
Cobblemon.LOGGER.info("Loaded ${callbacks.size} callbacks and ${clientCallbacks.size} client callbacks")
|
||||||
observable.emit(this)
|
observable.emit(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +99,7 @@ object CobblemonFlows : DataRegistry {
|
|||||||
functions: Map<String, (MoParams) -> Any> = emptyMap(),
|
functions: Map<String, (MoParams) -> Any> = emptyMap(),
|
||||||
cancelable: Cancelable? = null
|
cancelable: Cancelable? = null
|
||||||
) {
|
) {
|
||||||
if (eventResourceLocation !in flows) return
|
if (eventResourceLocation !in callbacks) return
|
||||||
|
|
||||||
if (cancelable == null) {
|
if (cancelable == null) {
|
||||||
runtime.environment.query.functions.remove("cancel")
|
runtime.environment.query.functions.remove("cancel")
|
||||||
@@ -106,7 +112,7 @@ object CobblemonFlows : DataRegistry {
|
|||||||
|
|
||||||
functions.forEach { (name, function) -> runtime.environment.query.addFunction(name, function) }
|
functions.forEach { (name, function) -> runtime.environment.query.addFunction(name, function) }
|
||||||
|
|
||||||
flows[eventResourceLocation]?.forEach {
|
callbacks[eventResourceLocation]?.forEach {
|
||||||
if (cancelable != null && cancelable.isCanceled) {
|
if (cancelable != null && cancelable.isCanceled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,6 @@ object CobblemonCommands {
|
|||||||
MarkGiveAllCommand.register(dispatcher)
|
MarkGiveAllCommand.register(dispatcher)
|
||||||
PcSearchCommand.register(dispatcher)
|
PcSearchCommand.register(dispatcher)
|
||||||
PcTakeCommand.register(dispatcher)
|
PcTakeCommand.register(dispatcher)
|
||||||
ValidateTeamCommand.register(dispatcher)
|
|
||||||
|
|
||||||
// Possibly lock down registration if and only if under dev environment or running in an environment
|
// Possibly lock down registration if and only if under dev environment or running in an environment
|
||||||
// with a certain system environment variable set
|
// with a certain system environment variable set
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
|
|||||||
.networkSynchronized(PokemonItemComponent.PACKET_CODEC)
|
.networkSynchronized(PokemonItemComponent.PACKET_CODEC)
|
||||||
.build())
|
.build())
|
||||||
|
|
||||||
val HELD_ITEM_REP: DataComponentType<HeldItemCapableComponent> = DataComponentType.builder<HeldItemCapableComponent>()
|
val HELD_ITEM_EFFECT: DataComponentType<HeldItemEffectComponent> = create("held_item_effect", DataComponentType.builder<HeldItemEffectComponent>()
|
||||||
.persistent(HeldItemCapableComponent.CODEC)
|
.persistent(HeldItemEffectComponent.CODEC)
|
||||||
.networkSynchronized(HeldItemCapableComponent.PACKET_CODEC)
|
.networkSynchronized(HeldItemEffectComponent.PACKET_CODEC)
|
||||||
.build()
|
.build())
|
||||||
|
|
||||||
val BAIT: DataComponentType<RodBaitComponent> = create("bait", DataComponentType.builder<RodBaitComponent>()
|
val BAIT: DataComponentType<RodBaitComponent> = create("bait", DataComponentType.builder<RodBaitComponent>()
|
||||||
.persistent(RodBaitComponent.CODEC)
|
.persistent(RodBaitComponent.CODEC)
|
||||||
@@ -86,6 +86,7 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
|
|||||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:ingredient"), INGREDIENT)
|
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:ingredient"), INGREDIENT)
|
||||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:food"), FOOD)
|
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:food"), FOOD)
|
||||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:mob_effects"), MOB_EFFECTS)
|
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:mob_effects"), MOB_EFFECTS)
|
||||||
|
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:held_item_effect"), HELD_ITEM_EFFECT)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val registry = BuiltInRegistries.DATA_COMPONENT_TYPE
|
override val registry = BuiltInRegistries.DATA_COMPONENT_TYPE
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.block.BerryBlock
|
|||||||
import com.cobblemon.mod.common.block.MintBlock
|
import com.cobblemon.mod.common.block.MintBlock
|
||||||
import com.cobblemon.mod.common.block.MintBlock.MintType
|
import com.cobblemon.mod.common.block.MintBlock.MintType
|
||||||
import com.cobblemon.mod.common.client.pokedex.PokedexType
|
import com.cobblemon.mod.common.client.pokedex.PokedexType
|
||||||
|
import com.cobblemon.mod.common.block.campfirepot.CampfirePotColor
|
||||||
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
|
import com.cobblemon.mod.common.entity.boat.CobblemonBoatType
|
||||||
import com.cobblemon.mod.common.item.*
|
import com.cobblemon.mod.common.item.*
|
||||||
import com.cobblemon.mod.common.item.armor.CobblemonArmorTrims
|
import com.cobblemon.mod.common.item.armor.CobblemonArmorTrims
|
||||||
@@ -192,19 +193,19 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
|||||||
|
|
||||||
val campfire_pots = mutableListOf<CampfirePotItem>()
|
val campfire_pots = mutableListOf<CampfirePotItem>()
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_RED = campfirePotItem(CobblemonBlocks.RED_CAMPFIRE_POT, "red")
|
val CAMPFIRE_POT_RED = campfirePotItem(CobblemonBlocks.RED_CAMPFIRE_POT, CampfirePotColor.RED)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_YELLOW = campfirePotItem(CobblemonBlocks.YELLOW_CAMPFIRE_POT, "yellow")
|
val CAMPFIRE_POT_YELLOW = campfirePotItem(CobblemonBlocks.YELLOW_CAMPFIRE_POT, CampfirePotColor.YELLOW)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_GREEN = campfirePotItem(CobblemonBlocks.GREEN_CAMPFIRE_POT, "green")
|
val CAMPFIRE_POT_GREEN = campfirePotItem(CobblemonBlocks.GREEN_CAMPFIRE_POT, CampfirePotColor.GREEN)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_BLUE = campfirePotItem(CobblemonBlocks.BLUE_CAMPFIRE_POT, "blue")
|
val CAMPFIRE_POT_BLUE = campfirePotItem(CobblemonBlocks.BLUE_CAMPFIRE_POT, CampfirePotColor.BLUE)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_PINK = campfirePotItem(CobblemonBlocks.PINK_CAMPFIRE_POT, "pink")
|
val CAMPFIRE_POT_PINK = campfirePotItem(CobblemonBlocks.PINK_CAMPFIRE_POT, CampfirePotColor.PINK)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_BLACK = campfirePotItem(CobblemonBlocks.BLACK_CAMPFIRE_POT, "black")
|
val CAMPFIRE_POT_BLACK = campfirePotItem(CobblemonBlocks.BLACK_CAMPFIRE_POT, CampfirePotColor.BLACK)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CAMPFIRE_POT_WHITE = campfirePotItem(CobblemonBlocks.WHITE_CAMPFIRE_POT, "white")
|
val CAMPFIRE_POT_WHITE = campfirePotItem(CobblemonBlocks.WHITE_CAMPFIRE_POT, CampfirePotColor.WHITE)
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val HEARTY_GRAINS = compostableItem("hearty_grains", ItemNameBlockItem(CobblemonBlocks.HEARTY_GRAINS, Properties().rarity(Rarity.COMMON)))
|
val HEARTY_GRAINS = compostableItem("hearty_grains", ItemNameBlockItem(CobblemonBlocks.HEARTY_GRAINS, Properties().rarity(Rarity.COMMON)))
|
||||||
@@ -400,7 +401,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
|||||||
@JvmField
|
@JvmField
|
||||||
val OLD_GATEAU = regionalFoodItem("old_gateau", 64, 9, 0.1335f, false)
|
val OLD_GATEAU = regionalFoodItem("old_gateau", 64, 9, 0.1335f, false)
|
||||||
@JvmField
|
@JvmField
|
||||||
val CASTELIACONE = regionalFoodItem("casteliacone", 64, 5, .28f, false)
|
val CASTELIACONE = regionalFoodItem("casteliacone", 64, 5, 0.28f, false)
|
||||||
@JvmField
|
@JvmField
|
||||||
val LUMIOSE_GALETTE = regionalFoodItem("lumiose_galette", 64, 4, 0.4f, false)
|
val LUMIOSE_GALETTE = regionalFoodItem("lumiose_galette", 64, 4, 0.4f, false)
|
||||||
@JvmField
|
@JvmField
|
||||||
@@ -695,7 +696,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
|||||||
@JvmField
|
@JvmField
|
||||||
val SUPERB_REMEDY = compostableItem("superb_remedy", RemedyItem(RemedyItem.SUPERB), 0.85f)
|
val SUPERB_REMEDY = compostableItem("superb_remedy", RemedyItem(RemedyItem.SUPERB), 0.85f)
|
||||||
@JvmField
|
@JvmField
|
||||||
val MOOMOO_MILK = create("moomoo_milk", CobblemonItem(Item.Properties().craftRemainder(Items.GLASS_BOTTLE)))
|
val MOOMOO_MILK = create("moomoo_milk", CobblemonItem(Item.Properties().craftRemainder(Items.GLASS_BOTTLE).stacksTo((16))))
|
||||||
|
|
||||||
@JvmField
|
@JvmField
|
||||||
val POTION = create("potion", PotionItem(PotionType.POTION))
|
val POTION = create("potion", PotionItem(PotionType.POTION))
|
||||||
@@ -1500,8 +1501,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun campfirePotItem(block: Block, type: String): CampfirePotItem {
|
private fun campfirePotItem(block: Block, color: CampfirePotColor): CampfirePotItem {
|
||||||
val item = create("campfire_pot_${type}", CampfirePotItem(block))
|
val item = create("campfire_pot_${color.suffix}", CampfirePotItem(block, color))
|
||||||
campfire_pots.add(item)
|
campfire_pots.add(item)
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
@@ -1648,4 +1649,4 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
|||||||
private fun foodItem(nutrition: Int, saturationModifier: Float): Item {
|
private fun foodItem(nutrition: Int, saturationModifier: Float): Item {
|
||||||
return CobblemonItem(Item.Properties().food(FoodProperties.Builder().nutrition(nutrition).saturationModifier(saturationModifier).build()))
|
return CobblemonItem(Item.Properties().food(FoodProperties.Builder().nutrition(nutrition).saturationModifier(saturationModifier).build()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ object CobblemonMechanics : DataRegistry {
|
|||||||
var potions = PotionsMechanic()
|
var potions = PotionsMechanic()
|
||||||
|
|
||||||
override fun sync(player: ServerPlayer) {}
|
override fun sync(player: ServerPlayer) {}
|
||||||
|
|
||||||
override fun reload(manager: ResourceManager) {
|
override fun reload(manager: ResourceManager) {
|
||||||
remedies = loadMechanic(manager, "remedies", RemediesMechanic::class.java)
|
remedies = loadMechanic(manager, "remedies", RemediesMechanic::class.java)
|
||||||
berries = loadMechanic(manager, "berries", BerriesMechanic::class.java)
|
berries = loadMechanic(manager, "berries", BerriesMechanic::class.java)
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ object CobblemonMemories {
|
|||||||
val TARGETED_BATTLE_POKEMON = register<UUID>("targeted_battle_pokemon")
|
val TARGETED_BATTLE_POKEMON = register<UUID>("targeted_battle_pokemon")
|
||||||
val NEAREST_VISIBLE_ATTACKER = register<LivingEntity>("nearest_visible_attacker")
|
val NEAREST_VISIBLE_ATTACKER = register<LivingEntity>("nearest_visible_attacker")
|
||||||
val NEARBY_GROWABLE_CROPS = register<BlockPos>("nearby_growable_crops")
|
val NEARBY_GROWABLE_CROPS = register<BlockPos>("nearby_growable_crops")
|
||||||
|
val NEARBY_SWEET_BERRY_BUSH = register<BlockPos>("nearest_sweet_berry_bush")
|
||||||
|
val DISABLE_WALK_TO_BERRY_BUSH = register<Boolean>("disable_walk_to_berry_bush")
|
||||||
|
val TIME_TRYING_TO_REACH_BERRY_BUSH = register<Int>("time_trying_to_reach_berry_bush")
|
||||||
|
val IS_CONSUMING_ITEM = register<Boolean>("is_consuming_item")
|
||||||
val RECENTLY_ATE_GRASS = register<Boolean>("recently_ate_grass")
|
val RECENTLY_ATE_GRASS = register<Boolean>("recently_ate_grass")
|
||||||
val HIVE_LOCATION = register<BlockPos>("hive_location")
|
val HIVE_LOCATION = register<BlockPos>("hive_location")
|
||||||
val HIVE_COOLDOWN = register<Boolean>("hive_cooldown")
|
val HIVE_COOLDOWN = register<Boolean>("hive_cooldown")
|
||||||
@@ -54,6 +58,8 @@ object CobblemonMemories {
|
|||||||
val HERD_SIZE = register<Int>("herd_size") // Don't bother saving it, we'll try to keep count roughly.
|
val HERD_SIZE = register<Int>("herd_size") // Don't bother saving it, we'll try to keep count roughly.
|
||||||
val ATTACK_TARGET_DATA = register<CobblemonAttackTargetData>("attack_target_data") // This is used to store additional information about the attack target, such as when to give up pursuit.
|
val ATTACK_TARGET_DATA = register<CobblemonAttackTargetData>("attack_target_data") // This is used to store additional information about the attack target, such as when to give up pursuit.
|
||||||
val WANDER_CONTROL = register<CobblemonWanderControl>("wander_control")
|
val WANDER_CONTROL = register<CobblemonWanderControl>("wander_control")
|
||||||
|
val DISABLE_WALK_TO_WANTED_ITEM = register<Boolean>("disable_walk_to_wanted_item")
|
||||||
|
val TIME_TRYING_TO_REACH_WANTED_ITEM = register<Int>("time_trying_to_wanted_item")
|
||||||
|
|
||||||
fun <U> register(id: String, codec: Codec<U>): MemoryModuleType<U> {
|
fun <U> register(id: String, codec: Codec<U>): MemoryModuleType<U> {
|
||||||
val memoryModule = MemoryModuleType(Optional.of(codec))
|
val memoryModule = MemoryModuleType(Optional.of(codec))
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
package com.cobblemon.mod.common
|
package com.cobblemon.mod.common
|
||||||
|
|
||||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||||
import com.cobblemon.mod.common.client.net.OpenBehaviourEditorHandler
|
|
||||||
import com.cobblemon.mod.common.client.net.CalculateSeatPositionsHandler
|
import com.cobblemon.mod.common.client.net.CalculateSeatPositionsHandler
|
||||||
|
import com.cobblemon.mod.common.client.net.OpenBehaviourEditorHandler
|
||||||
import com.cobblemon.mod.common.client.net.PlayerInteractOptionsHandler
|
import com.cobblemon.mod.common.client.net.PlayerInteractOptionsHandler
|
||||||
import com.cobblemon.mod.common.client.net.SetClientPlayerDataHandler
|
import com.cobblemon.mod.common.client.net.SetClientPlayerDataHandler
|
||||||
import com.cobblemon.mod.common.client.net.animation.PlayPosableAnimationHandler
|
import com.cobblemon.mod.common.client.net.animation.PlayPosableAnimationHandler
|
||||||
@@ -20,7 +20,7 @@ import com.cobblemon.mod.common.client.net.callback.party.OpenPartyCallbackHandl
|
|||||||
import com.cobblemon.mod.common.client.net.callback.partymove.OpenPartyMoveCallbackHandler
|
import com.cobblemon.mod.common.client.net.callback.partymove.OpenPartyMoveCallbackHandler
|
||||||
import com.cobblemon.mod.common.client.net.cooking.ToggleCookingPotLidHandler
|
import com.cobblemon.mod.common.client.net.cooking.ToggleCookingPotLidHandler
|
||||||
import com.cobblemon.mod.common.client.net.data.DataRegistrySyncPacketHandler
|
import com.cobblemon.mod.common.client.net.data.DataRegistrySyncPacketHandler
|
||||||
import com.cobblemon.mod.common.client.net.data.UnlockReloadPacketHandler
|
import com.cobblemon.mod.common.client.net.data.RideSettingsSyncHandler
|
||||||
import com.cobblemon.mod.common.client.net.dialogue.DialogueClosedHandler
|
import com.cobblemon.mod.common.client.net.dialogue.DialogueClosedHandler
|
||||||
import com.cobblemon.mod.common.client.net.dialogue.DialogueOpenedHandler
|
import com.cobblemon.mod.common.client.net.dialogue.DialogueOpenedHandler
|
||||||
import com.cobblemon.mod.common.client.net.effect.PokeSnackBlockParticlesHandler
|
import com.cobblemon.mod.common.client.net.effect.PokeSnackBlockParticlesHandler
|
||||||
@@ -65,8 +65,8 @@ import com.cobblemon.mod.common.client.net.trade.TradeProcessStartedHandler
|
|||||||
import com.cobblemon.mod.common.client.net.trade.TradeStartedHandler
|
import com.cobblemon.mod.common.client.net.trade.TradeStartedHandler
|
||||||
import com.cobblemon.mod.common.client.net.trade.TradeUpdatedHandler
|
import com.cobblemon.mod.common.client.net.trade.TradeUpdatedHandler
|
||||||
import com.cobblemon.mod.common.net.PacketRegisterInfo
|
import com.cobblemon.mod.common.net.PacketRegisterInfo
|
||||||
import com.cobblemon.mod.common.net.messages.client.OpenBehaviourEditorPacket
|
|
||||||
import com.cobblemon.mod.common.net.messages.client.CalculateSeatPositionsPacket
|
import com.cobblemon.mod.common.net.messages.client.CalculateSeatPositionsPacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.client.OpenBehaviourEditorPacket
|
||||||
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
|
import com.cobblemon.mod.common.net.messages.client.PlayerInteractOptionsPacket
|
||||||
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
|
import com.cobblemon.mod.common.net.messages.client.SetClientPlayerDataPacket
|
||||||
import com.cobblemon.mod.common.net.messages.client.animation.PlayPosableAnimationPacket
|
import com.cobblemon.mod.common.net.messages.client.animation.PlayPosableAnimationPacket
|
||||||
@@ -157,6 +157,7 @@ import com.cobblemon.mod.common.net.messages.server.callback.party.PartyPokemonS
|
|||||||
import com.cobblemon.mod.common.net.messages.server.callback.party.PartySelectCancelledPacket
|
import com.cobblemon.mod.common.net.messages.server.callback.party.PartySelectCancelledPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyMoveSelectCancelledPacket
|
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyMoveSelectCancelledPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyPokemonMoveSelectedPacket
|
import com.cobblemon.mod.common.net.messages.server.callback.partymove.PartyPokemonMoveSelectedPacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingSettingsPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatRangePacket
|
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatRangePacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatsPacket
|
import com.cobblemon.mod.common.net.messages.server.debug.ServerboundUpdateRidingStatsPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.dialogue.EscapeDialoguePacket
|
import com.cobblemon.mod.common.net.messages.server.dialogue.EscapeDialoguePacket
|
||||||
@@ -170,11 +171,11 @@ import com.cobblemon.mod.common.net.messages.server.pasture.UnpasturePokemonPack
|
|||||||
import com.cobblemon.mod.common.net.messages.server.pokedex.scanner.FinishScanningPacket
|
import com.cobblemon.mod.common.net.messages.server.pokedex.scanner.FinishScanningPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokedex.scanner.StartScanningPacket
|
import com.cobblemon.mod.common.net.messages.server.pokedex.scanner.StartScanningPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.interact.InteractPokemonPacket
|
import com.cobblemon.mod.common.net.messages.server.pokemon.interact.InteractPokemonPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetItemHiddenPacket
|
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetNicknamePacket
|
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetActiveMarkPacket
|
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetMarkingsPacket
|
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.ServerboundUpdateRidingStatePacket
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.ServerboundUpdateRidingStatePacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetActiveMarkPacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetItemHiddenPacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetMarkingsPacket
|
||||||
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.SetNicknamePacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.pokemon.update.evolution.AcceptEvolutionPacket
|
import com.cobblemon.mod.common.net.messages.server.pokemon.update.evolution.AcceptEvolutionPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.riding.DismountPokemonPacket
|
import com.cobblemon.mod.common.net.messages.server.riding.DismountPokemonPacket
|
||||||
import com.cobblemon.mod.common.net.messages.server.riding.ServerboundUpdateDriverInputPacket
|
import com.cobblemon.mod.common.net.messages.server.riding.ServerboundUpdateDriverInputPacket
|
||||||
@@ -208,6 +209,7 @@ import com.cobblemon.mod.common.net.serverhandling.callback.party.PartyPokemonSe
|
|||||||
import com.cobblemon.mod.common.net.serverhandling.callback.party.PartySelectCancelledHandler
|
import com.cobblemon.mod.common.net.serverhandling.callback.party.PartySelectCancelledHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyMoveSelectCancelledHandler
|
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyMoveSelectCancelledHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyPokemonMoveSelectedHandler
|
import com.cobblemon.mod.common.net.serverhandling.callback.partymove.PartyPokemonMoveSelectedHandler
|
||||||
|
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingSettingsHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatRangeHandler
|
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatRangeHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatsHandler
|
import com.cobblemon.mod.common.net.serverhandling.debug.ServerboundUpdateRidingStatsHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.dialogue.EscapeDialogueHandler
|
import com.cobblemon.mod.common.net.serverhandling.dialogue.EscapeDialogueHandler
|
||||||
@@ -222,11 +224,11 @@ import com.cobblemon.mod.common.net.serverhandling.pasture.UnpasturePokemonHandl
|
|||||||
import com.cobblemon.mod.common.net.serverhandling.pokedex.scanner.FinishScanningHandler
|
import com.cobblemon.mod.common.net.serverhandling.pokedex.scanner.FinishScanningHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokedex.scanner.StartScanningHandler
|
import com.cobblemon.mod.common.net.serverhandling.pokedex.scanner.StartScanningHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.interact.InteractPokemonHandler
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.interact.InteractPokemonHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetItemHiddenHandler
|
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetNicknameHandler
|
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetActiveMarkHandler
|
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetMarkingsHandler
|
|
||||||
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.ServerboundUpdateRidingStateHandler
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.ServerboundUpdateRidingStateHandler
|
||||||
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetActiveMarkHandler
|
||||||
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetItemHiddenHandler
|
||||||
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetMarkingsHandler
|
||||||
|
import com.cobblemon.mod.common.net.serverhandling.pokemon.update.SetNicknameHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.riding.DismountPokemonPacketHandler
|
import com.cobblemon.mod.common.net.serverhandling.riding.DismountPokemonPacketHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.riding.DriverInputPacketHandler
|
import com.cobblemon.mod.common.net.serverhandling.riding.DriverInputPacketHandler
|
||||||
import com.cobblemon.mod.common.net.serverhandling.starter.RequestStarterScreenHandler
|
import com.cobblemon.mod.common.net.serverhandling.starter.RequestStarterScreenHandler
|
||||||
@@ -310,6 +312,7 @@ object CobblemonNetwork {
|
|||||||
list.add(PacketRegisterInfo(MarksPotentialUpdatePacket.ID, MarksPotentialUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
list.add(PacketRegisterInfo(MarksPotentialUpdatePacket.ID, MarksPotentialUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||||
list.add(PacketRegisterInfo(MarkingsUpdatePacket.ID, MarkingsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
list.add(PacketRegisterInfo(MarkingsUpdatePacket.ID, MarkingsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||||
list.add(PacketRegisterInfo(RideBoostsUpdatePacket.ID, RideBoostsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
list.add(PacketRegisterInfo(RideBoostsUpdatePacket.ID, RideBoostsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||||
|
list.add(PacketRegisterInfo(RideStaminaUpdatePacket.ID, RideStaminaUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||||
|
|
||||||
// Evolution start
|
// Evolution start
|
||||||
list.add(PacketRegisterInfo(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler()))
|
list.add(PacketRegisterInfo(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler()))
|
||||||
@@ -388,7 +391,6 @@ object CobblemonNetwork {
|
|||||||
list.add(PacketRegisterInfo(BerryRegistrySyncPacket.ID, BerryRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(BerryRegistrySyncPacket.ID, BerryRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(SpeciesRegistrySyncPacket.ID, SpeciesRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(SpeciesRegistrySyncPacket.ID, SpeciesRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(PropertiesCompletionRegistrySyncPacket.ID, PropertiesCompletionRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(PropertiesCompletionRegistrySyncPacket.ID, PropertiesCompletionRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(UnlockReloadPacket.ID, UnlockReloadPacket::decode, UnlockReloadPacketHandler))
|
|
||||||
list.add(PacketRegisterInfo(StandardSpeciesFeatureSyncPacket.ID, StandardSpeciesFeatureSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(StandardSpeciesFeatureSyncPacket.ID, StandardSpeciesFeatureSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(GlobalSpeciesFeatureSyncPacket.ID, GlobalSpeciesFeatureSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(GlobalSpeciesFeatureSyncPacket.ID, GlobalSpeciesFeatureSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(SpeciesFeatureAssignmentSyncPacket.ID, SpeciesFeatureAssignmentSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(SpeciesFeatureAssignmentSyncPacket.ID, SpeciesFeatureAssignmentSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
@@ -401,10 +403,11 @@ object CobblemonNetwork {
|
|||||||
list.add(PacketRegisterInfo(DexEntrySyncPacket.ID, DexEntrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(DexEntrySyncPacket.ID, DexEntrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(SpawnBaitRegistrySyncPacket.ID, SpawnBaitRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(SpawnBaitRegistrySyncPacket.ID, SpawnBaitRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(SeasoningRegistrySyncPacket.ID, SeasoningRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(SeasoningRegistrySyncPacket.ID, SeasoningRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(FlowRegistrySyncPacket.ID, FlowRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(CallbackRegistrySyncPacket.ID, CallbackRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(CosmeticItemAssignmentSyncPacket.ID, CosmeticItemAssignmentSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(CosmeticItemAssignmentSyncPacket.ID, CosmeticItemAssignmentSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(BehaviourSyncPacket.ID, BehaviourSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(BehaviourSyncPacket.ID, BehaviourSyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
list.add(PacketRegisterInfo(MarkRegistrySyncPacket.ID, MarkRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
list.add(PacketRegisterInfo(MarkRegistrySyncPacket.ID, MarkRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||||
|
list.add(PacketRegisterInfo(RideSettingsSyncPacket.ID, RideSettingsSyncPacket::decode, RideSettingsSyncHandler))
|
||||||
|
|
||||||
// Effects
|
// Effects
|
||||||
list.add(PacketRegisterInfo(SpawnSnowstormParticlePacket.ID, SpawnSnowstormParticlePacket::decode, SpawnSnowstormParticleHandler))
|
list.add(PacketRegisterInfo(SpawnSnowstormParticlePacket.ID, SpawnSnowstormParticlePacket::decode, SpawnSnowstormParticleHandler))
|
||||||
@@ -578,6 +581,7 @@ object CobblemonNetwork {
|
|||||||
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatePacket.ID, ServerboundUpdateRidingStatePacket::decode, ServerboundUpdateRidingStateHandler))
|
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatePacket.ID, ServerboundUpdateRidingStatePacket::decode, ServerboundUpdateRidingStateHandler))
|
||||||
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatsPacket.ID, ServerboundUpdateRidingStatsPacket::decode, ServerboundUpdateRidingStatsHandler))
|
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatsPacket.ID, ServerboundUpdateRidingStatsPacket::decode, ServerboundUpdateRidingStatsHandler))
|
||||||
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatRangePacket.ID, ServerboundUpdateRidingStatRangePacket::decode, ServerboundUpdateRidingStatRangeHandler))
|
list.add(PacketRegisterInfo(ServerboundUpdateRidingStatRangePacket.ID, ServerboundUpdateRidingStatRangePacket::decode, ServerboundUpdateRidingStatRangeHandler))
|
||||||
|
list.add(PacketRegisterInfo(ServerboundUpdateRidingSettingsPacket.ID, ServerboundUpdateRidingSettingsPacket::decode, ServerboundUpdateRidingSettingsHandler))
|
||||||
list.add(PacketRegisterInfo(DismountPokemonPacket.ID, DismountPokemonPacket::decode, DismountPokemonPacketHandler))
|
list.add(PacketRegisterInfo(DismountPokemonPacket.ID, DismountPokemonPacket::decode, DismountPokemonPacketHandler))
|
||||||
list.add(PacketRegisterInfo(ServerboundUpdateDriverInputPacket.ID, ServerboundUpdateDriverInputPacket::decode, DriverInputPacketHandler))
|
list.add(PacketRegisterInfo(ServerboundUpdateDriverInputPacket.ID, ServerboundUpdateDriverInputPacket::decode, DriverInputPacketHandler))
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common
|
||||||
|
|
||||||
|
import com.bedrockk.molang.Expression
|
||||||
|
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
|
||||||
|
import com.cobblemon.mod.common.api.data.DataRegistry
|
||||||
|
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||||
|
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.RidingBehaviourSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.BirdSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.GliderSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.HelicopterSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.HoverSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.JetSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.air.RocketSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.land.HorseSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.land.MinekartSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.land.VehicleSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.BoatSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.BurstSettings
|
||||||
|
import com.cobblemon.mod.common.api.riding.behaviour.types.liquid.DolphinSettings
|
||||||
|
import com.cobblemon.mod.common.net.messages.client.data.RideSettingsSyncPacket
|
||||||
|
import com.cobblemon.mod.common.util.adapters.ExpressionAdapter
|
||||||
|
import com.cobblemon.mod.common.util.adapters.ExpressionLikeAdapter
|
||||||
|
import com.cobblemon.mod.common.util.adapters.FloatNumberRangeAdapter
|
||||||
|
import com.cobblemon.mod.common.util.cobblemonResource
|
||||||
|
import com.google.gson.GsonBuilder
|
||||||
|
import net.minecraft.advancements.critereon.MinMaxBounds
|
||||||
|
import net.minecraft.resources.ResourceLocation
|
||||||
|
import net.minecraft.server.level.ServerPlayer
|
||||||
|
import net.minecraft.server.packs.PackType
|
||||||
|
import net.minecraft.server.packs.resources.ResourceManager
|
||||||
|
|
||||||
|
object CobblemonRideSettings : DataRegistry {
|
||||||
|
override val id: ResourceLocation = cobblemonResource("ride_settings")
|
||||||
|
override val type = PackType.SERVER_DATA
|
||||||
|
override val observable = SimpleObservable<CobblemonRideSettings>()
|
||||||
|
val gson = GsonBuilder()
|
||||||
|
.setPrettyPrinting()
|
||||||
|
.registerTypeAdapter(Expression::class.java, ExpressionAdapter)
|
||||||
|
.registerTypeAdapter(ExpressionLike::class.java, ExpressionLikeAdapter)
|
||||||
|
.registerTypeAdapter(MinMaxBounds.Doubles::class.java, FloatNumberRangeAdapter)
|
||||||
|
.create()
|
||||||
|
|
||||||
|
var bird = BirdSettings()
|
||||||
|
var glider = GliderSettings()
|
||||||
|
var helicopter = HelicopterSettings()
|
||||||
|
var hover = HoverSettings()
|
||||||
|
var jet = JetSettings()
|
||||||
|
var rocket = RocketSettings()
|
||||||
|
|
||||||
|
var horse = HorseSettings()
|
||||||
|
var minekart = MinekartSettings()
|
||||||
|
var vehicle = VehicleSettings()
|
||||||
|
|
||||||
|
var boat = BoatSettings()
|
||||||
|
var burst = BurstSettings()
|
||||||
|
var dolphin = DolphinSettings()
|
||||||
|
|
||||||
|
override fun sync(player: ServerPlayer) {
|
||||||
|
player.sendPacket(
|
||||||
|
RideSettingsSyncPacket(
|
||||||
|
bird = bird,
|
||||||
|
glider = glider,
|
||||||
|
helicopter = helicopter,
|
||||||
|
hover = hover,
|
||||||
|
jet = jet,
|
||||||
|
rocket = rocket,
|
||||||
|
horse = horse,
|
||||||
|
minekart = minekart,
|
||||||
|
vehicle = vehicle,
|
||||||
|
boat = boat,
|
||||||
|
burst = burst,
|
||||||
|
dolphin = dolphin
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reload(manager: ResourceManager) {
|
||||||
|
bird = loadStyle(manager, "bird", BirdSettings::class.java)
|
||||||
|
glider = loadStyle(manager, "glider", GliderSettings::class.java)
|
||||||
|
helicopter = loadStyle(manager, "helicopter", HelicopterSettings::class.java)
|
||||||
|
hover = loadStyle(manager, "hover", HoverSettings::class.java)
|
||||||
|
jet = loadStyle(manager, "jet", JetSettings::class.java)
|
||||||
|
rocket = loadStyle(manager, "rocket", RocketSettings::class.java)
|
||||||
|
horse = loadStyle(manager, "horse", HorseSettings::class.java)
|
||||||
|
minekart = loadStyle(manager, "minekart", MinekartSettings::class.java)
|
||||||
|
vehicle = loadStyle(manager, "vehicle", VehicleSettings::class.java)
|
||||||
|
boat = loadStyle(manager, "boat", BoatSettings::class.java)
|
||||||
|
burst = loadStyle(manager, "burst", BurstSettings::class.java)
|
||||||
|
dolphin = loadStyle(manager, "dolphin", DolphinSettings::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun <T : RidingBehaviourSettings> loadStyle(manager: ResourceManager, name: String, clazz: Class<T>): T {
|
||||||
|
manager.getResourceOrThrow(cobblemonResource("ride_settings/$name.json")).open().use {
|
||||||
|
return gson.fromJson(it.reader(), clazz)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,10 @@ object CobblemonSensors {
|
|||||||
|
|
||||||
val NEARBY_FLOWER = register("nearby_flower", ::FlowerSensor)
|
val NEARBY_FLOWER = register("nearby_flower", ::FlowerSensor)
|
||||||
|
|
||||||
|
val NEARBY_SWEET_BERRY_BUSH = register("nearby_sweet_berry_bush", ::SweetBerryBushSensor)
|
||||||
|
|
||||||
|
val POKEMON_NEARBY_WANTED_ITEM = register("pokemon_nearby_wanted_item", ::PokemonItemSensor)
|
||||||
|
|
||||||
fun <E : Entity, U : Sensor<E>> register(id: String, supplier: Supplier<U>): SensorType<U> {
|
fun <E : Entity, U : Sensor<E>> register(id: String, supplier: Supplier<U>): SensorType<U> {
|
||||||
val sensor = SensorType(supplier)
|
val sensor = SensorType(supplier)
|
||||||
sensors[id] = sensor
|
sensors[id] = sensor
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ object Abilities : DataRegistry {
|
|||||||
fun all() = this.abilityMap.values.toList()
|
fun all() = this.abilityMap.values.toList()
|
||||||
fun first() = this.abilityMap.values.first()
|
fun first() = this.abilityMap.values.first()
|
||||||
fun get(name: String) = abilityMap[name.lowercase()]
|
fun get(name: String) = abilityMap[name.lowercase()]
|
||||||
|
fun getOrDummy(name: String) = get(name) ?: DUMMY
|
||||||
fun getOrException(name: String) = get(name) ?: throw IllegalArgumentException("Unable to find ability of name: $name")
|
fun getOrException(name: String) = get(name) ?: throw IllegalArgumentException("Unable to find ability of name: $name")
|
||||||
fun count() = this.abilityMap.size
|
fun count() = this.abilityMap.size
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,9 @@ class AbilityTemplate(
|
|||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
val CODEC: Codec<AbilityTemplate> = CodecUtils.createByStringCodec(
|
val CODEC: Codec<AbilityTemplate> = CodecUtils.createByStringCodec(
|
||||||
Abilities::get,
|
Abilities::getOrDummy,
|
||||||
AbilityTemplate::name
|
AbilityTemplate::name
|
||||||
) { id -> "No ability for ID $id" }
|
) { id -> "No ability for ID $id" }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+54
-10
@@ -9,23 +9,34 @@
|
|||||||
package com.cobblemon.mod.common.api.ai
|
package com.cobblemon.mod.common.api.ai
|
||||||
|
|
||||||
import com.bedrockk.molang.runtime.MoLangRuntime
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
|
import com.bedrockk.molang.runtime.struct.QueryStruct
|
||||||
|
import com.bedrockk.molang.runtime.value.DoubleValue
|
||||||
|
import com.cobblemon.mod.common.Cobblemon
|
||||||
import com.cobblemon.mod.common.api.ai.config.BehaviourConfig
|
import com.cobblemon.mod.common.api.ai.config.BehaviourConfig
|
||||||
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||||
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addStandardFunctions
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
||||||
|
import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||||
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
|
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
|
||||||
import com.cobblemon.mod.common.entity.MoLangScriptingEntity
|
import com.cobblemon.mod.common.entity.MoLangScriptingEntity
|
||||||
|
import com.cobblemon.mod.common.util.activityRegistry
|
||||||
|
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
|
||||||
import com.cobblemon.mod.common.util.resolve
|
import com.cobblemon.mod.common.util.resolve
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
|
import com.mojang.datafixers.util.Pair
|
||||||
import com.mojang.serialization.Dynamic
|
import com.mojang.serialization.Dynamic
|
||||||
import net.minecraft.resources.ResourceLocation
|
import net.minecraft.resources.ResourceLocation
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
import net.minecraft.world.entity.ai.sensing.SensorType
|
import net.minecraft.world.entity.ai.sensing.SensorType
|
||||||
import net.minecraft.world.entity.schedule.Activity
|
import net.minecraft.world.entity.schedule.Activity
|
||||||
import net.minecraft.world.entity.schedule.Schedule
|
import net.minecraft.world.entity.schedule.Schedule
|
||||||
|
|
||||||
class BehaviourConfigurationContext {
|
class BehaviourConfigurationContext {
|
||||||
|
val runtime = MoLangRuntime().setup()
|
||||||
|
|
||||||
var appliedBehaviours: Set<ResourceLocation> = setOf()
|
var appliedBehaviours: Set<ResourceLocation> = setOf()
|
||||||
|
|
||||||
var defaultActivity = Activity.IDLE
|
var defaultActivity = Activity.IDLE
|
||||||
@@ -35,7 +46,6 @@ class BehaviourConfigurationContext {
|
|||||||
val memories = mutableSetOf<MemoryModuleType<*>>()
|
val memories = mutableSetOf<MemoryModuleType<*>>()
|
||||||
val sensors = mutableSetOf<SensorType<*>>()
|
val sensors = mutableSetOf<SensorType<*>>()
|
||||||
|
|
||||||
val onAddScripts = mutableListOf<ResourceLocation>()
|
|
||||||
val onAdd = mutableListOf<ExpressionLike>()
|
val onAdd = mutableListOf<ExpressionLike>()
|
||||||
|
|
||||||
fun getOrCreateActivity(activity: Activity): ActivityConfigurationContext {
|
fun getOrCreateActivity(activity: Activity): ActivityConfigurationContext {
|
||||||
@@ -58,32 +68,27 @@ class BehaviourConfigurationContext {
|
|||||||
this.sensors.addAll(sensors)
|
this.sensors.addAll(sensors)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addOnAddScript(script: ResourceLocation) {
|
|
||||||
onAddScripts.add(script)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addOnAddScript(script: ExpressionLike) {
|
fun addOnAddScript(script: ExpressionLike) {
|
||||||
onAdd.add(script)
|
onAdd.add(script)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun apply(entity: LivingEntity, behaviourConfigs: List<BehaviourConfig>, dynamic: Dynamic<*>) {
|
fun apply(entity: LivingEntity, behaviourConfigs: List<BehaviourConfig>, dynamic: Dynamic<*>) {
|
||||||
|
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
||||||
|
runtime.withQueryValue("brain", createBrainStruct(entity, this))
|
||||||
|
|
||||||
if (entity is MoLangScriptingEntity) {
|
if (entity is MoLangScriptingEntity) {
|
||||||
entity.registerVariables(behaviourConfigs.flatMap { it.getVariables(entity) })
|
entity.registerVariables(behaviourConfigs.flatMap { it.getVariables(entity, this) })
|
||||||
entity.initializeScripting()
|
entity.initializeScripting()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the brain config
|
// Setup the brain config
|
||||||
|
behaviourConfigs.forEach { it.preconfigure(entity, this) }
|
||||||
behaviourConfigs.forEach { it.configure(entity, this) }
|
behaviourConfigs.forEach { it.configure(entity, this) }
|
||||||
|
|
||||||
var brain = entity.brain
|
var brain = entity.brain
|
||||||
// Apply the brain config
|
// Apply the brain config
|
||||||
if (entity is MoLangScriptingEntity) {
|
if (entity is MoLangScriptingEntity) {
|
||||||
brain = entity.assignNewBrainWithMemoriesAndSensors(dynamic, memories, sensors)
|
brain = entity.assignNewBrainWithMemoriesAndSensors(dynamic, memories, sensors)
|
||||||
|
|
||||||
val runtime = MoLangRuntime().setup()
|
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
|
||||||
onAddScripts.forEach { CobblemonScripts.run(it, runtime) }
|
|
||||||
onAdd.forEach { runtime.resolve(it) }
|
onAdd.forEach { runtime.resolve(it) }
|
||||||
}
|
}
|
||||||
activities.forEach { it.apply(entity) }
|
activities.forEach { it.apply(entity) }
|
||||||
@@ -92,4 +97,43 @@ class BehaviourConfigurationContext {
|
|||||||
brain.schedule = schedule
|
brain.schedule = schedule
|
||||||
brain.setActiveActivityIfPossible(defaultActivity)
|
brain.setActiveActivityIfPossible(defaultActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createBrainStruct(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): QueryStruct {
|
||||||
|
return QueryStruct(hashMapOf()).addStandardFunctions()
|
||||||
|
.addFunction("entity") { entity.asMostSpecificMoLangValue() }
|
||||||
|
.addFunction("create_activity") { params ->
|
||||||
|
val name = params.getString(0).asIdentifierDefaultingNamespace()
|
||||||
|
val activity = entity.level().activityRegistry.get(name) ?: return@addFunction run {
|
||||||
|
Cobblemon.LOGGER.error("Tried loading activity $name as part of an entity brain but that activity does not exist")
|
||||||
|
DoubleValue.ZERO
|
||||||
|
}
|
||||||
|
val existingActivityBuilder = behaviourConfigurationContext.activities.find { it.activity == activity }
|
||||||
|
if (existingActivityBuilder != null) {
|
||||||
|
return@addFunction createActivityStruct(existingActivityBuilder)
|
||||||
|
} else {
|
||||||
|
val activityConfigurationContext = ActivityConfigurationContext(activity)
|
||||||
|
behaviourConfigurationContext.activities.add(activityConfigurationContext)
|
||||||
|
return@addFunction createActivityStruct(activityConfigurationContext)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.addFunction("set_core_activities") { params ->
|
||||||
|
behaviourConfigurationContext.coreActivities = params.params.map { (it as ObjectValue<ActivityConfigurationContext>).obj.activity }.toSet()
|
||||||
|
return@addFunction DoubleValue.ONE
|
||||||
|
}
|
||||||
|
.addFunction("set_default_activity") { params ->
|
||||||
|
behaviourConfigurationContext.defaultActivity = params.get<ObjectValue<ActivityConfigurationContext>>(0).obj.activity
|
||||||
|
return@addFunction DoubleValue.ONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createActivityStruct(activityConfigurationContext: ActivityConfigurationContext): ObjectValue<ActivityConfigurationContext> {
|
||||||
|
val struct = ObjectValue(activityConfigurationContext)
|
||||||
|
struct.addStandardFunctions()
|
||||||
|
.addFunction("add_task") { params ->
|
||||||
|
val priority = params.getInt(0)
|
||||||
|
val task = params.get(1) as ObjectValue<BehaviorControl<in LivingEntity>>
|
||||||
|
activityConfigurationContext.tasks.add(Pair(priority, task.obj))
|
||||||
|
}
|
||||||
|
return struct
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,19 +33,13 @@ class CobblemonBehaviour(
|
|||||||
// detect if it's a ResourceLocation and failing that, Expression. The on[..]Script fields are kinda fringe though.
|
// detect if it's a ResourceLocation and failing that, Expression. The on[..]Script fields are kinda fringe though.
|
||||||
@SerializedName("onRemove", alternate = ["undo"])
|
@SerializedName("onRemove", alternate = ["undo"])
|
||||||
val onRemove: ExpressionLike? = null,
|
val onRemove: ExpressionLike? = null,
|
||||||
@SerializedName("onRemoveScript", alternate = ["undoScript"])
|
|
||||||
val onRemoveScript: ResourceLocation? = null,
|
|
||||||
val onAdd: ExpressionLike? = null,
|
val onAdd: ExpressionLike? = null,
|
||||||
val onAddScript: ResourceLocation? = null,
|
|
||||||
) {
|
) {
|
||||||
fun canBeApplied(entity: LivingEntity) = entityType?.let { entityType == entity.type.builtInRegistryHolder().unwrapKey().get().location() } != false
|
fun canBeApplied(entity: LivingEntity) = entityType?.let { entityType == entity.type.builtInRegistryHolder().unwrapKey().get().location() } != false
|
||||||
fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
if (onAdd != null) {
|
if (onAdd != null) {
|
||||||
behaviourConfigurationContext.addOnAddScript(onAdd)
|
behaviourConfigurationContext.addOnAddScript(onAdd)
|
||||||
}
|
}
|
||||||
if (onAddScript != null) {
|
|
||||||
behaviourConfigurationContext.addOnAddScript(onAddScript)
|
|
||||||
}
|
|
||||||
configurations.forEach { it.configure(entity, behaviourConfigurationContext) }
|
configurations.forEach { it.configure(entity, behaviourConfigurationContext) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,9 +47,6 @@ class CobblemonBehaviour(
|
|||||||
fun onRemove(entity: LivingEntity) {
|
fun onRemove(entity: LivingEntity) {
|
||||||
val runtime = MoLangRuntime().setup()
|
val runtime = MoLangRuntime().setup()
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
||||||
if (onRemoveScript != null) {
|
|
||||||
CobblemonScripts.run(onRemoveScript, runtime)
|
|
||||||
}
|
|
||||||
if (onRemove != null) {
|
if (onRemove != null) {
|
||||||
runtime.resolve(onRemove)
|
runtime.resolve(onRemove)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,22 @@ import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
|||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import kotlin.jvm.optionals.getOrNull
|
import kotlin.jvm.optionals.getOrNull
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The issue in a lot of the behaviour datapacking is that there are times when a property should be exposed to
|
||||||
|
* the user and other times that you want to fix the value in place. The remedy to this is using an [Either] where
|
||||||
|
* one side is an Expression, ergo a value that is not exposed to the user, and the other side is a fully defined
|
||||||
|
* configuration variable.
|
||||||
|
*
|
||||||
|
* When users are editing JSONs they can have a simple expression, or they can declare full variable to show to the
|
||||||
|
* user. Similarly, the classes for tasks and brain configurations can have defaults that hide from the user or
|
||||||
|
* defaults that are properly defined variables. One example where this is useful is Wander tasks which might be reused
|
||||||
|
* in panic activities where the walk speed is tuned up. When specifying the task in the panic activity, the value of
|
||||||
|
* the walk speed would be set (overriding the default which is the walk_speed MoLang variable) to a separate config
|
||||||
|
* variable that is exposed to the user. Pretty neat!
|
||||||
|
*
|
||||||
|
* @author Hiroku
|
||||||
|
* @since January 4th, 2025
|
||||||
|
*/
|
||||||
typealias ExpressionOrEntityVariable = Either<Expression, MoLangConfigVariable>
|
typealias ExpressionOrEntityVariable = Either<Expression, MoLangConfigVariable>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
-2
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
|||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.cobblemon.mod.common.util.resolveBoolean
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
@@ -28,9 +29,9 @@ class AddMemoriesAndSensorsConfig : BehaviourConfig {
|
|||||||
val memories: Set<MemoryModuleType<*>> = emptySet()
|
val memories: Set<MemoryModuleType<*>> = emptySet()
|
||||||
val sensors: Set<SensorType<*>> = mutableSetOf()
|
val sensors: Set<SensorType<*>> = mutableSetOf()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(condition).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(condition).asVariables()
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
if (!checkCondition(entity, condition)) return
|
if (!checkCondition(behaviourConfigurationContext, condition)) return
|
||||||
behaviourConfigurationContext.addMemories(memories)
|
behaviourConfigurationContext.addMemories(memories)
|
||||||
behaviourConfigurationContext.addSensors(sensors)
|
behaviourConfigurationContext.addSensors(sensors)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,13 @@ class AddTasksToActivity : BehaviourConfig {
|
|||||||
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
val tasksByPriority = mutableMapOf<Int, List<TaskConfig>>()
|
val tasksByPriority = mutableMapOf<Int, List<TaskConfig>>()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = tasksByPriority.values.flatten().flatMap { it.getVariables(entity) } + listOf(condition).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = tasksByPriority.values
|
||||||
|
.flatten()
|
||||||
|
.flatMap {
|
||||||
|
it.getVariables(entity, behaviourConfigurationContext)
|
||||||
|
} + listOf(condition).asVariables()
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
if (!checkCondition(entity, condition)) return
|
if (!checkCondition(behaviourConfigurationContext, condition)) return
|
||||||
|
|
||||||
val activities = if (activity != null) (activities + activity) else activities
|
val activities = if (activity != null) (activities + activity) else activities
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
|||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
|
||||||
class AddVariablesConfig(val variables: List<MoLangConfigVariable> = emptyList()) : BehaviourConfig {
|
class AddVariablesConfig(val variables: List<MoLangConfigVariable> = emptyList()) : BehaviourConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = variables
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = variables
|
||||||
|
|
||||||
// Configuration happens naturally through the override on variables
|
// Configuration happens naturally through the override on variables
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {}
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {}
|
||||||
|
|||||||
@@ -25,18 +25,27 @@ class ApplyBehaviours : BehaviourConfig {
|
|||||||
@SerializedName("behaviours", alternate = ["behaviors"])
|
@SerializedName("behaviours", alternate = ["behaviors"])
|
||||||
val behaviours = mutableListOf<ResourceLocation>()
|
val behaviours = mutableListOf<ResourceLocation>()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return if (checkCondition(entity, condition)) {
|
return if (checkCondition(behaviourConfigurationContext, condition)) {
|
||||||
behaviours.flatMap {
|
behaviours.flatMap {
|
||||||
CobblemonBehaviours.behaviours[it]?.configurations?.flatMap { it.getVariables(entity) } ?: emptyList()
|
CobblemonBehaviours.behaviours[it]?.configurations?.flatMap { it.getVariables(entity, behaviourConfigurationContext) } ?: emptyList()
|
||||||
} + listOf(condition).asVariables()
|
} + listOf(condition).asVariables()
|
||||||
} else {
|
} else {
|
||||||
listOf(condition).asVariables()
|
listOf(condition).asVariables()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun preconfigure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
|
if (!checkCondition(behaviourConfigurationContext, condition)) return
|
||||||
|
|
||||||
|
val configurations = behaviours.map { CobblemonBehaviours.behaviours[it]?.takeIf { it.canBeApplied(entity) } ?: return }
|
||||||
|
configurations.forEach {
|
||||||
|
it.configurations.forEach { it.preconfigure(entity, behaviourConfigurationContext) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
if (!checkCondition(entity, condition)) return
|
if (!checkCondition(behaviourConfigurationContext, condition)) return
|
||||||
|
|
||||||
val configurations = behaviours.map { CobblemonBehaviours.behaviours[it]?.takeIf { it.canBeApplied(entity) } ?: return Cobblemon.LOGGER.warn("Behaviour $it not found") }
|
val configurations = behaviours.map { CobblemonBehaviours.behaviours[it]?.takeIf { it.canBeApplied(entity) } ?: return Cobblemon.LOGGER.warn("Behaviour $it not found") }
|
||||||
// Why not just add the presets to the context directly?
|
// Why not just add the presets to the context directly?
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ interface BehaviourConfig {
|
|||||||
companion object {
|
companion object {
|
||||||
val types = mutableMapOf<ResourceLocation, Class<out BehaviourConfig>>(
|
val types = mutableMapOf<ResourceLocation, Class<out BehaviourConfig>>(
|
||||||
cobblemonResource("script") to ScriptBehaviourConfig::class.java,
|
cobblemonResource("script") to ScriptBehaviourConfig::class.java,
|
||||||
cobblemonResource("custom_script") to CustomScriptBehaviourConfig::class.java,
|
|
||||||
cobblemonResource("add_tasks_to_activity") to AddTasksToActivity::class.java,
|
cobblemonResource("add_tasks_to_activity") to AddTasksToActivity::class.java,
|
||||||
cobblemonResource("apply_behaviours") to ApplyBehaviours::class.java,
|
cobblemonResource("apply_behaviours") to ApplyBehaviours::class.java,
|
||||||
cobblemonResource("set_default_activity") to SetDefaultActivity::class.java,
|
cobblemonResource("set_default_activity") to SetDefaultActivity::class.java,
|
||||||
@@ -48,12 +47,16 @@ interface BehaviourConfig {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun checkCondition(entity: LivingEntity, expressionOrEntityVariable: ExpressionOrEntityVariable): Boolean {
|
/** Literally just here for shorthand. */
|
||||||
val runtime = MoLangRuntime().setup()
|
fun checkCondition(behaviourConfigurationContext: BehaviourConfigurationContext, expressionOrEntityVariable: ExpressionOrEntityVariable): Boolean {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
return behaviourConfigurationContext.runtime.resolveBoolean(expressionOrEntityVariable.map({ it }, { "q.entity.config.${it.variableName}".asExpression() }))
|
||||||
return runtime.resolveBoolean(expressionOrEntityVariable.map({ it }, { "q.entity.config.${it.variableName}".asExpression() }))
|
}
|
||||||
|
|
||||||
|
fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable>
|
||||||
|
|
||||||
|
fun preconfigure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
|
// Default implementation does nothing, can be overridden if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVariables(entity: LivingEntity): List<MoLangConfigVariable>
|
|
||||||
fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext)
|
fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext)
|
||||||
}
|
}
|
||||||
|
|||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023 Cobblemon Contributors
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config
|
|
||||||
|
|
||||||
import com.bedrockk.molang.runtime.MoLangRuntime
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
|
||||||
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
|
||||||
import com.cobblemon.mod.common.util.asExpressionLike
|
|
||||||
import com.cobblemon.mod.common.util.resolve
|
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
|
||||||
import net.minecraft.world.entity.LivingEntity
|
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
|
||||||
import net.minecraft.world.entity.ai.sensing.SensorType
|
|
||||||
|
|
||||||
class CustomScriptBehaviourConfig : BehaviourConfig {
|
|
||||||
companion object {
|
|
||||||
val runtime = MoLangRuntime().setup()
|
|
||||||
}
|
|
||||||
|
|
||||||
var condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
|
||||||
val variables: List<MoLangConfigVariable> = emptyList()
|
|
||||||
val script: ExpressionLike = "0".asExpressionLike()
|
|
||||||
val memories = emptySet<MemoryModuleType<*>>()
|
|
||||||
val sensors = emptySet<SensorType<*>>()
|
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = variables
|
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
|
||||||
if (!checkCondition(entity, condition)) return
|
|
||||||
behaviourConfigurationContext.addMemories(memories)
|
|
||||||
behaviourConfigurationContext.addSensors(sensors)
|
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
|
||||||
runtime.resolve(script)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -117,7 +117,7 @@ Example behaviour (`uses_healing_machine.json`):
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"type": "add_tasks_to_activity",
|
"type": "add_tasks_to_activity",
|
||||||
"activity": "idle",
|
"activity": "minecraft:idle",
|
||||||
"tasksByPriority": {
|
"tasksByPriority": {
|
||||||
"1": [
|
"1": [
|
||||||
"heal_using_healing_machine",
|
"heal_using_healing_machine",
|
||||||
@@ -177,27 +177,26 @@ Example:
|
|||||||
|
|
||||||
### script
|
### script
|
||||||
The `script` type executes a registered MoLang script which will apply some changes to the brain or entity. This can be
|
The `script` type executes a registered MoLang script which will apply some changes to the brain or entity. This can be
|
||||||
useful if the goal is to apply some kind of configuration to the entity that would otherwise be performed by an NPC preset
|
useful for complex variable configuration. `q.entity` will refer to the entity.
|
||||||
or NPC class. `q.entity` will refer to the entity. This is powerful when combined with [add_variables](#add_variables)
|
|
||||||
configs in the same behaviour preset.
|
- `executeEarly`: If true, the script will be executed in the variable phase which occurs before tasks are added to the brain. Use this when your script might influence which tasks are put onto the brain.
|
||||||
|
- `script`: Either a resource location for the `molang` datapack folder or a MoLang expression that will be executed.
|
||||||
|
- `variables`: A list of variables that can be configured in the UI. Each variable has the same properties as in `add_variables`.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "script",
|
"type": "script",
|
||||||
"script": "cobblemon:configure_npc_party"
|
"executeEarly": true,
|
||||||
}
|
"script": "cobblemon:configure_npc_party",
|
||||||
```
|
"variables": [
|
||||||
|
{
|
||||||
### custom_script
|
"variableName": "party_size",
|
||||||
The `custom_script` type executes a custom MoLang script from this config which will apply some changes to the brain or
|
"defaultValue": "3",
|
||||||
entity. This is useful for when you want to apply some kind of configuration to the entity that would otherwise be
|
"displayName": "Party Size",
|
||||||
by an NPC preset or NPC class. `q.entity` will refer to the entity.
|
"description": "The number of Pokémon in the NPC's party.",
|
||||||
|
"type": "NUMBER"
|
||||||
Example:
|
}
|
||||||
```json
|
]
|
||||||
{
|
|
||||||
"type": "custom_script",
|
|
||||||
"script": "q.entity.set_pathfinding_malus('WATER', -1);"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
+29
-73
@@ -9,94 +9,50 @@
|
|||||||
package com.cobblemon.mod.common.api.ai.config
|
package com.cobblemon.mod.common.api.ai.config
|
||||||
|
|
||||||
import com.bedrockk.molang.runtime.MoLangRuntime
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
import com.bedrockk.molang.runtime.struct.QueryStruct
|
|
||||||
import com.bedrockk.molang.runtime.value.DoubleValue
|
|
||||||
import com.cobblemon.mod.common.Cobblemon
|
|
||||||
import com.cobblemon.mod.common.api.ai.ActivityConfigurationContext
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addStandardFunctions
|
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
||||||
import com.cobblemon.mod.common.api.molang.ObjectValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.api.scripting.CobblemonScripts
|
|
||||||
import com.cobblemon.mod.common.util.activityRegistry
|
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
|
import com.cobblemon.mod.common.util.asExpressionLike
|
||||||
import com.cobblemon.mod.common.util.cobblemonResource
|
|
||||||
import com.cobblemon.mod.common.util.resolve
|
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import com.mojang.datafixers.util.Pair
|
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
|
||||||
import net.minecraft.world.entity.ai.sensing.SensorType
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a MoLang script as part of the entity's behaviour configuration. Variables can be configured here for convenience.
|
||||||
|
*
|
||||||
|
* When [executeEarly] is true, the script will run in an earlier phase than most configs, allowing it to get ahead of
|
||||||
|
* other behaviour configurations that might depend on the changes made by the script.
|
||||||
|
*
|
||||||
|
* @author Hiroku
|
||||||
|
* @since August 11th, 2025
|
||||||
|
*/
|
||||||
class ScriptBehaviourConfig : BehaviourConfig {
|
class ScriptBehaviourConfig : BehaviourConfig {
|
||||||
|
/** If true, the script will execute as part of the getVariables phase. */
|
||||||
|
val executeEarly: Boolean = false
|
||||||
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
val script = cobblemonResource("dummy")
|
val script: ExpressionLike = "0".asExpressionLike()
|
||||||
val variables = mutableListOf<MoLangConfigVariable>()
|
val variables = mutableListOf<MoLangConfigVariable>()
|
||||||
val memories = emptySet<MemoryModuleType<*>>()
|
|
||||||
val sensors = emptySet<SensorType<*>>()
|
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = variables
|
private fun runScript(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
|
if (!checkCondition(behaviourConfigurationContext, condition)) return
|
||||||
|
script.resolve(behaviourConfigurationContext.runtime)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = variables
|
||||||
|
|
||||||
|
override fun preconfigure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
|
if (executeEarly) {
|
||||||
|
runScript(entity = entity, behaviourConfigurationContext = behaviourConfigurationContext)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
if (!checkCondition(entity, condition)) return
|
if (!executeEarly) {
|
||||||
val runtime = MoLangRuntime().setup()
|
runScript(entity = entity, behaviourConfigurationContext = behaviourConfigurationContext)
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
}
|
||||||
|
|
||||||
val struct = createBrainStruct(entity, behaviourConfigurationContext)
|
|
||||||
val script = CobblemonScripts.scripts[this.script]
|
|
||||||
?: run {
|
|
||||||
Cobblemon.LOGGER.error("Tried loading script $script as part of an entity brain but that script does not exist")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
behaviourConfigurationContext.addMemories(memories)
|
|
||||||
behaviourConfigurationContext.addSensors(sensors)
|
|
||||||
|
|
||||||
runtime.resolve(script, mapOf("brain" to struct))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createBrainStruct(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): QueryStruct {
|
|
||||||
return QueryStruct(hashMapOf()).addStandardFunctions()
|
|
||||||
.addFunction("entity") { entity.asMostSpecificMoLangValue() }
|
|
||||||
.addFunction("create_activity") { params ->
|
|
||||||
val name = params.getString(0).asIdentifierDefaultingNamespace()
|
|
||||||
val activity = entity.level().activityRegistry.get(name) ?: return@addFunction run {
|
|
||||||
Cobblemon.LOGGER.error("Tried loading activity $name as part of an entity brain but that activity does not exist")
|
|
||||||
DoubleValue.ZERO
|
|
||||||
}
|
|
||||||
val existingActivityBuilder = behaviourConfigurationContext.activities.find { it.activity == activity }
|
|
||||||
if (existingActivityBuilder != null) {
|
|
||||||
return@addFunction createActivityStruct(existingActivityBuilder)
|
|
||||||
} else {
|
|
||||||
val activityConfigurationContext = ActivityConfigurationContext(activity)
|
|
||||||
behaviourConfigurationContext.activities.add(activityConfigurationContext)
|
|
||||||
return@addFunction createActivityStruct(activityConfigurationContext)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.addFunction("set_core_activities") { params ->
|
|
||||||
behaviourConfigurationContext.coreActivities = params.params.map { (it as ObjectValue<ActivityConfigurationContext>).obj.activity }.toSet()
|
|
||||||
return@addFunction DoubleValue.ONE
|
|
||||||
}
|
|
||||||
.addFunction("set_default_activity") { params ->
|
|
||||||
behaviourConfigurationContext.defaultActivity = params.get<ObjectValue<ActivityConfigurationContext>>(0).obj.activity
|
|
||||||
return@addFunction DoubleValue.ONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createActivityStruct(activityConfigurationContext: ActivityConfigurationContext): ObjectValue<ActivityConfigurationContext> {
|
|
||||||
val struct = ObjectValue(activityConfigurationContext)
|
|
||||||
struct.addStandardFunctions()
|
|
||||||
.addFunction("add_task") { params ->
|
|
||||||
val priority = params.getInt(0)
|
|
||||||
val task = params.get(1) as ObjectValue<BehaviorControl<in LivingEntity>>
|
|
||||||
activityConfigurationContext.tasks.add(Pair(priority, task.obj))
|
|
||||||
}
|
|
||||||
return struct
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ import net.minecraft.world.entity.schedule.Activity
|
|||||||
|
|
||||||
class SetCoreActivities : BehaviourConfig {
|
class SetCoreActivities : BehaviourConfig {
|
||||||
val activities = mutableListOf<Activity>()
|
val activities = mutableListOf<Activity>()
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
behaviourConfigurationContext.coreActivities = activities.toSet()
|
behaviourConfigurationContext.coreActivities = activities.toSet()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import net.minecraft.world.entity.schedule.Activity
|
|||||||
class SetDefaultActivity : BehaviourConfig {
|
class SetDefaultActivity : BehaviourConfig {
|
||||||
val activity: Activity = Activity.IDLE
|
val activity: Activity = Activity.IDLE
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
behaviourConfigurationContext.defaultActivity = activity
|
behaviourConfigurationContext.defaultActivity = activity
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,27 +8,21 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config
|
package com.cobblemon.mod.common.api.ai.config
|
||||||
|
|
||||||
import com.bedrockk.molang.runtime.MoLangRuntime
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.setup
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.MoLangScriptingEntity
|
import com.cobblemon.mod.common.entity.MoLangScriptingEntity
|
||||||
import com.cobblemon.mod.common.util.resolve
|
import com.cobblemon.mod.common.util.resolve
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
|
||||||
class SetVariablesConfig : BehaviourConfig {
|
class SetVariablesConfig : BehaviourConfig {
|
||||||
var variableValues = mutableMapOf<String, ExpressionLike>()
|
var variableValues = mutableMapOf<String, ExpressionLike>()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
override fun configure(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) {
|
||||||
val runtime = MoLangRuntime().setup()
|
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
|
||||||
if (entity is MoLangScriptingEntity) {
|
if (entity is MoLangScriptingEntity) {
|
||||||
variableValues.forEach { (variableName, valueExpression) ->
|
variableValues.forEach { (variableName, valueExpression) ->
|
||||||
entity.config.setDirectly(variableName, runtime.resolve(valueExpression))
|
entity.config.setDirectly(variableName, behaviourConfigurationContext.runtime.resolve(valueExpression))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.molang.ExpressionLike
|
|||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.util.asExpressionLike
|
import com.cobblemon.mod.common.util.asExpressionLike
|
||||||
|
import com.cobblemon.mod.common.util.mainThreadRuntime
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
import net.minecraft.server.level.ServerLevel
|
import net.minecraft.server.level.ServerLevel
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@@ -24,16 +25,16 @@ class ActivityChangeTaskConfig : SingleTaskConfig {
|
|||||||
val activity: Activity = Activity.IDLE
|
val activity: Activity = Activity.IDLE
|
||||||
val condition: ExpressionLike = "false".asExpressionLike()
|
val condition: ExpressionLike = "false".asExpressionLike()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> = emptyList()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> = emptyList()
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity> {
|
||||||
return object : OneShot<LivingEntity>() {
|
return object : OneShot<LivingEntity>() {
|
||||||
override fun trigger(serverLevel: ServerLevel, livingEntity: LivingEntity, l: Long): Boolean {
|
override fun trigger(serverLevel: ServerLevel, livingEntity: LivingEntity, l: Long): Boolean {
|
||||||
runtime.withQueryValue("entity", livingEntity.asMostSpecificMoLangValue())
|
mainThreadRuntime.withQueryValue("entity", livingEntity.asMostSpecificMoLangValue())
|
||||||
if (condition.resolveBoolean(runtime)) {
|
if (condition.resolveBoolean(mainThreadRuntime)) {
|
||||||
livingEntity.brain.setActiveActivityIfPossible(activity)
|
livingEntity.brain.setActiveActivityIfPossible(activity)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+6
-5
@@ -16,6 +16,7 @@ import com.cobblemon.mod.common.api.ai.config.task.WanderTaskConfig.Companion.WA
|
|||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.cobblemon.mod.common.util.mainThreadRuntime
|
||||||
import com.cobblemon.mod.common.util.resolveFloat
|
import com.cobblemon.mod.common.util.resolveFloat
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
@@ -38,7 +39,7 @@ class AirWanderTaskConfig : SingleTaskConfig {
|
|||||||
val minUpwardsMovement: ExpressionOrEntityVariable = Either.left("3.0".asExpression())
|
val minUpwardsMovement: ExpressionOrEntityVariable = Either.left("3.0".asExpression())
|
||||||
val minDownwardsMovement: ExpressionOrEntityVariable = Either.left("3.0".asExpression())
|
val minDownwardsMovement: ExpressionOrEntityVariable = Either.left("3.0".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(condition, wanderChance, horizontalRange, verticalRange, speedMultiplier, minUpwardsMovement, minDownwardsMovement).asVariables()
|
return listOf(condition, wanderChance, horizontalRange, verticalRange, speedMultiplier, minUpwardsMovement, minDownwardsMovement).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +47,7 @@ class AirWanderTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.LOOK_TARGET, CobblemonMemories.PATH_COOLDOWN)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.LOOK_TARGET, CobblemonMemories.PATH_COOLDOWN)
|
||||||
val wanderChanceExpression = wanderChance.asSimplifiedExpression(entity)
|
val wanderChanceExpression = wanderChance.asSimplifiedExpression(entity)
|
||||||
|
|
||||||
@@ -62,15 +62,16 @@ class AirWanderTaskConfig : SingleTaskConfig {
|
|||||||
return@Trigger false
|
return@Trigger false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val runtime = mainThreadRuntime
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
||||||
val wanderChance = runtime.resolveFloat(wanderChanceExpression)
|
val wanderChance = runtime.resolveFloat(wanderChanceExpression)
|
||||||
if (wanderChance <= 0 || world.random.nextFloat() > wanderChance) return@Trigger false
|
if (wanderChance <= 0 || world.random.nextFloat() > wanderChance) return@Trigger false
|
||||||
|
|
||||||
val rotVec = entity.getViewVector(0F)
|
val rotVec = entity.getViewVector(0F)
|
||||||
pathCooldown.setWithExpiry(true, 60L)
|
pathCooldown.setWithExpiry(true, 60L)
|
||||||
val target = HoverRandomPos.getPos(entity, horizontalRange.resolveInt(), verticalRange.resolveInt(), rotVec.x, rotVec.y, 1.5707964f, minUpwardsMovement.resolveInt(), minDownwardsMovement.resolveInt())
|
val target = HoverRandomPos.getPos(entity, horizontalRange.resolveInt(runtime), verticalRange.resolveInt(runtime), rotVec.x, rotVec.y, 1.5707964f, minUpwardsMovement.resolveInt(runtime), minDownwardsMovement.resolveInt(runtime))
|
||||||
?: return@Trigger false
|
?: return@Trigger false
|
||||||
walkTarget.set(WalkTarget(target, speedMultiplier.resolveFloat(), 3))
|
walkTarget.set(WalkTarget(target, speedMultiplier.resolveFloat(runtime), 3))
|
||||||
lookTarget.set(BlockPosTracker(target))
|
lookTarget.set(BlockPosTracker(target))
|
||||||
return@Trigger true
|
return@Trigger true
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -10,9 +10,7 @@ package com.cobblemon.mod.common.api.ai.config.task
|
|||||||
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
@@ -21,14 +19,12 @@ class AllOfTaskConfig : TaskConfig {
|
|||||||
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
val tasks: List<TaskConfig> = emptyList()
|
val tasks: List<TaskConfig> = emptyList()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = tasks.flatMap { it.getVariables(entity) }
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = tasks.flatMap { it.getVariables(entity, behaviourConfigurationContext) }
|
||||||
override fun createTasks(
|
override fun createTasks(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): List<BehaviorControl<in LivingEntity>> {
|
): List<BehaviorControl<in LivingEntity>> {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return emptyList()
|
||||||
if (!condition.resolveBoolean()) return emptyList()
|
|
||||||
|
|
||||||
return tasks.flatMap { it.createTasks(entity, behaviourConfigurationContext) }
|
return tasks.flatMap { it.createTasks(entity, behaviourConfigurationContext) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -17,7 +17,7 @@ import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
|||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class AttackAngryAtTaskConfig : SingleTaskConfig {
|
class AttackAngryAtTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@ import net.minecraft.world.entity.LivingEntity
|
|||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
|
||||||
class AttackHostileMobsTaskConfig : SingleTaskConfig {
|
class AttackHostileMobsTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return emptyList<MoLangConfigVariable>()
|
return emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
|
|||||||
+2
-6
@@ -10,11 +10,8 @@ package com.cobblemon.mod.common.api.ai.config.task
|
|||||||
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
@@ -24,13 +21,12 @@ import net.minecraft.world.entity.ai.sensing.SensorType
|
|||||||
|
|
||||||
class CalmDownTaskConfig : SingleTaskConfig {
|
class CalmDownTaskConfig : SingleTaskConfig {
|
||||||
var condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
var condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.HURT_BY,
|
MemoryModuleType.HURT_BY,
|
||||||
MemoryModuleType.HURT_BY_ENTITY,
|
MemoryModuleType.HURT_BY_ENTITY,
|
||||||
|
|||||||
+5
-6
@@ -12,11 +12,9 @@ import com.cobblemon.mod.common.CobblemonMemories
|
|||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import kotlin.jvm.optionals.getOrNull
|
import kotlin.jvm.optionals.getOrNull
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@@ -27,7 +25,9 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
|||||||
import net.minecraft.world.entity.ai.sensing.SensorType
|
import net.minecraft.world.entity.ai.sensing.SensorType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks nearby entities and counts how many have nominated this entity as their leader.
|
* Checks nearby entities and counts how many have nominated this entity as their leader. We normally update this
|
||||||
|
* as people join and leave the herd, but this is a fallback to make sure we don't get stuck with an incorrect value
|
||||||
|
* like if the entities die or whatever.
|
||||||
*
|
*
|
||||||
* @author Hiroku
|
* @author Hiroku
|
||||||
* @since June 17th, 2025
|
* @since June 17th, 2025
|
||||||
@@ -35,7 +35,7 @@ import net.minecraft.world.entity.ai.sensing.SensorType
|
|||||||
class CountFollowersTaskConfig : SingleTaskConfig {
|
class CountFollowersTaskConfig : SingleTaskConfig {
|
||||||
val checkTicks: ExpressionOrEntityVariable = Either.left("10".asExpression())
|
val checkTicks: ExpressionOrEntityVariable = Either.left("10".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(checkTicks).asVariables()
|
return listOf(checkTicks).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +43,7 @@ class CountFollowersTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
val checkTicksValue = checkTicks.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
val checkTicksValue = checkTicks.resolveInt()
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
||||||
CobblemonMemories.HERD_SIZE,
|
CobblemonMemories.HERD_SIZE,
|
||||||
|
|||||||
+4
-4
@@ -23,14 +23,14 @@ class DoNothingTaskConfig : SingleTaskConfig {
|
|||||||
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
val minDurationTicks: ExpressionOrEntityVariable = Either.left("40".asExpression())
|
val minDurationTicks: ExpressionOrEntityVariable = Either.left("40".asExpression())
|
||||||
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(minDurationTicks, maxDurationTicks).asVariables()
|
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(minDurationTicks, maxDurationTicks).asVariables()
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
return DoNothing(minDurationTicks.resolveInt(behaviourConfigurationContext.runtime), maxDurationTicks.resolveInt(behaviourConfigurationContext.runtime))
|
||||||
return DoNothing(minDurationTicks.resolveInt(), maxDurationTicks.resolveInt())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -29,7 +29,7 @@ class EatGrassTaskConfig : SingleTaskConfig {
|
|||||||
val cooldown = numberVariable(category = EATING_GRASS, name = COOLDOWN, default = 20 * 20).asExpressible()
|
val cooldown = numberVariable(category = EATING_GRASS, name = COOLDOWN, default = 20 * 20).asExpressible()
|
||||||
val eatGrassChance = numberVariable(category = EATING_GRASS, name = EAT_GRASS_CHANCE, default = 1 / (20 * 20F)).asExpressible()
|
val eatGrassChance = numberVariable(category = EATING_GRASS, name = EAT_GRASS_CHANCE, default = 1 / (20 * 20F)).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(
|
return listOf(
|
||||||
cooldown,
|
cooldown,
|
||||||
eatGrassChance
|
eatGrassChance
|
||||||
@@ -44,7 +44,7 @@ class EatGrassTaskConfig : SingleTaskConfig {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
val chance = eatGrassChance.resolveFloat()
|
val chance = eatGrassChance.resolveFloat(behaviourConfigurationContext.runtime)
|
||||||
if (chance == 0F) {
|
if (chance == 0F) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ class EatGrassTaskConfig : SingleTaskConfig {
|
|||||||
return WrapperLivingEntityTask(
|
return WrapperLivingEntityTask(
|
||||||
EatGrassTask(
|
EatGrassTask(
|
||||||
chance,
|
chance,
|
||||||
cooldown.resolveInt().toLong()
|
cooldown.resolveInt(behaviourConfigurationContext.runtime).toLong()
|
||||||
),
|
),
|
||||||
PokemonEntity::class.java
|
PokemonEntity::class.java
|
||||||
)
|
)
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask.Companion.wrapped
|
||||||
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.EatHeldItemTask
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
|
||||||
|
class EatHeldItemTaskConfig : SingleTaskConfig {
|
||||||
|
override fun getVariables(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
) = emptyList<MoLangConfigVariable>()
|
||||||
|
|
||||||
|
override fun createTask(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
if (entity !is PokemonEntity) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
behaviourConfigurationContext.addMemories(
|
||||||
|
CobblemonMemories.IS_CONSUMING_ITEM,
|
||||||
|
)
|
||||||
|
return EatHeldItemTask(entity).wrapped<PokemonEntity>()
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-4
@@ -28,7 +28,7 @@ class ExitBattleWhenHurtTaskConfig : SingleTaskConfig {
|
|||||||
var condition = booleanVariable(SharedEntityVariables.BATTLING_CATEGORY, "exit_battle_when_hurt", true).asExpressible()
|
var condition = booleanVariable(SharedEntityVariables.BATTLING_CATEGORY, "exit_battle_when_hurt", true).asExpressible()
|
||||||
var includePassiveDamage = booleanVariable(SharedEntityVariables.BATTLING_CATEGORY, "exit_battle_from_passive_damage", true).asExpressible()
|
var includePassiveDamage = booleanVariable(SharedEntityVariables.BATTLING_CATEGORY, "exit_battle_from_passive_damage", true).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
includePassiveDamage
|
includePassiveDamage
|
||||||
).asVariables()
|
).asVariables()
|
||||||
@@ -37,10 +37,9 @@ class ExitBattleWhenHurtTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
|
|
||||||
val includePassiveDamage = includePassiveDamage.resolveBoolean()
|
val includePassiveDamage = includePassiveDamage.resolveBoolean(behaviourConfigurationContext.runtime)
|
||||||
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.HURT_BY,
|
MemoryModuleType.HURT_BY,
|
||||||
|
|||||||
+2
-2
@@ -32,7 +32,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType
|
|||||||
*/
|
*/
|
||||||
class FindAirTaskConfig : SingleTaskConfig {
|
class FindAirTaskConfig : SingleTaskConfig {
|
||||||
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(walkSpeed).asVariables()
|
return listOf(walkSpeed).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ class FindAirTaskConfig : SingleTaskConfig {
|
|||||||
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
||||||
).apply(it) { walkTarget, pathCooldown ->
|
).apply(it) { walkTarget, pathCooldown ->
|
||||||
Trigger { world, entity, time ->
|
Trigger { world, entity, time ->
|
||||||
if (!entity.getIsSubmerged()) {
|
if (!entity.getIsSubmerged() || entity.isInLava) {
|
||||||
return@Trigger false
|
return@Trigger false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -8,17 +8,16 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.Cobblemon
|
||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.api.storage.party.PartyStore
|
import com.cobblemon.mod.common.api.storage.party.PartyStore
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
import com.cobblemon.mod.common.pokemon.ai.ToleratedHerdLeader
|
import com.cobblemon.mod.common.pokemon.ai.ToleratedHerdLeader
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
@@ -53,24 +52,25 @@ class FindHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
it is PokemonEntity &&
|
it is PokemonEntity &&
|
||||||
it != currentLeader &&
|
it != currentLeader &&
|
||||||
it.pokemon.storeCoordinates.get()?.store !is PartyStore &&
|
it.pokemon.storeCoordinates.get()?.store !is PartyStore &&
|
||||||
it.getHerdSize() < it.behaviour.herd.maxSize
|
it.getHerdSize() < it.behaviour.herd.maxSize &&
|
||||||
|
!it.brain.hasMemoryValue(CobblemonMemories.POKEMON_DROWSY)
|
||||||
}.forEach { possibleLeader ->
|
}.forEach { possibleLeader ->
|
||||||
possibleLeader as PokemonEntity
|
possibleLeader as PokemonEntity
|
||||||
val matchingHerdLeader = entity.behaviour.herd.bestMatchLeader(entity, possibleLeader) ?: return@forEach
|
val bestMatchingHerdLeader = entity.behaviour.herd.bestMatchLeader(entity, possibleLeader) ?: return@forEach
|
||||||
val alreadyIsALeader = possibleLeader.brain.hasMemoryValue(CobblemonMemories.HERD_SIZE)
|
val possibleLeaderIsAlreadyALeader = possibleLeader.brain.hasMemoryValue(CobblemonMemories.HERD_SIZE)
|
||||||
val nestedHerdTier = currentLeaderEntity?.getHerdTier() ?: 0
|
val currentLeaderHerdTier = currentLeaderEntity?.getHerdTier() ?: entity.getHerdTier()
|
||||||
if (nestedHerdTier >= matchingHerdLeader.tier) {
|
if (currentLeaderHerdTier >= bestMatchingHerdLeader.tier) {
|
||||||
return@forEach // This leader is following a leader of a higher tier, we can't replace them
|
return@forEach // This leader is following a leader of a higher tier, we can't replace them
|
||||||
}
|
}
|
||||||
val distance = entity.distanceTo(possibleLeader)
|
val distance = entity.distanceTo(possibleLeader)
|
||||||
if (matchingHerdLeader.tier < bestTier) {
|
if (bestMatchingHerdLeader.tier < bestTier) {
|
||||||
return@forEach // No need to check further if this leader is worse than the best found so far
|
return@forEach // No need to check further if this leader is worse than the best found so far
|
||||||
} else if ((distance > bestDistance && !alreadyIsALeader) && matchingHerdLeader.tier == bestTier) {
|
} else if ((distance > bestDistance && !possibleLeaderIsAlreadyALeader) && bestMatchingHerdLeader.tier == bestTier) {
|
||||||
return@forEach // No need to check further if this leader is farther than the best found so far, unless they are already a leader - I'd prefer to join a pack
|
return@forEach // No need to check further if this leader is farther than the best found so far, unless they are already a leader - I'd prefer to join a pack
|
||||||
} else {
|
} else {
|
||||||
bestLeader = possibleLeader
|
bestLeader = possibleLeader
|
||||||
bestDistance = distance
|
bestDistance = distance
|
||||||
bestTier = matchingHerdLeader.tier
|
bestTier = bestMatchingHerdLeader.tier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bestLeader ?: currentLeaderEntity
|
return bestLeader ?: currentLeaderEntity
|
||||||
@@ -80,7 +80,7 @@ class FindHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
// How frequently to check for whether it should herd. Probably isn't that expensive but might use this for chance.
|
// How frequently to check for whether it should herd. Probably isn't that expensive but might use this for chance.
|
||||||
val checkTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
val checkTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(checkTicks).asVariables()
|
return listOf(checkTicks).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,8 +98,7 @@ class FindHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
MemoryModuleType.WALK_TARGET
|
MemoryModuleType.WALK_TARGET
|
||||||
)
|
)
|
||||||
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
val checkTicksValue = checkTicks.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
val checkTicksValue = checkTicks.resolveInt()
|
|
||||||
return BehaviorBuilder.create { instance ->
|
return BehaviorBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
instance.present(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES),
|
instance.present(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES),
|
||||||
@@ -119,6 +118,7 @@ class FindHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
|
|
||||||
herdLeader.set(bestLeader.uuid.toString())
|
herdLeader.set(bestLeader.uuid.toString())
|
||||||
bestLeader.brain.eraseMemory(CobblemonMemories.HERD_LEADER)
|
bestLeader.brain.eraseMemory(CobblemonMemories.HERD_LEADER)
|
||||||
|
bestLeader.adjustHerdSize(1)
|
||||||
return@Trigger true
|
return@Trigger true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-2
@@ -14,23 +14,34 @@ import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
|||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
|
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.FindRestingPlaceTask
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.FindRestingPlaceTask
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.cobblemon.mod.common.util.asExpressionLike
|
||||||
|
import com.cobblemon.mod.common.util.resolveBoolean
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class FindRestingPlaceTaskConfig : SingleTaskConfig {
|
class FindRestingPlaceTaskConfig : SingleTaskConfig {
|
||||||
|
val condition: ExpressionLike = "true".asExpressionLike()
|
||||||
val horizontalSearchDistance: ExpressionOrEntityVariable = Either.left("16".asExpression())
|
val horizontalSearchDistance: ExpressionOrEntityVariable = Either.left("16".asExpression())
|
||||||
val verticalSearchDistance: ExpressionOrEntityVariable = Either.left("5".asExpression())
|
val verticalSearchDistance: ExpressionOrEntityVariable = Either.left("5".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(horizontalSearchDistance, verticalSearchDistance).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(horizontalSearchDistance, verticalSearchDistance).asVariables()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
if (entity !is PokemonEntity) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (!behaviourConfigurationContext.runtime.resolveBoolean(condition)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
CobblemonMemories.PATH_COOLDOWN,
|
CobblemonMemories.PATH_COOLDOWN,
|
||||||
CobblemonMemories.POKEMON_DROWSY,
|
CobblemonMemories.POKEMON_DROWSY,
|
||||||
@@ -39,7 +50,7 @@ class FindRestingPlaceTaskConfig : SingleTaskConfig {
|
|||||||
behaviourConfigurationContext.addSensors(CobblemonSensors.POKEMON_DROWSY)
|
behaviourConfigurationContext.addSensors(CobblemonSensors.POKEMON_DROWSY)
|
||||||
|
|
||||||
return WrapperLivingEntityTask(
|
return WrapperLivingEntityTask(
|
||||||
FindRestingPlaceTask.create(horizontalSearchDistance.resolveInt(), verticalSearchDistance.resolveInt()),
|
FindRestingPlaceTask.create(horizontalSearchDistance.resolveInt(behaviourConfigurationContext.runtime), verticalSearchDistance.resolveInt(behaviourConfigurationContext.runtime)),
|
||||||
PokemonEntity::class.java
|
PokemonEntity::class.java
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-27
@@ -9,45 +9,36 @@
|
|||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.ai.config.task.SharedEntityVariables.FLEE_DESIRED_DISTANCE
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.api.ai.config.task.SharedEntityVariables.FLEE_SPEED_MULTIPLIER
|
import com.cobblemon.mod.common.entity.ai.FleeFromAttackerTask
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.PathfinderMob
|
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
import net.minecraft.world.entity.ai.behavior.SetWalkTargetAwayFrom
|
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
import net.minecraft.world.entity.ai.sensing.SensorType
|
import net.minecraft.world.entity.ai.sensing.SensorType
|
||||||
|
|
||||||
class FleeAttackerTaskConfig : SingleTaskConfig {
|
class FleeAttackerTaskConfig : SingleTaskConfig {
|
||||||
var condition = booleanVariable(SharedEntityVariables.FEAR_CATEGORY, "flee_attacker", true).asExpressible()
|
val avoidDurationTicks: ExpressionOrEntityVariable = Either.left("600".asExpression())
|
||||||
var speedMultiplier = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_SPEED_MULTIPLIER, 0.5).asExpressible()
|
|
||||||
var desiredDistance = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_DESIRED_DISTANCE, 9).asExpressible()
|
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(
|
||||||
condition,
|
entity: LivingEntity,
|
||||||
speedMultiplier,
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
desiredDistance
|
): List<MoLangConfigVariable> {
|
||||||
).asVariables()
|
return listOf(avoidDurationTicks).asVariables()
|
||||||
|
}
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity> {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
behaviourConfigurationContext.addMemories(
|
||||||
if (!condition.resolveBoolean() || entity !is PathfinderMob) return null
|
MemoryModuleType.HURT_BY_ENTITY,
|
||||||
|
MemoryModuleType.AVOID_TARGET
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET)
|
|
||||||
behaviourConfigurationContext.addSensors(SensorType.HURT_BY)
|
|
||||||
|
|
||||||
val speedMultiplier = speedMultiplier.resolveFloat()
|
|
||||||
val desiredDistance = desiredDistance.resolveInt()
|
|
||||||
return WrapperLivingEntityTask(
|
|
||||||
SetWalkTargetAwayFrom.entity(MemoryModuleType.HURT_BY_ENTITY, speedMultiplier, desiredDistance, false),
|
|
||||||
PathfinderMob::class.java
|
|
||||||
)
|
)
|
||||||
|
behaviourConfigurationContext.addSensors(SensorType.HURT_BY)
|
||||||
|
return FleeFromAttackerTask.create(avoidDurationTicks.asExpression())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-5
@@ -27,18 +27,17 @@ class FleeNearestHostileTaskConfig : SingleTaskConfig {
|
|||||||
var speedMultiplier = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_SPEED_MULTIPLIER, 0.5).asExpressible()
|
var speedMultiplier = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_SPEED_MULTIPLIER, 0.5).asExpressible()
|
||||||
var desiredDistance = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_DESIRED_DISTANCE, 9).asExpressible()
|
var desiredDistance = numberVariable(SharedEntityVariables.FEAR_CATEGORY, FLEE_DESIRED_DISTANCE, 9).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(condition, speedMultiplier, desiredDistance).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(condition, speedMultiplier, desiredDistance).asVariables()
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime) || entity !is PathfinderMob) return null
|
||||||
if (!condition.resolveBoolean() || entity !is PathfinderMob) return null
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.WALK_TARGET)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.WALK_TARGET)
|
||||||
behaviourConfigurationContext.addSensors(SensorType.VILLAGER_HOSTILES)
|
behaviourConfigurationContext.addSensors(SensorType.VILLAGER_HOSTILES)
|
||||||
val speedMultiplier = speedMultiplier.resolveFloat()
|
val speedMultiplier = speedMultiplier.resolveFloat(behaviourConfigurationContext.runtime)
|
||||||
val desiredDistance = desiredDistance.resolveInt()
|
val desiredDistance = desiredDistance.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
return WrapperLivingEntityTask(
|
return WrapperLivingEntityTask(
|
||||||
SetWalkTargetAwayFrom.entity(MemoryModuleType.NEAREST_HOSTILE, speedMultiplier, desiredDistance, false),
|
SetWalkTargetAwayFrom.entity(MemoryModuleType.NEAREST_HOSTILE, speedMultiplier, desiredDistance, false),
|
||||||
PathfinderMob::class.java
|
PathfinderMob::class.java
|
||||||
|
|||||||
+7
-8
@@ -38,7 +38,7 @@ class FlyInCirclesTaskConfig : SingleTaskConfig {
|
|||||||
val minDurationTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
val minDurationTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
||||||
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("180".asExpression())
|
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("180".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(
|
return listOf(
|
||||||
minAngularVelocityDegrees,
|
minAngularVelocityDegrees,
|
||||||
maxAngularVelocityDegrees,
|
maxAngularVelocityDegrees,
|
||||||
@@ -57,15 +57,14 @@ class FlyInCirclesTaskConfig : SingleTaskConfig {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.PATH)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.PATH)
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
|
||||||
return CircleAroundTask(
|
return CircleAroundTask(
|
||||||
poseTypes = poseTypes,
|
poseTypes = poseTypes,
|
||||||
minTurnAngleDegrees = minAngularVelocityDegrees.resolveFloat(),
|
minTurnAngleDegrees = minAngularVelocityDegrees.resolveFloat(behaviourConfigurationContext.runtime),
|
||||||
maxTurnAngleDegrees = maxAngularVelocityDegrees.resolveFloat(),
|
maxTurnAngleDegrees = maxAngularVelocityDegrees.resolveFloat(behaviourConfigurationContext.runtime),
|
||||||
speed = speed.resolveFloat(),
|
speed = speed.resolveFloat(behaviourConfigurationContext.runtime),
|
||||||
verticalSpeed = verticalSpeed.resolveFloat(),
|
verticalSpeed = verticalSpeed.resolveFloat(behaviourConfigurationContext.runtime),
|
||||||
minDurationTicks = minDurationTicks.resolveFloat().toInt(),
|
minDurationTicks = minDurationTicks.resolveFloat(behaviourConfigurationContext.runtime).toInt(),
|
||||||
maxDurationTicks = maxDurationTicks.resolveFloat().toInt()
|
maxDurationTicks = maxDurationTicks.resolveFloat(behaviourConfigurationContext.runtime).toInt()
|
||||||
).wrapped<PokemonEntity>()
|
).wrapped<PokemonEntity>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -19,7 +19,7 @@ import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
|||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class FollowHerdLeaderTaskConfig : SingleTaskConfig {
|
class FollowHerdLeaderTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf()
|
return listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -27,13 +27,12 @@ class FollowWalkTargetTaskConfig : SingleTaskConfig {
|
|||||||
val minRunTicks: ExpressionOrEntityVariable = Either.left("150".asExpression())
|
val minRunTicks: ExpressionOrEntityVariable = Either.left("150".asExpression())
|
||||||
val maxRunTicks: ExpressionOrEntityVariable = Either.left("250".asExpression())
|
val maxRunTicks: ExpressionOrEntityVariable = Either.left("250".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(minRunTicks, maxRunTicks).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(minRunTicks, maxRunTicks).asVariables()
|
||||||
|
|
||||||
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<LivingEntity>? {
|
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.PATH, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, MemoryModuleType.PATH, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE)
|
||||||
return WrapperLivingEntityTask(
|
return WrapperLivingEntityTask(
|
||||||
FollowWalkTargetTask(minRunTicks.resolveInt(), maxRunTicks.resolveInt()),
|
FollowWalkTargetTask(minRunTicks.resolveInt(behaviourConfigurationContext.runtime), maxRunTicks.resolveInt(behaviourConfigurationContext.runtime)),
|
||||||
PathfinderMob::class.java
|
PathfinderMob::class.java
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -26,14 +26,13 @@ class GetAngryAtAttackerTaskConfig : SingleTaskConfig {
|
|||||||
|
|
||||||
val condition = booleanVariable(ATTACKING_CATEGORY, GET_ANGRY_AT_ATTACKER, true).asExpressible()
|
val condition = booleanVariable(ATTACKING_CATEGORY, GET_ANGRY_AT_ATTACKER, true).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(condition).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(condition).asVariables()
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.HURT_BY_ENTITY,
|
MemoryModuleType.HURT_BY_ENTITY,
|
||||||
MemoryModuleType.ANGRY_AT,
|
MemoryModuleType.ANGRY_AT,
|
||||||
|
|||||||
+2
-3
@@ -30,7 +30,7 @@ class GoToHealingMachineTaskConfig : SingleTaskConfig {
|
|||||||
val completionRange: ExpressionOrEntityVariable = Either.left("1".asExpression())
|
val completionRange: ExpressionOrEntityVariable = Either.left("1".asExpression())
|
||||||
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(condition, walkSpeed, horizontalSearchRange, verticalSearchRange, completionRange).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(condition, walkSpeed, horizontalSearchRange, verticalSearchRange, completionRange).asVariables()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SELF_HEALING = "self_healing"
|
const val SELF_HEALING = "self_healing"
|
||||||
@@ -41,8 +41,7 @@ class GoToHealingMachineTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.WALK_TARGET,
|
MemoryModuleType.WALK_TARGET,
|
||||||
MemoryModuleType.LOOK_TARGET,
|
MemoryModuleType.LOOK_TARGET,
|
||||||
|
|||||||
+7
-3
@@ -11,9 +11,12 @@ package com.cobblemon.mod.common.api.ai.config.task
|
|||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.OmniPathingEntity
|
import com.cobblemon.mod.common.entity.OmniPathingEntity
|
||||||
import com.cobblemon.mod.common.util.closestPosition
|
import com.cobblemon.mod.common.util.closestPosition
|
||||||
|
import com.cobblemon.mod.common.util.mainThreadRuntime
|
||||||
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
@@ -33,7 +36,7 @@ import net.minecraft.world.level.pathfinder.PathComputationType
|
|||||||
*/
|
*/
|
||||||
class GoToLandTaskConfig : SingleTaskConfig {
|
class GoToLandTaskConfig : SingleTaskConfig {
|
||||||
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
val walkSpeed = numberVariable(SharedEntityVariables.MOVEMENT_CATEGORY, SharedEntityVariables.WALK_SPEED, 0.35).asExpressible()
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(walkSpeed).asVariables()
|
return listOf(walkSpeed).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,13 +57,14 @@ class GoToLandTaskConfig : SingleTaskConfig {
|
|||||||
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
||||||
).apply(it) { walkTarget, pathCooldown ->
|
).apply(it) { walkTarget, pathCooldown ->
|
||||||
Trigger { world, entity, time ->
|
Trigger { world, entity, time ->
|
||||||
if (!entity.isInLiquid) {
|
if (!entity.isInWater) {
|
||||||
return@Trigger false
|
return@Trigger false
|
||||||
}
|
}
|
||||||
|
|
||||||
entity as PathfinderMob
|
entity as PathfinderMob
|
||||||
|
|
||||||
val walkSpeedValue = walkSpeed.resolveFloat()
|
mainThreadRuntime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
||||||
|
val walkSpeedValue = walkSpeed.resolveFloat(mainThreadRuntime)
|
||||||
|
|
||||||
val iterable = BlockPos.betweenClosed(
|
val iterable = BlockPos.betweenClosed(
|
||||||
Mth.floor(entity.x - 8.0),
|
Mth.floor(entity.x - 8.0),
|
||||||
|
|||||||
+7
-2
@@ -11,16 +11,21 @@ package com.cobblemon.mod.common.api.ai.config.task
|
|||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.CobblemonSensors
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.GoToSleepTask
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.GoToSleepTask
|
||||||
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.cobblemon.mod.common.util.resolveBoolean
|
||||||
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class GoToSleepTaskConfig : SingleTaskConfig {
|
class GoToSleepTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
var onlyFromStatus: ExpressionOrEntityVariable = Either.left("false".asExpression())
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
@@ -34,6 +39,6 @@ class GoToSleepTaskConfig : SingleTaskConfig {
|
|||||||
CobblemonMemories.POKEMON_SLEEPING
|
CobblemonMemories.POKEMON_SLEEPING
|
||||||
)
|
)
|
||||||
behaviourConfigurationContext.addSensors(CobblemonSensors.POKEMON_DROWSY)
|
behaviourConfigurationContext.addSensors(CobblemonSensors.POKEMON_DROWSY)
|
||||||
return WrapperLivingEntityTask(GoToSleepTask.create(), PokemonEntity::class.java)
|
return WrapperLivingEntityTask(GoToSleepTask.create(onlyFromStatus.resolveBoolean(behaviourConfigurationContext.runtime)), PokemonEntity::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.HarvestSweetBerryBushTask
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
|
class HarvestSweetBerryBushTaskConfig : SingleTaskConfig {
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
|
override fun createTask(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
if (entity !is PokemonEntity) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
behaviourConfigurationContext.addMemories(
|
||||||
|
CobblemonMemories.NEARBY_SWEET_BERRY_BUSH,
|
||||||
|
CobblemonMemories.DISABLE_WALK_TO_BERRY_BUSH,
|
||||||
|
CobblemonMemories.TIME_TRYING_TO_REACH_BERRY_BUSH,
|
||||||
|
MemoryModuleType.WALK_TARGET,
|
||||||
|
MemoryModuleType.LOOK_TARGET)
|
||||||
|
behaviourConfigurationContext.addSensors(CobblemonSensors.NEARBY_SWEET_BERRY_BUSH)
|
||||||
|
return HarvestSweetBerryBushTask()
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-4
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
|||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.cobblemon.mod.common.util.mainThreadRuntime
|
||||||
import com.cobblemon.mod.common.util.resolveBoolean
|
import com.cobblemon.mod.common.util.resolveBoolean
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
import com.cobblemon.mod.common.util.withQueryValue
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
@@ -34,12 +35,12 @@ class HateEntityTaskConfig : SingleTaskConfig {
|
|||||||
val entityCondition: Expression = "true".asExpression()
|
val entityCondition: Expression = "true".asExpression()
|
||||||
val range: ExpressionOrEntityVariable = Either.left("24".asExpression())
|
val range: ExpressionOrEntityVariable = Either.left("24".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
val range = range.resolveFloat()
|
val range = range.resolveFloat(behaviourConfigurationContext.runtime)
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
||||||
MemoryModuleType.ANGRY_AT
|
MemoryModuleType.ANGRY_AT
|
||||||
@@ -52,8 +53,8 @@ class HateEntityTaskConfig : SingleTaskConfig {
|
|||||||
).apply(instance) { entities, angryAt ->
|
).apply(instance) { entities, angryAt ->
|
||||||
Trigger { world, entity, _ ->
|
Trigger { world, entity, _ ->
|
||||||
val target = instance.get(entities).findClosest {
|
val target = instance.get(entities).findClosest {
|
||||||
runtime.withQueryValue("entity", it.asMostSpecificMoLangValue())
|
mainThreadRuntime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
||||||
return@findClosest runtime.resolveBoolean(entityCondition)
|
return@findClosest mainThreadRuntime.resolveBoolean(entityCondition)
|
||||||
}.orElse(null)
|
}.orElse(null)
|
||||||
|
|
||||||
if (target != null && target.distanceTo(entity) <= range) {
|
if (target != null && target.distanceTo(entity) <= range) {
|
||||||
|
|||||||
+2
-3
@@ -29,14 +29,13 @@ class HealUsingHealingMachineTaskConfig : SingleTaskConfig {
|
|||||||
val horizontalUseRange: ExpressionOrEntityVariable = Either.left("2".asExpression())
|
val horizontalUseRange: ExpressionOrEntityVariable = Either.left("2".asExpression())
|
||||||
val verticalUseRange: ExpressionOrEntityVariable = Either.left("1".asExpression())
|
val verticalUseRange: ExpressionOrEntityVariable = Either.left("1".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(condition, horizontalUseRange, verticalUseRange).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(condition, horizontalUseRange, verticalUseRange).asVariables()
|
||||||
|
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, CobblemonMemories.NPC_BATTLING,)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.WALK_TARGET, CobblemonMemories.NPC_BATTLING,)
|
||||||
behaviourConfigurationContext.addSensors(CobblemonSensors.NPC_BATTLING)
|
behaviourConfigurationContext.addSensors(CobblemonSensors.NPC_BATTLING)
|
||||||
return HealUsingHealingMachineTask(horizontalUseRange.asExpression(), verticalUseRange.asExpression())
|
return HealUsingHealingMachineTask(horizontalUseRange.asExpression(), verticalUseRange.asExpression())
|
||||||
|
|||||||
+5
-7
@@ -8,15 +8,14 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.CobblemonSensors
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.entity.npc.ai.LookAtBattlingPokemonTask
|
import com.cobblemon.mod.common.entity.npc.ai.LookAtBattlingPokemonTask
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
@@ -31,7 +30,7 @@ class LookAtBattlingPokemonTaskConfig : SingleTaskConfig {
|
|||||||
val minDurationTicks: ExpressionOrEntityVariable = Either.left("40".asExpression())
|
val minDurationTicks: ExpressionOrEntityVariable = Either.left("40".asExpression())
|
||||||
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
minDurationTicks,
|
minDurationTicks,
|
||||||
maxDurationTicks
|
maxDurationTicks
|
||||||
@@ -41,16 +40,15 @@ class LookAtBattlingPokemonTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!resolveBooleanVariable(LOOK_AT_BATTLING_POKEMON, behaviourConfigurationContext.runtime)) return null
|
||||||
if (!resolveBooleanVariable(LOOK_AT_BATTLING_POKEMON)) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.LOOK_TARGET,
|
MemoryModuleType.LOOK_TARGET,
|
||||||
CobblemonMemories.BATTLING_POKEMON
|
CobblemonMemories.BATTLING_POKEMON
|
||||||
)
|
)
|
||||||
behaviourConfigurationContext.addSensors(CobblemonSensors.BATTLING_POKEMON)
|
behaviourConfigurationContext.addSensors(CobblemonSensors.BATTLING_POKEMON)
|
||||||
return LookAtBattlingPokemonTask.create(
|
return LookAtBattlingPokemonTask.create(
|
||||||
minDurationTicks = minDurationTicks.resolveInt(),
|
minDurationTicks = minDurationTicks.resolveInt(behaviourConfigurationContext.runtime),
|
||||||
maxDurationTicks = maxDurationTicks.resolveInt()
|
maxDurationTicks = maxDurationTicks.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-4
@@ -27,7 +27,7 @@ class LookAtEntitiesTaskConfig : SingleTaskConfig {
|
|||||||
val condition = booleanVariable(SharedEntityVariables.LOOKING_CATEGORY, LOOK_AT_ENTITIES, true).asExpressible()
|
val condition = booleanVariable(SharedEntityVariables.LOOKING_CATEGORY, LOOK_AT_ENTITIES, true).asExpressible()
|
||||||
val maxDistance = numberVariable(SharedEntityVariables.LOOKING_CATEGORY, SEE_DISTANCE, 15).asExpressible()
|
val maxDistance = numberVariable(SharedEntityVariables.LOOKING_CATEGORY, SEE_DISTANCE, 15).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
maxDistance
|
maxDistance
|
||||||
).asVariables()
|
).asVariables()
|
||||||
@@ -36,10 +36,9 @@ class LookAtEntitiesTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.LOOK_TARGET)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.LOOK_TARGET)
|
||||||
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
||||||
return SetEntityLookTarget.create(maxDistance.resolveFloat())
|
return SetEntityLookTarget.create(maxDistance.resolveFloat(behaviourConfigurationContext.runtime))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+14
-3
@@ -10,17 +10,28 @@ package com.cobblemon.mod.common.api.ai.config.task
|
|||||||
|
|
||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.npc.ai.LookAtSpeakerTask
|
import com.cobblemon.mod.common.entity.npc.ai.LookAtSpeakerTask
|
||||||
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class LookAtSpeakerTaskConfig : SingleTaskConfig {
|
class LookAtSpeakerTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
) = LookAtSpeakerTask.create().also {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, CobblemonMemories.DIALOGUES)
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return LookAtSpeakerTask.create().also {
|
||||||
|
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, CobblemonMemories.DIALOGUES)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-4
@@ -28,7 +28,7 @@ class LookAtTargetTaskConfig : SingleTaskConfig {
|
|||||||
val minDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
val minDurationTicks: ExpressionOrEntityVariable = Either.left("80".asExpression())
|
||||||
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("160".asExpression())
|
val maxDurationTicks: ExpressionOrEntityVariable = Either.left("160".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
minDurationTicks,
|
minDurationTicks,
|
||||||
maxDurationTicks
|
maxDurationTicks
|
||||||
@@ -38,10 +38,9 @@ class LookAtTargetTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES)
|
||||||
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
||||||
return WrapperLivingEntityTask(LookAtTargetSink(minDurationTicks.resolveInt(), maxDurationTicks.resolveInt()), Mob::class.java)
|
return WrapperLivingEntityTask(LookAtTargetSink(minDurationTicks.resolveInt(behaviourConfigurationContext.runtime), maxDurationTicks.resolveInt(behaviourConfigurationContext.runtime)), Mob::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -19,7 +19,7 @@ import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
|||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
class LookAtTargetedBattlePokemonTaskConfig : SingleTaskConfig {
|
class LookAtTargetedBattlePokemonTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ class LookInDirectionTaskConfig : SingleTaskConfig {
|
|||||||
var yaw = numberVariable(LOOKING_CATEGORY, "locked_yaw", 0F).asExpressible()
|
var yaw = numberVariable(LOOKING_CATEGORY, "locked_yaw", 0F).asExpressible()
|
||||||
var pitch = numberVariable(LOOKING_CATEGORY, "locked_pitch", 0F).asExpressible()
|
var pitch = numberVariable(LOOKING_CATEGORY, "locked_pitch", 0F).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
yaw,
|
yaw,
|
||||||
pitch
|
pitch
|
||||||
|
|||||||
+5
-5
@@ -8,15 +8,14 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.Cobblemon
|
||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@@ -37,7 +36,7 @@ class MaintainHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
// How frequently to check for a better herd leader
|
// How frequently to check for a better herd leader
|
||||||
val checkTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
val checkTicks: ExpressionOrEntityVariable = Either.left("60".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(checkTicks).asVariables()
|
return listOf(checkTicks).asVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +52,7 @@ class MaintainHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES,
|
||||||
)
|
)
|
||||||
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
behaviourConfigurationContext.addSensors(SensorType.NEAREST_LIVING_ENTITIES)
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
val checkTicks = checkTicks.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
val checkTicks = checkTicks.resolveInt()
|
|
||||||
return BehaviorBuilder.create { instance ->
|
return BehaviorBuilder.create { instance ->
|
||||||
instance.group(
|
instance.group(
|
||||||
instance.present(CobblemonMemories.HERD_LEADER),
|
instance.present(CobblemonMemories.HERD_LEADER),
|
||||||
@@ -83,6 +81,8 @@ class MaintainHerdLeaderTaskConfig : SingleTaskConfig {
|
|||||||
if (bestLeader != null && bestLeader != leader) {
|
if (bestLeader != null && bestLeader != leader) {
|
||||||
bestLeader.brain.eraseMemory(CobblemonMemories.HERD_LEADER)
|
bestLeader.brain.eraseMemory(CobblemonMemories.HERD_LEADER)
|
||||||
entity.brain.setMemory(CobblemonMemories.HERD_LEADER, bestLeader.uuid.toString())
|
entity.brain.setMemory(CobblemonMemories.HERD_LEADER, bestLeader.uuid.toString())
|
||||||
|
bestLeader.adjustHerdSize(1)
|
||||||
|
leader.adjustHerdSize(-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return@Trigger true
|
return@Trigger true
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ import net.minecraft.world.entity.LivingEntity
|
|||||||
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
|
||||||
class ManageFlightInBattleTaskConfig : SingleTaskConfig {
|
class ManageFlightInBattleTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
|||||||
+2
-3
@@ -22,7 +22,7 @@ class MeleeAttackTaskConfig : SingleTaskConfig {
|
|||||||
val range = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_range", 1.5F).asExpressible()
|
val range = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_range", 1.5F).asExpressible()
|
||||||
val cooldownTicks = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_cooldown", 20).asExpressible()
|
val cooldownTicks = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "melee_cooldown", 20).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
range,
|
range,
|
||||||
cooldownTicks
|
cooldownTicks
|
||||||
@@ -32,8 +32,7 @@ class MeleeAttackTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.ATTACK_TARGET,
|
MemoryModuleType.ATTACK_TARGET,
|
||||||
MemoryModuleType.ATTACK_COOLING_DOWN
|
MemoryModuleType.ATTACK_COOLING_DOWN
|
||||||
|
|||||||
+4
-2
@@ -9,6 +9,7 @@
|
|||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
import com.bedrockk.molang.ast.StringExpression
|
import com.bedrockk.molang.ast.StringExpression
|
||||||
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
import com.bedrockk.molang.runtime.value.StringValue
|
import com.bedrockk.molang.runtime.value.StringValue
|
||||||
import com.cobblemon.mod.common.Cobblemon
|
import com.cobblemon.mod.common.Cobblemon
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
@@ -16,6 +17,7 @@ import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
|||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.entity.npc.NPCEntity
|
import com.cobblemon.mod.common.entity.npc.NPCEntity
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.util.resolveString
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import net.minecraft.server.level.ServerLevel
|
import net.minecraft.server.level.ServerLevel
|
||||||
import net.minecraft.world.entity.LivingEntity
|
import net.minecraft.world.entity.LivingEntity
|
||||||
@@ -35,7 +37,7 @@ class MemoryAspectTaskConfig : SingleTaskConfig {
|
|||||||
var memory: MemoryModuleType<*> = MemoryModuleType.DUMMY
|
var memory: MemoryModuleType<*> = MemoryModuleType.DUMMY
|
||||||
var aspect: ExpressionOrEntityVariable = Either.left(StringExpression(StringValue("")))
|
var aspect: ExpressionOrEntityVariable = Either.left(StringExpression(StringValue("")))
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(aspect).asVariables()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(aspect).asVariables()
|
||||||
override fun createTask(
|
override fun createTask(
|
||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
@@ -50,7 +52,7 @@ class MemoryAspectTaskConfig : SingleTaskConfig {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
val aspect = aspect.resolveString()
|
val aspect = behaviourConfigurationContext.runtime.resolveString(aspect.asExpression())
|
||||||
|
|
||||||
return object : Behavior<LivingEntity>(
|
return object : Behavior<LivingEntity>(
|
||||||
mapOf(memory to MemoryStatus.REGISTERED),
|
mapOf(memory to MemoryStatus.REGISTERED),
|
||||||
|
|||||||
+8
-11
@@ -12,12 +12,10 @@ import com.cobblemon.mod.common.CobblemonMemories
|
|||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
|
|
||||||
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
import com.cobblemon.mod.common.entity.ai.CobblemonWalkTarget
|
import com.cobblemon.mod.common.entity.ai.CobblemonWalkTarget
|
||||||
import com.cobblemon.mod.common.util.asExpression
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
import com.cobblemon.mod.common.util.closestPosition
|
import com.cobblemon.mod.common.util.closestPosition
|
||||||
import com.cobblemon.mod.common.util.withQueryValue
|
|
||||||
import com.mojang.datafixers.util.Either
|
import com.mojang.datafixers.util.Either
|
||||||
import java.util.function.Predicate
|
import java.util.function.Predicate
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
@@ -46,7 +44,7 @@ class MoveIntoFluidTaskConfig : SingleTaskConfig {
|
|||||||
val horizontalSearchRange: ExpressionOrEntityVariable = Either.left("8".asExpression())
|
val horizontalSearchRange: ExpressionOrEntityVariable = Either.left("8".asExpression())
|
||||||
val verticalSearchRange: ExpressionOrEntityVariable = Either.left("8".asExpression())
|
val verticalSearchRange: ExpressionOrEntityVariable = Either.left("8".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity): List<MoLangConfigVariable> {
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): List<MoLangConfigVariable> {
|
||||||
return listOf(
|
return listOf(
|
||||||
condition,
|
condition,
|
||||||
movesIntoWater,
|
movesIntoWater,
|
||||||
@@ -61,23 +59,22 @@ class MoveIntoFluidTaskConfig : SingleTaskConfig {
|
|||||||
entity: LivingEntity,
|
entity: LivingEntity,
|
||||||
behaviourConfigurationContext: BehaviourConfigurationContext
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
): BehaviorControl<in LivingEntity>? {
|
): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
MemoryModuleType.WALK_TARGET,
|
MemoryModuleType.WALK_TARGET,
|
||||||
CobblemonMemories.PATH_COOLDOWN
|
CobblemonMemories.PATH_COOLDOWN
|
||||||
)
|
)
|
||||||
val movesIntoWater = this@MoveIntoFluidTaskConfig.movesIntoWater.resolveBoolean()
|
val movesIntoWater = this@MoveIntoFluidTaskConfig.movesIntoWater.resolveBoolean(behaviourConfigurationContext.runtime)
|
||||||
val movesIntoLava = movesIntoLava.resolveBoolean()
|
val movesIntoLava = movesIntoLava.resolveBoolean(behaviourConfigurationContext.runtime)
|
||||||
val speedModifier = speedModifier.resolveFloat()
|
val speedModifier = speedModifier.resolveFloat(behaviourConfigurationContext.runtime)
|
||||||
val horizontalSearchRange = horizontalSearchRange.resolveInt()
|
val horizontalSearchRange = horizontalSearchRange.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
val verticalSearchRange = verticalSearchRange.resolveInt()
|
val verticalSearchRange = verticalSearchRange.resolveInt(behaviourConfigurationContext.runtime)
|
||||||
return BehaviorBuilder.create {
|
return BehaviorBuilder.create {
|
||||||
it.group(
|
it.group(
|
||||||
it.absent(MemoryModuleType.WALK_TARGET),
|
it.absent(MemoryModuleType.WALK_TARGET),
|
||||||
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
it.absent(CobblemonMemories.PATH_COOLDOWN)
|
||||||
).apply(it) { walkTarget, pathCooldown ->
|
).apply(it) { walkTarget, pathCooldown ->
|
||||||
Trigger { world, entity, _ ->
|
Trigger { _, entity, _ ->
|
||||||
val isInWater = entity.isInWater
|
val isInWater = entity.isInWater
|
||||||
val isInLava = entity.isInLava
|
val isInLava = entity.isInLava
|
||||||
// If it's already in a place it wants to be, then we're fine.
|
// If it's already in a place it wants to be, then we're fine.
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ class MoveToAttackTargetTaskConfig : SingleTaskConfig {
|
|||||||
val speedMultiplier = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "attacking_movement_speed", 0.5).asExpressible()
|
val speedMultiplier = numberVariable(SharedEntityVariables.ATTACKING_CATEGORY, "attacking_movement_speed", 0.5).asExpressible()
|
||||||
val closeEnoughDistance: ExpressionOrEntityVariable = Either.left("0".asExpression())
|
val closeEnoughDistance: ExpressionOrEntityVariable = Either.left("0".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
speedMultiplier,
|
speedMultiplier,
|
||||||
closeEnoughDistance
|
closeEnoughDistance
|
||||||
).asVariables()
|
).asVariables()
|
||||||
|
|||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
|
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
||||||
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.MoveToItemTask
|
||||||
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.mojang.datafixers.util.Either
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
|
class MoveToItemTaskConfig : SingleTaskConfig {
|
||||||
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
|
var speedMultiplier: ExpressionOrEntityVariable = Either.left("0.6".asExpression())
|
||||||
|
var maxDistance: ExpressionOrEntityVariable = Either.left("7.0".asExpression())
|
||||||
|
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
|
condition,
|
||||||
|
speedMultiplier,
|
||||||
|
maxDistance
|
||||||
|
).asVariables()
|
||||||
|
|
||||||
|
override fun createTask(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
behaviourConfigurationContext.addMemories(
|
||||||
|
MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM,
|
||||||
|
MemoryModuleType.WALK_TARGET,
|
||||||
|
MemoryModuleType.LOOK_TARGET,
|
||||||
|
CobblemonMemories.TIME_TRYING_TO_REACH_WANTED_ITEM,
|
||||||
|
CobblemonMemories.DISABLE_WALK_TO_WANTED_ITEM)
|
||||||
|
behaviourConfigurationContext.addSensors(CobblemonSensors.POKEMON_NEARBY_WANTED_ITEM)
|
||||||
|
|
||||||
|
|
||||||
|
return WrapperLivingEntityTask(
|
||||||
|
MoveToItemTask.create(
|
||||||
|
condition = condition.asExpression(),
|
||||||
|
speedMultiplier = speedMultiplier.asExpression(),
|
||||||
|
maxDistance = maxDistance.asExpression()
|
||||||
|
),
|
||||||
|
PokemonEntity::class.java
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -27,7 +27,7 @@ class MoveToOwnerTaskConfig : SingleTaskConfig {
|
|||||||
var teleportDistance: ExpressionOrEntityVariable = Either.left("24.0".asExpression())
|
var teleportDistance: ExpressionOrEntityVariable = Either.left("24.0".asExpression())
|
||||||
var maxDistance: ExpressionOrEntityVariable = Either.left("14.0".asExpression())
|
var maxDistance: ExpressionOrEntityVariable = Either.left("14.0".asExpression())
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
completionRange,
|
completionRange,
|
||||||
speedMultiplier,
|
speedMultiplier,
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.MoveToSweetBerryBushTask
|
||||||
|
import net.minecraft.util.valueproviders.UniformInt
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
|
class MoveToSweetBerryBushTaskConfig : SingleTaskConfig {
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
|
override fun createTask(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
if (entity !is PokemonEntity) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
behaviourConfigurationContext.addMemories(CobblemonMemories.NEARBY_SWEET_BERRY_BUSH, CobblemonMemories.DISABLE_WALK_TO_BERRY_BUSH,
|
||||||
|
CobblemonMemories.TIME_TRYING_TO_REACH_BERRY_BUSH, MemoryModuleType.WALK_TARGET, MemoryModuleType.LOOK_TARGET)
|
||||||
|
behaviourConfigurationContext.addSensors(CobblemonSensors.NEARBY_SWEET_BERRY_BUSH)
|
||||||
|
return MoveToSweetBerryBushTask.create(UniformInt.of(0, 10), 0.6f)
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-3
@@ -38,11 +38,10 @@ class OneOfTaskConfig : SingleTaskConfig {
|
|||||||
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
val options = mutableListOf<OneOfTaskOption>()
|
val options = mutableListOf<OneOfTaskOption>()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = options.flatMap { it.task.getVariables(entity) }
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = options.flatMap { it.task.getVariables(entity, behaviourConfigurationContext) }
|
||||||
|
|
||||||
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<in LivingEntity>? {
|
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<in LivingEntity>? {
|
||||||
runtime.withQueryValue("entity", entity.asMostSpecificMoLangValue())
|
if (!condition.resolveBoolean(behaviourConfigurationContext.runtime)) return null
|
||||||
if (!condition.resolveBoolean()) return null
|
|
||||||
return RunOne(options.map { it.task.createTasks(entity, behaviourConfigurationContext).first() toDF it.weight })
|
return RunOne(options.map { it.task.createTasks(entity, behaviourConfigurationContext).first() toDF it.weight })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -22,7 +22,7 @@ class PathToBeeHiveTaskConfig : SingleTaskConfig {
|
|||||||
|
|
||||||
val condition = booleanVariable(HONEY, "can_add_honey", true).asExpressible()
|
val condition = booleanVariable(HONEY, "can_add_honey", true).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition,
|
condition,
|
||||||
).asVariables()
|
).asVariables()
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ class PathToBeeHiveTaskConfig : SingleTaskConfig {
|
|||||||
if (entity !is PokemonEntity) {
|
if (entity !is PokemonEntity) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (!checkCondition(entity, condition)) {
|
if (!checkCondition(behaviourConfigurationContext.runtime, condition)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return PathToBeeHiveTask.create()
|
return PathToBeeHiveTask.create()
|
||||||
|
|||||||
+3
-2
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
import com.cobblemon.mod.common.CobblemonMemories
|
import com.cobblemon.mod.common.CobblemonMemories
|
||||||
import com.cobblemon.mod.common.CobblemonSensors
|
import com.cobblemon.mod.common.CobblemonSensors
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
@@ -24,7 +25,7 @@ class PathToFlowerTaskConfig : SingleTaskConfig {
|
|||||||
|
|
||||||
val condition = booleanVariable(POLLINATE, "can_pollinate", true).asExpressible()
|
val condition = booleanVariable(POLLINATE, "can_pollinate", true).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition
|
condition
|
||||||
).asVariables()
|
).asVariables()
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ class PathToFlowerTaskConfig : SingleTaskConfig {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkCondition(entity, condition)) {
|
if (!checkCondition(behaviourConfigurationContext.runtime, condition)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
behaviourConfigurationContext.addMemories(
|
behaviourConfigurationContext.addMemories(
|
||||||
|
|||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Cobblemon Contributors
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
|
import com.cobblemon.mod.common.api.ai.ExpressionOrEntityVariable
|
||||||
|
import com.cobblemon.mod.common.api.ai.WrapperLivingEntityTask
|
||||||
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
|
import com.cobblemon.mod.common.entity.pokemon.ai.tasks.PickUpItemTask
|
||||||
|
import com.cobblemon.mod.common.util.asExpression
|
||||||
|
import com.mojang.datafixers.util.Either
|
||||||
|
import net.minecraft.world.entity.LivingEntity
|
||||||
|
import net.minecraft.world.entity.ai.behavior.BehaviorControl
|
||||||
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
||||||
|
|
||||||
|
class PickUpItemTaskConfig : SingleTaskConfig {
|
||||||
|
val condition: ExpressionOrEntityVariable = Either.left("true".asExpression())
|
||||||
|
var maxReach: ExpressionOrEntityVariable = Either.left("1.0".asExpression())
|
||||||
|
|
||||||
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
|
condition,
|
||||||
|
maxReach
|
||||||
|
).asVariables()
|
||||||
|
|
||||||
|
override fun createTask(
|
||||||
|
entity: LivingEntity,
|
||||||
|
behaviourConfigurationContext: BehaviourConfigurationContext
|
||||||
|
): BehaviorControl<in LivingEntity>? {
|
||||||
|
behaviourConfigurationContext.addMemories(
|
||||||
|
MemoryModuleType.WALK_TARGET,
|
||||||
|
MemoryModuleType.LOOK_TARGET,
|
||||||
|
MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM
|
||||||
|
)
|
||||||
|
return WrapperLivingEntityTask(
|
||||||
|
PickUpItemTask.create(
|
||||||
|
condition = condition.asExpression(),
|
||||||
|
maxReach = maxReach.asExpression()
|
||||||
|
),
|
||||||
|
PokemonEntity::class.java
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-2
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.cobblemon.mod.common.api.ai.config.task
|
package com.cobblemon.mod.common.api.ai.config.task
|
||||||
|
|
||||||
|
import com.bedrockk.molang.runtime.MoLangRuntime
|
||||||
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
import com.cobblemon.mod.common.api.ai.BehaviourConfigurationContext
|
||||||
import com.cobblemon.mod.common.api.ai.asVariables
|
import com.cobblemon.mod.common.api.ai.asVariables
|
||||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||||
@@ -22,7 +23,7 @@ class PlaceHoneyInHiveTaskConfig : SingleTaskConfig {
|
|||||||
|
|
||||||
val condition = booleanVariable(HONEY, "can_add_honey", true).asExpressible()
|
val condition = booleanVariable(HONEY, "can_add_honey", true).asExpressible()
|
||||||
|
|
||||||
override fun getVariables(entity: LivingEntity) = listOf(
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = listOf(
|
||||||
condition
|
condition
|
||||||
).asVariables()
|
).asVariables()
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ class PlaceHoneyInHiveTaskConfig : SingleTaskConfig {
|
|||||||
if (entity !is PokemonEntity) {
|
if (entity !is PokemonEntity) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
if (!checkCondition(entity, condition)) {
|
if (!checkCondition(behaviourConfigurationContext.runtime, condition)) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return PlaceHoneyInHiveTask.create()
|
return PlaceHoneyInHiveTask.create()
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType
|
|||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
|
|
||||||
class PointToSpawnTaskConfig : SingleTaskConfig {
|
class PointToSpawnTaskConfig : SingleTaskConfig {
|
||||||
override fun getVariables(entity: LivingEntity) = emptyList<MoLangConfigVariable>()
|
override fun getVariables(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext) = emptyList<MoLangConfigVariable>()
|
||||||
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<in LivingEntity>? {
|
override fun createTask(entity: LivingEntity, behaviourConfigurationContext: BehaviourConfigurationContext): BehaviorControl<in LivingEntity>? {
|
||||||
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET)
|
behaviourConfigurationContext.addMemories(MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET)
|
||||||
return BehaviorBuilder.create {
|
return BehaviorBuilder.create {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user