mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-12-04 05:58:52 -05:00
Compare commits
607
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e01bc2eeab | ||
|
|
f6f3070b8e | ||
|
|
0f2301e668 | ||
|
|
e077a5d453 | ||
|
|
e7208ed396 | ||
|
|
27f8bbf029 | ||
|
|
2f97a69b8c | ||
|
|
79d67389ba | ||
|
|
61f2150f2e | ||
|
|
5d63c8fe06 | ||
|
|
0d109a64fd | ||
|
|
5daef700e7 | ||
|
|
21bd1550f0 | ||
|
|
0d4f63ba01 | ||
|
|
946cff21fb | ||
|
|
8a2291cd6e | ||
|
|
304ac0e07a | ||
|
|
3cac1138fb | ||
|
|
b19a11f8ab | ||
|
|
cad64ae24b | ||
|
|
9036909968 | ||
|
|
53b98e8008 | ||
|
|
574fd92827 | ||
|
|
e6d7513c20 | ||
|
|
e36252318a | ||
|
|
5d5dbb9e79 | ||
|
|
4036592c9a | ||
|
|
c0ddbad4f5 | ||
|
|
fa1f485cd2 | ||
|
|
b5aeb0e5f7 | ||
|
|
9c2680783a | ||
|
|
b7ed72241b | ||
|
|
689f9eabc0 | ||
|
|
4fd24be1d3 | ||
|
|
7579203527 | ||
|
|
9e3dd9373c | ||
|
|
c9b9ac7d07 | ||
|
|
dddae893cd | ||
|
|
86508801d3 | ||
|
|
de44411ad2 | ||
|
|
e59aa01345 | ||
|
|
3f3e8b5747 | ||
|
|
bb769fa165 | ||
|
|
163218c0a8 | ||
|
|
e61eadb834 | ||
|
|
29c8bbe9e9 | ||
|
|
7c42390515 | ||
|
|
ff84ca69cd | ||
|
|
dda3c4e981 | ||
|
|
072ad5ff12 | ||
|
|
1570bbf42b | ||
|
|
41cfe79b0e | ||
|
|
dc4e3dc39c | ||
|
|
d100537d41 | ||
|
|
fe218399e2 | ||
|
|
8f4a4a7e45 | ||
|
|
b3757113ac | ||
|
|
3bb17ffc6e | ||
|
|
f37924fb0c | ||
|
|
6e2765902e | ||
|
|
d7c32e4ad8 | ||
|
|
8732094c28 | ||
|
|
38fecf337e | ||
|
|
3c7c640217 | ||
|
|
b7e8cad3bd | ||
|
|
d553332017 | ||
|
|
de04379297 | ||
|
|
10bf9d1abd | ||
|
|
03b0bb9937 | ||
|
|
51a3d686ff | ||
|
|
267c14cdd5 | ||
|
|
c9367f63b4 | ||
|
|
48f8561662 | ||
|
|
951a36f82e | ||
|
|
e9edd7a1e9 | ||
|
|
cb407bb649 | ||
|
|
5e28612d99 | ||
|
|
ea007d21db | ||
|
|
dc1a035dae | ||
|
|
71db46d86b | ||
|
|
a61b71205b | ||
|
|
63b14aa4ba | ||
|
|
fb23e3961c | ||
|
|
bdf9606d61 | ||
|
|
bf5b03398c | ||
|
|
3a824b1971 | ||
|
|
0bbecc5951 | ||
|
|
c60fb253cd | ||
|
|
34240a101a | ||
|
|
c6a4db47f4 | ||
|
|
ac2dbde41e | ||
|
|
b8d19b3c4c | ||
|
|
747aedca27 | ||
|
|
9540bc9394 | ||
|
|
a7fed0d042 | ||
|
|
aedb0755f9 | ||
|
|
23eb10f5ea | ||
|
|
2c134c5e1b | ||
|
|
f7f70f14bc | ||
|
|
d3834b0bb7 | ||
|
|
2033240b83 | ||
|
|
1400505757 | ||
|
|
9da0459793 | ||
|
|
7ac41e2f68 | ||
|
|
e0cdc08cd3 | ||
|
|
438e502a5a | ||
|
|
d7b344cff8 | ||
|
|
249c305474 | ||
|
|
5b6ed359a3 | ||
|
|
d14e16fe5b | ||
|
|
65dd132081 | ||
|
|
54cd0ba700 | ||
|
|
7f8b241695 | ||
|
|
0b824fe4c1 | ||
|
|
46b4bfa7ea | ||
|
|
c9fc2ce95d | ||
|
|
91eff015dc | ||
|
|
a9c8825b3c | ||
|
|
9d64b0f06a | ||
|
|
f5a308e579 | ||
|
|
2b3c2358a5 | ||
|
|
a84a2aac58 | ||
|
|
fe86d644ad | ||
|
|
9eb8d5e832 | ||
|
|
5d2e877176 | ||
|
|
b2b08ac098 | ||
|
|
ae8e4a4f3a | ||
|
|
e5f0911b83 | ||
|
|
e1ae600419 | ||
|
|
34315d9f1d | ||
|
|
773cef8e46 | ||
|
|
282a15b1b2 | ||
|
|
3b17ad4f54 | ||
|
|
04c5b698c2 | ||
|
|
123029199c | ||
|
|
8f70bd5eaf | ||
|
|
24310d5144 | ||
|
|
b4b5d62632 | ||
|
|
d550d775a6 | ||
|
|
e572584dbf | ||
|
|
6ac58cf7c2 | ||
|
|
e8a1e66658 | ||
|
|
9c67d0ad6f | ||
|
|
0747d08a90 | ||
|
|
299ab3d5f7 | ||
|
|
7e0f48ea54 | ||
|
|
49a5090903 | ||
|
|
7e0e55d126 | ||
|
|
f3fa765890 | ||
|
|
a9a91a813a | ||
|
|
579e48f93c | ||
|
|
e8520953f6 | ||
|
|
47deb6504b | ||
|
|
cd0f95169a | ||
|
|
a23b37ee47 | ||
|
|
370d65284d | ||
|
|
e2b2ee9031 | ||
|
|
141b38b81c | ||
|
|
f41c2aa0c1 | ||
|
|
87fffe67f5 | ||
|
|
7a13a5a4d1 | ||
|
|
9efc3f1eef | ||
|
|
8188cabb4f | ||
|
|
b545e01aef | ||
|
|
c34a09430a | ||
|
|
403acf5822 | ||
|
|
d53c17bc8e | ||
|
|
7bc9778ce3 | ||
|
|
57687ffcdb | ||
|
|
d40e2706c0 | ||
|
|
abecc6c74d | ||
|
|
709b933661 | ||
|
|
d426d6e843 | ||
|
|
234acf0787 | ||
|
|
b4b0bed36c | ||
|
|
65f0bfdcd9 | ||
|
|
f598af314a | ||
|
|
cef14e938f | ||
|
|
f53cd87081 | ||
|
|
bfc820808f | ||
|
|
57a34e490d | ||
|
|
e817496f7e | ||
|
|
8aea2d5b74 | ||
|
|
47213c3ae4 | ||
|
|
d70fbe70d2 | ||
|
|
3768d4278e | ||
|
|
6283a0bee0 | ||
|
|
43a24a9c98 | ||
|
|
d8b401aee0 | ||
|
|
f64e919bf2 | ||
|
|
a727c099ae | ||
|
|
e4ae8fe6dd | ||
|
|
c46ab35af0 | ||
|
|
25bfdb3aa2 | ||
|
|
7d5b0c9648 | ||
|
|
2ccf49e65c | ||
|
|
bc12466e09 | ||
|
|
7d03f5f780 | ||
|
|
2eb23f0707 | ||
|
|
cbe7626bdc | ||
|
|
f83b10643c | ||
|
|
40be5a2060 | ||
|
|
2b26576a1c | ||
|
|
48d6f7f707 | ||
|
|
ea6bf1fcd1 | ||
|
|
e0ab5e60d0 | ||
|
|
3d4e941af2 | ||
|
|
6aa359d7cc | ||
|
|
646fc606d6 | ||
|
|
37e9823fe0 | ||
|
|
9cd24e76d2 | ||
|
|
fb52c1badd | ||
|
|
24126e582b | ||
|
|
a08ca9c8eb | ||
|
|
896198eca2 | ||
|
|
38a20c76a1 | ||
|
|
7ac80cb716 | ||
|
|
2a83af5626 | ||
|
|
7cc8fd8201 | ||
|
|
901de0031c | ||
|
|
f762ba7425 | ||
|
|
f5b92c11a0 | ||
|
|
ecc5143ae6 | ||
|
|
c6a7dcde33 | ||
|
|
7821801c83 | ||
|
|
85f8f971da | ||
|
|
2808e52873 | ||
|
|
69f8d4a306 | ||
|
|
e7351af2a8 | ||
|
|
7ad5ee633d | ||
|
|
742c4c8087 | ||
|
|
ae41d4ac58 | ||
|
|
3f4086fc90 | ||
|
|
9e993df788 | ||
|
|
a389c21b25 | ||
|
|
b20be79ce6 | ||
|
|
9b05db6c5f | ||
|
|
f7de61ce71 | ||
|
|
9811390573 | ||
|
|
11e7d193fb | ||
|
|
3e2788b789 | ||
|
|
bda999e1fd | ||
|
|
e249a96749 | ||
|
|
2078108ea7 | ||
|
|
ddb24e9621 | ||
|
|
b07795e547 | ||
|
|
7e63cd9c1d | ||
|
|
8680f2ade0 | ||
|
|
5679d4dc05 | ||
|
|
980c0d4c37 | ||
|
|
50f1abd47e | ||
|
|
a555ac8e6d | ||
|
|
9f2a4261f0 | ||
|
|
1b6b0524e8 | ||
|
|
5f740b1c58 | ||
|
|
f5e492a6ce | ||
|
|
c8c1677182 | ||
|
|
8431e25c31 | ||
|
|
121f7c6a9a | ||
|
|
c523408fe0 | ||
|
|
cef0ad7efa | ||
|
|
592ead6674 | ||
|
|
eb159d0702 | ||
|
|
d47197ab3b | ||
|
|
b4585cabd4 | ||
|
|
dd15de6e94 | ||
|
|
c5dab7208f | ||
|
|
4a5d53a020 | ||
|
|
cc163b73e1 | ||
|
|
d1682b78c6 | ||
|
|
52827c3be6 | ||
|
|
3869fc590d | ||
|
|
ba4f4c8137 | ||
|
|
7f372c1f16 | ||
|
|
4624e7cab2 | ||
|
|
95bc331dc9 | ||
|
|
90b22316cb | ||
|
|
dc1aec75ba | ||
|
|
f60b3f1f4f | ||
|
|
3e118dcca6 | ||
|
|
12aac4f52d | ||
|
|
97625d2750 | ||
|
|
ef600fda79 | ||
|
|
bd6364deac | ||
|
|
1fbdf1fce1 | ||
|
|
6060013110 | ||
|
|
755cf731f0 | ||
|
|
6246af2979 | ||
|
|
6b27f13396 | ||
|
|
f563f69afd | ||
|
|
354914105e | ||
|
|
b154b6de64 | ||
|
|
7d55d52608 | ||
|
|
ce337e8fff | ||
|
|
72b6f46c4b | ||
|
|
547af6dd77 | ||
|
|
70119478a5 | ||
|
|
10b2aecc12 | ||
|
|
565d38f085 | ||
|
|
9adeb60abe | ||
|
|
d748241727 | ||
|
|
77ee8b1743 | ||
|
|
5eef45b49a | ||
|
|
79f7dd1519 | ||
|
|
919dec6809 | ||
|
|
f00f73491d | ||
|
|
c7cf73812c | ||
|
|
80fbab35dc | ||
|
|
9f60ce51c7 | ||
|
|
343e13d1ac | ||
|
|
ca175ab164 | ||
|
|
ebad166b12 | ||
|
|
92f5fd7cd6 | ||
|
|
507319fa0f | ||
|
|
163e17fb3f | ||
|
|
290f3e2845 | ||
|
|
516e3c4cd9 | ||
|
|
e419030339 | ||
|
|
fe739cd644 | ||
|
|
dd5e9c08aa | ||
|
|
70c2404b20 | ||
|
|
fb56430213 | ||
|
|
083b439049 | ||
|
|
a8ac109a50 | ||
|
|
1813baaa6f | ||
|
|
5b5171b9bc | ||
|
|
fbe31f3232 | ||
|
|
b530af1ff6 | ||
|
|
8ec91f7a40 | ||
|
|
41b9411d06 | ||
|
|
3040eee59c | ||
|
|
10033be4b5 | ||
|
|
914067038a | ||
|
|
bf9f08826b | ||
|
|
da27b80e82 | ||
|
|
e6c9c7798e | ||
|
|
d0b7b956e8 | ||
|
|
0301064ed5 | ||
|
|
b8595f8d59 | ||
|
|
d120c8e031 | ||
|
|
aa91b5b20b | ||
|
|
84dfaa0a77 | ||
|
|
9987c0c13f | ||
|
|
b7a3e276f1 | ||
|
|
d9774272ce | ||
|
|
3b967933ca | ||
|
|
665aad40a8 | ||
|
|
527f429c20 | ||
|
|
85803b11b4 | ||
|
|
6d3f3d1353 | ||
|
|
b70748e1b8 | ||
|
|
c6406ab0ea | ||
|
|
28c750caf9 | ||
|
|
ab22780598 | ||
|
|
1b2e0fb58e | ||
|
|
6616234393 | ||
|
|
e33420bab7 | ||
|
|
17dcbb25c3 | ||
|
|
1b36c40959 | ||
|
|
db2cd8501e | ||
|
|
fd6348adbe | ||
|
|
e3c9c16add | ||
|
|
d17f8f90b8 | ||
|
|
bc9182e37f | ||
|
|
68923dd95f | ||
|
|
ab3449243f | ||
|
|
a8f6e66ab4 | ||
|
|
f3cb2aab87 | ||
|
|
d9c6522685 | ||
|
|
7074a63f95 | ||
|
|
3e005e5032 | ||
|
|
f93e8e221a | ||
|
|
cc7433025f | ||
|
|
aa17482a6e | ||
|
|
7f0f6e7c4d | ||
|
|
2fc9d587d9 | ||
|
|
1d950d9640 | ||
|
|
3b63f88669 | ||
|
|
4f35e8348d | ||
|
|
36c76b96b3 | ||
|
|
2fe98577b6 | ||
|
|
dadeb2670b | ||
|
|
aedca9e969 | ||
|
|
e1ca6bbc94 | ||
|
|
d41ef023ff | ||
|
|
30b769db13 | ||
|
|
ac7bd33f08 | ||
|
|
69908c1ab5 | ||
|
|
f8cdcde27c | ||
|
|
948d599390 | ||
|
|
4be1ab3cac | ||
|
|
fd5132b317 | ||
|
|
f021faf0d3 | ||
|
|
2b562ace12 | ||
|
|
a56d24b9dc | ||
|
|
607b59a978 | ||
|
|
b8eb2c708e | ||
|
|
7bffc44db0 | ||
|
|
1099ce055a | ||
|
|
de5e958bf3 | ||
|
|
ab6494a2f6 | ||
|
|
967fbd2608 | ||
|
|
e6ffd2e16d | ||
|
|
8ff0835e4e | ||
|
|
301df2e1d1 | ||
|
|
4c4f79494b | ||
|
|
bcd998d690 | ||
|
|
7ab3c18762 | ||
|
|
ddb426674f | ||
|
|
6c93a6c1a8 | ||
|
|
28d0ae9b75 | ||
|
|
742a6b244f | ||
|
|
4c5fcf5310 | ||
|
|
aaf5f4d354 | ||
|
|
5414cbcc14 | ||
|
|
3104239a9f | ||
|
|
32a360ba0c | ||
|
|
99d190abff | ||
|
|
33aa3043c6 | ||
|
|
4577c36afb | ||
|
|
6d9d5d1533 | ||
|
|
a6cc7b77bb | ||
|
|
3ef2eca934 | ||
|
|
e81eaa5b57 | ||
|
|
edc5ce5fb4 | ||
|
|
b1b7d3fea2 | ||
|
|
7ee88cefe5 | ||
|
|
2cfa9f8985 | ||
|
|
5bab095036 | ||
|
|
c394f56548 | ||
|
|
dc270bb64e | ||
|
|
8c6c3a6ca0 | ||
|
|
ac05f24646 | ||
|
|
2b3045594b | ||
|
|
86d8fb01ef | ||
|
|
fe9a1c7e99 | ||
|
|
a9735c69cb | ||
|
|
bf401d1ff0 | ||
|
|
fb6e65d868 | ||
|
|
aa04b27500 | ||
|
|
954d6fa156 | ||
|
|
dd2d22b793 | ||
|
|
03bfce766d | ||
|
|
fab9eed4e1 | ||
|
|
123ed403ae | ||
|
|
0c763e3715 | ||
|
|
b52a0a0ebd | ||
|
|
9c1edea469 | ||
|
|
87d8c17f4f | ||
|
|
3ab5a4daf3 | ||
|
|
f7672e66ab | ||
|
|
61d926a23d | ||
|
|
5ab364f0ab | ||
|
|
734d2b2414 | ||
|
|
0763a96f34 | ||
|
|
2ae4ba68e4 | ||
|
|
750adabba1 | ||
|
|
a914a69051 | ||
|
|
beacc319b9 | ||
|
|
c48b7b980b | ||
|
|
d553483dcb | ||
|
|
c9f1a61bf5 | ||
|
|
84d58bf2d9 | ||
|
|
df35528a53 | ||
|
|
405f6e91de | ||
|
|
ac072e5a88 | ||
|
|
ca0b098866 | ||
|
|
3fd13dd47c | ||
|
|
38bc7e1bde | ||
|
|
6497d770dd | ||
|
|
2410fa6578 | ||
|
|
32e1623998 | ||
|
|
31799ad144 | ||
|
|
b60f7ba22e | ||
|
|
c80ef7a8c0 | ||
|
|
7bdc302583 | ||
|
|
8de2a12323 | ||
|
|
6004c153d3 | ||
|
|
ac96ad3720 | ||
|
|
a06793616d | ||
|
|
97f545bd4e | ||
|
|
a267b63df2 | ||
|
|
ea9d961fd8 | ||
|
|
51396f94b1 | ||
|
|
412dc73d9d | ||
|
|
c605e2d030 | ||
|
|
d5c93b60a9 | ||
|
|
7d8c6aef8e | ||
|
|
3c593ea3ed | ||
|
|
5a7732588d | ||
|
|
25488ae972 | ||
|
|
4bf9733fe6 | ||
|
|
0672aebd61 | ||
|
|
5db7d6380f | ||
|
|
7f90a6ffec | ||
|
|
d45f0e382b | ||
|
|
fab6d6e82d | ||
|
|
a79c61c5a4 | ||
|
|
3dfe05dccd | ||
|
|
e485484051 | ||
|
|
865ddcd59b | ||
|
|
999070b270 | ||
|
|
00d1590790 | ||
|
|
6cc17a08dc | ||
|
|
60911f3ec7 | ||
|
|
7f1a35fffe | ||
|
|
10f5fd673e | ||
|
|
765921d219 | ||
|
|
2422e60aa1 | ||
|
|
e9265eb0a6 | ||
|
|
07ad7db139 | ||
|
|
159ecf5ffa | ||
|
|
12be2c7b7b | ||
|
|
95590a2673 | ||
|
|
869f6b1120 | ||
|
|
2cdfac02e6 | ||
|
|
a9127c7021 | ||
|
|
3023de995a | ||
|
|
59c3df6a47 | ||
|
|
7391e3bc69 | ||
|
|
4ab72a6334 | ||
|
|
af357aca51 | ||
|
|
c7d060bb8d | ||
|
|
c3db5c0525 | ||
|
|
04328d2b8a | ||
|
|
fb03f426c6 | ||
|
|
00ed7bb0e8 | ||
|
|
38d81ced56 | ||
|
|
95ecf75a3a | ||
|
|
0afde170f4 | ||
|
|
5a312ee6c6 | ||
|
|
6533da0ed6 | ||
|
|
339ad676ca | ||
|
|
0edc762ff8 | ||
|
|
320a3a11b8 | ||
|
|
f4d177ce8c | ||
|
|
f3598e915e | ||
|
|
3314075f6e | ||
|
|
141296a2d5 | ||
|
|
48147f460b | ||
|
|
2d72fbb82a | ||
|
|
98b72f07b6 | ||
|
|
465fb2bef4 | ||
|
|
d1f96af65f | ||
|
|
990dad0c51 | ||
|
|
67a8230b91 | ||
|
|
0d66e7bc1b | ||
|
|
56f0e0a1e2 | ||
|
|
1e5c48129c | ||
|
|
aed830b1ea | ||
|
|
c30596c89b | ||
|
|
851e0e56dd | ||
|
|
0e92743da5 | ||
|
|
9dc3b910f4 | ||
|
|
089d75cf57 | ||
|
|
9ef45d6324 | ||
|
|
881a957f59 | ||
|
|
0e0562c1a3 | ||
|
|
40cc7d30b2 | ||
|
|
c2b1d336db | ||
|
|
eca69b4d96 | ||
|
|
c607198de9 | ||
|
|
3ce9bd05a8 | ||
|
|
d209918dde | ||
|
|
c5de65044d | ||
|
|
96fbe3a685 | ||
|
|
d33defea6a | ||
|
|
d16d3eac34 | ||
|
|
99b175f72a | ||
|
|
ae4d16bfcb | ||
|
|
ff039c0d24 | ||
|
|
f4ef41c130 | ||
|
|
e572d22819 | ||
|
|
9c448eca97 | ||
|
|
742caa227d | ||
|
|
b095e87ec9 | ||
|
|
b2c66efa83 | ||
|
|
7274713e50 | ||
|
|
094f943ab5 | ||
|
|
f55198249f | ||
|
|
2fddfe12e6 | ||
|
|
88619f0512 | ||
|
|
695368932d | ||
|
|
84926f12eb | ||
|
|
9048c00021 | ||
|
|
ed5cc49b6d | ||
|
|
f348b4e8de | ||
|
|
6acd8167fb | ||
|
|
b131c2fe1f | ||
|
|
d848a2e78c | ||
|
|
2447f61f8c | ||
|
|
9839e48dee | ||
|
|
95f4f96cda | ||
|
|
9ce697bf00 | ||
|
|
5424513e7e | ||
|
|
4de268fcd8 | ||
|
|
86c415cc55 | ||
|
|
e08066a26c | ||
|
|
eea985d56d | ||
|
|
000d210b33 | ||
|
|
124d68a8fe | ||
|
|
0c019b1c71 | ||
|
|
fd5468ff6e | ||
|
|
1d2c1413da | ||
|
|
005945447b | ||
|
|
d69ddef3e3 | ||
|
|
4ac7060e4d |
No files matched your search
+153
-69
@@ -1,28 +1,36 @@
|
||||
# Changelog
|
||||
## [1.4.0](#1-4-0)
|
||||
## [1.4.0 - The Friends and Farms Update (October 13th, 2023)](#1-4-0)
|
||||
### Additions
|
||||
- Added nicknaming.
|
||||
- Added mints, found on mountains.
|
||||
- Added revival herbs, with pep-up flowers if fully grown, growing in lush caves.
|
||||
- Added medicinal leeks, growing on the surface of rivers and ponds. It is a potion ingredient!
|
||||
- Added big roots, generating from cave ceiling dirt and sometimes spreading into energy roots.
|
||||
- Added trading between players. Press R while looking at another player, you'll figure it out.
|
||||
- Added pasture blocks, used to let your PC Pokémon roam around your base.
|
||||
- Added 69 berry trees. Some are found in village farms, some from planting different berries close to each other.
|
||||
- Added pasture blocks, used to let your PC Pokémon roam around an area.
|
||||
- Added nicknaming from the summary menu of a Pokémon (click their name).
|
||||
- Added trading between players. Press R while looking at another player and you'll figure the rest out.
|
||||
- Added mints for changing Pokémon stats. These are most commonly found at high altitudes.
|
||||
- Added [Revival Herbs](https://wiki.cobblemon.com/index.php/Revival_Herb), with pep-up flowers when fully grown, growing in lush caves.
|
||||
- Added [Medicinal Leeks](https://wiki.cobblemon.com/index.php/Medicinal_Leek), growing on the surface of rivers and ponds. It is a potion ingredient and can be cooked as food!.
|
||||
- Added [Big Roots](https://wiki.cobblemon.com/index.php/Big_Root), generating from cave ceiling dirt which sometimes spread as energy roots.
|
||||
- Added [69 Berry Trees](https://wiki.cobblemon.com/index.php/Berry_Tree) and [Berries](https://wiki.cobblemon.com/index.php/Berry). Some are found in village farms, some from planting different berries close to each other.
|
||||
- Added mulches: Mulch Base, Growth Mulch, Surprise Mulch, Coarse Mulch, Humid Mulch, Rich Mulch, Loamy Mulch, Peat Mulch, and Sandy Mulch
|
||||
- Added [Vivichokes](https://wiki.cobblemon.com/index.php/Vivichoke), obtainable from wandering villager trades and some loot chests.
|
||||
- Added medicine brewing using medicinal leeks and berries in brewing stands.
|
||||
- Added Pokémon cries when in battles and being sent out.
|
||||
- Added support for scale in animations.
|
||||
- Added support for jump keyframes (i.e. pre and post keyframes)
|
||||
- Added AI for Nosepass to point towards world spawn when idle.
|
||||
- Added structure spawn conditions
|
||||
- Added cries for Gen 1-9 starters and their evolutions.
|
||||
- Added recipes for Berry Juice, Heal Powder, Remedy, Fine Remedy, Superb Remedy, Revive, Max Revive, HP Up, Protein, Iron, Calcium, Zinc, Carbos, PP Up, PP Max, Pasture, Medicinal Leek to Magenta Dye, Roasted Leek, Leek and Potato Stew, Braised Vivichoke, Vivichoke Dip, Mulch Base, Growth Mulch, Surprise Mulch, Coarse Mulch, Humid Mulch, Rich Mulch, Loamy Mulch, Peat Mulch, Sandy Mulch, X Attack, X Defense, X Special Attack, X Special Defense, X Speed, X Accuracy, Dire Hit, Guard Spec, Power Anklet, Power Band, Power Belt, Power Bracelet, Power Lens, Power Weight, Bright Powder, Destiny Knot
|
||||
- Added cries for Farfetchd, Galarian Farfetched, Rookidee, Corvisquire, Corviknight, Caterpie, Metapod, Butterfree, Weedle, Kakuna, Beedrill, Pidgey, Pidgeotto, Pidgeot, Rattata, Raticate, Clefairy, Clefable, Tauros, Eevee, Vaporeon, Flareon, Jolteon, Chatot, Darmanitan, Darumaka, Lucario, Mimikyu, Quagsire, Riolu, Wooper, Cleffa, Miltank, Buneary, Lopunny, Wooloo, Dubwool.
|
||||
- Added a shoulder mount for Mimikyu
|
||||
- Added Advancement trigger for defeating Pokémon and collecting varieties of Pokémon.
|
||||
- Added sleep animations to Arcanine, Jigglypuff, Wigglytuff, Vulpix and Ninetales.
|
||||
- Added medicinal items: Berry Juice, Heal Powder, Remedy, Fine Remedy, Superb Remedy, Revive, Max Revive, Potion, Super Potion, Hyper Potion, Max Potion, Full Restore, Full Heal, Antidote, Awakening, Burn Heal, Ice Heal, and Paralyze Heal.
|
||||
- Added battle items: X Attack, X Defence, X Sp.Atk, X Sp.Def, X Speed, Dire Hit, and Guard Spec.
|
||||
- Added EV items: Power Anklet, Power Band, Power Belt, Power Bracelet, Power Lens, Power Weight.
|
||||
- Added food items: Roasted Leek, Leek and Potato Stew, Braised Vivichoke, and Vivichoke Dip
|
||||
- Added evolution items: Auspicious Armor and Malicious Armor, which can be used to evolve Charcadet into Armarouge or Ceruledge respectively.
|
||||
- Added (mostly brewing) recipes for HP Up, Protein, Iron, Calcium, Zinc, Carbos, PP Up, PP Max, and Medicinal Leek to Magenta Dye.
|
||||
- Added held items: Bright Powder, Destiny Knot
|
||||
- Added AI for Nosepass to point towards world spawn when idle. We just think it's neat.
|
||||
- Added shoulder mounting for Mimikyu.
|
||||
- Added flying placeholder animations to Pidgey, Pidgeotto, Pidgeot, Golbat, Crobat, Scyther, Scizor, Zapdos, Moltres, Articuno, Dragonite, Rowlet, Dartrix, and Decidueye.
|
||||
- Added loot to various vanilla chest loot tables (Link Cable in Ancient Cities, Woodland Mansions, End Cities, and Igloos, Vivichoke Seeds in Jungle Temples, Dungeons, and Plains, Savanna, Snowy, and Taiga Villages, and all 7 Apricorn Sprouts in Desert, Plains, Savanna, Snowy, and Taiga Villages, as well as the Bonus Chest, which can also have 5 of the basic Poké Ball types)
|
||||
- Added a `doShinyStarters` gamerule to make it quick and easy to be offered shiny starters.
|
||||
- Added a `doPokemonLoot` gamerule to toggle Pokémon dropping items/exp on death.
|
||||
- Added ability activation announcement when in battle.
|
||||
- Added animations for Wailord and made it BIGGER.
|
||||
- Added Cherry Torterra variant.
|
||||
- Added 2 new face spots for Spinda. The number of unique Spindas increases...
|
||||
- Added Forretress Shulker variant.
|
||||
- Added the `/teststore <player> <store> <properties>` command allowing command block/mcfunction users to query a party, PC or both for Pokémon matching specific properties and returning the match count, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.teststore` if a permission mod is present.
|
||||
- Added the `/querylearnset <player> <slot> <move>` command allowing command block/mcfunction users to query a party slot and check if the Pokémon can learn a specific move returning a 1 if yes otherwise 0, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.querylearnset` if a permission mod is present.
|
||||
- Added the `/testpcslot <player> <slot> <properties>` command allowing command block/mcfunction users to query a pc slot and check if the Pokémon matches specific properties returning a 1 if yes otherwise 0, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.testpcslot` if a permission mod is present.
|
||||
@@ -30,18 +38,6 @@
|
||||
- Added the `/clearparty <player>` command for emptying a player's party.
|
||||
- Added the `/clearpc <player>` command for emptying a player's PC.
|
||||
- Added the `/pokemonrestart <reset_starters>` and the `/pokemonrestartother <player> <reset_starters>` command allowing command block/mcfunction users to reset a players Pokémon data.
|
||||
- Added support for "isBattle" and "isTouchingWater" properties on resource pack Pokémon poses. This allows your custom Pokémon to be posed differently when in battle.
|
||||
- Added support for "isVisible" on a transformed part on resource pack Pokémon poses. This allows your custom Pokémon to have bones disappear in specific poses, such as hiding Greninja's throwing star when not in a battle pose.
|
||||
- Added a "doShinyStarters" gamerule
|
||||
- Added the `doPokemonLoot` gamerule to toggle Pokémon dropping items/exp on death.
|
||||
- Added support for battle music. Sounds can be added to the ``battle.pvp.default`` and ``battle.pvw.default`` sound events.
|
||||
- Added ability activation announcement when in battle.
|
||||
- Added Auspicious Armor and Malicious Armor, which can be used to evolve Charcadet into Armarouge or Ceruledge respectively.
|
||||
- Added animations for Wailord.
|
||||
- Added Cherry Torterra variant.
|
||||
- Added 2 new face spots for Spinda.
|
||||
- Added Forretress Shulker variant.
|
||||
- Added 'enabled' optional property on model layers, allowing later variations to disable previously-defined layers. See [this issue](https://gitlab.com/cable-mc/cobblemon/-/issues/335) for how this looks.
|
||||
|
||||
### Pokémon Added
|
||||
#### Gen 2
|
||||
@@ -87,7 +83,7 @@
|
||||
- Cacnea
|
||||
- Cacturne
|
||||
- Poochyena
|
||||
- Mightyenna
|
||||
- Mightyena
|
||||
- Wingull
|
||||
- Pelipper
|
||||
- Numel
|
||||
@@ -137,12 +133,12 @@
|
||||
|
||||
#### Gen 5
|
||||
|
||||
- Bouffolant
|
||||
- Bouffalant
|
||||
- Roggenrola
|
||||
- Boldore
|
||||
- Gigalith
|
||||
- Venepede
|
||||
- Whirlpede
|
||||
- Venipede
|
||||
- Whirlipede
|
||||
- Scolipede
|
||||
- Yamask
|
||||
- Cofagrigus
|
||||
@@ -164,7 +160,7 @@
|
||||
|
||||
- Scatterbug
|
||||
- Spewpa
|
||||
- Vivillion
|
||||
- Vivillon
|
||||
- Skrelp
|
||||
- Dragalge
|
||||
- Bunnelby
|
||||
@@ -192,6 +188,8 @@
|
||||
- Golisopod
|
||||
- Crabrawler
|
||||
- Crabominable
|
||||
- Mudbray
|
||||
- Mudsdale
|
||||
|
||||
#### Gen 8
|
||||
|
||||
@@ -218,7 +216,7 @@
|
||||
|
||||
#### Gen 9
|
||||
|
||||
- Sprigatitto
|
||||
- Sprigatito
|
||||
- Floragato
|
||||
- Meowscarada
|
||||
- Fuecoco
|
||||
@@ -257,83 +255,149 @@
|
||||
- Clodsire
|
||||
|
||||
### Changes
|
||||
- Updated model and textures of Spiritomb, Koffing, Weezing, Kadabra, Alakazam, Emolga, Oshawott, Doduo, Dodrio, Dratini, Dragonair, Dragonite, Sneasel, Weavile, Gyarados, Hitmonlee, Hitmonchan, Chesnaught, Spinda, Mamoswine, Steelix, Midreavus, Mismagius, Buneary, Lopunny, Golduck, Meowth, Persian, Fennekin, Braixen, Delphox, Snivy, Servine, Serperior, Ratatta, Raticate, Nidorina, Nidoqueen, NidoranM, Nidoking, Riolu, Lucario, Haunter, Mankey, Primeape, Mew, Mewtwo, Arcanine, Magnemite, Magneton, Magnezone, Exeggcute, Exeggutor, Elekid, Electabuzz, Electivire, Pichu, Pikachu, Raichu, Gengar, Wooper, Drowzee, Hypno, Aerodactyl, Spearow, Fearow, Lickitung, Pidgey, Pidgeotto, Pidgeot, Scyther, Scizor, Kleavor, Popplio, Brionne, Primarina, Torchic, Combusken, Blaziken, Aerodacyl, Scyther, Scizor, Kleavor, Lickitung, Lickilicky, Happiny, Chansey and Blissey.
|
||||
- Updated animations for Steelix, Turtwig, Grotle, Torterra, Ponyta, Rapidash, Piplup, Prinplup, Empoleon, Drowzee, Hypno, Farfetch'd, Exeggcute, Exeggutor, Bidoof, Chimecho, Lickytung, Lickilicky, Popplio, Brionne, Luvdisc, Chimchar, Monferno, Infernape, Sobble, Drizzile, Inteleon, Greninja, Heatmor, Aerodactyl, Ditto, Lotad, Lombre, Ludicolo, Pumpkaboo, Gourgeist.
|
||||
- Removed the existing shoulder effects from Pokémon until we have more balanced versions of them (they're too powerful!)
|
||||
- Updated models and textures of Weedle, Dwebble and Crustle, Spiritomb, Koffing and Weezing, Kadabra and Alakazam, Emolga, Oshawott, Doduo and Dodrio, Dratini and Dragonair and Dragonite, Sneasel and Weavile, Gyarados, Hitmonlee and Hitmonchan, Chesnaught, Spinda, Mamoswine, Steelix, Misdreavus and Mismagius, Buneary and Lopunny, Golduck, Meowth and Persian, Fennekin and Braixen and Delphox, Snivy and Servine and Serperior, Ratatta and Raticate, Nidorina and Nidoqueen, Nidoran Male and Nidoking, Riolu and Lucario, Haunter and Gengar, Mankey and Primeape, Mew and Mewtwo, Arcanine, Magnemite and Magneton and Magnezone, Exeggcute and Exeggutor, Elekid and Electabuzz and Electivire, Pichu and Pikachu and Raichu, Wooper, Drowzee and Hypno, Aerodactyl, Spearow and Fearow, Lickitung and Lickilicky, Pidgey and Pidgeotto and Pidgeot, Scyther and Scizor and Kleavor, Popplio and Brionne and Primarina, Torchic and Combusken and Blaziken, Happiny and Chansey and Blissey.
|
||||
- Updated animations for Steelix, Turtwig and Grotle and Torterra, Ponyta and Rapidash, Piplup and Prinplup and Empoleon, Drowzee and Hypno, Farfetch'd, Exeggcute and Exeggutor, Bidoof, Chimecho, Lickitung and Lickilicky, Popplio and Brionne, Luvdisc, Chimchar and Monferno and Infernape, Sobble and Drizzile and Inteleon, Greninja, Heatmor, Aerodactyl, Ditto, Lotad and Lombre and Ludicolo, Pumpkaboo and Gourgeist.
|
||||
- Updated sprites for EV medicines, the rare candy, and the apricorn door item.
|
||||
- Updated textures for apricorn doors and all the evolution stone ores.
|
||||
- Ponyta and Rapidash now have animated textures; they look insane.
|
||||
- Updated Apricorn Leaves color.
|
||||
- Wild Pokémon now heal if you are defeated by them or flee from them.
|
||||
- Doubled the default time between ambient Pokémon cries (they have cries if you're using a resource pack to add them)
|
||||
- Moved spawn attempts per tick to a config option (ticksBetweenSpawnAttempts)
|
||||
- PCs can now be waterlogged
|
||||
- Starter selection prompt now appears as a tutorial-esque toast instead of plain text
|
||||
- Cobblemon items can now all have their own tooltips via resourcepacks, to add a tooltip simply add a lang entry like "item.cobblemon.{item_id}.tooltip", if you want to add multiple tooltip lines you can do so with "item.cobblemon.{item_id}.tooltip_1" and upwards.
|
||||
- Updated texture of Weedle.
|
||||
- Updated shiny texture of Dwebble and Crustle.
|
||||
- Reorganised the advancements recipes folder
|
||||
- Pokéedit command now supports IVs and EVs.
|
||||
- Reorganised creative categories
|
||||
- Pokémon can now wander into non-solid blocks such as foliage
|
||||
- Pokéballs now despawn after 30 seconds
|
||||
- Thrown Poké Balls now despawn after 30 seconds so that they don't fly forever.
|
||||
- Dive Balls will now have the same motion speed underwater as if they were thrown in the air.
|
||||
- Hardcoded potion shoulder effects have been removed, you can now use any potion vanilla or otherwise with the parameters you'd like, for more information see the [Datapack & Resourcepack Creators](#datapack-&-resourcepack-creators) section.
|
||||
- Clicking categories of the Stat sub-section or the party reorder button in the Summary screen will now produce a click sound.
|
||||
- Hardcoded potion shoulder effects have been removed. You can now use any potion vanilla or otherwise with the parameters you'd like, for more information see the [Datapack & Resourcepack Creators](#datapack-&-resourcepack-creators) section.
|
||||
- Clicking categories of the Stat subsection or the party reorder button in the Summary screen will now produce a click sound.
|
||||
- Updated PC Recipe.
|
||||
- Improved Pokémon AI and movement.
|
||||
- Friendship will slowly increase when Pokémon are shoulder-mounted.
|
||||
- Master balls are now unable to be burned when dropped into fire/lava.
|
||||
- Master Balls are now unable to be burned when dropped into fire/lava. They're made from stronger stuff.
|
||||
- Pokémon will appear red when hurt, like regular entities, except when they're fainting.
|
||||
- Ponyta and Rapidash now have animated textures.
|
||||
- Pokémon's air meter no longer depletes while battling underwater.
|
||||
- Sleeping partially restores PP of Pokémon
|
||||
- Item interaction evolutions and held item requirements now support NBT by creating an object JSON containing the key ``item`` for what used to be the existing condition support and a ``nbt`` key for the NBT format, this is the string [format](https://minecraft.fandom.com/wiki/NBT_format) expected in commands. Existing data does not need to be updated.
|
||||
- Shoulder mounts now match the shoulder position a bit more accurately when sneaking.
|
||||
- Poison Heal will now cause poisoned Pokémon to heal outside of battle.
|
||||
- Updated Poké Ball, PC, UI, evolution and Healing Machine sounds.
|
||||
|
||||
### Added cries to the following Pokémon:
|
||||
- All starters and their evolutions
|
||||
- Caterpie, Metapod, Butterfree
|
||||
- Weedle, Kakuna, Beedrill
|
||||
- Pidgey, Pidgeotto, Pidgeot
|
||||
- Rattata, Raticate
|
||||
- Spearow, Fearow
|
||||
- Ekans, Arbok
|
||||
- Pichu, Pikachu, Raichu, Alolan Raichu
|
||||
- Cleffa, Clefairy, Clefable
|
||||
- Mankey, Primeape, Annihilape
|
||||
- Ponyta, Rapidash, Galarian Ponyta, Galarian Rapidash
|
||||
- Farfetch'd, Galarian Farfetch'd, Sirfetch'd
|
||||
- Onix, Steelix
|
||||
- Tauros
|
||||
- Ditto
|
||||
- Eevee, Vaporeon, Jolteon, Flareon, Espeon, Umbreon, Leafeon, Glaceon, Sylveon
|
||||
- Hoothoot, Noctowl
|
||||
- Mareep, Flaaffy, Ampharos
|
||||
- Aipom, Ambipom
|
||||
- Wooper, Quagsire, Clodsire
|
||||
- Snubbull, Granbull
|
||||
- Miltank
|
||||
- Poochyena, Mightyena
|
||||
- Taillow, Swellow
|
||||
- Ralts, Kirlia, Gardevoir, Gallade
|
||||
- Shroomish, Breloom
|
||||
- Nincada, Ninjask, Shedinja
|
||||
- Buneary, Lopunny
|
||||
- Chingling
|
||||
- Chatot
|
||||
- Riolu, Lucario
|
||||
- Pidove, Tranquill, Unfezant
|
||||
- Roggenrola, Boldore, Gigalith
|
||||
- Venipede, Whirlipede, Scolipede
|
||||
- Maractus
|
||||
- Dwebble, Crustle
|
||||
- Yamask, Cofagrigus
|
||||
- Bunnelby, Diggersby
|
||||
- Fletchling, Fletchinder, Talonflame
|
||||
- Scatterbug, Spewpa, Vivillon
|
||||
- Honedge, Doublade, Aegislash
|
||||
- Skrelp, Dragalge
|
||||
- Phantump, Trevenant
|
||||
- Pumpkaboo, Gourgeist
|
||||
- Bergmite, Avalugg
|
||||
- Mudbray, Mudsdale
|
||||
- Stufful, Bewear
|
||||
- Mimikyu
|
||||
- Rookidee, Corvisquire, Corviknight
|
||||
- Nickit, Thievul
|
||||
- Wooloo, Dubwool
|
||||
- Yamper, Boltund
|
||||
- Tandemaus
|
||||
- Fidough, Dachsbun
|
||||
- Squawkabilly
|
||||
- Nacli, Naclstack, Garganacl
|
||||
- Charcadet, Armarouge, Ceruledge
|
||||
- Maschiff, Mabosstiff
|
||||
- Shroodle, Grafaiai
|
||||
- Flittle, Espathra
|
||||
- Tinkatink, Tinkatuff, Tinkaton
|
||||
- Varoom, Revavroom
|
||||
- Glimmet, Glimmora
|
||||
- Cetoddle, Cetitan
|
||||
- Tatsugiri
|
||||
|
||||
### Fixes
|
||||
- Fixed spawning moon phase dependent Pokémon only when the moon phase is wrong
|
||||
- Fixed spawning moon phase dependent Pokémon only when the moon phase is wrong (that's a funny woopsy)
|
||||
- Fixed large Pokémon spawning partially inside walls where they suffocate.
|
||||
- Fixed custom Pokémon in your party or PC not being removed when the addon is removed, causing major issues.
|
||||
- Fixed messages for entry hazards, screens, weather, damage, healing, Tailwind, Perish Song, Destiny Bond, Shed Skin, Uproar, Forewarn, Disguise, Arena Trap, Yawn, Curse, Clamp, Whirlpool, Liquid Ooze, Miracle Eye, Safeguard, Magic Bounce, Lock On, Focus Energy, Confusion, and more.
|
||||
- Fixed Porygon not evolving with an Upgrade.
|
||||
- Fixed super sized Pumpkaboo not having any moves.
|
||||
- Fixed Infernape look animation.
|
||||
- Fixed Garchomp t-posing while swimming.
|
||||
- Fixed a bug that caused sleeping Pokémon to stay asleep.
|
||||
- Fixed a bug that would freeze a battle when a Pokémon gets trapped due to an ability.
|
||||
- Fixed Garchomp T-posing while swimming which was very funny.
|
||||
- Fixed a bug that caused sleeping Pokémon to stay asleep. Forever. The years passing them by as they dream of a world without hate...
|
||||
- Fixed a bug that would freeze a battle when a Pokémon gets trapped by an ability, making the trap abilities even scarier and trap-like than they were before.
|
||||
- Fixed the Poké Ball close animation canceling whenever colliding with a block.
|
||||
- Fixed faint animations not working properly in add-ons.
|
||||
- Fixed lighting and Pokémon label issues when a Pokémon item frame is nearby.
|
||||
- Fixed Pokémon being able to spawn outside the world border as a tease.
|
||||
- Fixed deepslate water stone ore items looking like deepslate fire stone ores.
|
||||
- Fixed a bunch of client-side logging errors when Pokémon are shoulder mounted.
|
||||
- Fixed deepslate water stone ore items looking like deepslate fire stone ores. Huh?
|
||||
- Fixed a bunch of client-side logging errors when Pokémon are shoulder mounted. You didn't notice? Good.
|
||||
- Fixed a crash when wild Pokémon have to struggle under specific circumstances.
|
||||
- Fixed uncolored pixels on Yanma's shiny texture.
|
||||
- Fixed apricorn tree leaves looking gross on Fast graphics mode.
|
||||
- Fixed apricorn tree leaves looking gross on the Fast graphics mode.
|
||||
- Fixed hoes not breaking apricorn tree leaves any faster.
|
||||
- Fixed Shiftry's PC model position.
|
||||
- Fixed the /pc command not playing the opening sound.
|
||||
- Fixed Shedinja not being able to recover naturally.
|
||||
- Fixed different forms of Pokémon not being able to appear as different sizes.
|
||||
- Fixed the Healing Machine soft locking you from using others when removed by non-players.
|
||||
- Fixed animations being sped up when using the Replay Mod.
|
||||
- Fixed particle animations not running when a Pokémon is off-screen.
|
||||
- Fixed Pokémon variants and layers not rendering correctly when shouldered and playing on a dedicated server, existing shoulders affected will need to be retrieved and shouldered again.
|
||||
- Shoulder effects will now stay applied through situations that remove potion effects such as drinking milk.
|
||||
- Fixed Shedinja evolving to use the consumed Pokeball and removed the held item.
|
||||
- Fixed non-existent species in spawn pool file causing random species to spawn.
|
||||
- Fixed shearing Pokémon dropping 0-2 wool instead of 1-3.
|
||||
- Fixed some alignment issues in the stat hexagon of the summary menu.
|
||||
- Fixed capture calculations not applying ball bonuses entirely correctly.
|
||||
- Fixed shoulder effects not staying applied through situations that remove potion effects such as drinking milk.
|
||||
- Fixed Shedinja not being able to recover naturally.
|
||||
- Fixed Shedinja evolving to use the consumed Poké Ball and removed the held item to prevent dupes.
|
||||
- Fixed Shedinja healing above 1 HP.
|
||||
- Fixed Shedinja, basically.
|
||||
- Fixed shearing Pokémon dropping 0-2 wool instead of 1-3.
|
||||
- Fixed some alignment issues in the stat hexagon of the summary menu. OCD people rejoice.
|
||||
- Fixed capture calculations not applying ball bonuses entirely correctly.
|
||||
- Fixed battles soft-locking when consecutive Pokémon faint on switch-in.
|
||||
- Fixed timing and color of battle window messages.
|
||||
- Fixed players being able to trade, battle and let out their Pokémon while in spectator mode.
|
||||
- Fixed Galarian Yamask not being able to evolve and by proxy the ``damage_taken`` evolution requirement.
|
||||
- Fixed Bisharp not being able to evolve and by proxy the ``defeat`` evolution requirement.
|
||||
- Fixed White-Striped Basculin not being able to evolve and by proxy the ``recoil`` evolution requirement.
|
||||
- Fixed Primeape, Qwilfish and Stantler not being able to evolve and by proxy the ``use_move`` evolution requirement.
|
||||
- Fixed Bramblin, Pawmo, and Rellor not being able to evolve and by proxy the ``blocks_traveled`` evolution requirement.
|
||||
- Fixed White-Striped Basculin not being able to evolve because of a broken ``recoil`` evolution requirement.
|
||||
- Fixed Primeape, Qwilfish and Stantler not being able to evolve because of a broken ``use_move`` evolution requirement.
|
||||
- Fixed Bramblin, Pawmo, and Rellor not being able to evolve because of a broken ``blocks_traveled`` evolution requirement.
|
||||
- Fixed displayName property in spawn files not doing what it's meant to do.
|
||||
- Fixed Pokémon not sleeping in the wild like we wanted them to.
|
||||
|
||||
### Developer
|
||||
- Added SpawnEvent, ThrownPokeballHitEvent, PokemonSentEvent, PokemonRecalledEvent.
|
||||
@@ -343,9 +407,13 @@
|
||||
- Added capture check to BattleVictoryEvent.
|
||||
- The various hardcoded potion shoulder effects have been removed, make use of PotionBaseEffect.
|
||||
- Added ContextManager for tracking causes and contexts of conditions created during a battle. See BattleContext for types of conditions that are tracked.
|
||||
- Added MongoDB support for storing Pokémon and Player data. Must be enabled in config, requires MongoDB core and sync drivers (4.10.0+).
|
||||
- CobblemonShowdown updated to version 10.
|
||||
- Generation of a battle can be set in BattleFormat.
|
||||
- Pokémon now have ``teraType``, ``dmaxLevel``, and ``gmaxFactor`` properties. Gimmicks can be used during battle by adding the respective identifiers to ``keyItems`` in PlayerData: ``key_stone``, ``z_ring``, ``dynamax_band``, and ``tera_orb``. Dynamax is only supported in Gen 8 battles. Mega Evolution and Z-Power require custom held items to be added (e.g. an item with the path ``gengarite`` will allow Gengar to Mega Evolve). Currently custom Z-Crystals and Mega Stones are not supported.
|
||||
|
||||
### Datapack & Resourcepack Creators
|
||||
- All potion related shoulder effects have had their IDs changed, they now all share the same type being `potion_effect` and use the vanilla Potion data [parameters](https://minecraft.fandom.com/wiki/Potion#Item_data), take for example the default Pidgey asset:
|
||||
- All potion related shoulder effects have had their IDs changed. They now all share the same type being `potion_effect` and use the vanilla Potion data [parameters](https://minecraft.fandom.com/wiki/Potion#Item_data). For example, here is the converted Pidgey asset:
|
||||
- ```json
|
||||
{
|
||||
"type": "potion_effect",
|
||||
@@ -357,6 +425,22 @@
|
||||
}
|
||||
```
|
||||
- Renamed the ``walked_steps`` evolution requirement to ``blocks_traveled``.
|
||||
- Added support for scale in animations.
|
||||
- Added support for jump keyframes (i.e. pre and post keyframes)
|
||||
- Added structure spawning conditions
|
||||
- Added Advancement trigger for defeating Pokémon and collecting varieties of Pokémon.
|
||||
- Added support for "isBattle" and "isTouchingWater" properties on resource pack Pokémon poses. This allows your custom Pokémon to be posed differently when in battle.
|
||||
- Added support for "isVisible" on a transformed part on resource pack Pokémon poses. This allows your custom Pokémon to have bones disappear in specific poses, such as hiding Greninja's throwing star when not in a battle pose.
|
||||
- Added support for battle music. Sounds can be added to the ``battle.pvp.default`` and ``battle.pvw.default`` sound events.
|
||||
- Added 'enabled' optional property on model layers, allowing later variations to disable previously-defined layers. See [this issue](https://gitlab.com/cable-mc/cobblemon/-/issues/335) for how this looks.
|
||||
- Cobblemon items can now all have their own tooltips via resourcepacks. To add a tooltip, add a lang entry like "item.cobblemon.{item_id}.tooltip". If you want to add multiple tooltip lines you can do so with "item.cobblemon.{item_id}.tooltip_1" and upwards.
|
||||
- Item interaction evolutions and held item requirements now support NBT by creating an object JSON containing the key ``item`` for what used to be the existing condition support and a ``nbt`` key for the NBT format, this is the string [format](https://minecraft.fandom.com/wiki/NBT_format) expected in commands. Existing data does not need to be updated.
|
||||
- Fixed faint animations not working properly in add-ons.
|
||||
- Fixed non-existent species in spawn pool files causing random species to spawn.
|
||||
|
||||
### Localization
|
||||
- Added partial translations for Dutch, Polish, Swedish, Hungarian, Czech, Cyprus Greek, and even Esperanto.
|
||||
- Updated translation for French and Canadian French, Simplified Chinese, Japanese, Korean, Spanish and Mexican Spanish, Pirate English, German, Thai, Turkish, Portuguese and Brazilian Portuguese, Ukrainian, and Russian.
|
||||
|
||||
## [1.3.1 (March 31st, 2023)](#1-3-1)
|
||||
|
||||
@@ -370,7 +454,7 @@
|
||||
- Add lava surface spawn preset.
|
||||
- Added an ``any`` evolution requirement allowing you to define ``possibilities`` of other evolution requirements, for example, this allows you to create an evolution that requires the Pokémon to be shiny or a female.
|
||||
- Added the `/spawnpokemonfrompool [amount]` or `/forcespawn [amount]` command to spawn Pokémon(s) in the surrounding area using the natural spawn rates/pool of that area, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.spawnpokemon` if a permission mod is present. On a successful execution of the command, the amount of Pokémon spawned will be the output.
|
||||
- Added the `/pokebox` and `/pokeboxall` commands to move Pokemon(s) to the PC from a Player's party, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.pokebox` if a permission mod is present. On a successful execution of the command the output will be the number of pokemon moved to the Player's PC.
|
||||
- Added the `/pokebox` and `/pokeboxall` commands to move Pokémon(s) to the PC from a Player's party, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.pokebox` if a permission mod is present. On a successful execution of the command the output will be the number of pokemon moved to the Player's PC.
|
||||
- Added the `/pc` command which opens up the PC UI the same way interacting with the block would, this will be a cheat command in the Minecraft permission system or use the permission `cobblemon.command.pc` if a permission mod is present.
|
||||
|
||||
### Changes
|
||||
@@ -393,7 +477,6 @@
|
||||
- Changed the recipes for Mystic Water, Miracle Seed, and Charcoal Stick to utilise the evolution stones, as well as Never-Melt Ice having an alternate recipe using the Ice Stone.
|
||||
- Replaced the `Failed to handle` battle messages to `Missing interpretation` to make it more clear that mechanics do work just still pending dedicated messages.
|
||||
- Healing Machine and PC are now mine-able with pickaxes and Apricorn leaves are mine-able using hoes.
|
||||
- Updated Pokéball, UI and evolution sounds.
|
||||
|
||||
### Fixes
|
||||
- Fixed killing a Dodrio killing your game. Dodrio will never look the same to us.
|
||||
@@ -714,6 +797,7 @@
|
||||
- Fixed Magnitude battle messages.
|
||||
- Moves that are disabled or out of PP now show transparently in the battle GUI instead of being hidden completely.
|
||||
- Statuses like sleep and frozen no longer last forever if it was carried over from a previous battle.
|
||||
- Fixed a formatting error that affected Pokemon nicknames when the storage type is JSON.
|
||||
|
||||
### Localization
|
||||
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
|
||||
|
||||
@@ -25,6 +25,7 @@ repositories {
|
||||
mavenCentral()
|
||||
//JEI
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://maven.tterrag.com/")
|
||||
}
|
||||
|
||||
license {
|
||||
|
||||
@@ -27,6 +27,8 @@ dependencies {
|
||||
implementation(libs.reflect)
|
||||
|
||||
modImplementation(libs.fabricLoader)
|
||||
//Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
modApi(libs.molang)
|
||||
compileOnlyApi(libs.jeiApi)
|
||||
|
||||
@@ -35,6 +37,9 @@ dependencies {
|
||||
|
||||
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||
|
||||
// For datastore
|
||||
modCompileOnly(libs.mongoDriverCore)
|
||||
modCompileOnly(libs.mongoDriverSync)
|
||||
|
||||
testRuntimeOnly(libs.junitEngine)
|
||||
testImplementation(libs.junitApi)
|
||||
|
||||
@@ -9,36 +9,30 @@
|
||||
package com.cobblemon.mod.common.mixin;
|
||||
|
||||
import com.cobblemon.mod.common.block.PreEmptsExplosion;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.explosion.Explosion;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(value = Explosion.class)
|
||||
public class ExplosionMixin {
|
||||
|
||||
@Shadow @Final private World world;
|
||||
|
||||
@Inject(
|
||||
@Redirect(
|
||||
method = "affectWorld",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"
|
||||
),
|
||||
locals = LocalCapture.CAPTURE_FAILSOFT
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;",
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
public void cobblemon$whenExploded(boolean particles, CallbackInfo ci, boolean bl, ObjectArrayList<?> objectArrayList, boolean bl2, ObjectListIterator<?> var5, BlockPos blockPos, BlockState blockState) {
|
||||
if (blockState.getBlock() instanceof PreEmptsExplosion preExplosionBlock) {
|
||||
preExplosionBlock.whenExploded(world, blockState, blockPos);
|
||||
public BlockState cobblemon$whenExploded(World world, BlockPos pos) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
if(blockState.getBlock() instanceof PreEmptsExplosion preExplosionBlock) {
|
||||
preExplosionBlock.whenExploded(world, blockState, pos);
|
||||
}
|
||||
return blockState;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common
|
||||
|
||||
import com.cobblemon.mod.common.advancement.CobblemonCriteria
|
||||
import com.cobblemon.mod.common.advancement.criterion.EvolvePokemonContext
|
||||
import com.cobblemon.mod.common.api.Priority
|
||||
import com.cobblemon.mod.common.api.SeasonResolver
|
||||
import com.cobblemon.mod.common.api.data.DataProvider
|
||||
@@ -48,13 +49,16 @@ import com.cobblemon.mod.common.api.spawning.prospecting.SpawningProspector
|
||||
import com.cobblemon.mod.common.api.starter.StarterHandler
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStoreManager
|
||||
import com.cobblemon.mod.common.api.storage.adapter.conversions.ReforgedConversion
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatifle.FileStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatifle.JSONStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatifle.NBTStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.database.MongoDBStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.JSONStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.NBTStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.factory.FileBackedPokemonStoreFactory
|
||||
import com.cobblemon.mod.common.api.storage.pc.PCStore
|
||||
import com.cobblemon.mod.common.api.storage.pc.link.PCLinkManager
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerDataStoreManager
|
||||
import com.cobblemon.mod.common.api.storage.player.factory.JsonPlayerDataStoreFactory
|
||||
import com.cobblemon.mod.common.api.storage.player.factory.MongoPlayerDataStoreFactory
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonEntityTypeTags
|
||||
import com.cobblemon.mod.common.battles.BagItems
|
||||
import com.cobblemon.mod.common.battles.BattleFormat
|
||||
@@ -63,7 +67,12 @@ import com.cobblemon.mod.common.battles.BattleSide
|
||||
import com.cobblemon.mod.common.battles.ShowdownThread
|
||||
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.command.argument.*
|
||||
import com.cobblemon.mod.common.command.argument.MoveArgumentType
|
||||
import com.cobblemon.mod.common.command.argument.PartySlotArgumentType
|
||||
import com.cobblemon.mod.common.command.argument.PokemonArgumentType
|
||||
import com.cobblemon.mod.common.command.argument.PokemonPropertiesArgumentType
|
||||
import com.cobblemon.mod.common.command.argument.PokemonStoreArgumentType
|
||||
import com.cobblemon.mod.common.command.argument.SpawnBucketArgumentType
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.config.LastChangedVersion
|
||||
import com.cobblemon.mod.common.config.constraint.IntConstraint
|
||||
@@ -83,15 +92,33 @@ import com.cobblemon.mod.common.pokemon.feature.TagSeasonResolver
|
||||
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
|
||||
import com.cobblemon.mod.common.pokemon.properties.HiddenAbilityPropertyType
|
||||
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.UntradeableProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.tags.PokemonFlagProperty
|
||||
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
|
||||
import com.cobblemon.mod.common.starter.CobblemonStarterHandler
|
||||
import com.cobblemon.mod.common.trade.TradeManager
|
||||
import com.cobblemon.mod.common.util.*
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.ifDedicatedServer
|
||||
import com.cobblemon.mod.common.util.isLaterVersion
|
||||
import com.cobblemon.mod.common.util.party
|
||||
import com.cobblemon.mod.common.util.removeAmountIf
|
||||
import com.cobblemon.mod.common.util.server
|
||||
import com.cobblemon.mod.common.world.feature.CobblemonPlacedFeatures
|
||||
import com.cobblemon.mod.common.world.feature.ore.CobblemonOrePlacedFeatures
|
||||
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
|
||||
import com.mongodb.ConnectionString
|
||||
import com.mongodb.MongoClientSettings
|
||||
import com.mongodb.client.MongoClient
|
||||
import com.mongodb.client.MongoClients
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import java.util.UUID
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.reflect.jvm.javaField
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.command.argument.serialize.ConstantArgumentSerializer
|
||||
import net.minecraft.entity.data.TrackedDataHandlerRegistry
|
||||
@@ -101,15 +128,6 @@ import net.minecraft.registry.RegistryKey
|
||||
import net.minecraft.util.WorldSavePath
|
||||
import net.minecraft.world.World
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import java.util.*
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
object Cobblemon {
|
||||
const val MODID = "cobblemon"
|
||||
@@ -236,7 +254,6 @@ object Cobblemon {
|
||||
DataKeys.HAS_BEEN_SHEARED,
|
||||
FlagSpeciesFeatureProvider(keys = listOf(DataKeys.HAS_BEEN_SHEARED), default = false))
|
||||
|
||||
CustomPokemonProperty.register(UntradeableProperty)
|
||||
CustomPokemonProperty.register(UncatchableProperty)
|
||||
CustomPokemonProperty.register(PokemonFlagProperty)
|
||||
CustomPokemonProperty.register(HiddenAbilityPropertyType)
|
||||
@@ -249,15 +266,52 @@ object Cobblemon {
|
||||
PlatformEvents.SERVER_STARTING.subscribe { event ->
|
||||
val server = event.server
|
||||
playerData = PlayerDataStoreManager().also { it.setup(server) }
|
||||
|
||||
val mongoClient: MongoClient?
|
||||
|
||||
val pokemonStoreRoot = server.getSavePath(WorldSavePath.ROOT).resolve("pokemon").toFile()
|
||||
val storeAdapter = when (config.storageFormat) {
|
||||
"nbt", "json" -> {
|
||||
val jsonFactory = JsonPlayerDataStoreFactory()
|
||||
jsonFactory.setup(server)
|
||||
playerData.setFactory(jsonFactory)
|
||||
|
||||
if (config.storageFormat == "nbt") {
|
||||
NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
|
||||
} else {
|
||||
JSONStoreAdapter(
|
||||
pokemonStoreRoot.absolutePath,
|
||||
useNestedFolders = true,
|
||||
folderPerClass = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"mongodb" -> {
|
||||
try {
|
||||
Class.forName("com.mongodb.client.MongoClient")
|
||||
|
||||
val mongoClientSettings = MongoClientSettings.builder()
|
||||
.applyConnectionString(ConnectionString(config.mongoDBConnectionString))
|
||||
.build()
|
||||
mongoClient = MongoClients.create(mongoClientSettings)
|
||||
val mongoFactory = MongoPlayerDataStoreFactory(mongoClient, config.mongoDBDatabaseName)
|
||||
playerData.setFactory(mongoFactory)
|
||||
MongoDBStoreAdapter(mongoClient, config.mongoDBDatabaseName)
|
||||
} catch (e: ClassNotFoundException) {
|
||||
LOGGER.error("MongoDB driver not found.")
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
else -> throw IllegalArgumentException("Unsupported storageFormat: ${config.storageFormat}")
|
||||
}
|
||||
.with(ReforgedConversion(server.getSavePath(WorldSavePath.ROOT))) as FileStoreAdapter<*>
|
||||
|
||||
storage.registerFactory(
|
||||
priority = Priority.LOWEST,
|
||||
factory = FileBackedPokemonStoreFactory(
|
||||
adapter = if (config.storageFormat == "nbt") {
|
||||
NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
|
||||
} else {
|
||||
JSONStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
|
||||
}.with(ReforgedConversion(server.getSavePath(WorldSavePath.ROOT))) as FileStoreAdapter<*>,
|
||||
adapter = storeAdapter,
|
||||
createIfMissing = true,
|
||||
pcConstructor = { uuid -> PCStore(uuid).also { it.resize(config.defaultBoxCount) } }
|
||||
)
|
||||
@@ -283,7 +337,7 @@ object Cobblemon {
|
||||
// Ensure the config option is enabled and that the result was a ninjask and that shedinja exists
|
||||
if (this.config.ninjaskCreatesShedinja && pokemon.species.resourceIdentifier == ninjaskIdentifier && PokemonSpecies.getByIdentifier(Pokemon.SHEDINJA) != null) {
|
||||
val player = pokemon.getOwnerPlayer() ?: return@subscribe
|
||||
if (player.inventory.containsAny { it.item is PokeBallItem }) {
|
||||
if (player.isCreative || player.inventory.containsAny { it.item is PokeBallItem }) {
|
||||
var pokeball = Items.AIR
|
||||
player.inventory.combinedInventory.forEach {
|
||||
it.forEach {
|
||||
@@ -292,7 +346,12 @@ object Cobblemon {
|
||||
}
|
||||
}
|
||||
}
|
||||
player.inventory.removeAmountIf(1) { it.item is PokeBallItem }
|
||||
if (!player.isCreative) {
|
||||
player.inventory.removeAmountIf(1) { it.item is PokeBallItem }
|
||||
}
|
||||
if (pokeball == Items.AIR) {
|
||||
pokeball = CobblemonItems.POKE_BALL
|
||||
}
|
||||
val properties = event.evolution.result.copy()
|
||||
properties.species = Pokemon.SHEDINJA.toString()
|
||||
val product = pokemon.clone()
|
||||
@@ -300,6 +359,7 @@ object Cobblemon {
|
||||
properties.apply(product)
|
||||
product.caughtBall = (pokeball as PokeBallItem).pokeBall
|
||||
pokemon.storeCoordinates.get()?.store?.add(product)
|
||||
CobblemonCriteria.EVOLVE_POKEMON.trigger(player, EvolvePokemonContext(event.pokemon.preEvolution!!.species.resourceIdentifier, product.species.resourceIdentifier, playerData.get(player).advancementData.totalEvolvedCount))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
|
||||
|
||||
private fun berryBlock(name: String): BerryBlock {
|
||||
val identifier = cobblemonResource("${name}_berry")
|
||||
val block = this.create(identifier.path, BerryBlock(identifier, AbstractBlock.Settings.copy(Blocks.WHEAT).dynamicBounds().sounds(BlockSoundGroup.CROP)))
|
||||
val block = this.create(identifier.path, BerryBlock(identifier, AbstractBlock.Settings.copy(Blocks.WHEAT).dynamicBounds().sounds(BlockSoundGroup.CROP).strength(0.2F)))
|
||||
this.berries[identifier] = block
|
||||
return block
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common
|
||||
|
||||
import com.cobblemon.mod.common.api.data.JsonDataRegistry
|
||||
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
|
||||
@@ -20,6 +21,7 @@ import net.minecraft.network.listener.ClientPlayPacketListener
|
||||
import net.minecraft.network.packet.Packet
|
||||
import net.minecraft.registry.RegistryKey
|
||||
import net.minecraft.registry.tag.TagKey
|
||||
import net.minecraft.resource.ResourceManager
|
||||
import net.minecraft.resource.ResourceReloader
|
||||
import net.minecraft.resource.ResourceType
|
||||
import net.minecraft.server.MinecraftServer
|
||||
@@ -160,6 +162,13 @@ interface CobblemonImplementation {
|
||||
*/
|
||||
fun server(): MinecraftServer?
|
||||
|
||||
/**
|
||||
* Handles platform independent reloading of a [JsonDataRegistry].
|
||||
*
|
||||
* @param registry The [JsonDataRegistry] to reload.
|
||||
* @param manager The [ResourceManager] to reload from.
|
||||
*/
|
||||
fun <T> reloadJsonRegistry(registry: JsonDataRegistry<T>, manager: ResourceManager): HashMap<Identifier, T>
|
||||
}
|
||||
|
||||
enum class ModAPI {
|
||||
|
||||
@@ -338,7 +338,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
|
||||
@JvmField
|
||||
val ROASTED_LEEK = create("roasted_leek", Item(Item.Settings().food(FoodComponent.Builder().snack().hunger(3).saturationModifier(0.3f).build())))
|
||||
@JvmField
|
||||
val BRAISED_VIVICHOKE = create("braised_vivichoke", Item(Item.Settings().maxCount(1).food(FoodComponent.Builder().hunger(6).saturationModifier(0.6f).build())))
|
||||
val BRAISED_VIVICHOKE = create("braised_vivichoke", Item(Item.Settings().food(FoodComponent.Builder().hunger(6).saturationModifier(0.6f).build())))
|
||||
@JvmField
|
||||
val VIVICHOKE_DIP = create("vivichoke_dip", object : StewItem(Settings().maxCount(1)
|
||||
.food(FoodComponent.Builder()
|
||||
|
||||
@@ -211,6 +211,7 @@ object CobblemonNetwork : NetworkManager {
|
||||
this.createClientBound(HeldItemUpdatePacket.ID, HeldItemUpdatePacket::decode, PokemonUpdatePacketHandler())
|
||||
this.createClientBound(PokemonStateUpdatePacket.ID, PokemonStateUpdatePacket::decode, PokemonUpdatePacketHandler())
|
||||
this.createClientBound(TetheringUpdatePacket.ID, TetheringUpdatePacket::decode, PokemonUpdatePacketHandler())
|
||||
this.createClientBound(TradeableUpdatePacket.ID, TradeableUpdatePacket::decode, PokemonUpdatePacketHandler())
|
||||
|
||||
// Evolution start
|
||||
this.createClientBound(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler())
|
||||
|
||||
@@ -32,7 +32,7 @@ object CobblemonTradeOffers {
|
||||
* @return The resulting list.
|
||||
*/
|
||||
fun tradeOffersFor(profession: VillagerProfession): List<VillagerTradeOffer> = when (profession) {
|
||||
VillagerProfession.FARMER -> listOf(VillagerTradeOffer(VillagerProfession.FARMER, 3, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 32, 1, 1, 6))))
|
||||
VillagerProfession.FARMER -> listOf(VillagerTradeOffer(VillagerProfession.FARMER, 3, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 24, 1, 1, 6))))
|
||||
else -> emptyList()
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ object CobblemonTradeOffers {
|
||||
* @return The resulting list.
|
||||
*/
|
||||
fun resolveWanderingTradeOffers(): List<WandererTradeOffer> = listOf(
|
||||
WandererTradeOffer(false, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 32, 1, 1, 6)))
|
||||
WandererTradeOffer(false, listOf(TradeOffers.SellItemFactory(CobblemonItems.VIVICHOKE_SEEDS, 24, 1, 1, 6)))
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
+4
-1
@@ -30,7 +30,10 @@ class LevelUpCriterionCondition(id: Identifier, entity: LootContextPredicate) :
|
||||
override fun matches(player: ServerPlayerEntity, context: LevelUpContext): Boolean {
|
||||
val preEvo = context.pokemon.preEvolution == null
|
||||
val hasEvolution = !context.pokemon.evolutions.none()
|
||||
val evolutionCheck = !(preEvo == hasEvolution)
|
||||
var evolutionCheck = true
|
||||
if (preEvo || hasEvolution) {
|
||||
evolutionCheck = !(preEvo == hasEvolution)
|
||||
}
|
||||
return level == context.level && evolutionCheck == evolved
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ interface SleepDepth {
|
||||
|
||||
override fun shouldWake(pokemonEntity: PokemonEntity): Boolean {
|
||||
val nearbyPlayers = pokemonEntity.world.getPlayers(TargetPredicate.createNonAttackable(), pokemonEntity, Box.of(pokemonEntity.pos, 16.0, 16.0, 16.0))
|
||||
return nearbyPlayers.none { !it.isSneaking }
|
||||
return nearbyPlayers.any { !it.isSneaking }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.api.battles.interpreter
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
|
||||
import com.cobblemon.mod.common.api.moves.MoveTemplate
|
||||
import com.cobblemon.mod.common.api.moves.Moves
|
||||
import com.cobblemon.mod.common.battles.ActiveBattlePokemon
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import java.util.UUID
|
||||
@@ -194,6 +196,11 @@ class BattleMessage(rawMessage: String) {
|
||||
return Effect.parse(data)
|
||||
}
|
||||
|
||||
fun moveAt(index: Int): MoveTemplate? {
|
||||
val argument = argumentAt(index)?.lowercase()?.replace("[^a-z0-9]".toRegex(), "") ?: return null
|
||||
return Moves.getByName(argument)
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries an optional argument with given [argumentName] for a 'pnx' that will be parsed into a [BattleActor] and [ActiveBattlePokemon].
|
||||
*
|
||||
|
||||
@@ -66,9 +66,6 @@ object Berries : JsonDataRegistry<Berry> {
|
||||
|
||||
private val berries = hashMapOf<Identifier, Berry>()
|
||||
|
||||
val PECHA
|
||||
get() = this.getByName("")
|
||||
|
||||
override fun reload(data: Map<Identifier, Berry>) {
|
||||
this.berries.clear()
|
||||
data.forEach { (identifier, berry) ->
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.cobblemon.mod.common.util.writeBox
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import java.awt.Color
|
||||
import java.util.EnumSet
|
||||
import kotlin.math.min
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.client.model.ModelPart
|
||||
@@ -159,16 +160,14 @@ class Berry(
|
||||
val base = this.baseYield.random()
|
||||
val bonus = this.bonusYield(world, state, pos)
|
||||
var yield = base + bonus.first
|
||||
val event = BerryYieldCalculationEvent(this, world, state, pos, placer, yield, bonus.second)
|
||||
val treeEntity = world.getBlockEntity(pos) as BerryBlockEntity
|
||||
if (BerryBlock.getMulch(state) == MulchVariant.RICH) {
|
||||
yield = yield.times(1.2).coerceAtMost(maxYield().toDouble()).toInt()
|
||||
yield = min(yield + 1, maxYield())
|
||||
treeEntity.decrementMulchDuration(world, pos, state)
|
||||
}
|
||||
val event = BerryYieldCalculationEvent(this, world, state, pos, placer, yield, bonus.second)
|
||||
CobblemonEvents.BERRY_YIELD.post(event) { yield = it.yield }
|
||||
return yield
|
||||
//Just for testing the renderer
|
||||
//return growthPoints.size
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,8 +298,7 @@ class Berry(
|
||||
if (factor.isValid(world, state, pos)) {
|
||||
bonus += factor.yield()
|
||||
passed += factor
|
||||
}
|
||||
else if (hasBiomeMulch) {
|
||||
} else if (hasBiomeMulch) {
|
||||
bonus += factor.yield()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ class PartySelectCallback(
|
||||
|
||||
open class PartySelectPokemonDTO(
|
||||
val pokemonProperties: PokemonProperties,
|
||||
val aspects: Set<String>,
|
||||
val heldItem: ItemStack = ItemStack.EMPTY,
|
||||
var currentHealth: Int,
|
||||
var maxHealth: Int,
|
||||
@@ -129,13 +130,13 @@ open class PartySelectPokemonDTO(
|
||||
@JvmOverloads
|
||||
constructor(pokemon: Pokemon, enabled: Boolean = true): this(
|
||||
pokemonProperties = pokemon.createPokemonProperties(
|
||||
PokemonPropertyExtractor.ASPECTS,
|
||||
PokemonPropertyExtractor.SPECIES,
|
||||
PokemonPropertyExtractor.LEVEL,
|
||||
PokemonPropertyExtractor.NICKNAME,
|
||||
PokemonPropertyExtractor.POKEBALL,
|
||||
PokemonPropertyExtractor.STATUS
|
||||
PokemonPropertyExtractor.STATUS,
|
||||
),
|
||||
aspects = pokemon.aspects,
|
||||
heldItem = pokemon.heldItemNoCopy(),
|
||||
currentHealth = pokemon.currentHealth,
|
||||
maxHealth = pokemon.hp,
|
||||
@@ -144,6 +145,7 @@ open class PartySelectPokemonDTO(
|
||||
|
||||
constructor(buffer: PacketByteBuf): this(
|
||||
pokemonProperties = PokemonProperties().loadFromNBT(buffer.readNbt() as NbtCompound),
|
||||
aspects = buffer.readList { it.readString() }.toSet(),
|
||||
heldItem = buffer.readItemStack(),
|
||||
currentHealth = buffer.readInt(),
|
||||
maxHealth = buffer.readInt(),
|
||||
@@ -152,6 +154,7 @@ open class PartySelectPokemonDTO(
|
||||
|
||||
fun writeToBuffer(buffer: PacketByteBuf) {
|
||||
buffer.writeNbt(pokemonProperties.saveToNBT())
|
||||
buffer.writeCollection(aspects) { _, aspect -> buffer.writeString(aspect) }
|
||||
buffer.writeItemStack(heldItem)
|
||||
buffer.writeInt(currentHealth)
|
||||
buffer.writeInt(maxHealth)
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.data
|
||||
|
||||
import com.cobblemon.mod.common.util.endsWith
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import java.io.File
|
||||
import java.util.concurrent.ExecutionException
|
||||
import net.minecraft.resource.ResourceManager
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
@@ -44,23 +42,7 @@ interface JsonDataRegistry<T> : DataRegistry {
|
||||
val resourcePath: String
|
||||
|
||||
override fun reload(manager: ResourceManager) {
|
||||
val data = hashMapOf<Identifier, T>()
|
||||
manager.findResources(this.resourcePath) { path -> path.endsWith(JSON_EXTENSION) }.forEach { (identifier, resource) ->
|
||||
if (identifier.namespace == "pixelmon") {
|
||||
return@forEach
|
||||
}
|
||||
resource.inputStream.use { stream ->
|
||||
stream.bufferedReader().use { reader ->
|
||||
val resolvedIdentifier = Identifier(identifier.namespace, File(identifier.path).nameWithoutExtension)
|
||||
try {
|
||||
data[resolvedIdentifier] = this.gson.fromJson(reader, this.typeToken.type)
|
||||
} catch (exception: Exception) {
|
||||
throw ExecutionException("Error loading JSON for data: $identifier", exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.reload(data)
|
||||
this.reload(Cobblemon.implementation.reloadJsonRegistry(this, manager))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +53,6 @@ interface JsonDataRegistry<T> : DataRegistry {
|
||||
fun reload(data: Map<Identifier, T>)
|
||||
|
||||
companion object {
|
||||
private const val JSON_EXTENSION = ".json"
|
||||
const val JSON_EXTENSION = ".json"
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,11 @@ package com.cobblemon.mod.common.api.drop
|
||||
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents.LOOT_DROPPED
|
||||
import com.cobblemon.mod.common.api.events.drops.LootDroppedEvent
|
||||
import kotlin.random.Random
|
||||
import net.minecraft.entity.LivingEntity
|
||||
import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.server.world.ServerWorld
|
||||
import net.minecraft.util.math.Vec3d
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* A table of drops that can produce a list of [DropEntry]. You can produce a drop list from [getDrops] to
|
||||
|
||||
@@ -180,10 +180,10 @@ fun drawPortraitPokemon(
|
||||
partialTicks: Float
|
||||
) {
|
||||
val model = PokemonModelRepository.getPoser(species.resourceIdentifier, aspects)
|
||||
val texture = PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, state)
|
||||
val texture = PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, state?.animationSeconds ?: 0F)
|
||||
|
||||
val context = RenderContext()
|
||||
PokemonModelRepository.variations[species.resourceIdentifier]?.getTexture(aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
|
||||
PokemonModelRepository.getTextureNoSubstitute(species.resourceIdentifier, aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
|
||||
context.put(RenderContext.SCALE, species.getForm(aspects).baseScale)
|
||||
|
||||
val renderType = model.getLayer(texture)
|
||||
|
||||
@@ -124,9 +124,6 @@ interface PokemonSelectingItem {
|
||||
handler = { pk ->
|
||||
if (stack.isHeld(player)) {
|
||||
applyToPokemon(player, stack, pk)
|
||||
if (!player.isCreative) {
|
||||
stack.decrement(1)
|
||||
}
|
||||
CobblemonCriteria.POKEMON_INTERACT.trigger(player, PokemonInteractContext(pk.species.resourceIdentifier, Registries.ITEM.getId(stack.item)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ open class PokemonProperties {
|
||||
props.teraType = parseStringOfRegistry(keyPairs, listOf("tera_type", "tera")) { ElementalTypes.get(it)?.name }
|
||||
props.dmaxLevel = parseIntProperty(keyPairs, listOf("dmax_level", "dmax"))?.coerceIn(0, Cobblemon.config.maxDynamaxLevel)
|
||||
props.gmaxFactor = parseBooleanProperty(keyPairs, listOf("gmax_factor", "gmax"))
|
||||
props.tradeable = parseBooleanProperty(keyPairs, listOf("tradeable", "tradable"))
|
||||
|
||||
val maybeIVs = IVs()
|
||||
val maybeEVs = EVs()
|
||||
@@ -155,7 +156,7 @@ open class PokemonProperties {
|
||||
}
|
||||
|
||||
private fun parseSpeciesIdentifier(keyPairs: MutableList<Pair<String, String?>>): String? {
|
||||
fun cleanSpeciesName(string: String) = string.lowercase().replace("[^a-z0-9:]".toRegex(), "")
|
||||
fun cleanSpeciesName(string: String) = string.lowercase().replace("[^a-z0-9_:]".toRegex(), "")
|
||||
val matched = getMatchedKeyPair(keyPairs, listOf("species"))
|
||||
if (matched != null) {
|
||||
val value = matched.second?.let(::cleanSpeciesName) ?: return null
|
||||
@@ -258,6 +259,7 @@ open class PokemonProperties {
|
||||
var teraType: String? = null
|
||||
var dmaxLevel: Int? = null
|
||||
var gmaxFactor: Boolean? = null
|
||||
var tradeable: Boolean? = null
|
||||
|
||||
var ivs: IVs? = null
|
||||
var evs: EVs? = null
|
||||
@@ -310,6 +312,8 @@ open class PokemonProperties {
|
||||
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemon.teraType = type } }
|
||||
dmaxLevel?.let { pokemon.dmaxLevel = it }
|
||||
gmaxFactor?.let { pokemon.gmaxFactor = it }
|
||||
tradeable?.let { pokemon.tradeable = it }
|
||||
pokemon.updateAspects()
|
||||
}
|
||||
|
||||
fun apply(pokemonEntity: PokemonEntity) {
|
||||
@@ -348,6 +352,8 @@ open class PokemonProperties {
|
||||
teraType?.let { ElementalTypes.get(it)?.let { type -> pokemonEntity.pokemon.teraType = type } }
|
||||
dmaxLevel?.let { pokemonEntity.pokemon.dmaxLevel = it }
|
||||
gmaxFactor?.let { pokemonEntity.pokemon.gmaxFactor = it }
|
||||
tradeable?.let { pokemonEntity.pokemon.tradeable = it }
|
||||
pokemonEntity.pokemon.updateAspects()
|
||||
}
|
||||
|
||||
fun matches(pokemon: Pokemon): Boolean {
|
||||
@@ -384,6 +390,7 @@ open class PokemonProperties {
|
||||
teraType?.takeIf { it != pokemon.teraType.name }?.let { return false }
|
||||
dmaxLevel?.takeIf { it != pokemon.dmaxLevel }?.let { return false }
|
||||
gmaxFactor?.takeIf { it != pokemon.gmaxFactor }?.let { return false }
|
||||
tradeable?.takeIf { it != pokemon.tradeable }?.let { return false }
|
||||
return customProperties.none { !it.matches(pokemon) }
|
||||
}
|
||||
|
||||
@@ -419,6 +426,7 @@ open class PokemonProperties {
|
||||
teraType?.takeIf { it != pokemonEntity.pokemon.teraType.name }?.let { return false }
|
||||
dmaxLevel?.takeIf { it != pokemonEntity.pokemon.dmaxLevel }?.let { return false }
|
||||
gmaxFactor?.takeIf { it != pokemonEntity.pokemon.gmaxFactor }?.let { return false }
|
||||
tradeable?.takeIf { it != pokemonEntity.pokemon.tradeable }?.let { return false }
|
||||
return customProperties.none { !it.matches(pokemonEntity) }
|
||||
}
|
||||
|
||||
@@ -462,6 +470,7 @@ open class PokemonProperties {
|
||||
teraType?.takeIf { it != properties.teraType }?.let { return false }
|
||||
dmaxLevel?.takeIf { it != properties.dmaxLevel }?.let { return false }
|
||||
gmaxFactor?.takeIf { it != properties.gmaxFactor }?.let { return false }
|
||||
tradeable?.takeIf { it != properties.tradeable }?.let { return false }
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -477,7 +486,6 @@ open class PokemonProperties {
|
||||
fun roll(pokemon: Pokemon) {
|
||||
val baseTypes = pokemon.species.types.toList()
|
||||
if (this.shiny == null) pokemon.shiny = Cobblemon.config.shinyRate.checkRate()
|
||||
if (this.gmaxFactor == null) pokemon.gmaxFactor = Cobblemon.config.gigantamaxFactorRate.checkRate()
|
||||
if (this.teraType == null) pokemon.teraType =
|
||||
if (Cobblemon.config.teraTypeRate.checkRate()) ElementalTypes.all().filter { !baseTypes.contains(it) }.random()
|
||||
else baseTypes.random()
|
||||
@@ -509,6 +517,7 @@ open class PokemonProperties {
|
||||
teraType?.let { nbt.putString(DataKeys.POKEMON_TERA_TYPE, it) }
|
||||
dmaxLevel?.let { nbt.putInt(DataKeys.POKEMON_DMAX_LEVEL, it) }
|
||||
gmaxFactor?.let { nbt.putBoolean(DataKeys.POKEMON_GMAX_FACTOR, it) }
|
||||
tradeable?.let { nbt.putBoolean(DataKeys.POKEMON_TRADEABLE, it) }
|
||||
val custom = NbtList()
|
||||
customProperties.map { NbtString.of(it.asString()) }.forEach { custom.add(it) }
|
||||
nbt.put(DataKeys.POKEMON_PROPERTIES_CUSTOM, custom)
|
||||
@@ -533,6 +542,7 @@ open class PokemonProperties {
|
||||
teraType = if (tag.contains(DataKeys.POKEMON_TERA_TYPE)) tag.getString(DataKeys.POKEMON_TERA_TYPE) else null
|
||||
dmaxLevel = if (tag.contains(DataKeys.POKEMON_DMAX_LEVEL)) tag.getInt(DataKeys.POKEMON_DMAX_LEVEL) else null
|
||||
gmaxFactor = if (tag.contains(DataKeys.POKEMON_GMAX_FACTOR)) tag.getBoolean(DataKeys.POKEMON_GMAX_FACTOR) else null
|
||||
tradeable = if (tag.contains(DataKeys.POKEMON_TRADEABLE)) tag.getBoolean(DataKeys.POKEMON_TRADEABLE) else null
|
||||
val custom = tag.getList(DataKeys.POKEMON_PROPERTIES_CUSTOM, NbtElement.STRING_TYPE.toInt())
|
||||
// This is kinda gross
|
||||
custom.forEach { customProperties.addAll(parse(it.asString()).customProperties) }
|
||||
@@ -559,6 +569,7 @@ open class PokemonProperties {
|
||||
teraType?.let { json.addProperty(DataKeys.POKEMON_TERA_TYPE, it) }
|
||||
dmaxLevel?.let { json.addProperty(DataKeys.POKEMON_DMAX_LEVEL, it) }
|
||||
gmaxFactor?.let { json.addProperty(DataKeys.POKEMON_GMAX_FACTOR, it) }
|
||||
tradeable?.let { json.addProperty(DataKeys.POKEMON_TRADEABLE, it) }
|
||||
val custom = JsonArray()
|
||||
customProperties.map { it.asString() }.forEach { custom.add(it) }
|
||||
json.add(DataKeys.POKEMON_PROPERTIES_CUSTOM, custom)
|
||||
@@ -584,6 +595,7 @@ open class PokemonProperties {
|
||||
teraType = json.get(DataKeys.POKEMON_TERA_TYPE)?.asString
|
||||
dmaxLevel = json.get(DataKeys.POKEMON_DMAX_LEVEL)?.asInt
|
||||
gmaxFactor = json.get(DataKeys.POKEMON_GMAX_FACTOR)?.asBoolean
|
||||
tradeable = json.get(DataKeys.POKEMON_TRADEABLE)?.asBoolean
|
||||
val custom = json.get(DataKeys.POKEMON_PROPERTIES_CUSTOM)?.asJsonArray
|
||||
// This is still kinda gross
|
||||
custom?.forEach { customProperties.addAll(parse(it.asString).customProperties) }
|
||||
@@ -613,6 +625,7 @@ open class PokemonProperties {
|
||||
teraType?.let { pieces.add("tera_type=$it") }
|
||||
dmaxLevel?.let { pieces.add("dmax_level=$it") }
|
||||
gmaxFactor?.let { pieces.add("gmax_factor=$it") }
|
||||
tradeable?.let { pieces.add("tradeable=$it") }
|
||||
customProperties.forEach { pieces.add(it.asString()) }
|
||||
return pieces.joinToString(separator)
|
||||
}
|
||||
|
||||
+15
-1
@@ -10,11 +10,14 @@ package com.cobblemon.mod.common.api.pokemon.effect.adapter
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffect
|
||||
import com.cobblemon.mod.common.api.pokemon.effect.ShoulderEffectRegistry
|
||||
import com.cobblemon.mod.common.pokemon.effects.PotionBaseEffect
|
||||
import com.google.gson.JsonDeserializationContext
|
||||
import com.google.gson.JsonDeserializer
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
import java.lang.reflect.Type
|
||||
import net.minecraft.registry.Registries
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
object ShoulderEffectAdapter: JsonDeserializer<ShoulderEffect> {
|
||||
override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): ShoulderEffect {
|
||||
@@ -23,7 +26,18 @@ object ShoulderEffectAdapter: JsonDeserializer<ShoulderEffect> {
|
||||
} else {
|
||||
json.asJsonObject.get("type").asString to json.asJsonObject
|
||||
}
|
||||
val effect = ShoulderEffectRegistry.get(typeId) ?: throw IllegalArgumentException("Cannot find shoulder effect with type '$typeId'")
|
||||
val effect = ShoulderEffectRegistry.get(typeId) ?: run {
|
||||
try {
|
||||
val effectId = Identifier(typeId.replace("-", "_").replace("slow_fall", "slow_falling"))
|
||||
val registry = Registries.STATUS_EFFECT
|
||||
val effect = registry.get(effectId)
|
||||
if (effect != null) {
|
||||
return PotionBaseEffect(effect, 0, true, false, false)
|
||||
}
|
||||
} catch (_: Exception) {}
|
||||
|
||||
throw IllegalArgumentException("Cannot find shoulder effect with type '$typeId'")
|
||||
}
|
||||
return context.deserialize(obj, effect)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -90,7 +90,7 @@ object CobblemonSpawningProspector : SpawningProspector {
|
||||
val state = query.getBlockState(pos.set(x, y, z))
|
||||
blocks[x - area.baseX][y - baseY][z - area.baseZ] = WorldSlice.BlockData(
|
||||
state = state,
|
||||
light = state.getOpacity(world, pos)
|
||||
light = world.getLightLevel(pos)
|
||||
)
|
||||
|
||||
if (canSeeSky) {
|
||||
|
||||
@@ -32,12 +32,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
|
||||
override fun iterator() = pokemon.iterator()
|
||||
|
||||
override fun get(position: BottomlessPosition) = position.currentIndex
|
||||
.takeIf { it < pokemon.size && it >= 0 }
|
||||
.takeIf { it in pokemon.indices }
|
||||
?.let { pokemon[it] }
|
||||
|
||||
override fun getFirstAvailablePosition() = BottomlessPosition(pokemon.size)
|
||||
override fun isValidPosition(position: BottomlessPosition) = position.currentIndex >= 0
|
||||
operator fun get(index: Int) = index.takeIf { it >= 0 && it < pokemon.size }?.let { pokemon[it] }
|
||||
operator fun get(index: Int) = index.takeIf { it in pokemon.indices }?.let { pokemon[it] }
|
||||
override fun getObservingPlayers() = emptySet<ServerPlayerEntity>()
|
||||
override fun sendTo(player: ServerPlayerEntity) {}
|
||||
|
||||
@@ -58,7 +58,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
|
||||
override fun loadFromNBT(nbt: NbtCompound): BottomlessStore {
|
||||
var i = -1
|
||||
while (nbt.contains(DataKeys.STORE_SLOT + ++i)) {
|
||||
pokemon.add(Pokemon().loadFromNBT(nbt.getCompound(DataKeys.STORE_SLOT + i)))
|
||||
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + i)
|
||||
try {
|
||||
pokemon.add(Pokemon().loadFromNBT(pokemonNBT))
|
||||
} catch(_: InvalidSpeciesException) {
|
||||
handleInvalidSpeciesNBT(pokemonNBT)
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
@@ -71,7 +76,12 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
|
||||
override fun loadFromJSON(json: JsonObject): BottomlessStore {
|
||||
var i = -1
|
||||
while (json.has(DataKeys.STORE_SLOT + ++i)) {
|
||||
pokemon.add(Pokemon().loadFromJSON(json.getAsJsonObject(DataKeys.STORE_SLOT + i)))
|
||||
val pokemonJSON = json.getAsJsonObject(DataKeys.STORE_SLOT + i)
|
||||
try {
|
||||
pokemon.add(Pokemon().loadFromJSON(pokemonJSON))
|
||||
} catch (_: InvalidSpeciesException) {
|
||||
handleInvalidSpeciesJSON(pokemonJSON)
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
@@ -92,11 +102,16 @@ open class BottomlessStore(override val uuid: UUID) : PokemonStore<BottomlessPos
|
||||
this.pokemon.add(pokemon)
|
||||
storeChangeObservable.emit(Unit)
|
||||
} else if (position.currentIndex in 0 until this.pokemon.size) {
|
||||
var startIndex = position.currentIndex;
|
||||
if (pokemon != null) {
|
||||
this.pokemon.add(position.currentIndex, pokemon)
|
||||
startIndex += 1;
|
||||
} else {
|
||||
this.pokemon.removeAt(position.currentIndex)
|
||||
}
|
||||
for(i in startIndex until this.pokemon.size) {
|
||||
this.pokemon[i].storeCoordinates.set(StoreCoordinates(this, BottomlessPosition(i)))
|
||||
}
|
||||
storeChangeObservable.emit(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.storage
|
||||
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
/**
|
||||
* An exception when trying to deserialize a Pokemon instance with an identifier that doesn't seem to be in the registry.
|
||||
*
|
||||
* @author Hiroku
|
||||
* @since October 9th, 2023
|
||||
*/
|
||||
class InvalidSpeciesException(val identifier: Identifier) : IllegalStateException("Invalid species: $identifier")
|
||||
@@ -146,8 +146,10 @@ abstract class PokemonStore<T : StorePosition> : Iterable<Pokemon> {
|
||||
|
||||
operator fun get(uuid: UUID) = find { it.uuid == uuid }
|
||||
|
||||
open fun handleInvalidSpeciesNBT(nbt: NbtCompound) {}
|
||||
abstract fun saveToNBT(nbt: NbtCompound): NbtCompound
|
||||
abstract fun loadFromNBT(nbt: NbtCompound): PokemonStore<T>
|
||||
open fun handleInvalidSpeciesJSON(json: JsonObject) {}
|
||||
abstract fun saveToJSON(json: JsonObject): JsonObject
|
||||
abstract fun loadFromJSON(json: JsonObject): PokemonStore<T>
|
||||
abstract fun savePositionToNBT(position: T, nbt: NbtCompound)
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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.storage.adapter.database
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
import com.cobblemon.mod.common.api.storage.adapter.CobblemonAdapterParent
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.JSONStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.NBTStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
|
||||
import com.cobblemon.mod.common.api.storage.pc.PCStore
|
||||
import com.cobblemon.mod.common.util.server
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import com.mongodb.client.MongoClient
|
||||
import com.mongodb.client.MongoCollection
|
||||
import com.mongodb.client.model.ReplaceOptions
|
||||
import net.minecraft.util.WorldSavePath
|
||||
import org.bson.Document
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* A [FileStoreAdapter] for MongoDB. This allows a [PokemonStore] to be serialized to a MongoDB database.
|
||||
*
|
||||
* @author Pebbles
|
||||
* @since August 23rd, 2023
|
||||
*/
|
||||
open class MongoDBStoreAdapter(
|
||||
private val mongoClient: MongoClient,
|
||||
private val databaseName: String,
|
||||
) : CobblemonAdapterParent<JsonObject>(), FileStoreAdapter<JsonObject> {
|
||||
private fun getCollection(storeClass: Class<out PokemonStore<*>>): MongoCollection<Document> {
|
||||
val collectionName = when (storeClass) {
|
||||
PlayerPartyStore::class.java -> "PlayerPartyCollection"
|
||||
PCStore::class.java -> "PCCollection"
|
||||
else -> "OtherCollection"
|
||||
}
|
||||
return mongoClient.getDatabase(databaseName).getCollection(collectionName)
|
||||
}
|
||||
|
||||
private val gson: Gson = Gson()
|
||||
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> serialize(store: T): JsonObject {
|
||||
return store.saveToJSON(JsonObject())
|
||||
}
|
||||
|
||||
override fun save(storeClass: Class<out PokemonStore<*>>, uuid: UUID, serialized: JsonObject) {
|
||||
val document = Document.parse(gson.toJson(serialized))
|
||||
document.put("uuid", uuid.toString())
|
||||
|
||||
val collection = getCollection(storeClass)
|
||||
val filter = Document("uuid", uuid.toString())
|
||||
collection.replaceOne(filter, document, ReplaceOptions().upsert(true))
|
||||
}
|
||||
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> provide(storeClass: Class<T>, uuid: UUID): T? {
|
||||
val server = server()!!
|
||||
val pokemonStoreRoot = server.getSavePath(WorldSavePath.ROOT).resolve("pokemon").toFile()
|
||||
val jsonAdapter = JSONStoreAdapter(
|
||||
pokemonStoreRoot.absolutePath,
|
||||
useNestedFolders = true,
|
||||
folderPerClass = true
|
||||
)
|
||||
val nbtAdapter = NBTStoreAdapter(pokemonStoreRoot.absolutePath, useNestedFolders = true, folderPerClass = true)
|
||||
|
||||
// 1. Check if data exists in MongoDB
|
||||
val collection = getCollection(storeClass)
|
||||
val filter = Document("uuid", uuid.toString())
|
||||
val document = collection.find(filter).first()
|
||||
|
||||
if (document != null) {
|
||||
val json = gson.fromJson(document.toJson(), JsonObject::class.java)
|
||||
val store = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
store.loadFromJSON(json)
|
||||
return store
|
||||
}
|
||||
|
||||
// 2. Fallback to checking JSON and NBT
|
||||
val nbtStore = nbtAdapter.provide(storeClass, uuid)
|
||||
if (nbtStore != null) {
|
||||
save(storeClass, uuid, serialize(nbtStore))
|
||||
return nbtStore
|
||||
}
|
||||
|
||||
val jsonStore = jsonAdapter.provide(storeClass, uuid)
|
||||
if (jsonStore != null) {
|
||||
save(storeClass, uuid, serialize(jsonStore))
|
||||
return jsonStore
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatifle
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatfile
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatifle
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatfile
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatifle
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatfile
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatifle
|
||||
package com.cobblemon.mod.common.api.storage.adapter.flatfile
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon.LOGGER
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
+2
-2
@@ -14,7 +14,7 @@ import com.cobblemon.mod.common.api.reactive.Observable.Companion.emitWhile
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
import com.cobblemon.mod.common.api.storage.adapter.SerializedStore
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatifle.FileStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.adapter.flatfile.FileStoreAdapter
|
||||
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
|
||||
import com.cobblemon.mod.common.api.storage.pc.PCStore
|
||||
import com.cobblemon.mod.common.platform.events.PlatformEvents
|
||||
@@ -123,7 +123,7 @@ open class FileBackedPokemonStoreFactory<S>(
|
||||
}
|
||||
|
||||
override fun onPlayerDisconnect(playerID: UUID) {
|
||||
dirtyStores.find { it.uuid == playerID }?.let { save(it) }
|
||||
dirtyStores.filter { it.uuid == playerID }.forEach(::save)
|
||||
storeCaches.forEach { (_, cache) -> cache.cacheMap.remove(playerID) }
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
|
||||
import com.cobblemon.mod.common.api.reactive.Observable
|
||||
import com.cobblemon.mod.common.api.reactive.Observable.Companion.stopAfter
|
||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
|
||||
import com.cobblemon.mod.common.api.storage.PokemonStore
|
||||
import com.cobblemon.mod.common.api.storage.StoreCoordinates
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
@@ -168,8 +169,12 @@ open class PartyStore(override val uuid: UUID) : PokemonStore<PartyPosition>() {
|
||||
while (slotCount < slots.size) { slots.add(null) }
|
||||
for (slot in slots.indices) {
|
||||
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + slot)
|
||||
if (!pokemonNBT.isEmpty) {
|
||||
slots[slot] = Pokemon().loadFromNBT(pokemonNBT)
|
||||
try {
|
||||
if (!pokemonNBT.isEmpty) {
|
||||
slots[slot] = Pokemon().loadFromNBT(pokemonNBT)
|
||||
}
|
||||
} catch (_: InvalidSpeciesException) {
|
||||
handleInvalidSpeciesNBT(pokemonNBT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +201,12 @@ open class PartyStore(override val uuid: UUID) : PokemonStore<PartyPosition>() {
|
||||
for (slot in slots.indices) {
|
||||
val key = DataKeys.STORE_SLOT + slot
|
||||
if (json.has(key)) {
|
||||
slots[slot] = Pokemon().loadFromJSON(json.get(key).asJsonObject)
|
||||
val pokemonJSON = json.get(key).asJsonObject
|
||||
try {
|
||||
slots[slot] = Pokemon().loadFromJSON(pokemonJSON)
|
||||
} catch (_: InvalidSpeciesException) {
|
||||
handleInvalidSpeciesJSON(pokemonJSON)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.api.storage.pc
|
||||
|
||||
import com.cobblemon.mod.common.api.reactive.Observable.Companion.stopAfter
|
||||
import com.cobblemon.mod.common.api.reactive.SimpleObservable
|
||||
import com.cobblemon.mod.common.api.storage.InvalidSpeciesException
|
||||
import com.cobblemon.mod.common.api.storage.StoreCoordinates
|
||||
import com.cobblemon.mod.common.net.messages.client.storage.pc.SetPCBoxPokemonPacket
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
@@ -120,7 +121,12 @@ open class PCBox(val pc: PCStore) : Iterable<Pokemon> {
|
||||
open fun loadFromJSON(json: JsonObject): PCBox {
|
||||
for (slot in 0 until POKEMON_PER_BOX) {
|
||||
if (json.has(DataKeys.STORE_SLOT + slot)) {
|
||||
pokemon[slot] = Pokemon().loadFromJSON(json.getAsJsonObject(DataKeys.STORE_SLOT + slot))
|
||||
val pokemonJson = json.getAsJsonObject(DataKeys.STORE_SLOT + slot)
|
||||
try {
|
||||
pokemon[slot] = Pokemon().loadFromJSON(pokemonJson)
|
||||
} catch (_: InvalidSpeciesException) {
|
||||
pc.handleInvalidSpeciesJSON(pokemonJson)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
@@ -129,7 +135,12 @@ open class PCBox(val pc: PCStore) : Iterable<Pokemon> {
|
||||
open fun loadFromNBT(nbt: NbtCompound): PCBox {
|
||||
for (slot in 0 until POKEMON_PER_BOX) {
|
||||
if (nbt.contains(DataKeys.STORE_SLOT + slot)) {
|
||||
pokemon[slot] = Pokemon().loadFromNBT(nbt.getCompound(DataKeys.STORE_SLOT + slot))
|
||||
val pokemonNBT = nbt.getCompound(DataKeys.STORE_SLOT + slot)
|
||||
try {
|
||||
pokemon[slot] = Pokemon().loadFromNBT(pokemonNBT)
|
||||
} catch (_: InvalidSpeciesException) {
|
||||
pc.handleInvalidSpeciesNBT(pokemonNBT)
|
||||
}
|
||||
}
|
||||
}
|
||||
return this
|
||||
|
||||
+35
@@ -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.api.storage.player
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
|
||||
/**
|
||||
* A dummy implementation of the [PlayerDataExtension] interface.
|
||||
* Used for when a previous [PlayerDataExtension] is no longer registered.
|
||||
*
|
||||
* @author Deltric
|
||||
* @since 2023-10-01
|
||||
*/
|
||||
class DummyPlayerDataExtension(
|
||||
val json: JsonObject
|
||||
): PlayerDataExtension {
|
||||
|
||||
override fun name(): String {
|
||||
return this.json.get(PlayerDataExtension.NAME_KEY).asString
|
||||
}
|
||||
|
||||
override fun serialize(): JsonObject {
|
||||
return this.json
|
||||
}
|
||||
|
||||
override fun deserialize(json: JsonObject): PlayerDataExtension {
|
||||
return DummyPlayerDataExtension(json)
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.storage.player.adapter
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerAdvancementData
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerData
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtension
|
||||
import com.cobblemon.mod.common.util.adapters.IdentifierAdapter
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.mongodb.client.MongoClient
|
||||
import com.mongodb.client.model.ReplaceOptions
|
||||
import net.minecraft.util.Identifier
|
||||
import org.bson.Document
|
||||
import java.util.UUID
|
||||
import kotlin.reflect.KMutableProperty
|
||||
import kotlin.reflect.full.memberProperties
|
||||
|
||||
class MongoPlayerDataAdapter(
|
||||
mongoClient: MongoClient,
|
||||
databaseName: String
|
||||
) : PlayerDataStoreAdapter {
|
||||
|
||||
companion object {
|
||||
val gson = GsonBuilder()
|
||||
.disableHtmlEscaping()
|
||||
.registerTypeAdapter(PlayerDataExtension::class.java, PlayerDataExtensionAdapter)
|
||||
.registerTypeAdapter(Identifier::class.java, IdentifierAdapter)
|
||||
.create()
|
||||
}
|
||||
|
||||
private val collection = mongoClient.getDatabase(databaseName).getCollection("PlayerDataCollection")
|
||||
|
||||
override fun load(uuid: UUID): PlayerData {
|
||||
val filter = Document("uuid", uuid.toString())
|
||||
val document = collection.find(filter).first()
|
||||
|
||||
return if (document != null) {
|
||||
val jsonStr = document.toJson()
|
||||
gson.fromJson(jsonStr, PlayerData::class.java).also {
|
||||
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
|
||||
if (newProps.isNotEmpty()) {
|
||||
val defaultData = PlayerData.defaultData(uuid)
|
||||
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PlayerData.defaultData(uuid).also(::save)
|
||||
}
|
||||
}
|
||||
|
||||
override fun save(playerData: PlayerData) {
|
||||
val jsonStr = gson.toJson(playerData)
|
||||
val document = Document.parse(jsonStr)
|
||||
document.put("uuid", playerData.uuid.toString())
|
||||
val filter = Document("uuid", playerData.uuid.toString())
|
||||
|
||||
collection.replaceOne(filter, document, ReplaceOptions().upsert(true))
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -8,6 +8,8 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.player.adapter
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.storage.player.DummyPlayerDataExtension
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtension
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerDataExtensionRegistry
|
||||
import com.google.gson.JsonDeserializationContext
|
||||
@@ -34,7 +36,13 @@ object PlayerDataExtensionAdapter: JsonSerializer<PlayerDataExtension>, JsonDese
|
||||
val jObject = json.asJsonObject
|
||||
val name = jObject.get(PlayerDataExtension.NAME_KEY)
|
||||
?: throw IllegalStateException("PlayerDataExtension without name")
|
||||
val extension = PlayerDataExtensionRegistry.getOrException(name.asString)
|
||||
return extension.getDeclaredConstructor().newInstance().deserialize(jObject)
|
||||
val extension = PlayerDataExtensionRegistry.get(name.asString)
|
||||
|
||||
return if (extension != null) {
|
||||
extension.getDeclaredConstructor().newInstance().deserialize(jObject)
|
||||
} else {
|
||||
Cobblemon.LOGGER.info("No PlayerDataExtension registered with name ${name.asString}, loading data with a dummy extension.")
|
||||
DummyPlayerDataExtension(jObject)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -26,7 +26,7 @@ class JsonPlayerDataStoreFactory : PlayerDataStoreFactory {
|
||||
}
|
||||
|
||||
override fun load(uuid: UUID): PlayerData {
|
||||
return if(cache.contains(uuid))
|
||||
return if (cache.contains(uuid))
|
||||
cache[uuid]!!;
|
||||
else {
|
||||
val data = adapter.load(uuid);
|
||||
@@ -40,7 +40,7 @@ class JsonPlayerDataStoreFactory : PlayerDataStoreFactory {
|
||||
}
|
||||
|
||||
override fun saveAll() {
|
||||
cache.forEach { (_, pd) -> adapter.save(pd)}
|
||||
cache.forEach { (_, pd) -> adapter.save(pd) }
|
||||
cache.removeIf { (uuid, _) -> uuid.getPlayer() == null }
|
||||
}
|
||||
|
||||
|
||||
+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.api.storage.player.factory
|
||||
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerData
|
||||
import com.cobblemon.mod.common.api.storage.player.adapter.MongoPlayerDataAdapter
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
import com.cobblemon.mod.common.util.removeIf
|
||||
import com.mongodb.client.MongoClient
|
||||
import java.util.UUID
|
||||
|
||||
class MongoPlayerDataStoreFactory(mongoClient: MongoClient, databaseName: String) : PlayerDataStoreFactory {
|
||||
|
||||
private val cache = mutableMapOf<UUID, PlayerData>()
|
||||
private val adapter = MongoPlayerDataAdapter(mongoClient, databaseName)
|
||||
|
||||
override fun load(uuid: UUID): PlayerData {
|
||||
return if (cache.contains(uuid))
|
||||
cache[uuid]!!;
|
||||
else {
|
||||
val data = adapter.load(uuid);
|
||||
cache[uuid] = data
|
||||
data
|
||||
}
|
||||
}
|
||||
|
||||
override fun save(data: PlayerData) {
|
||||
adapter.save(data)
|
||||
}
|
||||
|
||||
override fun saveAll() {
|
||||
cache.forEach { (_, pd) -> adapter.save(pd) }
|
||||
cache.removeIf { (uuid, _) -> uuid.getPlayer() == null }
|
||||
}
|
||||
|
||||
override fun onPlayerDisconnect(uuid: UUID) {
|
||||
cache.remove(uuid)
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import net.minecraft.registry.tag.TagKey
|
||||
object CobblemonBiomeTags {
|
||||
|
||||
@JvmField
|
||||
val IS_ABYSS = create("is_abyss")
|
||||
val IS_DEEP_DARK = create("is_deep_dark")
|
||||
@JvmField
|
||||
val IS_ARID = create("is_arid")
|
||||
@JvmField
|
||||
@@ -38,7 +38,7 @@ object CobblemonBiomeTags {
|
||||
@JvmField
|
||||
val IS_COLD = create("is_cold")
|
||||
@JvmField
|
||||
val IS_DEEP = create("is_deep")
|
||||
val IS_DEEP_OCEAN = create("is_deep_ocean")
|
||||
@JvmField
|
||||
val IS_DESERT = create("is_desert")
|
||||
@JvmField
|
||||
@@ -52,9 +52,9 @@ object CobblemonBiomeTags {
|
||||
@JvmField
|
||||
val IS_FRESHWATER = create("is_freshwater")
|
||||
@JvmField
|
||||
val IS_FRIGID = create("is_frigid")
|
||||
val IS_COLD_OCEAN = create("is_cold_ocean")
|
||||
@JvmField
|
||||
val IS_FROZEN = create("is_frozen")
|
||||
val IS_FROZEN_OCEAN = create("is_frozen_ocean")
|
||||
@JvmField
|
||||
val IS_GLACIAL = create("is_glacial")
|
||||
@JvmField
|
||||
@@ -68,7 +68,7 @@ object CobblemonBiomeTags {
|
||||
@JvmField
|
||||
val IS_JUNGLE = create("is_jungle")
|
||||
@JvmField
|
||||
val IS_LUKEWARM = create("is_lukewarm")
|
||||
val IS_LUKEWARM_OCEAN = create("is_lukewarm_ocean")
|
||||
@JvmField
|
||||
val IS_LUSH = create("is_lush")
|
||||
@JvmField
|
||||
@@ -86,7 +86,7 @@ object CobblemonBiomeTags {
|
||||
@JvmField
|
||||
val IS_PLATEAU = create("is_plateau")
|
||||
@JvmField
|
||||
val IS_REEF = create("is_reef")
|
||||
val IS_WARM_OCEAN = create("is_warm_ocean")
|
||||
@JvmField
|
||||
val IS_RIVER = create("is_river")
|
||||
@JvmField
|
||||
@@ -96,7 +96,7 @@ object CobblemonBiomeTags {
|
||||
@JvmField
|
||||
val IS_SKY = create("is_sky")
|
||||
@JvmField
|
||||
val IS_SNOWY = create("is_snowy")
|
||||
val IS_SNOWY_FOREST = create("is_snowy_forest")
|
||||
@JvmField
|
||||
val IS_SPOOKY = create("is_spooky")
|
||||
@JvmField
|
||||
|
||||
@@ -66,7 +66,7 @@ object BattleBuilder {
|
||||
CobblemonEvents.BATTLE_STARTED_PRE.postThen(
|
||||
BattleStartedPreEvent(listOf(player1Actor, player2Actor), battleFormat, true, false, false))
|
||||
{
|
||||
SuccessfulBattleStart(
|
||||
return SuccessfulBattleStart(
|
||||
BattleRegistry.startBattle(
|
||||
battleFormat = battleFormat,
|
||||
side1 = BattleSide(player1Actor),
|
||||
@@ -136,7 +136,7 @@ object BattleBuilder {
|
||||
if (!cloneParties) {
|
||||
pokemonEntity.battleId.set(Optional.of(battle.battleId))
|
||||
}
|
||||
SuccessfulBattleStart(battle)
|
||||
return SuccessfulBattleStart(battle)
|
||||
}
|
||||
errors
|
||||
} else {
|
||||
|
||||
@@ -690,7 +690,7 @@ object ShowdownInterpreter {
|
||||
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
|
||||
val name = pokemon.getName()
|
||||
// Move may be null as it's not always given
|
||||
val moveName = message.argumentAt(2)?.let { Moves.getByName(it)?.displayName } ?: Text.EMPTY
|
||||
val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() }
|
||||
|
||||
val lang = when (effectID) {
|
||||
// TODO: in the games they use a generic image because there is a popup of the ability and the sprite of the mon, it may be good to have a similar system here
|
||||
@@ -962,7 +962,7 @@ object ShowdownInterpreter {
|
||||
}
|
||||
// Includes revealed move
|
||||
"forewarn" -> {
|
||||
val moveName = message.argumentAt(2)?.let { Moves.getByName(it)?.displayName } ?: Text.EMPTY
|
||||
val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() }
|
||||
battleLang("activate.forewarn", sourceName, moveName)
|
||||
}
|
||||
"focussash", "focusband" -> battleLang("activate.focusband", pokemonName, message.effectAt(1)!!.typelessData)
|
||||
@@ -1545,7 +1545,7 @@ object ShowdownInterpreter {
|
||||
val rawHpAndStatus = privateMessage.argumentAt(1)?.split(" ") ?: return
|
||||
val rawHpRatio = rawHpAndStatus.getOrNull(0) ?: return
|
||||
val newHealth = rawHpRatio.split("/").map { it.toFloatOrNull() ?: return }
|
||||
val newHealthRatio = publicMessage.argumentAt(1)?.split("/")?.map { it.toFloatOrNull() ?: return } ?: return
|
||||
val newHealthRatio = rawHpRatio.split("/").map { it.toFloatOrNull()?.div(100) ?: return }
|
||||
val effect = privateMessage.effect()
|
||||
val pokemonName = battlePokemon.getName()
|
||||
broadcastOptionalAbility(battle, effect, pokemonName)
|
||||
@@ -1553,7 +1553,7 @@ object ShowdownInterpreter {
|
||||
battle.dispatchWaiting {
|
||||
if (pnx != null) {
|
||||
// dynamax changes max health
|
||||
battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, newHealth[0], newHealth[1]), BattleHealthChangePacket(pnx, newHealthRatio[0], newHealthRatio[1]))
|
||||
battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, newHealth[0], newHealth[1]), BattleHealthChangePacket(pnx, newHealthRatio[0]))
|
||||
}
|
||||
val silent = privateMessage.hasOptionalArgument("silent")
|
||||
if (!silent) {
|
||||
|
||||
@@ -67,6 +67,14 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Settings) :
|
||||
*/
|
||||
fun berry(): Berry? = Berries.getByIdentifier(this.berryIdentifier)
|
||||
|
||||
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity) {
|
||||
if (!player.isCreative && state.get(AGE) == FRUIT_AGE) {
|
||||
val treeEntity = world.getBlockEntity(pos) as BerryBlockEntity
|
||||
treeEntity.harvest(world, state, pos, player).forEach { drop -> Block.dropStack(world, pos, drop) }
|
||||
}
|
||||
super.onBreak(world, pos, state, player)
|
||||
}
|
||||
|
||||
override fun createBlockEntity(pos: BlockPos, state: BlockState) = BerryBlockEntity(pos, state, berryIdentifier)
|
||||
|
||||
override fun isFertilizable(world: WorldView, pos: BlockPos, state: BlockState, isClient: Boolean) = !this.isMaxAge(state)
|
||||
@@ -89,8 +97,8 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Settings) :
|
||||
val newState = state.with(AGE, newAge)
|
||||
val treeEntity = world.getBlockEntity(pos) as BerryBlockEntity
|
||||
if (curAge == MATURE_AGE) {
|
||||
determineMutation(world, random, pos, state)
|
||||
treeEntity.generateGrowthPoints(world, state, pos, null)
|
||||
determineMutation(world, random, pos, state)
|
||||
}
|
||||
|
||||
world.setBlockState(pos, newState, Block.NOTIFY_LISTENERS)
|
||||
@@ -148,6 +156,7 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Settings) :
|
||||
setMulch(world, pos, state, variant)
|
||||
treeEntity.mulchDuration = variant.duration
|
||||
world.playSound(null, pos, CobblemonSounds.MULCH_PLACE, SoundCategory.BLOCKS, 0.6F, 1F)
|
||||
treeEntity.refreshTimers(pos)
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
@@ -235,7 +244,7 @@ class BerryBlock(private val berryIdentifier: Identifier, settings: Settings) :
|
||||
|
||||
|
||||
val STANDARD_SPROUT = listOf(Box(0.0, -1.0, 0.0, 16.0, 16.0, 16.0))
|
||||
val STANDARD_MATURE = listOf(Box(0.0, -1.0, 0.0, 16.0, 25.0, 16.0))
|
||||
val STANDARD_MATURE = listOf(Box(0.0, -1.0, 0.0, 16.0, 24.0, 16.0))
|
||||
|
||||
val SHORT_SPROUT = listOf(Box(0.0, -1.0, 0.0, 16.0, 12.0, 16.0))
|
||||
val SHORT_MATURE = listOf(Box(0.0, -1.0, 0.0, 16.0, 16.0, 16.0))
|
||||
|
||||
@@ -39,7 +39,7 @@ class MintBlock(private val mintType: MintType, settings: Settings) : CropBlock(
|
||||
// DO NOT use withAge
|
||||
// Explanation for these 2 beautiful copy pasta are basically that we need to keep the blockstate and that's not possible with the default impl :(
|
||||
override fun randomTick(state: BlockState, world: ServerWorld, pos: BlockPos, random: Random) {
|
||||
if (world.getBaseLightLevel(pos, 0) < 9 || this.isMature(state) || random.nextInt(50) != 0) {
|
||||
if (world.getBaseLightLevel(pos, 0) < 9 || this.isMature(state) || random.nextInt(8) != 0) {
|
||||
return
|
||||
}
|
||||
this.applyGrowth(world, pos, state, false)
|
||||
@@ -139,4 +139,4 @@ class MintBlock(private val mintType: MintType, settings: Settings) : CropBlock(
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,14 @@ import com.cobblemon.mod.common.util.isInBattle
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import com.cobblemon.mod.common.util.playSoundServer
|
||||
import com.cobblemon.mod.common.util.toVec3d
|
||||
import net.minecraft.block.*
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.block.BlockRenderType
|
||||
import net.minecraft.block.BlockState
|
||||
import net.minecraft.block.BlockWithEntity
|
||||
import net.minecraft.block.Blocks
|
||||
import net.minecraft.block.HorizontalFacingBlock
|
||||
import net.minecraft.block.ShapeContext
|
||||
import net.minecraft.block.Waterloggable
|
||||
import net.minecraft.block.entity.BlockEntity
|
||||
import net.minecraft.block.entity.BlockEntityType
|
||||
import net.minecraft.entity.LivingEntity
|
||||
@@ -34,7 +41,11 @@ import net.minecraft.server.network.ServerPlayerEntity
|
||||
import net.minecraft.state.StateManager
|
||||
import net.minecraft.state.property.BooleanProperty
|
||||
import net.minecraft.state.property.EnumProperty
|
||||
import net.minecraft.util.*
|
||||
import net.minecraft.util.ActionResult
|
||||
import net.minecraft.util.BlockMirror
|
||||
import net.minecraft.util.BlockRotation
|
||||
import net.minecraft.util.Hand
|
||||
import net.minecraft.util.StringIdentifiable
|
||||
import net.minecraft.util.hit.BlockHitResult
|
||||
import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.util.math.Direction
|
||||
@@ -43,6 +54,7 @@ import net.minecraft.util.shape.VoxelShapes
|
||||
import net.minecraft.world.BlockView
|
||||
import net.minecraft.world.World
|
||||
import net.minecraft.world.WorldAccess
|
||||
import net.minecraft.world.WorldEvents
|
||||
import net.minecraft.world.WorldView
|
||||
|
||||
class PCBlock(properties: Settings): BlockWithEntity(properties), Waterloggable {
|
||||
@@ -168,15 +180,6 @@ class PCBlock(properties: Settings): BlockWithEntity(properties), Waterloggable
|
||||
|
||||
private fun isBase(state: BlockState): Boolean = state.get(PART) == PCPart.BOTTOM
|
||||
|
||||
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
|
||||
super.onBreak(world, pos, state, player)
|
||||
val otherPart = world.getBlockState(getPositionOfOtherPart(state, pos))
|
||||
if (otherPart.block is PCBlock) {
|
||||
world.setBlockState(getPositionOfOtherPart(state, pos), Blocks.AIR.defaultState, 35)
|
||||
world.syncWorldEvent(player, 2001, getPositionOfOtherPart(state, pos), Block.getRawIdFromState(otherPart))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPlaced(world: World, pos: BlockPos, state: BlockState, placer: LivingEntity?, itemStack: ItemStack?) {
|
||||
world.setBlockState(pos.up(), state
|
||||
.with(PART, PCPart.TOP)
|
||||
@@ -205,6 +208,20 @@ class PCBlock(properties: Settings): BlockWithEntity(properties), Waterloggable
|
||||
return if (state.get(PART) == PCPart.BOTTOM) blockState.isSideSolidFullSquare(world, blockPos, Direction.UP) else blockState.isOf(this)
|
||||
}
|
||||
|
||||
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
|
||||
if (!world.isClient && player?.isCreative == true) {
|
||||
var blockPos: BlockPos = BlockPos.ORIGIN
|
||||
var blockState: BlockState = state
|
||||
val part = state.get(PART)
|
||||
if (part == PCPart.TOP && world.getBlockState(pos.down().also { blockPos = it }).also { blockState = it }.isOf(state.block) && blockState.get(PART) == PCPart.BOTTOM) {
|
||||
val blockState2 = if (blockState.fluidState.isOf(Fluids.WATER)) Blocks.WATER.defaultState else Blocks.AIR.defaultState
|
||||
world.setBlockState(blockPos, blockState2, NOTIFY_ALL or SKIP_DROPS)
|
||||
world.syncWorldEvent(player, WorldEvents.BLOCK_BROKEN, blockPos, getRawIdFromState(blockState))
|
||||
}
|
||||
}
|
||||
super.onBreak(world, pos, state, player)
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun canPathfindThrough(blockState: BlockState, blockGetter: BlockView, blockPos: BlockPos, pathComputationType: NavigationType) = false
|
||||
|
||||
@@ -281,15 +298,24 @@ class PCBlock(properties: Settings): BlockWithEntity(properties), Waterloggable
|
||||
|
||||
override fun getStateForNeighborUpdate(
|
||||
state: BlockState,
|
||||
direction: Direction?,
|
||||
neighborState: BlockState?,
|
||||
direction: Direction,
|
||||
neighborState: BlockState,
|
||||
world: WorldAccess,
|
||||
pos: BlockPos?,
|
||||
neighborPos: BlockPos?
|
||||
): BlockState? {
|
||||
pos: BlockPos,
|
||||
neighborPos: BlockPos
|
||||
): BlockState {
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world))
|
||||
}
|
||||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos)
|
||||
|
||||
val isPC = neighborState.isOf(this)
|
||||
val part = state.get(PART)
|
||||
if (!isPC && part == PCPart.TOP && neighborPos == pos.down()) {
|
||||
return Blocks.AIR.defaultState
|
||||
} else if (!isPC && part == PCPart.BOTTOM && neighborPos == pos.up()) {
|
||||
return Blocks.AIR.defaultState
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
}
|
||||
@@ -58,8 +58,8 @@ import net.minecraft.util.shape.VoxelShapes
|
||||
import net.minecraft.world.BlockView
|
||||
import net.minecraft.world.World
|
||||
import net.minecraft.world.WorldAccess
|
||||
import net.minecraft.world.WorldEvents
|
||||
import net.minecraft.world.WorldView
|
||||
import net.minecraft.world.explosion.Explosion
|
||||
|
||||
@Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
|
||||
class PastureBlock(properties: Settings): BlockWithEntity(properties), Waterloggable, PreEmptsExplosion {
|
||||
@@ -180,23 +180,34 @@ class PastureBlock(properties: Settings): BlockWithEntity(properties), Waterlogg
|
||||
builder.add(WATERLOGGED)
|
||||
}
|
||||
|
||||
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
|
||||
super.onBreak(world, pos, state, player)
|
||||
val otherPart = world.getBlockState(getPositionOfOtherPart(state, pos))
|
||||
if (otherPart.block is PastureBlock) {
|
||||
world.setBlockState(getPositionOfOtherPart(state, pos), Blocks.AIR.defaultState, 35)
|
||||
world.syncWorldEvent(player, 2001, getPositionOfOtherPart(state, pos), Block.getRawIdFromState(otherPart))
|
||||
fun checkBreakEntity(world: WorldAccess, state: BlockState, pos: BlockPos) {
|
||||
if (state.get(PART) == PasturePart.TOP) {
|
||||
return
|
||||
}
|
||||
val blockEntity = world.getBlockEntity(pos)
|
||||
if (blockEntity is PokemonPastureBlockEntity) {
|
||||
blockEntity.onBroken()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBroken(world: WorldAccess, pos: BlockPos, state: BlockState) {
|
||||
val blockEntity = world.getBlockEntity(pos) as? PokemonPastureBlockEntity ?: return
|
||||
super.onBroken(world, pos, state)
|
||||
blockEntity.onBroken()
|
||||
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
|
||||
checkBreakEntity(world, state, pos)
|
||||
if (!world.isClient && player?.isCreative == true) {
|
||||
var blockPos: BlockPos = BlockPos.ORIGIN
|
||||
var blockState: BlockState = state
|
||||
val part = state.get(PART)
|
||||
if (part == PasturePart.TOP && world.getBlockState(pos.down().also { blockPos = it }).also { blockState = it }.isOf(state.block) && blockState.get(PART) == PasturePart.BOTTOM) {
|
||||
checkBreakEntity(world, blockState, blockPos)
|
||||
val blockState2 = if (blockState.fluidState.isOf(Fluids.WATER)) Blocks.WATER.defaultState else Blocks.AIR.defaultState
|
||||
world.setBlockState(blockPos, blockState2, NOTIFY_ALL or SKIP_DROPS)
|
||||
world.syncWorldEvent(player, WorldEvents.BLOCK_BROKEN, blockPos, getRawIdFromState(blockState))
|
||||
}
|
||||
}
|
||||
super.onBreak(world, pos, state, player)
|
||||
}
|
||||
|
||||
override fun whenExploded(world: World?, state: BlockState, pos: BlockPos?) {
|
||||
val blockEntity = world?.getBlockEntity(pos) as? PokemonPastureBlockEntity ?: return
|
||||
override fun whenExploded(world: World, state: BlockState, pos: BlockPos) {
|
||||
val blockEntity = world.getBlockEntity(pos) as? PokemonPastureBlockEntity ?: return
|
||||
blockEntity.onBroken()
|
||||
}
|
||||
|
||||
@@ -307,16 +318,25 @@ class PastureBlock(properties: Settings): BlockWithEntity(properties), Waterlogg
|
||||
|
||||
override fun getStateForNeighborUpdate(
|
||||
state: BlockState,
|
||||
direction: Direction?,
|
||||
neighborState: BlockState?,
|
||||
direction: Direction,
|
||||
neighborState: BlockState,
|
||||
world: WorldAccess,
|
||||
pos: BlockPos?,
|
||||
neighborPos: BlockPos?
|
||||
): BlockState? {
|
||||
pos: BlockPos,
|
||||
neighborPos: BlockPos
|
||||
): BlockState {
|
||||
if (state.get(WATERLOGGED)) {
|
||||
world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world))
|
||||
}
|
||||
return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos)
|
||||
}
|
||||
|
||||
val isPasture = neighborState.isOf(this)
|
||||
val part = state.get(PART)
|
||||
if (!isPasture && part == PasturePart.TOP && neighborPos == pos.down()) {
|
||||
return Blocks.AIR.defaultState
|
||||
} else if (!isPasture && part == PasturePart.BOTTOM && neighborPos == pos.up()) {
|
||||
checkBreakEntity(world, state, pos)
|
||||
return Blocks.AIR.defaultState
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,5 @@ import net.minecraft.util.math.BlockPos
|
||||
import net.minecraft.world.World
|
||||
|
||||
interface PreEmptsExplosion {
|
||||
fun whenExploded(world: World?, state: BlockState, pos: BlockPos?)
|
||||
fun whenExploded(world: World, state: BlockState, pos: BlockPos)
|
||||
}
|
||||
@@ -56,9 +56,6 @@ class BerryBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobblemon
|
||||
//The time left for the tree to grow to the next stage
|
||||
var stageTimer: Int = growthTimer / BerryBlock.MATURE_AGE
|
||||
set(value) {
|
||||
if (value < 0) {
|
||||
throw IllegalArgumentException("You cannot set the stage growth time to less than zero")
|
||||
}
|
||||
if (field != value) {
|
||||
this.markDirty()
|
||||
}
|
||||
@@ -111,23 +108,18 @@ class BerryBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobblemon
|
||||
|
||||
fun resetGrowTimers(pos: BlockPos, state: BlockState) {
|
||||
val curAge = state.get(BerryBlock.AGE)
|
||||
if (curAge != 5) {
|
||||
val berry = Berries.getByIdentifier(berryIdentifier)!!
|
||||
var multiplier = 10
|
||||
val world = world
|
||||
if (world != null && world.getBlockState(pos).block is BerryBlock) {
|
||||
if (getMulch(state) == MulchVariant.GROWTH) {
|
||||
decrementMulchDuration(world, pos, state)
|
||||
}
|
||||
multiplier = 15
|
||||
}
|
||||
val upperGrowthLimit = ((if (curAge == 0) berry.growthTime.last else berry.refreshRate.last) * multiplier) / 10
|
||||
val lowerGrowthLimit = ((if (curAge == 0) berry.growthTime.first else berry.refreshRate.first) * multiplier) / 10
|
||||
val growthRange = lowerGrowthLimit..upperGrowthLimit
|
||||
growthTimer = growthRange.random() * ticksPerMinute
|
||||
|
||||
goToNextStageTimer(BerryBlock.FRUIT_AGE - curAge)
|
||||
if (curAge == 5) {
|
||||
return
|
||||
}
|
||||
|
||||
val multiplier = 14
|
||||
val berry = Berries.getByIdentifier(berryIdentifier)!!
|
||||
val lowerGrowthLimit = (if (curAge == 0) berry.growthTime.first else berry.refreshRate.first) * multiplier / 10
|
||||
val upperGrowthLimit = (if (curAge == 0) berry.growthTime.last else berry.refreshRate.last) * multiplier / 10
|
||||
val growthRange = lowerGrowthLimit..upperGrowthLimit
|
||||
|
||||
this.growthTimer = this.applyMulchModifier(pos, growthRange.random() * ticksPerMinute)
|
||||
this.goToNextStageTimer(BerryBlock.FRUIT_AGE - curAge)
|
||||
}
|
||||
|
||||
fun goToNextStageTimer(stagesLeft: Int) {
|
||||
@@ -137,6 +129,37 @@ class BerryBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobblemon
|
||||
growthTimer -= stageTimer
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to apply an effect to the growth timer based on the mulch type.
|
||||
* Currently only used for growth mulch.
|
||||
* @param pos The position of the block
|
||||
* @param timer Timer to be modified
|
||||
* @return The modified timer
|
||||
*/
|
||||
private fun applyMulchModifier(pos: BlockPos, timer: Int): Int {
|
||||
val state = world?.getBlockState(pos) ?: return timer
|
||||
|
||||
val curAge = state.get(BerryBlock.AGE)
|
||||
if (curAge == 5) {
|
||||
return timer
|
||||
}
|
||||
|
||||
if (getMulch(state) != MulchVariant.GROWTH) {
|
||||
return timer
|
||||
}
|
||||
|
||||
return (timer * 0.66).toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to refresh the timers when a new mulch is applied.
|
||||
* @param pos The position of the block
|
||||
*/
|
||||
fun refreshTimers(pos: BlockPos) {
|
||||
this.growthTimer = this.applyMulchModifier(pos, growthTimer)
|
||||
this.stageTimer = this.applyMulchModifier(pos, stageTimer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [Berry] behind this entity,
|
||||
* This will be null if it doesn't exist in the [Berries] registry.
|
||||
@@ -286,7 +309,6 @@ class BerryBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobblemon
|
||||
val newState = state.with(BerryBlock.AGE, 3)
|
||||
world.setBlockState(pos, newState, Block.NOTIFY_LISTENERS)
|
||||
world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos)
|
||||
this.generateGrowthPoints(world, newState, pos, player)
|
||||
resetGrowTimers(pos, newState)
|
||||
return
|
||||
}
|
||||
@@ -294,7 +316,7 @@ class BerryBlockEntity(pos: BlockPos, state: BlockState) : BlockEntity(Cobblemon
|
||||
companion object {
|
||||
internal val TICKER = BlockEntityTicker<BerryBlockEntity> { world, pos, state, blockEntity ->
|
||||
if (world.isClient) return@BlockEntityTicker
|
||||
if (blockEntity.stageTimer > 0) {
|
||||
if (blockEntity.stageTimer >= 0) {
|
||||
blockEntity.stageTimer--
|
||||
}
|
||||
if (blockEntity.stageTimer == 0) {
|
||||
|
||||
@@ -15,8 +15,8 @@ import com.cobblemon.mod.common.api.text.gray
|
||||
import com.cobblemon.mod.common.client.battle.ClientBattle
|
||||
import com.cobblemon.mod.common.client.gui.PartyOverlay
|
||||
import com.cobblemon.mod.common.client.gui.battle.BattleOverlay
|
||||
import com.cobblemon.mod.common.client.render.block.BerryBlockRenderer
|
||||
import com.cobblemon.mod.common.client.particle.BedrockParticleEffectRepository
|
||||
import com.cobblemon.mod.common.client.render.block.BerryBlockRenderer
|
||||
import com.cobblemon.mod.common.client.render.block.HealingMachineRenderer
|
||||
import com.cobblemon.mod.common.client.render.item.CobblemonBuiltinItemRendererRegistry
|
||||
import com.cobblemon.mod.common.client.render.item.PokemonItemRenderer
|
||||
@@ -31,16 +31,10 @@ import com.cobblemon.mod.common.client.storage.ClientStorageManager
|
||||
import com.cobblemon.mod.common.client.trade.ClientTrade
|
||||
import com.cobblemon.mod.common.data.CobblemonDataProvider
|
||||
import com.cobblemon.mod.common.item.PokeBallItem
|
||||
import com.cobblemon.mod.common.block.entity.BerryBlockEntity
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository
|
||||
import com.cobblemon.mod.common.platform.events.PlatformEvents
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import java.awt.Color
|
||||
import net.minecraft.client.color.block.BlockColorProvider
|
||||
import net.minecraft.client.color.block.BlockColors
|
||||
import net.minecraft.client.color.item.ItemColorProvider
|
||||
import net.minecraft.client.color.world.BiomeColors
|
||||
import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.client.render.RenderLayer
|
||||
import net.minecraft.client.render.entity.EntityRenderer
|
||||
@@ -93,7 +87,8 @@ object CobblemonClient {
|
||||
this.implementation.registerBlockEntityRenderer(CobblemonBlockEntities.BERRY, ::BerryBlockRenderer)
|
||||
|
||||
registerBlockRenderTypes()
|
||||
registerColors()
|
||||
//registerColors()
|
||||
registerFlywheelRenderers()
|
||||
|
||||
LOGGER.info("Registering custom BuiltinItemRenderers")
|
||||
CobblemonBuiltinItemRendererRegistry.register(CobblemonItems.POKEMON_MODEL, PokemonItemRenderer())
|
||||
@@ -121,6 +116,15 @@ object CobblemonClient {
|
||||
}
|
||||
}
|
||||
|
||||
fun registerFlywheelRenderers() {
|
||||
// InstancedRenderRegistry
|
||||
// .configure(CobblemonBlockEntities.BERRY)
|
||||
// .alwaysSkipRender()
|
||||
// .factory(::BerryEntityInstance)
|
||||
// .apply()
|
||||
}
|
||||
|
||||
/*
|
||||
fun registerColors() {
|
||||
this.implementation.registerBlockColors(BlockColorProvider { _, _, _, _ ->
|
||||
return@BlockColorProvider 0xE0A33A
|
||||
@@ -129,6 +133,7 @@ object CobblemonClient {
|
||||
return@ItemColorProvider 0xE0A33A
|
||||
}, CobblemonItems.APRICORN_LEAVES)
|
||||
}
|
||||
*/
|
||||
|
||||
private fun registerBlockRenderTypes() {
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.cobblemon.mod.common.CobblemonNetwork
|
||||
import com.cobblemon.mod.common.battles.BattleFormat
|
||||
import com.cobblemon.mod.common.net.messages.server.battle.BattleSelectActionsPacket
|
||||
import java.util.UUID
|
||||
|
||||
class ClientBattle(
|
||||
val battleId: UUID,
|
||||
val battleFormat: BattleFormat
|
||||
@@ -50,4 +51,8 @@ class ClientBattle(
|
||||
?: throw IllegalStateException("Invalid pnx: $pnx - unknown pokemon")
|
||||
return actor to pokemon
|
||||
}
|
||||
|
||||
fun getParticipatingActor(uuid: UUID): ClientBattleActor? {
|
||||
return sides.flatMap { it.actors }.find { it.uuid == uuid }
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.api.scheduling.after
|
||||
import com.cobblemon.mod.common.api.scheduling.lerp
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.additives.EarBounceAdditive
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.StatefulAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPoseableModel
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
@@ -46,6 +47,9 @@ class PokemonClientDelegate : PoseableEntityState<PokemonEntity>(), PokemonSideD
|
||||
|
||||
private val minimumFallSpeed = -0.1F
|
||||
private val intensityVelocityCap = -0.5F
|
||||
|
||||
private var cryAnimation: StatefulAnimation<PokemonEntity, *>? = null
|
||||
|
||||
override fun changePokemon(pokemon: Pokemon) {
|
||||
pokemon.isClient = true
|
||||
currentEntity.subscriptions.add(currentEntity.species.subscribeIncludingCurrent {
|
||||
@@ -148,8 +152,13 @@ class PokemonClientDelegate : PoseableEntityState<PokemonEntity>(), PokemonSideD
|
||||
fun cry() {
|
||||
val model = currentModel ?: return
|
||||
if (model is PokemonPoseableModel) {
|
||||
if (cryAnimation != null && cryAnimation in statefulAnimations) {
|
||||
return
|
||||
}
|
||||
|
||||
val animation = model.cryAnimation(currentEntity, this) ?: return
|
||||
statefulAnimations.add(animation)
|
||||
cryAnimation = animation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,10 +52,10 @@ fun drawProfilePokemon(
|
||||
scale: Float = 20F
|
||||
) {
|
||||
val model = PokemonModelRepository.getPoser(species, aspects)
|
||||
val texture = PokemonModelRepository.getTexture(species, aspects, state)
|
||||
val texture = PokemonModelRepository.getTexture(species, aspects, state?.animationSeconds ?: 0F)
|
||||
|
||||
val context = RenderContext()
|
||||
PokemonModelRepository.variations[species]?.getTexture(aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
|
||||
PokemonModelRepository.getTextureNoSubstitute(species, aspects, 0f).let { it -> context.put(RenderContext.TEXTURE, it) }
|
||||
context.put(RenderContext.SCALE, PokemonSpecies.getByIdentifier(species)!!.getForm(aspects).baseScale)
|
||||
|
||||
val renderType = model.getLayer(texture)
|
||||
|
||||
@@ -387,7 +387,7 @@ class BattleOverlay : InGameHud(MinecraftClient.getInstance(), MinecraftClient.g
|
||||
reversed: Boolean = false
|
||||
) {
|
||||
val model = PokeBallModelRepository.getPoser(state.pokeBall.name, state.aspects)
|
||||
val texture = PokeBallModelRepository.getTexture(state.pokeBall.name, state.aspects, state)
|
||||
val texture = PokeBallModelRepository.getTexture(state.pokeBall.name, state.aspects, state.animationSeconds)
|
||||
val renderType = model.getLayer(texture)
|
||||
|
||||
RenderSystem.applyModelViewMatrix()
|
||||
|
||||
+1
@@ -95,6 +95,7 @@ class PartySelectGUI(
|
||||
x = slotX,
|
||||
y = slotY,
|
||||
pokemon = pokemon.pokemonProperties,
|
||||
aspects = pokemon.aspects,
|
||||
heldItem = pokemon.heldItem,
|
||||
currentHealth = pokemon.currentHealth,
|
||||
maxHealth = pokemon.maxHealth,
|
||||
|
||||
+2
-1
@@ -35,6 +35,7 @@ import org.joml.Vector3f
|
||||
class PartySlotButton(
|
||||
x: Int, y: Int,
|
||||
val pokemon: PokemonProperties,
|
||||
val aspects: Set<String>,
|
||||
val currentHealth: Int,
|
||||
val maxHealth: Int,
|
||||
val heldItem: ItemStack,
|
||||
@@ -54,7 +55,7 @@ class PartySlotButton(
|
||||
|
||||
val state = PokemonFloatingState()
|
||||
|
||||
private val renderablePokemon = pokemon.asRenderablePokemon()
|
||||
private val renderablePokemon = pokemon.asRenderablePokemon().also { it.aspects = aspects }
|
||||
|
||||
override fun render(context: DrawContext, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
hovered = pMouseX >= x && pMouseY >= y && pMouseX < x + width && pMouseY < y + height && enabled
|
||||
|
||||
+3
-1
@@ -40,9 +40,11 @@ fun createPokemonInteractGui(pokemonID: UUID, canMountShoulder: Boolean): Intera
|
||||
}
|
||||
)
|
||||
val options = mutableMapOf(
|
||||
Orientation.TOP_LEFT to mountShoulder,
|
||||
Orientation.TOP_RIGHT to giveItem,
|
||||
)
|
||||
if (canMountShoulder) {
|
||||
options[Orientation.TOP_LEFT] = mountShoulder
|
||||
}
|
||||
return InteractWheelGUI(options, Text.translatable("cobblemon.ui.interact.pokemon"))
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.client.gui.pasture
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonNetwork
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.pasture.PasturePermissions
|
||||
import com.cobblemon.mod.common.api.reactive.SettableObservable
|
||||
import com.cobblemon.mod.common.client.gui.pc.PCGUIConfiguration
|
||||
@@ -27,6 +28,7 @@ class PasturePCGUIConfiguration(
|
||||
selectOverride = { pcGui, position, pokemon ->
|
||||
if (pokemon != null && !pokemon.isFainted() && pokemon.tetheringId == null && permissions.canPasture) {
|
||||
CobblemonNetwork.sendToServer(PasturePokemonPacket(pokemonId = pokemon.uuid, pastureId = pastureId))
|
||||
pcGui.playSound(CobblemonSounds.PC_CLICK)
|
||||
}
|
||||
},
|
||||
canSelect = { pokemon -> !pokemon.isFainted() && pokemon.tetheringId == null }
|
||||
|
||||
+2
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.pasture
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.api.text.text
|
||||
@@ -158,6 +159,7 @@ class PasturePokemonScrollList(
|
||||
xPos = 0,
|
||||
yPos = 0,
|
||||
onPress = {
|
||||
parent.storageWidget.pcGui.playSound(CobblemonSounds.PC_CLICK)
|
||||
UnpasturePokemonPacket(
|
||||
pastureId = parent.pasturePCGUIConfiguration.pastureId,
|
||||
pokemonId = pokemon.pokemonId
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.pasture
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.pc.PCGUI
|
||||
import com.cobblemon.mod.common.client.gui.pc.StorageWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.net.messages.server.pasture.UnpastureAllPokemonPacket
|
||||
@@ -21,6 +23,7 @@ import net.minecraft.client.gui.DrawContext
|
||||
import net.minecraft.text.Text
|
||||
|
||||
class PastureWidget(
|
||||
val storageWidget: StorageWidget,
|
||||
val pasturePCGUIConfiguration: PasturePCGUIConfiguration,
|
||||
x: Int,
|
||||
y: Int
|
||||
@@ -35,6 +38,7 @@ class PastureWidget(
|
||||
x = x + 6,
|
||||
y = y + 153
|
||||
) {
|
||||
storageWidget.pcGui.playSound(CobblemonSounds.PC_CLICK)
|
||||
UnpastureAllPokemonPacket(pasturePCGUIConfiguration.pastureId).sendToServer()
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class StorageWidget(
|
||||
y = y + 124,
|
||||
parent = this,
|
||||
onPress = {
|
||||
if (!displayConfirmRelease) {
|
||||
if (!displayConfirmRelease && canDeleteSelected()) {
|
||||
displayConfirmRelease = true
|
||||
playSound(CobblemonSounds.PC_CLICK)
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class StorageWidget(
|
||||
)
|
||||
|
||||
if (pcGui.configuration is PasturePCGUIConfiguration) {
|
||||
this.pastureWidget = PastureWidget(pcGui.configuration, x + 182, y - 19)
|
||||
this.pastureWidget = PastureWidget(this, pcGui.configuration, x + 182, y - 19)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-35
@@ -31,7 +31,6 @@ class NicknameEntryWidget(
|
||||
private const val MAX_NAME_LENGTH = 12
|
||||
}
|
||||
|
||||
var lastSavedName: String? = null
|
||||
var pokemonName = ""
|
||||
|
||||
init {
|
||||
@@ -43,59 +42,44 @@ class NicknameEntryWidget(
|
||||
if (isFocused) {
|
||||
isFocused = false
|
||||
}
|
||||
|
||||
this.pokemon = pokemon
|
||||
pokemonName = I18n.translate(pokemon.species.translatedName.string)
|
||||
this.lastSavedName = pokemon.nickname?.string
|
||||
setChangedListener {
|
||||
if (it != pokemonName && it.isNotBlank()) {
|
||||
pokemon.nickname = Text.literal(it)
|
||||
this.pokemonName = I18n.translate(pokemon.species.translatedName.string)
|
||||
|
||||
this.setChangedListener {
|
||||
if (it.isNotBlank()) {
|
||||
this.updateNickname(it)
|
||||
} else {
|
||||
pokemon.nickname = null
|
||||
this.updateNickname(pokemonName)
|
||||
}
|
||||
}
|
||||
text = pokemon.getDisplayName().string
|
||||
}
|
||||
|
||||
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
if (mouseX.toInt() in x..(x + width) && mouseY.toInt() in y..(y + height)) {
|
||||
return if (mouseX.toInt() in x..(x + width) && mouseY.toInt() in y..(y + height)) {
|
||||
isFocused = true
|
||||
return true
|
||||
true
|
||||
} else {
|
||||
return false
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun setFocused(focused: Boolean) {
|
||||
super.setFocused(focused)
|
||||
val oldText = text.trim()
|
||||
val pokemonName = I18n.translate(pokemon.species.translatedName.string)
|
||||
text = text.trim().ifBlank { pokemonName }
|
||||
if (!focused) {
|
||||
val newNickname = if (text == pokemonName) null else text
|
||||
updateNickname(oldText, newNickname)
|
||||
this.updateNickname(text)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNickname(oldText: String, newNickname: String?) {
|
||||
if (!(newNickname == null && pokemon.nickname == null)) {
|
||||
|
||||
val pokemonName = I18n.translate(pokemon.species.translatedName.string)
|
||||
val name = if (pokemonName == newNickname) {
|
||||
null
|
||||
} else {
|
||||
newNickname
|
||||
}
|
||||
|
||||
if (name == lastSavedName) {
|
||||
return
|
||||
}
|
||||
|
||||
println("Setting ${pokemon.species.name} nickname to: $name")
|
||||
lastSavedName = name
|
||||
private fun updateNickname(newNickname: String) {
|
||||
if (pokemon.nickname == null || pokemon.nickname?.string != newNickname) {
|
||||
val effectiveNickname = if (newNickname == pokemonName) null else newNickname
|
||||
CobblemonNetwork.sendToServer(
|
||||
SetNicknamePacket(
|
||||
pokemonUUID = pokemon.uuid,
|
||||
nickname = name,
|
||||
nickname = effectiveNickname,
|
||||
isParty = isParty
|
||||
)
|
||||
)
|
||||
@@ -117,10 +101,7 @@ class NicknameEntryWidget(
|
||||
|
||||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
||||
if (keyCode == InputUtil.GLFW_KEY_ESCAPE) {
|
||||
val oldText = text.trim()
|
||||
val pokemonName = I18n.translate(pokemon.species.translatedName.string)
|
||||
val newNickname = if (text == pokemonName) null else text
|
||||
updateNickname(oldText, newNickname)
|
||||
this.updateNickname(text.trim().ifBlank { this.pokemonName })
|
||||
}
|
||||
return super.keyPressed(keyCode, scanCode, modifiers)
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ open class PartySlot(
|
||||
private val genderIconMale = cobblemonResource("textures/gui/pc/gender_icon_male.png")
|
||||
private val genderIconFemale = cobblemonResource("textures/gui/pc/gender_icon_female.png")
|
||||
private val selectPointerResource = cobblemonResource("textures/gui/pc/pc_pointer.png")
|
||||
private val untradeableResource = cobblemonResource("textures/gui/trade/trade_slot_icon_locked.png")
|
||||
}
|
||||
|
||||
override fun playDownSound(soundManager: SoundManager) {
|
||||
@@ -106,8 +107,22 @@ open class PartySlot(
|
||||
scale = TradeGUI.SCALE
|
||||
)
|
||||
}
|
||||
matrices.pop()
|
||||
if (!pokemon.tradeable) {
|
||||
matrices.push()
|
||||
matrices.translate(0F, 0F, 10F)
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
texture = untradeableResource,
|
||||
x = (x + 8) / TradeGUI.SCALE,
|
||||
y = (y + 8) / TradeGUI.SCALE,
|
||||
width = 20,
|
||||
height = 20,
|
||||
scale = TradeGUI.SCALE
|
||||
)
|
||||
matrices.pop()
|
||||
}
|
||||
|
||||
matrices.pop()
|
||||
if (hasSelected()) {
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
@@ -139,5 +154,5 @@ open class PartySlot(
|
||||
return pokemon?.pokemonId == offeredPokemon?.uuid && pokemon != null
|
||||
}
|
||||
|
||||
fun isHovered(mouseX: Int, mouseY: Int) = mouseX.toFloat() in (x.toFloat()..(x.toFloat() + SIZE)) && mouseY.toFloat() in (y.toFloat()..(y.toFloat() + SIZE))
|
||||
fun isHovered(mouseX: Int, mouseY: Int) = pokemon?.tradeable != false && mouseX.toFloat() in (x.toFloat()..(x.toFloat() + SIZE)) && mouseY.toFloat() in (y.toFloat()..(y.toFloat() + SIZE))
|
||||
}
|
||||
+1
-3
@@ -20,8 +20,6 @@ object DownShiftPartyBinding : CobblemonKeyBinding(
|
||||
KeybindCategories.COBBLEMON_CATEGORY
|
||||
) {
|
||||
override fun onPress() {
|
||||
if (CobblemonClient.storage.selectedSlot >= 0) {
|
||||
CobblemonClient.storage.shiftSelected(true)
|
||||
}
|
||||
CobblemonClient.storage.shiftSelected(true)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ import net.minecraft.client.util.InputUtil
|
||||
object HidePartyBinding : CobblemonKeyBinding(
|
||||
"key.cobblemon.hideparty",
|
||||
InputUtil.Type.KEYSYM,
|
||||
InputUtil.GLFW_KEY_P,
|
||||
InputUtil.GLFW_KEY_O,
|
||||
KeybindCategories.COBBLEMON_CATEGORY
|
||||
) {
|
||||
var shouldHide = false
|
||||
|
||||
+1
-3
@@ -20,8 +20,6 @@ object UpShiftPartyBinding : CobblemonKeyBinding(
|
||||
KeybindCategories.COBBLEMON_CATEGORY
|
||||
) {
|
||||
override fun onPress() {
|
||||
if (CobblemonClient.storage.selectedSlot >= 0) {
|
||||
CobblemonClient.storage.shiftSelected(false)
|
||||
}
|
||||
CobblemonClient.storage.shiftSelected(false)
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -48,6 +48,9 @@ object BattleSwitchPokemonHandler : ClientNetworkPacketHandler<BattleSwitchPokem
|
||||
)
|
||||
)
|
||||
|
||||
CobblemonClient.storage.switchToPokemon(packet.newPokemon.uuid)
|
||||
// Only update currently selected Pokémon if it's our Pokémon being switched in
|
||||
if (actor == battle.getParticipatingActor(client.session.profile.id)) {
|
||||
CobblemonClient.storage.switchToPokemon(packet.newPokemon.uuid)
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-5
@@ -6,15 +6,19 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client
|
||||
package com.cobblemon.mod.common.client.render
|
||||
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.client.texture.SpriteAtlasHolder
|
||||
import net.minecraft.client.texture.TextureManager
|
||||
import net.minecraft.util.Identifier
|
||||
|
||||
class CobblemonBerryAtlas(textureManager: TextureManager) : SpriteAtlasHolder(
|
||||
class CobblemonAtlas(
|
||||
textureManager: TextureManager,
|
||||
atlasId: Identifier,
|
||||
sourcePath: Identifier
|
||||
) : SpriteAtlasHolder(
|
||||
textureManager,
|
||||
cobblemonResource("textures/atlas/berries.png"),
|
||||
cobblemonResource("berries")
|
||||
atlasId,
|
||||
sourcePath
|
||||
) {
|
||||
}
|
||||
@@ -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.client.render
|
||||
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.texture.SpriteAtlasHolder
|
||||
|
||||
object CobblemonAtlases {
|
||||
val atlases = mutableSetOf<SpriteAtlasHolder>()
|
||||
|
||||
val BERRY_SPRITE_ATLAS = register("textures/atlas/berries.png", "berries")
|
||||
fun register(atlasId: String, sourcePath: String): SpriteAtlasHolder {
|
||||
val atlas = CobblemonAtlas(
|
||||
MinecraftClient.getInstance().textureManager,
|
||||
cobblemonResource(atlasId),
|
||||
cobblemonResource(sourcePath)
|
||||
)
|
||||
atlases.add(atlas)
|
||||
return atlas
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.client.render.block
|
||||
//import com.cobblemon.mod.common.block.BerryBlock
|
||||
//import com.cobblemon.mod.common.block.entity.BerryBlockEntity
|
||||
//import com.cobblemon.mod.common.client.render.layer.CobblemonRenderLayers
|
||||
//import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository
|
||||
//import com.cobblemon.mod.common.util.cobblemonResource
|
||||
//import com.jozufozu.flywheel.api.MaterialManager
|
||||
//import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance
|
||||
//import com.jozufozu.flywheel.core.Materials
|
||||
//import com.jozufozu.flywheel.core.materials.model.ModelData
|
||||
//
|
||||
//class BerryEntityInstance(val materialManager: MaterialManager, val entity: BerryBlockEntity) : BlockEntityInstance<BerryBlockEntity>(materialManager, entity) {
|
||||
// val models: MutableList<ModelData> = mutableListOf()
|
||||
// override fun init() {
|
||||
// super.init()
|
||||
// val age = entity.cachedState.get(BerryBlock.AGE)
|
||||
// if (age < BerryBlock.FLOWER_AGE) {
|
||||
// return
|
||||
// }
|
||||
// entity.berryAndGrowthPoint().forEach {
|
||||
// val newModel = if (age == BerryBlock.FLOWER_AGE) BerryModelRepository.flywheelModelOf(
|
||||
// cobblemonResource("flower.geo")
|
||||
// ) else BerryModelRepository.flywheelModelOf(it.first.fruitModelIdentifier)
|
||||
// if (newModel != null) {
|
||||
// val instancedModel = materialManager
|
||||
// .cutout(CobblemonRenderLayers.BERRY_LAYER)
|
||||
// .material(Materials.TRANSFORMED)
|
||||
// .model(newModel.name()) { newModel }
|
||||
// .createInstance()
|
||||
// models.add(instancedModel)
|
||||
// val identity = instancedModel.loadIdentity()
|
||||
// identity.translate(instancePosition)
|
||||
// identity.translate(it.second.position.multiply(1.0/16.0))
|
||||
// identity.rotateZ(it.second.rotation.z)
|
||||
// identity.rotateY(it.second.rotation.y + 180)
|
||||
// identity.rotateX(-it.second.rotation.x)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun updateLight() {
|
||||
// relight(worldPosition, models.stream())
|
||||
// }
|
||||
//
|
||||
// override fun remove() {
|
||||
// models.forEach {
|
||||
// it.delete()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
+1
-1
@@ -30,7 +30,7 @@ class PokemonItemRenderer : CobblemonBuiltinItemRenderer {
|
||||
|
||||
matrices.push()
|
||||
val model = PokemonModelRepository.getPoser(species.resourceIdentifier, aspects)
|
||||
val renderLayer = model.getLayer(PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, null))
|
||||
val renderLayer = model.getLayer(PokemonModelRepository.getTexture(species.resourceIdentifier, aspects, 0F))
|
||||
|
||||
val transformations = positions[mode]!!
|
||||
|
||||
|
||||
+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.client.render.layer
|
||||
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.render.*
|
||||
import net.minecraft.client.render.RenderPhase.*
|
||||
|
||||
object CobblemonRenderLayers {
|
||||
val BERRY_LAYER = run {
|
||||
val multiPhaseParameters = RenderLayer.MultiPhaseParameters.builder()
|
||||
.lightmap(ENABLE_LIGHTMAP)
|
||||
.program(CUTOUT_PROGRAM)
|
||||
.texture(Texture(
|
||||
cobblemonResource("textures/atlas/berries.png"),
|
||||
false,
|
||||
true
|
||||
))
|
||||
.cull(DISABLE_CULLING)
|
||||
.build(true)
|
||||
RenderLayer.of(
|
||||
"berries",
|
||||
VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL,
|
||||
VertexFormat.DrawMode.QUADS,
|
||||
512,
|
||||
true,
|
||||
false,
|
||||
multiPhaseParameters
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -103,7 +103,7 @@ class PokemonOnShoulderRenderer<T : PlayerEntity>(renderLayerParent: FeatureRend
|
||||
val model = PokemonModelRepository.getPoser(shoulderData.species.resourceIdentifier, shoulderData.aspects)
|
||||
val state = PokemonFloatingState()
|
||||
state.updatePartialTicks(ageInTicks + partialTicks)
|
||||
val vertexConsumer = buffer.getBuffer(model.getLayer(PokemonModelRepository.getTexture(shoulderData.species.resourceIdentifier, shoulderData.aspects, state)))
|
||||
val vertexConsumer = buffer.getBuffer(model.getLayer(PokemonModelRepository.getTexture(shoulderData.species.resourceIdentifier, shoulderData.aspects, state.animationSeconds)))
|
||||
val i = LivingEntityRenderer.getOverlay(livingEntity, 0.0f)
|
||||
|
||||
val pose = model.poses.values
|
||||
|
||||
+141
-5
@@ -8,11 +8,23 @@
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Bone
|
||||
import com.cobblemon.mod.common.client.util.adapters.LocatorBoneAdapter
|
||||
import com.cobblemon.mod.common.util.math.fromEulerXYZ
|
||||
import com.cobblemon.mod.common.util.math.geometry.toRadians
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import net.minecraft.client.model.*
|
||||
import net.minecraft.client.model.Dilation
|
||||
import net.minecraft.client.model.ModelData
|
||||
import net.minecraft.client.model.ModelPartBuilder
|
||||
import net.minecraft.client.model.ModelPartData
|
||||
import net.minecraft.client.model.ModelTransform
|
||||
import net.minecraft.client.model.TexturedModelData
|
||||
import net.minecraft.client.texture.SpriteAtlasHolder
|
||||
import net.minecraft.client.util.math.MatrixStack
|
||||
import net.minecraft.util.Identifier
|
||||
import org.joml.Quaternionf
|
||||
import org.joml.Vector2i
|
||||
import org.joml.Vector3f
|
||||
|
||||
class TexturedModel {
|
||||
@SerializedName("format_version")
|
||||
@@ -21,6 +33,126 @@ class TexturedModel {
|
||||
val geometry: List<ModelGeometry>? = null
|
||||
|
||||
fun create(isForLivingEntityRenderer: Boolean) : TexturedModelData {
|
||||
return createWithUvOverride(isForLivingEntityRenderer, 0, 0, null, null)
|
||||
}
|
||||
|
||||
fun resolveParentsFromRoot(boneMap: MutableMap<String, ModelBone>, bone: ModelBone): Set<ModelBone> {
|
||||
return if (bone.parent == null) {
|
||||
emptySet()
|
||||
} else {
|
||||
val parent = boneMap[bone.parent] ?: return emptySet()
|
||||
resolveParentsFromRoot(boneMap, parent) + bone
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The core idea here is that Bedrock GEO models have a particular set of rules, and Flywheel has its own
|
||||
* set of rules. In Bedrock, there are bones, and those are used to apply cumulative rotations, and rotations
|
||||
* alone. This can make cubes move if you rotate around a distant pivot point, but modifying pivots alone is
|
||||
* not going to change cubes.
|
||||
*
|
||||
* If a bone has a crazy far away pivot but no rotation, it has no effect on the cubes. This is different to Java
|
||||
* Edition's [net.minecraft.client.model.ModelPart] models, which have 'parts', and the position of those parts
|
||||
* has a cumulative position impact on the children rather than just a rotational one.
|
||||
*
|
||||
* Flywheel, on the other hand, has none of these. There is no hierarchy, and rotations are always around the
|
||||
* origin. This is very like the Java Edition baked model format that's used for blocks, but we're not converting
|
||||
* a block model, are we?
|
||||
*
|
||||
* The major issue is that our GEO cumulative rotations must be converted to be done in a single rotation about
|
||||
* (0,0,0). We need both the orientation and the position to be the same. The way this has been accomplished is to:
|
||||
* - use [MatrixStack]s to calculate the correct final-destination for each cube start position,
|
||||
* - convert the matrix we used to a rotation about zero by breaking it into euler angles
|
||||
* - note that this euler rotation is correct on orientation but wrong on final position, and is how flywheel does it.
|
||||
* - invert the euler rotation
|
||||
* - apply the inverted rotation to the correct final-destination to find the correct pre-destination
|
||||
*
|
||||
* - Hiro & Apion
|
||||
*/
|
||||
// fun createFlywheelModel(atlas: SpriteAtlasHolder, textureName: Identifier, name: String): Model {
|
||||
// val texture = atlas.getSprite(textureName)
|
||||
// val width = ((texture.maxU * atlas.atlas.width.toFloat()) - (texture.minU * atlas.atlas.width)).toInt()
|
||||
// val height =( (texture.maxV * atlas.atlas.height.toFloat()) - (texture.minV * atlas.atlas.height)).toInt()
|
||||
//
|
||||
// val modelBuilder = PartBuilder(name, width, height)
|
||||
// modelBuilder.sprite(texture)
|
||||
// val boneMap = mutableMapOf<String, ModelBone>()
|
||||
// geometry?.forEach { it.bones?.forEach { boneMap[it.name] = it } }
|
||||
//
|
||||
// geometry?.forEach {
|
||||
// it.bones?.forEach { bone ->
|
||||
// // This is meant to prepare the rotation stack so that the rotation around a cube's pivot point is respecting
|
||||
// // all of the parent bone rotations. It's not meant to influence the POSITION of the cubes further down
|
||||
// // the chain, only the location of the joints. It doesn't sum the pivot points either; the child bones
|
||||
// // are only affected by the parent bones because of the rotations.
|
||||
// //
|
||||
// // This probably doesn't work but haven't tested it on models with joints so.
|
||||
// val stack = MatrixStack()
|
||||
// for (bone in resolveParentsFromRoot(mutableMapOf(), bone)) {
|
||||
// val rotation = bone.rotation?.takeIf { it[0] != 0F || it[1] != 0F || it[2] != 0F } ?: continue
|
||||
// stack.translate(-bone.pivot[0], bone.pivot[1], -bone.pivot[2])
|
||||
// stack.multiply(Quaternionf().rotationXYZ(rotation[0].toRadians(), rotation[1].toRadians(), rotation[2].toRadians()))
|
||||
// stack.translate(bone.pivot[0], -bone.pivot[1], bone.pivot[2])
|
||||
// }
|
||||
//
|
||||
// bone.cubes?.forEach { cube ->
|
||||
// val size = cube.size?.let { Vector3f(it[0], it[1], it[2]) } ?: Vector3f()
|
||||
// val rotation = cube.rotation?.let { Vector3f(it[0], it[1], it[2]) } ?: Vector3f()
|
||||
// val inflation = (cube.inflate ?: 0F) / 2
|
||||
// val uvs = cube.uv?.let { Vector2i(it[0], it[1]) } ?: Vector2i()
|
||||
//
|
||||
// /*
|
||||
// * The origin has the X and Z flipped, and that also means counting from the opposite side of the
|
||||
// * cube (second line is accomplishing that part). The reason for this is because Minecraft Java Edition
|
||||
// * is a "right hand" coordinate system (finger guns time!!) whereas Bedrock presumably is left-hand.
|
||||
// *
|
||||
// * Pivots are also inverted fyi.
|
||||
// *
|
||||
// * - Hiro
|
||||
// */
|
||||
// val origin = cube.origin?.let { Vector3f(-it[0], it[1], -it[2]) } ?: Vector3f()
|
||||
// origin.sub(size.get(Vector3f()).mul(1F, 0F, 1F))
|
||||
// val pivot = cube.pivot?.let { Vector3f(-it[0], it[1], -it[2]) } ?: Vector3f()
|
||||
//
|
||||
// // Apply translate, rotate, then translate back because the pivots don't actually directly translate
|
||||
// // to shifted positions in Bedrock.
|
||||
// stack.push()
|
||||
// stack.translate(pivot.x, pivot.y, pivot.z)
|
||||
// stack.multiply(Quaternionf().rotationXYZ(rotation.x.toRadians(), rotation.y.toRadians(), rotation.z.toRadians()))
|
||||
// stack.translate(-pivot.x, -pivot.y, -pivot.z)
|
||||
// val rotationMatrix = stack.peek().positionMatrix
|
||||
// stack.pop()
|
||||
//
|
||||
// // Finds where Bedrock put the start of the cube. The matrix does the rotation correctly because we
|
||||
// // are chasing rotations around very specific points.
|
||||
// val desiredPoint = rotationMatrix.transformPosition(origin.get(Vector3f()))
|
||||
//
|
||||
// // The rotation in Euler angles (which are about 0,0,0), that's what Flywheel likes to eat.
|
||||
// // It will orient it correctly, but a limitation of Euler angles is that it can't get the thing
|
||||
// // to rotate around a specific point, only ever the origin. We'll fix that.
|
||||
// val eulerRotation = rotationMatrix.getEulerAnglesXYZ(Vector3f())
|
||||
// // The reversed form of the rotation Flywheel is about to apply.
|
||||
// val reversedRotation = Quaternionf().fromEulerXYZ(-eulerRotation.x, -eulerRotation.y, -eulerRotation.z)
|
||||
// // Figure out the start point such that Flywheel applying the eulerRotation will put it at the desired point.
|
||||
// val correctStart = reversedRotation.transform(desiredPoint.get(Vector3f()))
|
||||
//
|
||||
// // Now just put it all together. Inflation is a slight tweak to size and start position.
|
||||
// // Invert YZ is something I don't understand but is necessary.
|
||||
// modelBuilder.cuboid()
|
||||
// .sprite(texture)
|
||||
// .start(correctStart.x - inflation, correctStart.y - inflation, correctStart.z - inflation)
|
||||
// .invertYZ()
|
||||
// .size(size.x + 2 * inflation, size.y + 2 * inflation, size.z + 2 * inflation)
|
||||
// .rotate(eulerRotation.x, eulerRotation.y, eulerRotation.z)
|
||||
// .textureOffset(uvs.x, uvs.y)
|
||||
// .endCuboid()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return modelBuilder.build()
|
||||
// }
|
||||
|
||||
fun createWithUvOverride(isForLivingEntityRenderer: Boolean, u: Int, v: Int, textureWidth: Int?, textureHeight: Int?) : TexturedModelData {
|
||||
val modelData = ModelData()
|
||||
val parts = HashMap<String, ModelPartData>()
|
||||
val bones = HashMap<String, ModelBone>()
|
||||
@@ -94,8 +226,8 @@ class TexturedModel {
|
||||
|
||||
if (cube.uv != null) {
|
||||
subPart.uv(
|
||||
cube.uv[0],
|
||||
cube.uv[1]
|
||||
cube.uv[0] + u,
|
||||
cube.uv[1] + v
|
||||
)
|
||||
}
|
||||
if (cube.mirror != null && cube.mirror == true) {
|
||||
@@ -147,7 +279,11 @@ class TexturedModel {
|
||||
}
|
||||
}
|
||||
|
||||
return TexturedModelData.of(modelData, geometry.description.textureWidth, geometry.description.textureHeight)
|
||||
return TexturedModelData.of(
|
||||
modelData,
|
||||
textureWidth ?: geometry.description.textureWidth,
|
||||
textureHeight ?: geometry.description.textureHeight
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
if (geometry != null) {
|
||||
throw IllegalArgumentException("Error creating TexturedModelData with identifier ${geometry[0].description.identifier}", e)
|
||||
|
||||
+18
-6
@@ -26,14 +26,15 @@ import java.lang.Float.min
|
||||
class PoseTransitionAnimation<T : Entity>(
|
||||
val beforePose: Pose<T, *>,
|
||||
val afterPose: Pose<T, *>,
|
||||
durationTicks: Int = 20
|
||||
val durationTicks: Int = 20
|
||||
) : StatefulAnimation<T, ModelFrame> {
|
||||
override val isTransform = true
|
||||
override val isPosePauser = false
|
||||
|
||||
var changedPose = false
|
||||
val transforms = mutableListOf<GradualTransform>()
|
||||
val startTime = System.currentTimeMillis()
|
||||
val endTime = startTime + durationTicks * 50L
|
||||
var initialized = false
|
||||
var startTime = System.currentTimeMillis()
|
||||
var endTime = startTime + durationTicks * 50L
|
||||
|
||||
inner class GradualTransform(
|
||||
val modelPart: ModelPart,
|
||||
@@ -56,7 +57,7 @@ class PoseTransitionAnimation<T : Entity>(
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
fun initialize() {
|
||||
val beforeTransforms = beforePose.transformedParts
|
||||
val afterTransforms = afterPose.transformedParts
|
||||
|
||||
@@ -92,8 +93,11 @@ class PoseTransitionAnimation<T : Entity>(
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
this.startTime = System.currentTimeMillis()
|
||||
this.endTime = startTime + durationTicks * 50L
|
||||
initialized = true
|
||||
}
|
||||
override fun preventsIdle(entity: T?, state: PoseableEntityState<T>, idleAnimation: StatelessAnimation<T, *>) = false
|
||||
override fun run(
|
||||
entity: T?,
|
||||
@@ -105,6 +109,14 @@ class PoseTransitionAnimation<T : Entity>(
|
||||
headYaw: Float,
|
||||
headPitch: Float
|
||||
): Boolean {
|
||||
if (state.allStatefulAnimations.any { it.isPosePauser }) {
|
||||
return true
|
||||
} else if (!initialized) {
|
||||
initialize()
|
||||
}
|
||||
if (state.allStatefulAnimations.any { it.isPosePauser }) {
|
||||
println("There is a pose pauser during our transition")
|
||||
}
|
||||
val now = System.currentTimeMillis()
|
||||
val durationMillis = (endTime - startTime).toFloat()
|
||||
val passedMillis = (now - startTime).toFloat()
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ import net.minecraft.entity.Entity
|
||||
*/
|
||||
interface StatefulAnimation<T : Entity, F : ModelFrame> {
|
||||
val isTransform: Boolean
|
||||
val isPosePauser: Boolean
|
||||
/**
|
||||
* Whether this animation should prevent the given idle animation from occurring.
|
||||
*
|
||||
|
||||
+10
-6
@@ -161,27 +161,31 @@ object BedrockAnimationAdapter : JsonDeserializer<BedrockAnimation> {
|
||||
val timeDbl = time.toDouble()
|
||||
when {
|
||||
keyframeJson is JsonObject -> {
|
||||
// The interpolation type, at time of writing, is only set for catmullrom ("smooth" in Blockbench)
|
||||
// while all other interpolation types, whether it's step or linear or bezier, work by just having
|
||||
// one or many linearly interpolated frames in some fancy way that I don't understand. Doesn't matter
|
||||
// though, once they write to a file they're just many little linear keyframes.
|
||||
val interpolationType = when (keyframeJson.get("lerp_mode")?.asString ?: "linear") {
|
||||
"catmullrom" -> InterpolationType.SMOOTH
|
||||
else -> InterpolationType.LINEAR
|
||||
}
|
||||
if (keyframeJson.has("post")) {
|
||||
val post = keyframeJson["post"]
|
||||
// val transformationData = keyframeJson["post"].asJsonArray.map { it.asDouble }
|
||||
// val transformationVector = Vec3d(transformationData[0], transformationData[1], transformationData[2])
|
||||
keyframes[timeDbl] = JumpBedrockAnimationKeyFrame(
|
||||
time = timeDbl,
|
||||
transformation = transformation,
|
||||
pre = deserializeMolangBoneValue(keyframeJson["pre"]?.asJsonArray ?: post.asJsonArray, transformation),
|
||||
post = deserializeMolangBoneValue(post.asJsonArray, transformation),
|
||||
interpolationType = InterpolationType.SMOOTH
|
||||
interpolationType = interpolationType
|
||||
)
|
||||
} else if (keyframeJson.has("pre")) {
|
||||
val pre = keyframeJson["pre"]
|
||||
// val transformationData = keyframeJson["post"].asJsonArray.map { it.asDouble }
|
||||
// val transformationVector = Vec3d(transformationData[0], transformationData[1], transformationData[2])
|
||||
keyframes[timeDbl] = JumpBedrockAnimationKeyFrame(
|
||||
time = timeDbl,
|
||||
transformation = transformation,
|
||||
pre = deserializeMolangBoneValue(pre.asJsonArray, transformation),
|
||||
post = deserializeMolangBoneValue(keyframeJson["post"]?.asJsonArray ?: pre.asJsonArray, transformation),
|
||||
interpolationType = InterpolationType.SMOOTH
|
||||
interpolationType = interpolationType
|
||||
)
|
||||
} else {
|
||||
throw IllegalStateException("transformation data ('post') could not be found")
|
||||
|
||||
+7
@@ -33,15 +33,22 @@ open class BedrockStatefulAnimation<T : Entity>(
|
||||
|
||||
var startedSeconds = -1F
|
||||
var isTransformAnimation = false
|
||||
var isPosePauserAnimation = true
|
||||
private var afterAction: (T, PoseableEntityState<T>) -> Unit = { _, _ -> }
|
||||
|
||||
override val isTransform: Boolean
|
||||
get() = isTransformAnimation
|
||||
override val isPosePauser: Boolean
|
||||
get() = isPosePauserAnimation
|
||||
|
||||
fun isTransformAnimation(value: Boolean) = this.also {
|
||||
it.isTransformAnimation = value
|
||||
}
|
||||
|
||||
fun isPosePauserAnimation(value: Boolean) = this.also {
|
||||
it.isPosePauserAnimation = value
|
||||
}
|
||||
|
||||
fun andThen(action: (entity: T, PoseableEntityState<T>) -> Unit) = this.also {
|
||||
it.afterAction = action
|
||||
}
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class JsonPokemonPoseableModel(override val rootPart: Bone) : PokemonPoseableMod
|
||||
val cry: Supplier<StatefulAnimation<PokemonEntity, ModelFrame>>? = null
|
||||
|
||||
override fun getFaintAnimation(pokemonEntity: PokemonEntity, state: PoseableEntityState<PokemonEntity>) = faint?.get()
|
||||
override val cryAnimation = CryProvider { _, _ -> cry?.get()?.also { if (it is BedrockStatefulAnimation) it.setPreventsIdle(false) } }
|
||||
override val cryAnimation = CryProvider { _, _ -> cry?.get()?.also { if (it is BedrockStatefulAnimation) it.setPreventsIdle(false).isPosePauserAnimation(true) } }
|
||||
|
||||
object JsonModelExclusion: ExclusionStrategy {
|
||||
override fun shouldSkipField(f: FieldAttributes): Boolean {
|
||||
|
||||
+2
-2
@@ -94,10 +94,10 @@ abstract class PokemonPoseableModel : PoseableEntityModel<PokemonEntity>() {
|
||||
// state: PoseableEntityState<PokemonEntity>
|
||||
// ): StatefulAnimation<PokemonEntity, ModelFrame>? = null
|
||||
|
||||
override fun setupEntityTypeContext (entity: PokemonEntity?) {
|
||||
override fun setupEntityTypeContext(entity: PokemonEntity?) {
|
||||
entity?.let {
|
||||
context.put(RenderContext.SCALE, it.pokemon.form.baseScale)
|
||||
PokemonModelRepository.variations[it.pokemon.species.resourceIdentifier]?.getTexture(it.pokemon.aspects, 0f).let { texture -> context.put(RenderContext.TEXTURE, texture) }
|
||||
PokemonModelRepository.getTexture(it.pokemon.species.resourceIdentifier, it.pokemon.aspects, 0f).let { texture -> context.put(RenderContext.TEXTURE, texture) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,5 +122,5 @@ class ArbokModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>,
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("arbok", "faint") else null
|
||||
) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("arbok", "faint") else null
|
||||
}
|
||||
+1
-1
@@ -105,5 +105,5 @@ class BlastoiseModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("blastoise", "faint") else null
|
||||
) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("blastoise", "faint") else null
|
||||
}
|
||||
+1
-1
@@ -73,5 +73,5 @@ class BulbasaurModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Qua
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("bulbasaur", "faint") else null
|
||||
) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("bulbasaur", "faint") else null
|
||||
}
|
||||
+1
-1
@@ -68,5 +68,5 @@ class CaterpieModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("caterpie", "faint") else null
|
||||
) = bedrockStateful("caterpie", "faint")
|
||||
}
|
||||
+1
-1
@@ -78,5 +78,5 @@ class CharmanderModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isNotPosedIn(sleep)) bedrockStateful("charmander", "faint") else null
|
||||
) = bedrockStateful("charmander", "faint")
|
||||
}
|
||||
+1
-1
@@ -76,5 +76,5 @@ class CharmeleonModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("charmeleon", "faint") else null
|
||||
) = if (state.isPosedIn(standing, walk, sleep)) bedrockStateful("charmeleon", "faint") else null
|
||||
}
|
||||
+1
-1
@@ -66,5 +66,5 @@ class ClefableModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("clefable", "faint") else null
|
||||
) = bedrockStateful("clefable", "faint")
|
||||
}
|
||||
+1
-1
@@ -66,5 +66,5 @@ class ClefairyModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("clefairy", "faint") else null
|
||||
) = bedrockStateful("clefairy", "faint")
|
||||
}
|
||||
+4
-2
@@ -28,10 +28,12 @@ class DiglettModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override val profileScale = 0.9F
|
||||
override val profileTranslation = Vec3d(0.0, 0.15, 0.0)
|
||||
|
||||
lateinit var stand: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var sleep: PokemonPose
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("diglett", "blink").setPreventsIdle(false)}
|
||||
registerPose(
|
||||
stand = registerPose(
|
||||
poseName = "stand",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
@@ -43,7 +45,7 @@ class DiglettModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
idleAnimations = arrayOf(bedrock("diglett", "sleep"))
|
||||
)
|
||||
|
||||
registerPose(
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES,
|
||||
quirks = arrayOf(blink),
|
||||
|
||||
+1
-1
@@ -74,5 +74,5 @@ class DittoModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("ditto", "faint") else null
|
||||
) = bedrockStateful("ditto", "faint")
|
||||
}
|
||||
+1
-1
@@ -77,5 +77,5 @@ class ExeggcuteModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("exeggcute", "faint") else null
|
||||
) = bedrockStateful("exeggcute", "faint")
|
||||
}
|
||||
+4
-4
@@ -36,11 +36,11 @@ class ExeggutorAlolanModel(root: ModelPart) : PokemonPoseableModel(), HeadedFram
|
||||
override val head: ModelPart = getPart("head3")
|
||||
}
|
||||
|
||||
override val portraitScale = 1.9F
|
||||
override val portraitTranslation = Vec3d(-1.3, 11.5, 0.0)
|
||||
override val portraitScale = 1.0F
|
||||
override val portraitTranslation = Vec3d(-1.4, 16.55, 0.0)
|
||||
|
||||
override val profileScale = 0.9F
|
||||
override val profileTranslation = Vec3d(0.0, 0.38, 0.0)
|
||||
override val profileScale = 0.45F
|
||||
override val profileTranslation = Vec3d(0.0, 1.0, 0.0)
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
|
||||
+5
-6
@@ -38,11 +38,11 @@ class ExeggutorModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
override val head: ModelPart = getPart("head3")
|
||||
}
|
||||
|
||||
override val portraitScale = 2.1F
|
||||
override val portraitTranslation = Vec3d(-1.0, 0.5, 0.0)
|
||||
override val portraitScale = 1.2F
|
||||
override val portraitTranslation = Vec3d(-1.0, 1.77, 0.0)
|
||||
|
||||
override val profileScale = 0.75F
|
||||
override val profileTranslation = Vec3d(0.0, 0.65, 0.0)
|
||||
override val profileScale = 0.45F
|
||||
override val profileTranslation = Vec3d(0.0, 1.1, 0.0)
|
||||
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
@@ -77,7 +77,6 @@ class ExeggutorModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
quirks = arrayOf(blink1, blink2, blink3),
|
||||
condition = { !it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
BipedWalkAnimation(this, periodMultiplier = 0.7F, amplitudeMultiplier = 1f),
|
||||
singleBoneLook(),
|
||||
SingleBoneLookAnimation(head2, false, false, disableX = false, disableY = false),
|
||||
SingleBoneLookAnimation(head3, false, false, disableX = false, disableY = false),
|
||||
@@ -102,5 +101,5 @@ class ExeggutorModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bip
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk, battleidle)) bedrockStateful("exeggutor", "faint") else null
|
||||
) = bedrockStateful("exeggutor", "faint")
|
||||
}
|
||||
+1
-1
@@ -60,5 +60,5 @@ class GloomModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>,
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("gloom", "faint") else null
|
||||
) = bedrockStateful("gloom", "faint")
|
||||
}
|
||||
+16
-1
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PoseableEntityState
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BimanualSwingAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.asTransformed
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BimanualFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
@@ -42,6 +43,7 @@ class HitmonchanModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("hitmonchan", "blink").setPreventsIdle(false)}
|
||||
@@ -55,6 +57,7 @@ class HitmonchanModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
transformTicks = 5,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
@@ -72,10 +75,22 @@ class HitmonchanModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Bi
|
||||
bedrock("hitmonchan", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
singleBoneLook(),
|
||||
bedrock("hitmonchan", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("hitmonchan", "faint") else null
|
||||
) = bedrockStateful("hitmonchan", "faint")
|
||||
}
|
||||
+14
-1
@@ -40,6 +40,7 @@ class HitmonleeModel(root: ModelPart) : PokemonPoseableModel(), BipedFrame, Bima
|
||||
lateinit var standing: PokemonPose
|
||||
lateinit var walk: PokemonPose
|
||||
lateinit var sleep: PokemonPose
|
||||
lateinit var battleidle: PokemonPose
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk("blink") { bedrockStateful("hitmonlee", "blink").setPreventsIdle(false)}
|
||||
@@ -53,6 +54,7 @@ class HitmonleeModel(root: ModelPart) : PokemonPoseableModel(), BipedFrame, Bima
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
transformTicks = 5,
|
||||
condition = { !it.isBattling },
|
||||
quirks = arrayOf(blink),
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("hitmonlee", "ground_idle")
|
||||
@@ -68,10 +70,21 @@ class HitmonleeModel(root: ModelPart) : PokemonPoseableModel(), BipedFrame, Bima
|
||||
bedrock("hitmonlee", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink),
|
||||
condition = { it.isBattling },
|
||||
idleAnimations = arrayOf(
|
||||
bedrock("hitmonlee", "battle_idle")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("hitmonlee", "faint") else null
|
||||
) = bedrockStateful("hitmonlee", "faint")
|
||||
}
|
||||
+1
-1
@@ -75,5 +75,5 @@ class IvysaurModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame, Quadr
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("ivysaur", "faint") else null
|
||||
) = bedrockStateful("ivysaur", "faint")
|
||||
}
|
||||
+1
-1
@@ -63,5 +63,5 @@ class JigglypuffModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("jigglypuff", "faint") else null
|
||||
) = bedrockStateful("jigglypuff", "faint")
|
||||
}
|
||||
+1
-1
@@ -52,5 +52,5 @@ class KakunaModel(root: ModelPart) : PokemonPoseableModel(), HeadedFrame {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>,
|
||||
) = if (state.isPosedIn(standing)) bedrockStateful("kakuna", "faint") else null
|
||||
) = bedrockStateful("kakuna", "faint")
|
||||
}
|
||||
+1
-1
@@ -65,5 +65,5 @@ class MagnemiteModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("magnemite", "faint") else null
|
||||
) = bedrockStateful("magnemite", "faint")
|
||||
}
|
||||
+1
-1
@@ -65,5 +65,5 @@ class MagnetonModel(root: ModelPart) : PokemonPoseableModel() {
|
||||
override fun getFaintAnimation(
|
||||
pokemonEntity: PokemonEntity,
|
||||
state: PoseableEntityState<PokemonEntity>
|
||||
) = if (state.isPosedIn(standing, walk)) bedrockStateful("magneton", "faint") else null
|
||||
) = bedrockStateful("magneton", "faint")
|
||||
}
|
||||
Loaded 100 of 2486 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user