mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-21 14:46:25 -04:00
Compare commits
715
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89c2b5cef3 | ||
|
|
bd4a6fc48c | ||
|
|
c7bca0ba19 | ||
|
|
9b2d032c6a | ||
|
|
be76f8a180 | ||
|
|
2af0324ee5 | ||
|
|
8aa4f57a33 | ||
|
|
3599dc97cc | ||
|
|
8a5d895f03 | ||
|
|
36169db388 | ||
|
|
1900999a74 | ||
|
|
ab16814cd2 | ||
|
|
9f622fcd74 | ||
|
|
956e2c43b8 | ||
|
|
130f87c9f7 | ||
|
|
22b4e8c75f | ||
|
|
c19a3ca444 | ||
|
|
a006eb5dcc | ||
|
|
ed419e7e53 | ||
|
|
bff2387b4d | ||
|
|
41544efeba | ||
|
|
e6e6c9f7f6 | ||
|
|
22d8e39db3 | ||
|
|
bfdf1e9e6c | ||
|
|
c3fccfde09 | ||
|
|
4bb8d43a6e | ||
|
|
fda4b67776 | ||
|
|
f1ee9d45de | ||
|
|
01f7d13e3f | ||
|
|
d85e30f3a6 | ||
|
|
e6f147bd94 | ||
|
|
c66de51e39 | ||
|
|
7d552735f3 | ||
|
|
94c42e7e2c | ||
|
|
ef4690d4fe | ||
|
|
433c0ff345 | ||
|
|
59d42fb328 | ||
|
|
17d6837e34 | ||
|
|
34b4337849 | ||
|
|
392e8663be | ||
|
|
578ff37705 | ||
|
|
77406f91a3 | ||
|
|
9bf526e93e | ||
|
|
29b763ef19 | ||
|
|
938b7a7a94 | ||
|
|
f920639e3f | ||
|
|
ea499a935e | ||
|
|
1dbe5eb944 | ||
|
|
dba0bae810 | ||
|
|
8c04081af5 | ||
|
|
d7de4b2463 | ||
|
|
61b767158a | ||
|
|
f2f16cdc9e | ||
|
|
2aec4f972f | ||
|
|
bc8164cf17 | ||
|
|
a09cf1b93d | ||
|
|
b436c42cb1 | ||
|
|
79b83bc8d7 | ||
|
|
a6b5453b34 | ||
|
|
7fcb9e8b4d | ||
|
|
f3740abd39 | ||
|
|
e4decf50ea | ||
|
|
22d33ac5d8 | ||
|
|
f2392db3be | ||
|
|
9fed44328f | ||
|
|
26d0340fb5 | ||
|
|
21f2945dc4 | ||
|
|
16a5316a69 | ||
|
|
378a5ca401 | ||
|
|
d956ca2c3c | ||
|
|
14a079fae1 | ||
|
|
3e9331ec64 | ||
|
|
a7c43701c0 | ||
|
|
34aef306c1 | ||
|
|
b4e99204c8 | ||
|
|
8c09cebc59 | ||
|
|
b5bfe44196 | ||
|
|
38c5fcc23f | ||
|
|
9edfa279be | ||
|
|
2769d5560d | ||
|
|
ed7d2d5d2a | ||
|
|
d839a13b7e | ||
|
|
a23cd170b2 | ||
|
|
3dec294728 | ||
|
|
c67cf2e05d | ||
|
|
3b96beef36 | ||
|
|
dcbac52fd7 | ||
|
|
64dd8336c6 | ||
|
|
2681cdc5ba | ||
|
|
8d265bd820 | ||
|
|
6b43e5d99d | ||
|
|
b430b8a1b4 | ||
|
|
329810407a | ||
|
|
6ca04bb064 | ||
|
|
ebf0144222 | ||
|
|
a71cfaadc8 | ||
|
|
31195dacdb | ||
|
|
4074aa50ce | ||
|
|
107ec7634d | ||
|
|
ed85de34b3 | ||
|
|
6dbf1288a0 | ||
|
|
aee915dc91 | ||
|
|
a1974fbe74 | ||
|
|
145481530d | ||
|
|
b5694b4e13 | ||
|
|
9df4669865 | ||
|
|
92543f9aed | ||
|
|
5d5cb3a240 | ||
|
|
452117c781 | ||
|
|
bc267ec72b | ||
|
|
33a2a0a8e0 | ||
|
|
dac1b3cbf0 | ||
|
|
6d89b737a7 | ||
|
|
53e540472a | ||
|
|
e2804dc83f | ||
|
|
82e82cb28e | ||
|
|
052fee56a1 | ||
|
|
15970f2ab0 | ||
|
|
3874867b74 | ||
|
|
ed6485f1d3 | ||
|
|
c7b1036bdf | ||
|
|
8730ff3a3e | ||
|
|
c8bd7c8604 | ||
|
|
b049a39680 | ||
|
|
6503b0806a | ||
|
|
ef0e785855 | ||
|
|
cccd30a284 | ||
|
|
be35e937d9 | ||
|
|
5a73456202 | ||
|
|
089e6c15da | ||
|
|
4f63c40096 | ||
|
|
218d33d78d | ||
|
|
dae5445c3a | ||
|
|
57f9d5b6dc | ||
|
|
fdfa10f5fe | ||
|
|
e12a1df252 | ||
|
|
69e74be5e5 | ||
|
|
8c9ee22547 | ||
|
|
c8074dd825 | ||
|
|
bda5e2ade2 | ||
|
|
0c5118b840 | ||
|
|
0d0eaf2465 | ||
|
|
4eb90400aa | ||
|
|
7387612f0e | ||
|
|
5188318f20 | ||
|
|
627ee5e9b2 | ||
|
|
7f3bd8bec2 | ||
|
|
db70a0f816 | ||
|
|
ab9a66c556 | ||
|
|
f5e1dfe080 | ||
|
|
175aa93284 | ||
|
|
b7926a70ab | ||
|
|
28f2caff58 | ||
|
|
128451785f | ||
|
|
0171ed9747 | ||
|
|
1fb09e27fc | ||
|
|
30a3d6ed83 | ||
|
|
4aa4c229fa | ||
|
|
18cecc68dd | ||
|
|
5036ed0db1 | ||
|
|
3b3150fc72 | ||
|
|
b9fb970ec4 | ||
|
|
761b306590 | ||
|
|
1e7dfce918 | ||
|
|
a453199eae | ||
|
|
f5267c832f | ||
|
|
7f6e0c0377 | ||
|
|
420d42b36d | ||
|
|
a45028d83b | ||
|
|
76ab7e998b | ||
|
|
cbbfa974aa | ||
|
|
9dc6649eb7 | ||
|
|
97ef0dda0a | ||
|
|
71334dc889 | ||
|
|
4d8c4b1d7b | ||
|
|
0701380a36 | ||
|
|
2b03e5660e | ||
|
|
b44a53efce | ||
|
|
5678776938 | ||
|
|
f3985d8250 | ||
|
|
b497c603ca | ||
|
|
b9807773ee | ||
|
|
aba02d7b53 | ||
|
|
0eef30af4a | ||
|
|
3a064c7269 | ||
|
|
1cece70687 | ||
|
|
c2d85df3e0 | ||
|
|
a7c0242575 | ||
|
|
97a7554e79 | ||
|
|
77108ae687 | ||
|
|
413271546f | ||
|
|
75e3c4be7a | ||
|
|
7891347d90 | ||
|
|
0a9b1c5c97 | ||
|
|
89d86aa6e3 | ||
|
|
fd45dacad2 | ||
|
|
a336f0968a | ||
|
|
df852ace9b | ||
|
|
9d6ae6952c | ||
|
|
19c6f98ea4 | ||
|
|
dbc1674416 | ||
|
|
3e8c0ed14e | ||
|
|
5f8ee45f1e | ||
|
|
5f3e1fb395 | ||
|
|
4befb0a16a | ||
|
|
aab55966a8 | ||
|
|
746c29c6f6 | ||
|
|
0c31f14b15 | ||
|
|
e565426291 | ||
|
|
6f115e44e3 | ||
|
|
dd161c2d53 | ||
|
|
50500ab204 | ||
|
|
169c406f03 | ||
|
|
985691958f | ||
|
|
d972b2f998 | ||
|
|
5dc03a71f6 | ||
|
|
6535dd950a | ||
|
|
840d7f50ee | ||
|
|
1d7da21e69 | ||
|
|
c33adf3a8b | ||
|
|
c39eeb69f4 | ||
|
|
32d6811884 | ||
|
|
fa7eb0d98c | ||
|
|
242fa3fed8 | ||
|
|
9364992979 | ||
|
|
488f9b995a | ||
|
|
05f58f86c2 | ||
|
|
3fa3f06a02 | ||
|
|
0a80269670 | ||
|
|
5e2373c656 | ||
|
|
60b95b6fa5 | ||
|
|
77d7bb0fe4 | ||
|
|
bf78e68831 | ||
|
|
49a6dd826a | ||
|
|
b0d80d6c96 | ||
|
|
ca1f008319 | ||
|
|
d22d7cc5b4 | ||
|
|
1ceba8973f | ||
|
|
558daea446 | ||
|
|
6f5a298a5c | ||
|
|
e016d48584 | ||
|
|
9540a4b3eb | ||
|
|
e7234daff6 | ||
|
|
7fbc2b5143 | ||
|
|
9d50dae3d1 | ||
|
|
655a467193 | ||
|
|
cbc6c56c9e | ||
|
|
360de79482 | ||
|
|
8e7ceae7e1 | ||
|
|
92221e0e98 | ||
|
|
27285e3e7f | ||
|
|
04612d58f3 | ||
|
|
ffd5dbb717 | ||
|
|
d7242d2895 | ||
|
|
51c2a418ce | ||
|
|
882a5921e8 | ||
|
|
9b58e229d6 | ||
|
|
d357c2cbcb | ||
|
|
5621326c43 | ||
|
|
9fd2b3f1d6 | ||
|
|
a89d428699 | ||
|
|
91eda647fa | ||
|
|
c0da612281 | ||
|
|
7dc76fdeb3 | ||
|
|
7e11497c64 | ||
|
|
81978f025b | ||
|
|
8dc3eaafc7 | ||
|
|
c0af1abf9f | ||
|
|
b2d56c339c | ||
|
|
bc49537e16 | ||
|
|
c4c59e6aa5 | ||
|
|
de3cac46fb | ||
|
|
995ad49336 | ||
|
|
1abe38f97b | ||
|
|
ff7fa49baa | ||
|
|
92b2612350 | ||
|
|
ba17f0d35f | ||
|
|
5a628b4c39 | ||
|
|
0b46516ed1 | ||
|
|
715b5d1a08 | ||
|
|
44ca37207f | ||
|
|
cd363e4ef7 | ||
|
|
9d234fa556 | ||
|
|
47e49993ad | ||
|
|
7afdbd2d4b | ||
|
|
38e699aa44 | ||
|
|
2b26e47876 | ||
|
|
2f07f33a71 | ||
|
|
eaec3612aa | ||
|
|
db0c2a0cc2 | ||
|
|
c431cf7b1e | ||
|
|
a5dd0eb924 | ||
|
|
466d91fcbf | ||
|
|
e1a3077780 | ||
|
|
5936ced1d7 | ||
|
|
3d6967d3c7 | ||
|
|
449a8cdb53 | ||
|
|
c91d4a9515 | ||
|
|
793f059f3c | ||
|
|
7200e87886 | ||
|
|
a1dc5c8340 | ||
|
|
2345e7efcc | ||
|
|
d32ed6309c | ||
|
|
72e9481946 | ||
|
|
f3ba7ef121 | ||
|
|
e9aca93f70 | ||
|
|
6f8e3bca29 | ||
|
|
49349848b8 | ||
|
|
bfe1afda4b | ||
|
|
bd54020c9c | ||
|
|
605d44f2c2 | ||
|
|
5c42b441fd | ||
|
|
2211232652 | ||
|
|
4ef8c40a83 | ||
|
|
99ca941c73 | ||
|
|
e5b977ff1a | ||
|
|
0e381ac098 | ||
|
|
ace08a5673 | ||
|
|
de00622235 | ||
|
|
e652b5773d | ||
|
|
ae1f6393b7 | ||
|
|
ddb0ad4dda | ||
|
|
83bc1292ea | ||
|
|
39075b843e | ||
|
|
7db59cc3bd | ||
|
|
5e5f35b306 | ||
|
|
65ef2076eb | ||
|
|
e8f6bbd742 | ||
|
|
5256bf1267 | ||
|
|
d2a5dfcdc0 | ||
|
|
124eb876de | ||
|
|
7b1f50b183 | ||
|
|
2c9705e230 | ||
|
|
b78d05611d | ||
|
|
4574e9ae65 | ||
|
|
4508f47c93 | ||
|
|
683d62f9e0 | ||
|
|
217b1cc561 | ||
|
|
b72f90551e | ||
|
|
30b146a59d | ||
|
|
1e4afe36be | ||
|
|
a76ec37e63 | ||
|
|
c3f397b508 | ||
|
|
d4f5b1c0ca | ||
|
|
ae4680f546 | ||
|
|
b0c14c686c | ||
|
|
4a59c02340 | ||
|
|
9754515ec6 | ||
|
|
f810cdb090 | ||
|
|
af8cfa8b3d | ||
|
|
c9de2b2bf1 | ||
|
|
f3bd112f3e | ||
|
|
2d3bd8c2af | ||
|
|
8a9a59fd3c | ||
|
|
c738f55078 | ||
|
|
2e39aa7f7f | ||
|
|
c65aaf03eb | ||
|
|
d3e18cb8c0 | ||
|
|
8de519ad3f | ||
|
|
d06c735585 | ||
|
|
c820a01db0 | ||
|
|
0d6f6221cb | ||
|
|
77e6070e78 | ||
|
|
46c5849842 | ||
|
|
72bca5b6fc | ||
|
|
94d12f69fe | ||
|
|
1f68bab455 | ||
|
|
390d214976 | ||
|
|
5b40c8bab2 | ||
|
|
7eee9117c0 | ||
|
|
49e1b6ac00 | ||
|
|
d356ad3a3d | ||
|
|
0f38eb5bca | ||
|
|
1d3e54a54a | ||
|
|
4792b14051 | ||
|
|
66d87d68de | ||
|
|
5d60825c7d | ||
|
|
4ca40b59d9 | ||
|
|
a9b6e02a71 | ||
|
|
055eaab819 | ||
|
|
1f467a72a6 | ||
|
|
14ee434e13 | ||
|
|
d317a4488e | ||
|
|
3b78d68ed0 | ||
|
|
2d234931d7 | ||
|
|
ff01cc1551 | ||
|
|
4ae49291ad | ||
|
|
268f219754 | ||
|
|
6d819a0507 | ||
|
|
41e0c1bf2d | ||
|
|
db8b5ab631 | ||
|
|
d7c531d51f | ||
|
|
03f690e450 | ||
|
|
6ffc6b98e5 | ||
|
|
a99865e0c6 | ||
|
|
2c7d5a937f | ||
|
|
37c9c7970a | ||
|
|
a9c1c318dc | ||
|
|
4e74e85976 | ||
|
|
30f9e506b2 | ||
|
|
72b17e3c04 | ||
|
|
ca00521ba8 | ||
|
|
3f289b1deb | ||
|
|
cbd86be78c | ||
|
|
c62e1bcc28 | ||
|
|
6c91bc273e | ||
|
|
76d9fae579 | ||
|
|
76de1f6076 | ||
|
|
b1971f90be | ||
|
|
e702d0088d | ||
|
|
332a0a6e1b | ||
|
|
58bf92eeab | ||
|
|
7787d749c9 | ||
|
|
b075145090 | ||
|
|
afe7fff061 | ||
|
|
6f3abd0986 | ||
|
|
2da2c41011 | ||
|
|
252a223e89 | ||
|
|
dcf8b22592 | ||
|
|
5c1dbfff7b | ||
|
|
e8c9ae1a64 | ||
|
|
b1f9796e21 | ||
|
|
02847c428d | ||
|
|
7552038d48 | ||
|
|
84d6a8b110 | ||
|
|
e9be40848a | ||
|
|
d8dd485d3f | ||
|
|
b27924bd4a | ||
|
|
be61d2d2ad | ||
|
|
647989944e | ||
|
|
e80facfd3b | ||
|
|
43dbc87a1e | ||
|
|
4b4ef77d4e | ||
|
|
cb431c0b5f | ||
|
|
f56960d15b | ||
|
|
41017342c9 | ||
|
|
9b218bb4f7 | ||
|
|
fbe37cf81a | ||
|
|
6ec091dfa5 | ||
|
|
e6a9c8e32e | ||
|
|
ba034be048 | ||
|
|
157fe0435b | ||
|
|
1123d10b05 | ||
|
|
8f7fa9a324 | ||
|
|
7cf60159c4 | ||
|
|
c5add81e90 | ||
|
|
5a6ada47b9 | ||
|
|
f4336c9227 | ||
|
|
123562c672 | ||
|
|
493101850e | ||
|
|
6bba26a848 | ||
|
|
46474f67b8 | ||
|
|
14f0a4643c | ||
|
|
037e667411 | ||
|
|
0a25c286cd | ||
|
|
5561270a60 | ||
|
|
1d499bbce8 | ||
|
|
6e8bf6999c | ||
|
|
5da8977ec0 | ||
|
|
fcb32062d3 | ||
|
|
9e74c7fd18 | ||
|
|
d3d73cc30d | ||
|
|
d9f76677c0 | ||
|
|
151999c2cd | ||
|
|
0460f17c1f | ||
|
|
2c69513d2b | ||
|
|
617efe6a58 | ||
|
|
2734f1d00c | ||
|
|
e66069b270 | ||
|
|
a661575451 | ||
|
|
a23017cd1f | ||
|
|
0df19ce18a | ||
|
|
5a751546ec | ||
|
|
ee9e1cabc1 | ||
|
|
d78b46155f | ||
|
|
1afd61d517 | ||
|
|
97a5083ff5 | ||
|
|
0d31e74790 | ||
|
|
02214196f4 | ||
|
|
aae268cfc5 | ||
|
|
20f37d8799 | ||
|
|
0b825bcda3 | ||
|
|
aba3bd22c7 | ||
|
|
b1fc33f5a1 | ||
|
|
f2033f5e33 | ||
|
|
6c600b7bdb | ||
|
|
e93bfb7f0f | ||
|
|
8976909742 | ||
|
|
30a9c2f53e | ||
|
|
ea60790865 | ||
|
|
f906fac8f3 | ||
|
|
05b324a3cb | ||
|
|
8ce1c7ccf5 | ||
|
|
a37f93241f | ||
|
|
6689663ca9 | ||
|
|
959b81a58f | ||
|
|
62e607b44e | ||
|
|
407bb6b977 | ||
|
|
a9efd327b8 | ||
|
|
64cb4d2ff8 | ||
|
|
54786fa82e | ||
|
|
ecab1b7825 | ||
|
|
75d7106f46 | ||
|
|
6f82c09afa | ||
|
|
778e5e219c | ||
|
|
f4682e0bd2 | ||
|
|
906d487ffc | ||
|
|
817b801bf7 | ||
|
|
e401b11ab9 | ||
|
|
165f70e01d | ||
|
|
fddfbfb4ed | ||
|
|
03e229c511 | ||
|
|
0b08372407 | ||
|
|
6d26b5de20 | ||
|
|
ef179410f9 | ||
|
|
194f6e019a | ||
|
|
1f933827b9 | ||
|
|
28765bb2ce | ||
|
|
136391db04 | ||
|
|
0cc39e71fc | ||
|
|
d65cc08793 | ||
|
|
a1729a0266 | ||
|
|
8505634df3 | ||
|
|
02047c1ec0 | ||
|
|
068fa4b2ef | ||
|
|
bfd266a40e | ||
|
|
6367d4e2aa | ||
|
|
f8a680f381 | ||
|
|
81750e6eb9 | ||
|
|
818cf682bf | ||
|
|
3112a0650f | ||
|
|
747ef94f04 | ||
|
|
dbacada48c | ||
|
|
26db8a40cc | ||
|
|
6e5feda00e | ||
|
|
f04330074b | ||
|
|
80d733d329 | ||
|
|
0099dcf5c5 | ||
|
|
0a30551b7d | ||
|
|
e4ee0227fd | ||
|
|
4ec7168499 | ||
|
|
650647e94b | ||
|
|
a5371f4b5d | ||
|
|
d47e7fb3c4 | ||
|
|
ef983e17fe | ||
|
|
d78975be6e | ||
|
|
19a264870c | ||
|
|
ee1753de67 | ||
|
|
742354b2cb | ||
|
|
e2f6aaa4de | ||
|
|
abc2911059 | ||
|
|
d76caf7093 | ||
|
|
bf859f8435 | ||
|
|
b31c10cc52 | ||
|
|
89e3c7d8b0 | ||
|
|
167b09f24f | ||
|
|
39165266d5 | ||
|
|
7405f2de75 | ||
|
|
762fe87454 | ||
|
|
ebbc81b605 | ||
|
|
12d41aada1 | ||
|
|
61fe9c23ce | ||
|
|
945c9c60a9 | ||
|
|
8413b0392e | ||
|
|
868edcd392 | ||
|
|
a3b2f9b6fc | ||
|
|
12b444bb41 | ||
|
|
0e814fd567 | ||
|
|
7b083aa038 | ||
|
|
4e0a4c84b5 | ||
|
|
2d9b47e645 | ||
|
|
39a2182736 | ||
|
|
5a996abbf3 | ||
|
|
a20def5161 | ||
|
|
030f370290 | ||
|
|
f3ade3cb82 | ||
|
|
315cb6a1ac | ||
|
|
60615d32f5 | ||
|
|
1d27d9cf5b | ||
|
|
2ba760d0f9 | ||
|
|
c31ec3b418 | ||
|
|
d0afab9604 | ||
|
|
4e9f8fe1c0 | ||
|
|
803f93aa73 | ||
|
|
853940d009 | ||
|
|
6ddb746d49 | ||
|
|
2b86b15132 | ||
|
|
5f0f5d0aa5 | ||
|
|
136aab872a | ||
|
|
a1d4702af0 | ||
|
|
b2777c13b8 | ||
|
|
26cb473b9d | ||
|
|
907c639e28 | ||
|
|
80d2eafed7 | ||
|
|
519122e5be | ||
|
|
c211768d5c | ||
|
|
908f318eeb | ||
|
|
0143f93577 | ||
|
|
f8615aeb82 | ||
|
|
b113448a9c | ||
|
|
2930a11c75 | ||
|
|
982de7f5c7 | ||
|
|
bfdb5e9787 | ||
|
|
d5ea945c6b | ||
|
|
5a18d038a2 | ||
|
|
d0389d6c9c | ||
|
|
c9bc6e24fe | ||
|
|
8b4a8e9534 | ||
|
|
5adfd00509 | ||
|
|
4090e038ae | ||
|
|
f3ab282fd1 | ||
|
|
40b97d3c1e | ||
|
|
829b97270d | ||
|
|
61111c8038 | ||
|
|
1f4fbaa177 | ||
|
|
9e8ef7e875 | ||
|
|
190d90a966 | ||
|
|
5a07c82a5d | ||
|
|
9c2e56ee8b | ||
|
|
c83f194dc9 | ||
|
|
b9bcb66d2a | ||
|
|
b72050da1d | ||
|
|
82522ad6ab | ||
|
|
d40e2e6103 | ||
|
|
96715770a7 | ||
|
|
48fa67c2e4 | ||
|
|
9a6217f755 | ||
|
|
f1f035b5f9 | ||
|
|
19aa53effc | ||
|
|
be7cb4583c | ||
|
|
887891f74d | ||
|
|
d83cd34bf4 | ||
|
|
bee41a90f9 | ||
|
|
79afe9d812 | ||
|
|
9fe55c5692 | ||
|
|
feddce2575 | ||
|
|
4ddc5e3a93 | ||
|
|
f63f1764ab | ||
|
|
7c694e9733 | ||
|
|
21b6977387 | ||
|
|
408735399c | ||
|
|
f6c856d161 | ||
|
|
8173cf13a8 | ||
|
|
7d0becf1bd | ||
|
|
9b4a87ce68 | ||
|
|
464c4d349d | ||
|
|
a35d3131f8 | ||
|
|
9d99d3c331 | ||
|
|
b100516b24 | ||
|
|
8da5396443 | ||
|
|
5d2a727311 | ||
|
|
d7f03215e2 | ||
|
|
d366471e71 | ||
|
|
e5163f154a | ||
|
|
cfc497d8ed | ||
|
|
35f8ab0257 | ||
|
|
e890743c86 | ||
|
|
ffec6e307d | ||
|
|
7c35db7eaa | ||
|
|
9f0c2296bc | ||
|
|
6b0a06c64d | ||
|
|
160186931f | ||
|
|
22c4a14fbe | ||
|
|
241a82764b | ||
|
|
6e4d48bb07 | ||
|
|
7a383f419a | ||
|
|
933b99d349 | ||
|
|
72d78084f6 | ||
|
|
fcee4d2774 | ||
|
|
61c7f3bc13 | ||
|
|
3830637f3c | ||
|
|
45f8049521 | ||
|
|
823774bcfe | ||
|
|
920e5211c0 | ||
|
|
7da61e3d8d | ||
|
|
754b60b15c | ||
|
|
839454bfd6 | ||
|
|
3b6a0667d6 | ||
|
|
f298adaea8 | ||
|
|
641206b811 | ||
|
|
93a94b4900 | ||
|
|
40363c2ea1 | ||
|
|
6f15d65d90 | ||
|
|
02f9b21cff | ||
|
|
79cf154304 | ||
|
|
a650683d45 | ||
|
|
311dc3dc9c | ||
|
|
bda1f80ecc | ||
|
|
817796bf40 | ||
|
|
8a48eeab8b | ||
|
|
0061104c0d | ||
|
|
5110a1be17 | ||
|
|
4cbb998106 | ||
|
|
17de3f496c | ||
|
|
b54181e93a | ||
|
|
eaf7edcd94 | ||
|
|
cdf1631e2b | ||
|
|
841f49553e | ||
|
|
57d7d5a1b9 | ||
|
|
b1f2ab2ed7 | ||
|
|
f629d95844 | ||
|
|
30904fbdda | ||
|
|
9a3be6a85a | ||
|
|
88c91d9bdd | ||
|
|
5d2efe3e6b | ||
|
|
d6354d3d94 | ||
|
|
4ddfdd828c | ||
|
|
06b70c6204 | ||
|
|
2dc9d11f79 | ||
|
|
fbb161c511 | ||
|
|
f84bc62d61 | ||
|
|
2e20554d1e | ||
|
|
bb9fcc64ed | ||
|
|
2d908468ea | ||
|
|
c9ae148d86 |
+198
-41
@@ -1,52 +1,177 @@
|
||||
# Changelog
|
||||
## [1.6.1 (Release TBD)](#1-6-1)
|
||||
## [1.7.0 (Month xth, 2025)](#1-7-0)
|
||||
|
||||
### Additions
|
||||
- Added an in-game configuration screen, allowing all settings from `main.json` to be edited directly in-game.
|
||||
- Added `/cobblemonconfig reload` command to reload `main.json` configuration. **Note:** Some settings require a server restart to take effect; use this command cautiously.
|
||||
|
||||
### Changes
|
||||
- Renamed `chargeGainedPerTick` config to `secondsToChargeHealingMachine`.
|
||||
|
||||
### Fixes
|
||||
- Fixed Particles sometimes facing the wrong direction (looking at you, Swords Dance)
|
||||
- Fixed PCs always opening at box 2 instead of box 1.
|
||||
|
||||
### Developer
|
||||
- A finished battle now has winners and losers set inside of `PokemonBattle` instead of them always being empty.
|
||||
- Dialogues are correctly removed from memory when they are stopped.
|
||||
- Dialogues with variably-set initial pages now properly start timeout tracking.
|
||||
- Added `EvGainedEvent.Pre` and `EvGainedEvent.Post`.
|
||||
- Deprecated `EVs#add(Stat, Int)`, you will not be able to compile against this code please migrate to the `EVs#add(Stat, Int, EvSource)` you most likely want to use `SidemodEvSource` but please check other implementations or make your own.
|
||||
|
||||
### Additions
|
||||
- Added `/cobblemonconfig reload` command to reload `main.json` configuration. **Note:** Some settings require a server restart to take effect; use this command cautiously.
|
||||
- Added the Model Appendages system, allowing for resolver-based bedrock model attachments to Pokémon models based on Locators.
|
||||
- View the `egg` examples in `assets/cobblemon/bedrock/appendage` for an example of how to use this system.
|
||||
|
||||
## [1.6.1 (January 26th, 2025)](#1-6-1)
|
||||
|
||||
### Additions
|
||||
- Added crossover paintings from Close Combat: Premonition, Altar, Slumber, and Nomad.
|
||||
- Added Galarica Nuts, used for crafting Galarica Cuffs and Wreaths. Dropped from certain Pokémon. Take a wild guess which.
|
||||
- Added compatibility with Repurposed Structures. (Thank you, TelepathicGrunt!)
|
||||
- Added an evolution method for Karrablast to evolve into Escavalier in singleplayer.
|
||||
- Pokédexes can now be placed in Chiseled Bookshelves.
|
||||
- Added optional box argument to the /pc command.
|
||||
- Pokédex and Dialogue screens now close when the inventory keybind is pressed.
|
||||
- Added config setting `maxPokedexScanningDetectionRange` to control from what distance the player can scan Pokémon using the Pokédex.
|
||||
- Added the `is_standing_on_blocks(depth, blocks...)` MoLang function, which returns whether the specified entity is standing on a specific block or set of blocks. Example usage: `q.is_standing_on_blocks(2, minecraft:sand)`
|
||||
- Added config setting `hideUnimplementedPokemonInThePokedex` which hides unimplemented Pokémon from the Pokédex when set to true.
|
||||
- Added molang particle queries for getting distance to targeted entities.
|
||||
- Added debug renderer for poseable entity locators.
|
||||
- Added `baseScale` property to NPCs.
|
||||
- Added the player to `PokerodReelEvent`.
|
||||
- Pokédex and Dialogue API screens now close when the inventory keybind is pressed.
|
||||
- Added Galarica Nuts, used for crafting Galarica Cuffs and Wreaths. Dropped from certain Pokémon.
|
||||
- Added specific compatibility with Repurposed Structures. (Thank you, TelepathicGrunt!)
|
||||
- Added debug renderer for posable entity locators.
|
||||
- Added crossover paintings from Close Combat, Premonition, Altar, Slumber, and Nomad.
|
||||
- Added optional box argument to the /pc command
|
||||
|
||||
### Changes
|
||||
- Pokémon will now be dynamically revealed to the Pokédex as they're seen instead of revealing entire parties at the end of battle regardless.
|
||||
- Unseen wild Pokémon will update their name from '???' to their real name as soon as a battle starts to reflect the battle UI showing the actual species name.
|
||||
- Pokémon under the illusion effect will reveal their disguise to the Pokédex first and then the base Pokémon once the disguise is broken.
|
||||
- Added more support for a variety of Fabric/NeoForge Convention tags.
|
||||
- Reformatted some tags to be more consistent.
|
||||
- Edited some recipes to utilize tags instead of direct item ids, for greater mod compatibility.
|
||||
- Berries will drop if broken at age 0
|
||||
- Improved Fortune drops on Mint Seeds
|
||||
- New Slowpoke shiny texture.
|
||||
- Updated drops for many Pokémon.
|
||||
- Completely resynced Pokémon move and stat data based on later games. Learnsets have changed considerably to maximise available moves.
|
||||
- Cobblemon save data now saves .old files where applicable as a means to recover from file corruption due to crashes or similar abrupt stops
|
||||
|
||||
### Pokémon Added
|
||||
|
||||
#### Gen 5
|
||||
- Ducklett
|
||||
- Swanna
|
||||
- Shelmet
|
||||
- Accelgor
|
||||
- Karrablast
|
||||
- Escavalier
|
||||
- Rufflet
|
||||
- Braviary
|
||||
- Foongus
|
||||
- Amoonguss
|
||||
|
||||
#### Gen 6
|
||||
- Binacle
|
||||
- Barbaracle
|
||||
|
||||
#### Gen 7
|
||||
- Dewpider
|
||||
- Araquanid
|
||||
- Alolan Geodude
|
||||
- Alolan Graveler
|
||||
- Alolan Golem
|
||||
|
||||
#### Gen 8
|
||||
- Galarian Slowpoke
|
||||
- Galarian Slowbro
|
||||
- Galarian Slowking
|
||||
|
||||
#### Gen 9
|
||||
- Paldean Tauros
|
||||
|
||||
### Added cries to the following Pokémon
|
||||
- All Nidorans
|
||||
- Shellder, Cloyster
|
||||
- Pinsir
|
||||
- Tyrogue, Hitmontop
|
||||
- Spinda
|
||||
|
||||
### Animation updates for the following Pokémon
|
||||
- Primeape
|
||||
- Munchlax
|
||||
- Snorlax
|
||||
- Poliwrath
|
||||
- Goldeen
|
||||
- Seaking
|
||||
- Dondozo
|
||||
- Wobbuffet
|
||||
- Charcadet
|
||||
- Armarouge
|
||||
- Ceruledge
|
||||
- Geodude
|
||||
- Graveler
|
||||
- Golem
|
||||
- Sandile
|
||||
- Krokorok
|
||||
- Krookodile
|
||||
|
||||
### Model updates for the following Pokémon
|
||||
- Slowpoke
|
||||
- Slowbro
|
||||
- Slowking
|
||||
- Eiscue
|
||||
- Tauros
|
||||
- Goldeen
|
||||
- Seaking
|
||||
- Charcadet
|
||||
- Armarouge
|
||||
- Ceruledge
|
||||
- Pinsir
|
||||
- Geodude
|
||||
- Graveler
|
||||
- Golem
|
||||
|
||||
### Cry updates for the following Pokémon
|
||||
- Sceptile
|
||||
|
||||
### Changes
|
||||
- Completely re-synced Pokémon move and stat data based on later games. Learnsets have changed considerably to maximise available moves.
|
||||
- Pokémon will now be dynamically revealed to the Pokédex as they're seen in battle instead of revealing entire parties at the end of battle.
|
||||
- Unseen wild Pokémon will update their name from '???' to their real name as soon as a battle starts to match how the battle UI shows the actual species name.
|
||||
- Pokémon under the illusion effect will reveal their disguise to the Pokédex first and then the base Pokémon once the disguise is broken.
|
||||
- Berries will now drop from berry trees if broken at age 0 so you aren't punished for mistaken planting.
|
||||
- Increased Fortune drops on Mint Seeds.
|
||||
- Updated Slowpoke's shiny texture.
|
||||
- Updated drops for many Pokémon.
|
||||
- Adjusted the evolution sound to match the timing of the particle effect.
|
||||
- Made berry trees shear-able by dispenser blocks. I'm sure nobody will make unholy contraptions with this.
|
||||
- Edited some recipes to utilize tags instead of direct item IDs, for better mod compatibility.
|
||||
- Added more support for a variety of Fabric/NeoForge conventional tags.
|
||||
- Reformatted some tags to be more consistent.
|
||||
|
||||
### Fixes
|
||||
- Fixed Pokédex sometimes crashing when switching forms.
|
||||
- Fixed Pokédex interface not transitioning out when closed.
|
||||
- Fixed texture dimensions for the interact interface.
|
||||
- Fixed crash related to Tom's Simple Storage mod and Fossil Machine.
|
||||
- Fixed texture dimensions for the player and Pokémon interact interface.
|
||||
- Fixed crash related to Tom's Simple Storage mod and the Fossil Machine.
|
||||
- Fixed not being able to retrieve a fossil from the Fossil Machine with an empty hand.
|
||||
- Fixed Pokémon being collidable while being captured by a Poké Ball.
|
||||
- Fixed Pokémon being collidable (collidible? collissionable? kaleidoscopable?) while being captured by a Poké Ball.
|
||||
- Fixed `full_party`, `own_zangoose_seviper`, `use_revive` and `use_candy` Advancement triggers.
|
||||
- Fixed `healing_machine` Advancement by using the correct 1.21 trigger.
|
||||
- Fix Display Cases not dropping items if destroyed through explosions.
|
||||
- Fixed an issue where the first Pokémon in the pastured Pokémon list clipped into the interface.
|
||||
- Fixed all Pokémon facing South on spawn.
|
||||
- Parametric particle motion now works.
|
||||
- Event spawned particles now work.
|
||||
- Particles can now have independent coordinate spaces.
|
||||
- Fixed bait being consumed when not reeling in any Pokémon.
|
||||
- Fixed bait being consumed even when not reeling in any Pokémon.
|
||||
- Fixed Miltank milk magically disappearing out of your bucket.
|
||||
- Fixed Pokémon nicknames migrating from 1.5.2 not being displayed properly.
|
||||
- Fixed capitalization in one of our config fields, but allowing typo'd version to still be valid.
|
||||
- Fixed Poké Rods not working if lure or luck of the sea enchantments get removed by other mods.
|
||||
- Fixed crashes related to Pokémon when they are ready to evolve while holding an enchanted item.
|
||||
- Fixed crashes that sometimes occur when evolving Nincada.
|
||||
- Fixed plants not being compostible on NeoForge.
|
||||
- Fixed capitalization in one of our config options. It was a very important fix. Very important. Old configs are fine.
|
||||
- Fixed Poké Rods not working if Lure or Luck of the Sea enchantments get removed by other mods.
|
||||
- Fixed crashes related to Pokémon when they are ready to evolve while holding an enchanted item. Very specific.
|
||||
- Fixed a crash that sometimes occurred when evolving Nincada.
|
||||
- Fixed Cobblemon plants not being compostable on NeoForge.
|
||||
- Fixed hide UI (F1 key) not hiding the party overlay.
|
||||
- Fixed NPC MoLang command `player_lose_command` not working.
|
||||
- Corrected misaligned tooltips with editboxes in the NPC editor screen.
|
||||
- Fixed misaligned tooltips with edit boxes in the NPC editor screen.
|
||||
- Fixed Pokémon riding two boats when attempting to deploy a platform on water.
|
||||
- Made berry trees be shearable by dispenser blocks.
|
||||
- Fixed the summary screen showing there's experience to reach the next level when at level cap.
|
||||
- Fixed the summary screen showing there's experience to reach the next level when they are at the level cap.
|
||||
- Fixed Pokémon forgetting moves when evolving on specific cases.
|
||||
- Fixed Adorn compatibility, including improvements when using JEI/REI (Apricorn items now show up under the collapsed entries rather than standalone).
|
||||
- Fixed error message appearing on battle log when using Solar Beam with Sunny Day.
|
||||
@@ -54,35 +179,68 @@
|
||||
- Fixed `/pokedex grant all` command not giving male/female/shininess completion for some Pokémon.
|
||||
- Fixed `/pokedex grant only` and `/pokedex remove only` not respecting the form parameter passed.
|
||||
- Fixed variant forms appearing incorrectly in the Pokédex when the normal form had not been unlocked.
|
||||
- Fixed Pokémon occasionally being shot into the sky during battle.
|
||||
- Fixed Pokémon occasionally being shot into the sky during battle. No Pokémon were harmed by this bug, probably.
|
||||
- Fixed NPC editing GUI not updating aspects until a game restart.
|
||||
- Fix some users being unable to open their PC if a Pokémon in said PC had a lot of pp raises beyond normal bounds
|
||||
- Fix some color variants (dubwool, conkeldurr and undyed wooloo) missing in the Pokédex
|
||||
- Fix invalid species or held_items causing Players to not be able to load into their world anymore (commonly happening after removing addons/mods)
|
||||
- Fixed some users being unable to open their PC if a Pokémon in it had a lot of PP raises beyond normal bounds. How did you get those, anyway? Tell me or the Bellossom gets it.
|
||||
- Fixed some color variants (Dubwool, Conkeldurr and Undyed wooloo) being missing in the Pokédex.
|
||||
- Fixed invalid species or held items causing Players to not be able to load into their world anymore (commonly happening after removing addons/mods).
|
||||
- Fixed Wooloo variants not being automatically registered in the owner's Pokédex when dyed.
|
||||
- Fixed Vivichoke Dip and Leek and Potato Stew not returning a bowl upon consumption.
|
||||
- Fixed Fossil Restoration Machine not accepting Hay Bales.
|
||||
- Fixed Potion items so that they no longer apply over double their intended healing value.
|
||||
- Fixed Vivichoke Dip and Leek & Potato Stew not returning a bowl upon consumption.
|
||||
- Fixed Fossil Restoration Tank not accepting Hay Bales as organic material.
|
||||
- Fixed Potion items applying double their intended healing value.
|
||||
- Fixed Fast Ball capture bonuses applying to all Pokémon, making it the Best Ball instead of the Mediocre Edge-Case Ball.
|
||||
- Fixed "learned new move" messages appearing for already-known moves on Pokémon evolutions.
|
||||
- Fixed Pokémon Item Models breaking shadows nearby when being placed in Display Cases or Item Frames.
|
||||
- Fixed berries not giving bonus yields when planted in their preferred biomes. I'm sure we've fixed that 5 times now.
|
||||
- Fixed the NeoForge version not supporting "SodiumDynamicLights".
|
||||
- Fixed players disconnecting from servers if they made changes to certain config options.
|
||||
- Fixed players with shouldered Pokémon not being able to rejoin their 1.5.2 worlds using 1.6.
|
||||
- Fixed `PokemonProperties` utilizing `ability=<some ability>` being treated as a forced ability even when it is a legal ability for the Pokémon.
|
||||
- Fixed type formatting in Pokédex scanner mode when dual types require two lines.
|
||||
- Fixed trading sometimes crashing the game or server.
|
||||
- Fixed Wild shiny sounds not respecting the `shinyNoticeParticlesDistance` config setting.
|
||||
- Fixed Pokémon being able to evolve mid-battle.
|
||||
- Fixed NPC held items being able to be stolen by players. Don't be a thief!
|
||||
- Fixed evolutions that require a held item consuming it as soon as meeting requirements when it should only be consumed upon evolution.
|
||||
- Fixed Pokémon showing only the default form when selecting them as a target in battle.
|
||||
- Fixed a possible error coming out of reeling fishing rods in specific situations.
|
||||
- Fixed incorrect weights being used when Poké Fishing with Luck of the Sea.
|
||||
- Parametric particle motion now works.
|
||||
- Event-spawned particles now work.
|
||||
- Particles can now have independent coordinate spaces.
|
||||
|
||||
### Molang & Datapacks
|
||||
### Developer
|
||||
- Updated the Pokédex data updated events to always include a `Pokemon` instance, and optionally a `DisguiseData` instance.
|
||||
- Updated fields in `SpawnNPCPacket` and `SpawnPokemonPacket` to be visible and mutable.
|
||||
- Updated `UnvalidatedPlaySoundS2CPacket` to be public instead of internal and made its fields mutable.
|
||||
- Added `hideNameTag` field and `HideNPCNameTag` nbt tag to `NPCEntity` to allow hiding the name tag of the NPC.
|
||||
- Added the player to `PokerodReelEvent` so you know who is doing the reeling.
|
||||
|
||||
### MoLang & Datapacks
|
||||
- Added flows for:
|
||||
- `forme_change`: Triggered when a Pokémon changes form in battle.
|
||||
- `mega_evolution`: Triggered when a Pokémon mega evolves in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `zpower_used`: Triggered when a Pokémon uses a Z-Power move in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `terastallization`: Triggered when a Pokémon terastallizes in battle. (Note: Third party mods are required for this feature currently)
|
||||
- `mega_evolution`: Triggered when a Pokémon mega evolves in battle. (Note: Third-party mods are required for this feature currently)
|
||||
- `zpower_used`: Triggered when a Pokémon uses a Z-Power move in battle. (Note: Third-party mods are required for this feature currently)
|
||||
- `terastallization`: Triggered when a Pokémon terastallizes in battle. (Note: Third-party mods are required for this feature currently)
|
||||
- `battle_fainted`: Triggered when a Pokémon faints in battle.
|
||||
- `battle_fled`: Triggered when a Player flees from battle.
|
||||
- `battle_fled`: Triggered when a player flees from battle.
|
||||
- `battle_started_pre`: Triggered when a battle starts. Cancelable!
|
||||
- `battle_started_post`: Triggered when a battle starts.
|
||||
- `apricorn_harvested`: Triggered when an apricorn is harvested.
|
||||
- `apricorn_harvested`: Triggered when an Apricorn is harvested.
|
||||
- `thrown_pokeball_hit`: Triggered when a thrown Pokéball hits a Pokémon.
|
||||
- `level_up`: Triggered when a Pokémon levels up.
|
||||
- `pokemon_fainted`: Triggered when a Pokémon faints.
|
||||
- `pokemon_gained`: Triggered when a Player gains a Pokémon.
|
||||
- Added molang functions:
|
||||
- `pokemon_gained`: Triggered when a player gains a Pokémon.
|
||||
- Added MoLang functions:
|
||||
- For Pokémon:
|
||||
- `pokemon.apply(PokemonProperties)`: Applies the given properties to the Pokémon.
|
||||
- `pokemon.owner`: Returns the owner of the Pokémon or 0.0 if there is no owner or they are not online.
|
||||
- For all entities:
|
||||
- `entity.is_standing_on_blocks(depth, blocks...)`: Returns whether the specified entity is standing on a specific block or set of blocks. Example usage: `q.is_standing_on_blocks(2, minecraft:sand)`
|
||||
- Added NPC field:
|
||||
- `hideNameTag`: Hides the name tag of the NPC.
|
||||
- Added `baseScale` property to NPCs.
|
||||
- Added MoLang particle queries for getting distance to targeted entities.
|
||||
|
||||
## [1.6.0 - The Record Catch Update (December 25th, 2024)](#1-6-0)
|
||||
#### "Now that there's a fishing mechanic, the mod is actually good!"
|
||||
@@ -1985,5 +2143,4 @@ Thank you so much to all of our community translators that bring the mod to the
|
||||
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
|
||||
|
||||
## [1.0.0 (November 12th, 2022)](#1-0-0)
|
||||
- Initial release.
|
||||
|
||||
- Initial release.
|
||||
@@ -1,27 +0,0 @@
|
||||
plugins {
|
||||
id("java-gradle-plugin")
|
||||
kotlin("jvm") version "2.1.0"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("net.neoforged:moddev-gradle:2.0.75")
|
||||
implementation("dev.architectury:at:1.0.1")
|
||||
implementation("net.fabricmc:access-widener:2.1.0")
|
||||
}
|
||||
|
||||
gradlePlugin {
|
||||
plugins {
|
||||
create("cobblemongradle") {
|
||||
id = "com.cobblemon.gradle"
|
||||
implementationClass = "com.cobblemon.gradle.CobblemonGradle"
|
||||
version = "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
dependencyResolutionManagement {
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.cobblemon.gradle
|
||||
|
||||
import com.cobblemon.gradle.extension.CobblemonGradleExtension
|
||||
import com.cobblemon.gradle.extension.tasks.ConvertAccessWidenersTask
|
||||
import com.cobblemon.gradle.extension.tasks.UnzipAccessWidenersTask
|
||||
import net.neoforged.nfrtgradle.CreateMinecraftArtifacts
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.LibraryElements
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
|
||||
class CobblemonGradle : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
val cobblemonExtension = project.extensions.create(
|
||||
CobblemonGradleExtension.EXTENSION_NAME,
|
||||
CobblemonGradleExtension::class.java
|
||||
)
|
||||
|
||||
//This exists because all of
|
||||
// - com.cobblemon:mod
|
||||
// - com.cobblemon:mod-resources
|
||||
// - com.cobblemon:accesswidener
|
||||
//technically point to the same dependency (the :common project). To pick the proper artifact from that project
|
||||
//we set attributes in that project and check for them here.
|
||||
val accessWideners = project.configurations.register("accessWidener") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.OBJECTS)
|
||||
)
|
||||
}
|
||||
}
|
||||
val includeRootResources = project.configurations.register("includeRootResources") { configuration ->
|
||||
configuration.isCanBeConsumed = false
|
||||
configuration.isCanBeResolved = true
|
||||
configuration.isCanBeDeclared = true
|
||||
configuration.attributes {
|
||||
it.attribute(
|
||||
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
|
||||
project.objects.named(LibraryElements::class.java, LibraryElements.RESOURCES)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val unzipAwTask = project.tasks.register("unzipAccessWideners", UnzipAccessWidenersTask::class.java) {
|
||||
it.accessWidenerZips = accessWideners.get()
|
||||
}
|
||||
|
||||
|
||||
val convertAwTask = project.tasks.register(ConvertAccessWidenersTask.NAME, ConvertAccessWidenersTask::class.java) {
|
||||
it.enabled = cobblemonExtension.convertAccessWideners
|
||||
it.dependsOn(unzipAwTask)
|
||||
it.accessWideners = project.files(unzipAwTask).plus(project.files(cobblemonExtension.additionalAccessWideners))
|
||||
}
|
||||
|
||||
//Add root resources and access wideners to output jar
|
||||
project.tasks.named("processResources", ProcessResources::class.java) { task ->
|
||||
task.dependsOn(includeRootResources)
|
||||
if (cobblemonExtension.convertAccessWideners) {
|
||||
task.dependsOn(convertAwTask)
|
||||
task.from(convertAwTask)
|
||||
}
|
||||
else {
|
||||
task.dependsOn(unzipAwTask)
|
||||
task.from(unzipAwTask)
|
||||
}
|
||||
task.doLast {
|
||||
project.copy {
|
||||
it.from(project.provider {
|
||||
includeRootResources.get().resolve().map { project.zipTree(it) }
|
||||
})
|
||||
it.into(task.destinationDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.tasks.withType(CreateMinecraftArtifacts::class.java) {
|
||||
it.dependsOn(convertAwTask)
|
||||
it.accessTransformers.from(convertAwTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.cobblemon.gradle.extension
|
||||
|
||||
import org.gradle.api.file.FileCollection
|
||||
|
||||
abstract class CobblemonGradleExtension {
|
||||
var additionalAccessWideners: FileCollection? = null
|
||||
var convertAccessWideners = true
|
||||
|
||||
companion object {
|
||||
const val EXTENSION_NAME = "cobblemon"
|
||||
}
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import dev.architectury.at.AccessChange
|
||||
import dev.architectury.at.AccessTransform
|
||||
import dev.architectury.at.AccessTransformSet
|
||||
import dev.architectury.at.ModifierChange
|
||||
import dev.architectury.at.io.AccessTransformFormats
|
||||
import net.fabricmc.accesswidener.AccessWidenerReader
|
||||
import net.fabricmc.accesswidener.AccessWidenerVisitor
|
||||
import org.cadixdev.bombe.type.signature.MethodSignature
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.io.Writer
|
||||
import java.nio.file.Files
|
||||
|
||||
abstract class ConvertAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWideners: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@Internal
|
||||
val accessTransformerDir = project.layout.buildDirectory.dir("access-transformers")
|
||||
|
||||
@OutputFiles
|
||||
val accessTransformers = project.files ({
|
||||
accessWideners.files.map {
|
||||
accessTransformerDir.get().file(it.name.replace("accesswidener", "accesstransformer.cfg"))
|
||||
}
|
||||
})
|
||||
|
||||
@TaskAction
|
||||
fun convertAccessWideners() {
|
||||
accessWideners.files.forEach { file ->
|
||||
val awFile = Files.newBufferedReader(file.toPath())
|
||||
val result = AccessTransformSet.create();
|
||||
|
||||
AccessWidenerReader(object : AccessWidenerVisitor {
|
||||
override fun visitClass(name: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(name).merge(toAt(access));
|
||||
}
|
||||
|
||||
override fun visitMethod(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeMethod(MethodSignature.of(name, descriptor), toAt(access));
|
||||
}
|
||||
|
||||
override fun visitField(owner: String, name: String, descriptor: String, access: AccessWidenerReader.AccessType, transitive: Boolean) {
|
||||
result.getOrCreateClass(owner).mergeField(name, toAt(access));
|
||||
}
|
||||
}).read(awFile)
|
||||
|
||||
val outputFile = accessTransformerDir.get().file(
|
||||
file.name.replace("accesswidener", "accesstransformer.cfg")
|
||||
)
|
||||
var outputWriter: Writer? = null
|
||||
try {
|
||||
outputWriter = outputFile.asFile.writer()
|
||||
AccessTransformFormats.FML.write(outputWriter, result)
|
||||
}
|
||||
finally {
|
||||
outputWriter?.flush()
|
||||
outputWriter?.close()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun toAt(access: AccessWidenerReader.AccessType): AccessTransform {
|
||||
return when (access) {
|
||||
AccessWidenerReader.AccessType.ACCESSIBLE -> AccessTransform.of(AccessChange.PUBLIC)
|
||||
AccessWidenerReader.AccessType.EXTENDABLE, AccessWidenerReader.AccessType.MUTABLE -> AccessTransform.of(
|
||||
AccessChange.PUBLIC,
|
||||
ModifierChange.REMOVE
|
||||
)
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
const val NAME = "convertAccessWideners"
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.cobblemon.gradle.extension.tasks
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.OutputFiles
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
abstract class UnzipAccessWidenersTask : DefaultTask() {
|
||||
abstract var accessWidenerZips: FileCollection
|
||||
@InputFiles get
|
||||
|
||||
@OutputFiles
|
||||
val outputFiles = project.provider {
|
||||
project.files(accessWidenerZips.flatMap { zip ->
|
||||
project.zipTree(zip).files.map { OUTPUT_DIR.get().file(it.name) }
|
||||
})
|
||||
}
|
||||
|
||||
@Internal
|
||||
val OUTPUT_DIR = project.layout.buildDirectory.dir("cobblemon-working/access-wideners")
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
project.copy {
|
||||
it.from(accessWidenerZips.map(project::zipTree))
|
||||
it.into(OUTPUT_DIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -1,14 +1,12 @@
|
||||
plugins {
|
||||
//id("cobblemon.root-conventions")
|
||||
id("cobblemon.root-conventions")
|
||||
id ("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
version = "${project.property("mod_version")}+${project.property("mc_version")}"
|
||||
|
||||
val isSnapshot = project.property("snapshot")?.equals("true") ?: false
|
||||
/*
|
||||
if (isSnapshot) {
|
||||
val fixedBranchName = versioning.info.branch.substringAfter("/")
|
||||
version = "$version-${fixedBranchName}-${versioning.info.build}"
|
||||
}
|
||||
*/
|
||||
+54
-90
@@ -1,102 +1,68 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "2.1.0"
|
||||
id ("net.neoforged.moddev") version "2.0.75"
|
||||
id("net.kyori.blossom") version "2.1.0"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||
id("com.cobblemon.gradle")
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
cobblemon {
|
||||
additionalAccessWideners = files(sourceSets.main.get().resources).filter { it.extension == "accesswidener" }
|
||||
}
|
||||
|
||||
val rootResources = configurations.create("rootResources") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.RESOURCES))
|
||||
}
|
||||
}
|
||||
|
||||
val accessWidenerExport = configurations.create("accessWidenerExport") {
|
||||
isCanBeConsumed = true
|
||||
isCanBeResolved = false
|
||||
attributes {
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.OBJECTS))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
exclude("*.accesswidener")
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipResources") {
|
||||
dependsOn("processResources")
|
||||
from(tasks.processResources.get().destinationDir)
|
||||
this.archiveBaseName = "mod-resources"
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zipAccessWideners") {
|
||||
from(sourceSets.main.get().resources)
|
||||
include("*.accesswidener")
|
||||
this.archiveBaseName = "mod-accesswideners"
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
archiveBaseName = "mod"
|
||||
manifest {
|
||||
attributes(mapOf("FMLModType" to "GAMELIBRARY"))
|
||||
}
|
||||
exclude {
|
||||
it.file in tasks.processResources.get().outputs.files
|
||||
}
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn(tasks.named("zipResources"))
|
||||
dependsOn(tasks.named("zipAccessWideners"))
|
||||
}
|
||||
|
||||
artifacts {
|
||||
add("rootResources", tasks.getByName<Zip>("zipResources"))
|
||||
add("accessWidenerExport", tasks.getByName("zipAccessWideners"))
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.architectury.dev/")
|
||||
maven("https://maven.fabricmc.net/")
|
||||
}
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://maven.blamejared.com/")
|
||||
maven("https://api.modrinth.com/maven")
|
||||
maven(url = "../deps")
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.bundles.mongo)
|
||||
compileOnly(libs.bundles.kotlin)
|
||||
compileOnly(libs.molang)
|
||||
compileOnly(libs.graal)
|
||||
compileOnly(libs.jei.api)
|
||||
compileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.common.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
compileOnly("net.fabricmc:sponge-mixin:0.15.5+mixin.0.8.7")
|
||||
compileOnly("io.github.llamalad7:mixinextras-fabric:0.4.1")
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
neoForge {
|
||||
neoFormVersion = "1.21.1-20240808.144430"
|
||||
interfaceInjectionData.from("src/main/resources/interfaces.json")
|
||||
validateAccessTransformers = true
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -106,7 +72,7 @@ sourceSets {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
project.projectDir.parentFile.resolve("HEADER").forEachLine {
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
@@ -119,14 +85,12 @@ sourceSets {
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version as String)
|
||||
property("isSnapshot", "true")
|
||||
/*
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.format.DateTimeFormatter
|
||||
import utilities.isSnapshot
|
||||
import utilities.version
|
||||
|
||||
/*
|
||||
*
|
||||
* * 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/.
|
||||
*
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("cobblemon.base-conventions")
|
||||
id("cobblemon.publish-conventions")
|
||||
|
||||
id("net.kyori.blossom")
|
||||
id("org.jetbrains.gradle.plugin.idea-ext")
|
||||
id("net.nemerosa.versioning") version "3.1.0"
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("neoforge", "fabric")
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven(url = "${rootProject.projectDir}/deps")
|
||||
maven(url = "https://api.modrinth.com/maven")
|
||||
maven(url = "https://maven.neoforged.net/releases")
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.bundles.kotlin)
|
||||
modImplementation(libs.fabric.loader)
|
||||
modApi(libs.molang)
|
||||
|
||||
// Integrations
|
||||
compileOnlyApi(libs.jei.api)
|
||||
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
|
||||
isTransitive = false
|
||||
}
|
||||
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
|
||||
// modCompileOnly(libs.flywheelFabric)
|
||||
|
||||
// Showdown
|
||||
modCompileOnly(libs.graal)
|
||||
|
||||
// Data Storage
|
||||
modCompileOnly(libs.bundles.mongo)
|
||||
|
||||
// Unit Testing
|
||||
testImplementation(libs.bundles.unitTesting)
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
testLogging {
|
||||
setEvents(listOf("failed"))
|
||||
setExceptionFormat("full")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
blossom {
|
||||
kotlinSources {
|
||||
fun generateLicenseHeader() : String {
|
||||
val builder = StringBuilder()
|
||||
builder.append("/*\n")
|
||||
rootProject.file("HEADER").forEachLine {
|
||||
if(it.isEmpty()) {
|
||||
builder.append(" *").append("\n")
|
||||
} else {
|
||||
builder.append(" * ").append(it).append("\n")
|
||||
}
|
||||
}
|
||||
|
||||
return builder.append(" */").append("\n").toString()
|
||||
}
|
||||
|
||||
property("license", generateLicenseHeader())
|
||||
property("modid", "cobblemon")
|
||||
property("version", project.version())
|
||||
property("isSnapshot", if(rootProject.isSnapshot()) "true" else "false")
|
||||
property("gitCommit", versioning.info.commit)
|
||||
property("branch", versioning.info.branch)
|
||||
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
|
||||
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
[versions]
|
||||
# Kotlin
|
||||
kotlin = "2.0.0"
|
||||
|
||||
# Plugins
|
||||
licenser = "0.6.1"
|
||||
shadow = "8.1.1"
|
||||
blossom = "2.1.0"
|
||||
idea-ext = "1.1.7"
|
||||
|
||||
# Loom
|
||||
loom = "1.7-SNAPSHOT"
|
||||
architectury-plugin = "3.4-SNAPSHOT"
|
||||
|
||||
# Common
|
||||
molang = "1.1.18"
|
||||
graal = "22.3.0"
|
||||
icu4j = "71.1"
|
||||
jei-api = "19.8.2.99"
|
||||
|
||||
# Fabric
|
||||
fabric-loader = "0.16.5"
|
||||
fabric-api = "0.104.0+1.21.1"
|
||||
fabric-kotlin = "1.11.0+kotlin.2.0.0"
|
||||
fabric-permissions-api = "0.2-SNAPSHOT"
|
||||
lambDynamicLights = "3.0.1+1.21.1"
|
||||
debugutils-fabric = "1.21-1.0.6-fabric"
|
||||
|
||||
# NeoForge
|
||||
neoforge = "21.1.66"
|
||||
neo-kotlin-for-forge = "5.5.0"
|
||||
debugutils-forge = "1.21-1.0.6-neoforge"
|
||||
|
||||
# Data Storage
|
||||
mongo = "4.10.2"
|
||||
|
||||
# Testing
|
||||
junit = "5.9.0"
|
||||
mockito = "5.2.0"
|
||||
mockk = "1.12.1"
|
||||
classgraph = "4.8.153"
|
||||
|
||||
[libraries]
|
||||
# General Buildscript Plugins
|
||||
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
loom = { group = "dev.architectury", name = "architectury-loom", version.ref = "loom" }
|
||||
architectury = { group = "architectury-plugin", name = "architectury-plugin.gradle.plugin", version.ref = "architectury-plugin" }
|
||||
shadow = { group = "com.github.johnrengelman", name = "shadow", version.ref = "shadow" }
|
||||
blossom = { group = "net.kyori", name = "blossom", version.ref = "blossom" }
|
||||
ideaExt = { group = "org.jetbrains.gradle.plugin.idea-ext", name = "org.jetbrains.gradle.plugin.idea-ext.gradle.plugin", version.ref = "idea-ext"}
|
||||
licenser = { group = "gradle.plugin.org.cadixdev.gradle", name = "licenser", version.ref = "licenser" }
|
||||
|
||||
# Kotlin
|
||||
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" }
|
||||
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" }
|
||||
|
||||
# Common
|
||||
jei-api = { group = "mezz.jei", name = "jei-1.21-common-api", version.ref = "jei-api"}
|
||||
molang = { group = "local.com.bedrockk", name = "molang", version.ref = "molang" }
|
||||
graal = { group = "org.graalvm.js", name = "js", version.ref = "graal" }
|
||||
icu4j = { group = "com.ibm.icu", name = "icu4j", version.ref = "icu4j" }
|
||||
|
||||
# Fabric
|
||||
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
|
||||
fabric-kotlin = { group = "net.fabricmc", name = "fabric-language-kotlin", version.ref = "fabric-kotlin" }
|
||||
fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions-api" }
|
||||
adorn-fabric = { group = "maven.modrinth", name = "adorn", version = "6.0.0-neoforge"}
|
||||
lambDynamicLights = { group = "maven.modrinth", name = "lambdynamiclights", version.ref = "lambDynamicLights"}
|
||||
jei-api-fabric = { group = "mezz.jei", name = "jei-1.21-fabric-api", version.ref = "jei-api" }
|
||||
jei-fabric = { group = "mezz.jei", name = "jei-1.21-fabric", version.ref = "jei-api"}
|
||||
fabric-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-fabric"}
|
||||
|
||||
# NeoForge
|
||||
neoforge = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge" }
|
||||
neo-kotlin-forge = { group = "thedarkcolour", name = "kotlinforforge-neoforge", version.ref = "neo-kotlin-for-forge" }
|
||||
neoforge-debugutils = { group = "maven.modrinth", name = "debugutils", version.ref = "debugutils-forge"}
|
||||
|
||||
# Data Storage
|
||||
mongo-driver-core = { group = "org.mongodb", name = "mongodb-driver-core", version.ref = "mongo" }
|
||||
mongo-driver-sync = { group = "org.mongodb", name = "mongodb-driver-sync", version.ref = "mongo" }
|
||||
|
||||
# Testing
|
||||
junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" }
|
||||
mockito-core = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||
mock-kotlin = { group = "io.mockk", name = "mockk", version.ref = "mockk" }
|
||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||
|
||||
[bundles]
|
||||
kotlin = [ "kotlin-stdlib", "kotlin-reflect" ]
|
||||
fabric = [ "fabric-kotlin", "fabric-permissions" ]
|
||||
fabric-integrations-compileOnly = [ "adorn-fabric", "lambDynamicLights", "jei-api-fabric" ]
|
||||
fabric-integrations-runtimeOnly = [ "jei-fabric" ]
|
||||
mongo = [ "mongo-driver-core", "mongo-driver-sync" ]
|
||||
unitTesting = [ "junit", "mockito-core", "mock-kotlin", "classgraph" ]
|
||||
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents;
|
||||
import com.cobblemon.mod.common.api.events.item.LeftoversCreatedEvent;
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies;
|
||||
import com.cobblemon.mod.common.api.storage.party.PartyStore;
|
||||
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore;
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags;
|
||||
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData;
|
||||
import com.cobblemon.mod.common.pokedex.scanner.ScannableEntity;
|
||||
@@ -178,10 +179,10 @@ public abstract class PlayerMixin extends LivingEntity implements ScannableEntit
|
||||
|
||||
@Override @Nullable
|
||||
public PokedexEntityData resolvePokemonScan() {
|
||||
if(CompoundTagUtilities.isShoulderPokemon(this.getShoulderEntityRight())){
|
||||
if (CompoundTagUtilities.isShoulderPokemon(this.getShoulderEntityRight())){
|
||||
return getDataFromShoulderPokemon(this.getShoulderEntityRight());
|
||||
}
|
||||
if(CompoundTagUtilities.isShoulderPokemon(this.getShoulderEntityLeft())){
|
||||
if (CompoundTagUtilities.isShoulderPokemon(this.getShoulderEntityLeft())){
|
||||
return getDataFromShoulderPokemon(this.getShoulderEntityLeft());
|
||||
}
|
||||
return null;
|
||||
@@ -190,30 +191,34 @@ public abstract class PlayerMixin extends LivingEntity implements ScannableEntit
|
||||
@Nullable @Unique
|
||||
private PokedexEntityData getDataFromShoulderPokemon(CompoundTag shoulderTag) {
|
||||
CompoundTag pokemonTag = shoulderTag.getCompound(DataKeys.POKEMON);
|
||||
if(pokemonTag.isEmpty()) return null;
|
||||
if (pokemonTag.isEmpty()) return null;
|
||||
Species species = PokemonSpecies.INSTANCE.getByIdentifier(ResourceLocation.parse(pokemonTag.getString(DataKeys.POKEMON_SPECIES_IDENTIFIER)));
|
||||
if(species == null) return null;
|
||||
if (species == null) return null;
|
||||
String formId = pokemonTag.getString(DataKeys.POKEMON_FORM_ID);
|
||||
FormData form = species.getStandardForm();
|
||||
List<FormData> formList = species.getForms().stream().filter(it -> it.formOnlyShowdownId().equals(formId)).toList();
|
||||
if(!formList.isEmpty()) form = formList.getFirst();
|
||||
if(form == null) return null;
|
||||
if (!formList.isEmpty()) form = formList.getFirst();
|
||||
if (form == null) return null;
|
||||
String genderString = pokemonTag.getString(DataKeys.POKEMON_GENDER);
|
||||
if(genderString.isEmpty()) return null;
|
||||
if (genderString.isEmpty()) return null;
|
||||
Gender gender = Gender.valueOf(genderString);
|
||||
boolean shiny = pokemonTag.getBoolean(DataKeys.POKEMON_SHINY);
|
||||
int level = pokemonTag.getInt(DataKeys.POKEMON_LEVEL);
|
||||
Set<String> aspects = shoulderTag.getList(DataKeys.SHOULDER_ASPECTS, Tag.TAG_STRING).stream().map(Tag::getAsString).collect(Collectors.toSet());
|
||||
|
||||
return new PokedexEntityData(
|
||||
species,
|
||||
form,
|
||||
gender,
|
||||
aspects,
|
||||
shiny,
|
||||
level,
|
||||
this.getUUID()
|
||||
);
|
||||
Pokemon pokemon = new Pokemon();
|
||||
if (level().isClientSide) {
|
||||
pokemon.setSpecies(species);
|
||||
pokemon.setForm(form);
|
||||
pokemon.setGender(gender);
|
||||
pokemon.setShiny(shiny);
|
||||
pokemon.setLevel(level);
|
||||
pokemon.setForcedAspects(aspects);
|
||||
} else {
|
||||
PlayerPartyStore party = Cobblemon.INSTANCE.getStorage().getParty(this.getUUID(), this.registryAccess());
|
||||
pokemon = party.get(shoulderTag.getUUID(DataKeys.SHOULDER_UUID));
|
||||
}
|
||||
return new PokedexEntityData(pokemon, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.api.SeasonResolver
|
||||
import com.cobblemon.mod.common.api.data.DataProvider
|
||||
import com.cobblemon.mod.common.api.drop.CommandDropEntry
|
||||
import com.cobblemon.mod.common.api.drop.DropEntry
|
||||
import com.cobblemon.mod.common.api.drop.EvolutionItemDropEntry
|
||||
import com.cobblemon.mod.common.api.drop.ItemDropEntry
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents.DATA_SYNCHRONIZED
|
||||
@@ -61,11 +62,7 @@ import com.cobblemon.mod.common.api.storage.player.adapter.PlayerDataMongoBacken
|
||||
import com.cobblemon.mod.common.api.storage.player.factory.CachedPlayerDataStoreFactory
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonEntityTypeTags
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.battles.BagItems
|
||||
import com.cobblemon.mod.common.battles.BattleFormat
|
||||
import com.cobblemon.mod.common.battles.BattleRegistry
|
||||
import com.cobblemon.mod.common.battles.BattleSide
|
||||
import com.cobblemon.mod.common.battles.ShowdownThread
|
||||
import com.cobblemon.mod.common.battles.*
|
||||
import com.cobblemon.mod.common.battles.actor.PokemonBattleActor
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.client.CobblemonPack
|
||||
@@ -88,22 +85,11 @@ import com.cobblemon.mod.common.pokemon.aspects.SHINY_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.evolution.variants.BlockClickEvolution
|
||||
import com.cobblemon.mod.common.pokemon.feature.TagSeasonResolver
|
||||
import com.cobblemon.mod.common.pokemon.helditem.CobblemonHeldItemManager
|
||||
import com.cobblemon.mod.common.pokemon.properties.AspectPropertyType
|
||||
import com.cobblemon.mod.common.pokemon.properties.BattleCloneProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.FreezeFrameProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.HiddenAbilityPropertyType
|
||||
import com.cobblemon.mod.common.pokemon.properties.NoAIProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.UnaspectPropertyType
|
||||
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
|
||||
import com.cobblemon.mod.common.pokemon.properties.*
|
||||
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.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.server
|
||||
import com.cobblemon.mod.common.util.*
|
||||
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
|
||||
@@ -111,25 +97,26 @@ 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.math.roundToInt
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.reflect.jvm.javaField
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.commands.synchronization.SingletonArgumentInfo
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.server.packs.PackType
|
||||
import net.minecraft.world.item.NameTagItem
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.storage.LevelResource
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import org.apache.logging.log4j.Logger
|
||||
import java.io.File
|
||||
import java.io.FileReader
|
||||
import java.io.FileWriter
|
||||
import java.io.PrintWriter
|
||||
import java.util.*
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
object Cobblemon {
|
||||
const val MODID = CobblemonBuildDetails.MOD_ID
|
||||
@@ -200,6 +187,7 @@ object Cobblemon {
|
||||
|
||||
DropEntry.register("command", CommandDropEntry::class.java)
|
||||
DropEntry.register("item", ItemDropEntry::class.java, isDefault = true)
|
||||
DropEntry.register("evolution", EvolutionItemDropEntry::class.java)
|
||||
|
||||
ExperienceGroups.registerDefaults()
|
||||
CaptureCalculators.registerDefaults()
|
||||
@@ -218,7 +206,7 @@ object Cobblemon {
|
||||
storage.onPlayerDataSync(it)
|
||||
playerDataManager.syncAllToPlayer(it)
|
||||
starterHandler.handleJoin(it)
|
||||
ServerSettingsPacket(this.config.preventCompletePartyDeposit, this.config.displayEntityLevelLabel, this.config.displayEntityNameLabel, this.config.maxPokemonLevel).sendToPlayer(it)
|
||||
sendServerSettingsPacketToPlayer(it)
|
||||
}
|
||||
PlatformEvents.SERVER_PLAYER_LOGOUT.subscribe {
|
||||
PCLinkManager.removeLink(it.player.uuid)
|
||||
@@ -256,6 +244,8 @@ object Cobblemon {
|
||||
// Lowest priority because this applies after luxury ball bonus as of gen 4
|
||||
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(Priority.LOWEST) { event ->
|
||||
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
|
||||
if (increment <= 0) //these affects are only meant to affect positive gains
|
||||
return@subscribe
|
||||
// Our Luxury ball spec is diff from official, but we will still assume these stack
|
||||
if (event.pokemon.heldItemNoCopy().`is`(CobblemonItemTags.IS_FRIENDSHIP_BOOSTER)) {
|
||||
increment += increment * 0.5F
|
||||
@@ -264,8 +254,17 @@ object Cobblemon {
|
||||
}
|
||||
|
||||
HeldItemProvider.register(CobblemonHeldItemManager, Priority.LOWEST)
|
||||
}
|
||||
|
||||
|
||||
fun sendServerSettingsPacketToPlayer(player: ServerPlayer) {
|
||||
ServerSettingsPacket(
|
||||
this.config.preventCompletePartyDeposit,
|
||||
this.config.displayEntityLevelLabel,
|
||||
this.config.displayEntityNameLabel,
|
||||
this.config.maxPokemonLevel,
|
||||
this.config.maxPokemonFriendship,
|
||||
this.config.maxDynamaxLevel,
|
||||
).sendToPlayer(player)
|
||||
}
|
||||
|
||||
fun initialize() {
|
||||
@@ -425,7 +424,23 @@ object Cobblemon {
|
||||
}
|
||||
}
|
||||
|
||||
private fun initializeConfig() {
|
||||
loadCobblemonConfig()
|
||||
saveConfig(this.config)
|
||||
PokemonSpecies.observable.subscribe { starterConfig = this.loadStarterConfig() }
|
||||
}
|
||||
|
||||
fun loadConfig() {
|
||||
initializeConfig()
|
||||
bestSpawner.init()
|
||||
}
|
||||
|
||||
fun reloadConfig() {
|
||||
initializeConfig()
|
||||
bestSpawner.reloadConfig()
|
||||
}
|
||||
|
||||
private fun loadCobblemonConfig() {
|
||||
val configFile = File(CONFIG_PATH)
|
||||
configFile.parentFile.mkdirs()
|
||||
|
||||
@@ -468,12 +483,6 @@ object Cobblemon {
|
||||
} else {
|
||||
this.config = CobblemonConfig()
|
||||
}
|
||||
|
||||
config.lastSavedVersion = VERSION
|
||||
this.saveConfig()
|
||||
|
||||
bestSpawner.loadConfig()
|
||||
PokemonSpecies.observable.subscribe { starterConfig = this.loadStarterConfig() }
|
||||
}
|
||||
|
||||
fun loadStarterConfig(): StarterConfig {
|
||||
@@ -496,12 +505,14 @@ object Cobblemon {
|
||||
}
|
||||
}
|
||||
|
||||
fun saveConfig() {
|
||||
fun saveConfig(config: CobblemonConfig) {
|
||||
config.lastSavedVersion = VERSION
|
||||
|
||||
try {
|
||||
val configFile = File(CONFIG_PATH)
|
||||
val fileWriter = FileWriter(configFile)
|
||||
// Put the config to json then flush the writer to commence writing.
|
||||
CobblemonConfig.GSON.toJson(this.config, fileWriter)
|
||||
CobblemonConfig.GSON.toJson(config, fileWriter)
|
||||
fileWriter.flush()
|
||||
fileWriter.close()
|
||||
} catch (exception: Exception) {
|
||||
@@ -523,4 +534,4 @@ object Cobblemon {
|
||||
this.implementation.registerCommandArgument(cobblemonResource("npc_class"), NPCClassArgumentType::class, SingletonArgumentInfo.contextFree(NPCClassArgumentType::npcClass))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ object CobblemonCommands {
|
||||
FreezePokemonCommand.register(dispatcher)
|
||||
ApplyPlayerTextureCommand.register(dispatcher)
|
||||
RunMolangScriptCommand.register(dispatcher)
|
||||
CobblemonConfigCommand.register(dispatcher)
|
||||
|
||||
// Possibly lock down registration if and only if under dev environment or running in an environment
|
||||
// with a certain system environment variable set
|
||||
|
||||
@@ -317,6 +317,7 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, ResourceKey<Registry<It
|
||||
@JvmField val RAZOR_FANG = noSettingsItem("razor_fang")
|
||||
@JvmField val AUSPICIOUS_ARMOR = heldItem("auspicious_armor")
|
||||
@JvmField val MALICIOUS_ARMOR = heldItem("malicious_armor")
|
||||
@JvmField val SHELL_HELMET = heldItem("shell_helmet")
|
||||
|
||||
private val berries = mutableMapOf<ResourceLocation, BerryItem>()
|
||||
// Plants
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.cobblemon.mod.common.client.net.pasture.PokemonPasturedHandler
|
||||
import com.cobblemon.mod.common.client.net.pasture.PokemonUnpasturedHandler
|
||||
import com.cobblemon.mod.common.client.net.pokedex.ServerConfirmedRegisterHandler
|
||||
import com.cobblemon.mod.common.client.net.pokemon.update.PokemonUpdatePacketHandler
|
||||
import com.cobblemon.mod.common.client.net.settings.OpenCobblemonConfigEditorHandler
|
||||
import com.cobblemon.mod.common.client.net.settings.ServerSettingsPacketHandler
|
||||
import com.cobblemon.mod.common.client.net.sound.UnvalidatedPlaySoundS2CPacketHandler
|
||||
import com.cobblemon.mod.common.client.net.spawn.SpawnExtraDataEntityHandler
|
||||
@@ -80,6 +81,7 @@ import com.cobblemon.mod.common.net.messages.client.pokemon.update.*
|
||||
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.AddEvolutionPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.ClearEvolutionsPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.RemoveEvolutionPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.settings.OpenCobblemonConfigScreenPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.settings.ServerSettingsPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.sound.UnvalidatedPlaySoundS2CPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.spawn.SpawnGenericBedrockPacket
|
||||
@@ -284,6 +286,7 @@ object CobblemonNetwork {
|
||||
|
||||
// Settings packets
|
||||
list.add(PacketRegisterInfo(ServerSettingsPacket.ID, ServerSettingsPacket::decode, ServerSettingsPacketHandler))
|
||||
list.add(PacketRegisterInfo(OpenCobblemonConfigScreenPacket.ID, OpenCobblemonConfigScreenPacket::decode, OpenCobblemonConfigEditorHandler))
|
||||
|
||||
// Data registries
|
||||
list.add(PacketRegisterInfo(AbilityRegistrySyncPacket.ID, AbilityRegistrySyncPacket::decode, DataRegistrySyncPacketHandler()))
|
||||
|
||||
@@ -43,7 +43,8 @@ interface SleepDepth {
|
||||
"comatose" to comatose,
|
||||
"normal" to normal
|
||||
)
|
||||
val adapter = StringIdentifiedObjectAdapter { depths[it] ?: throw IllegalArgumentException("Unknown sleep depth: $it") }
|
||||
|
||||
val adapter = StringIdentifiedObjectAdapter({ depths[it] ?: throw IllegalArgumentException("Unknown sleep depth: $it") })
|
||||
}
|
||||
|
||||
fun canSleep(pokemonEntity: PokemonEntity): Boolean
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
|
||||
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMoLangValue
|
||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.BattleEvSource
|
||||
import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.api.text.red
|
||||
@@ -272,7 +273,7 @@ open class PokemonBattle(
|
||||
opponent.awardExperience(opponentPokemon, experience)
|
||||
}
|
||||
Cobblemon.evYieldCalculator.calculate(opponentPokemon, faintedPokemon).forEach { (stat, amount) ->
|
||||
pokemon.evs.add(stat, amount)
|
||||
pokemon.evs.add(stat, amount, BattleEvSource(this, opponentPokemon.facedOpponents.toList(), pokemon))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class ActiveDialogue(var playerEntity: ServerPlayer, var dialogueReference: Dial
|
||||
)
|
||||
|
||||
dialogueReference.initializationAction.invoke(this)
|
||||
setPage(currentPage)
|
||||
|
||||
if (!completion.isDone) {
|
||||
val packet = DialogueOpenedPacket(this, true)
|
||||
|
||||
@@ -52,6 +52,6 @@ object DialogueManager {
|
||||
fun stopDialogue(playerEntity: ServerPlayer) {
|
||||
val activeDialogue = playerEntity.activeDialogue ?: return
|
||||
DialogueClosedPacket(activeDialogue.dialogueId).sendToPlayer(playerEntity)
|
||||
activeDialogues.remove(activeDialogue.dialogueId)
|
||||
activeDialogues.remove(playerEntity.uuid)
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.drop
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
@@ -40,17 +41,23 @@ interface DropEntry {
|
||||
* to be dropped.
|
||||
*/
|
||||
val percentage: Float
|
||||
|
||||
/**
|
||||
* The drop's quantity when doing selection from the [DropTable]. See the drop table documentation for more on how
|
||||
* this works.
|
||||
*/
|
||||
val quantity: Int
|
||||
|
||||
/**
|
||||
* The maximum number of times the item can be selected drop the [DropTable]. In most cases this will just be 1,
|
||||
* meaning that the item, once picked, cannot be picked again. A larger value will allow the same [DropEntry] from
|
||||
* appearing multiple times in a drop action.
|
||||
*/
|
||||
val maxSelectableTimes: Int
|
||||
|
||||
/** Whether this is considered a possible drop at the moment or not */
|
||||
fun canDrop(pokemon: Pokemon?): Boolean = true
|
||||
|
||||
/** The logic to use to actually drop the thing. */
|
||||
fun drop(entity: LivingEntity?, world: ServerLevel, pos: Vec3, player: ServerPlayer?)
|
||||
}
|
||||
@@ -11,11 +11,13 @@ 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 com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import kotlin.random.Random
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
/**
|
||||
@@ -45,9 +47,11 @@ class DropTable {
|
||||
* Gets a drop list from this table as a list of [DropEntry]. You can specify the range of drop quantity totals
|
||||
* that will be possible, or if you leave it blank it will use [DropTable.amount].
|
||||
*/
|
||||
fun getDrops(amount: IntRange = this.amount): List<DropEntry> {
|
||||
fun getDrops(amount: IntRange = this.amount, pokemon: Pokemon? = null): List<DropEntry> {
|
||||
val chosenAmount = amount.random()
|
||||
val possibleDrops = entries.filter { it.quantity <= chosenAmount }.toMutableList()
|
||||
val possibleDrops = entries.filter {
|
||||
it.quantity <= chosenAmount && it.canDrop(pokemon)
|
||||
}.toMutableList()
|
||||
|
||||
if (possibleDrops.isEmpty()) {
|
||||
return emptyList()
|
||||
@@ -87,11 +91,10 @@ class DropTable {
|
||||
world: ServerLevel,
|
||||
pos: Vec3,
|
||||
player: ServerPlayer?,
|
||||
amount: IntRange = this.amount
|
||||
amount: IntRange = this.amount,
|
||||
pokemon: Pokemon? = null,
|
||||
) {
|
||||
val drops = getDrops(amount).toMutableList()
|
||||
val heldItem = (entity as PokemonEntity).pokemon.heldItemNoCopy()
|
||||
if (!heldItem.isEmpty) entity.spawnAtLocation(heldItem.item)
|
||||
val drops = getDrops(amount, pokemon).toMutableList()
|
||||
LOOT_DROPPED.postThen(
|
||||
event = LootDroppedEvent(this, player, entity, drops),
|
||||
ifSucceeded = { it.drops.forEach { it.drop(entity, world, pos, player) } }
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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.drop
|
||||
|
||||
import com.cobblemon.mod.common.api.pokemon.evolution.requirement.EvolutionRequirement
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
class EvolutionItemDropEntry : ItemDropEntry() {
|
||||
val requirements: MutableSet<EvolutionRequirement> = mutableSetOf()
|
||||
|
||||
override fun canDrop(pokemon: Pokemon?): Boolean = pokemon != null && requirements.all { it.check(pokemon) }
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.api.drop
|
||||
|
||||
import com.cobblemon.mod.common.api.serialization.StringIdentifiedObjectAdapter
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
* The way an item will be dropped.
|
||||
@@ -28,6 +29,9 @@ enum class ItemDropMethod(val methodName: String) {
|
||||
TO_INVENTORY("to-inventory");
|
||||
|
||||
companion object {
|
||||
val adapter = StringIdentifiedObjectAdapter { str -> values().firstOrNull { it.methodName == str } }
|
||||
val adapter = StringIdentifiedObjectAdapter(
|
||||
{ str -> ItemDropMethod.entries.firstOrNull { it.methodName == str } },
|
||||
{ value -> (value ?: ON_ENTITY).methodName },
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -158,6 +158,11 @@ object CobblemonEvents {
|
||||
@JvmField
|
||||
val EXPERIENCE_CANDY_USE_POST = EventObservable<ExperienceCandyUseEvent.Post>()
|
||||
|
||||
@JvmField
|
||||
val EV_GAINED_EVENT_PRE = CancelableObservable<EvGainedEvent.Pre>()
|
||||
@JvmField
|
||||
val EV_GAINED_EVENT_POST = EventObservable<EvGainedEvent.Post>()
|
||||
|
||||
@JvmField
|
||||
val POKEMON_RELEASED_EVENT_PRE = CancelableObservable<ReleasePokemonEvent.Pre>()
|
||||
@JvmField
|
||||
|
||||
+4
-6
@@ -18,19 +18,17 @@ import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.entity.LivingEntity
|
||||
|
||||
data class PokemonScannedEvent(val player: ServerPlayer, val scannedPokemonEntityData: PokedexEntityData, val scannedEntity: ScannableEntity) {
|
||||
val pokedexEntityData: PokedexEntityData
|
||||
get() = scannedPokemonEntityData
|
||||
|
||||
val isOwned: Boolean
|
||||
get() = scannedPokemonEntityData.ownerUUID == player.uuid
|
||||
get() = scannedPokemonEntityData.pokemon.getOwnerUUID() == player.uuid
|
||||
|
||||
val context = mutableMapOf(
|
||||
"player" to player.asMoLangValue(),
|
||||
"pokemon" to scannedPokemonEntityData.struct,
|
||||
"pokemon" to scannedPokemonEntityData.pokemon.struct,
|
||||
"disguise" to (scannedPokemonEntityData.disguise?.struct ?: DoubleValue.ZERO),
|
||||
"entity" to {
|
||||
when (scannedEntity) {
|
||||
is LivingEntity -> scannedEntity.asMostSpecificMoLangValue()
|
||||
else -> DoubleValue(0.0)
|
||||
else -> DoubleValue.ZERO
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.cobblemon.mod.common.api.events.Cancelable
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.EvSource
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
|
||||
/**
|
||||
* Fired during EV mutation.
|
||||
*
|
||||
* @see [Pre]
|
||||
* @see [Post]
|
||||
*/
|
||||
interface EvGainedEvent {
|
||||
|
||||
/**
|
||||
* The [Stat] having EVs added to itself.
|
||||
*/
|
||||
val stat: Stat
|
||||
|
||||
/**
|
||||
* The [EvSource] that fired this event.
|
||||
*/
|
||||
val source: EvSource
|
||||
|
||||
/**
|
||||
* Fired before EV mutation occurs, cancelling will cause the mutation to be flagged as not successful (returns 0).
|
||||
*
|
||||
* @property stat See [EvGainedEvent.stat].
|
||||
* @property amount The amount of EVs that will be gained.
|
||||
* @property source See [EvGainedEvent.source].
|
||||
*/
|
||||
class Pre(override val stat: Stat, var amount: Int, override val source: EvSource) : EvGainedEvent, Cancelable()
|
||||
|
||||
/**
|
||||
* Fired after EV mutation occurs, this is purely for notification purposes.
|
||||
*
|
||||
* @property stat See [EvGainedEvent.stat].
|
||||
* @property amount The final amount of EVs gained.
|
||||
* @property source See [EvGainedEvent.source].
|
||||
*/
|
||||
class Post(override val stat: Stat, val amount: Int, override val source: EvSource) : EvGainedEvent
|
||||
|
||||
}
|
||||
+9
-2
@@ -8,6 +8,7 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.events.pokemon
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
/**
|
||||
@@ -18,5 +19,11 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
*/
|
||||
data class FriendshipUpdatedEvent(
|
||||
val pokemon: Pokemon,
|
||||
var newFriendship: Int
|
||||
)
|
||||
val newFriendshipInitial: Int
|
||||
)
|
||||
{
|
||||
var newFriendship: Int = newFriendshipInitial
|
||||
set(value) {
|
||||
field = value.coerceIn(0, Cobblemon.config.maxPokemonFriendship)
|
||||
}
|
||||
}
|
||||
+5
-7
@@ -17,16 +17,14 @@ import com.cobblemon.mod.common.api.pokedex.AbstractPokedexManager
|
||||
import com.cobblemon.mod.common.api.pokedex.FormDexRecord
|
||||
import com.cobblemon.mod.common.api.pokedex.PokedexEntryProgress
|
||||
import com.cobblemon.mod.common.pokedex.scanner.PokedexEntityData
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.getPlayer
|
||||
import com.mojang.datafixers.util.Either
|
||||
import java.util.UUID
|
||||
|
||||
/**
|
||||
* Event that fires when a Pokémon's information is gained or updated in the Pokédex.
|
||||
*/
|
||||
sealed interface PokedexDataChangedEvent {
|
||||
val dataSource: Either<PokedexEntityData, Pokemon>
|
||||
val dataSource: PokedexEntityData
|
||||
val knowledge: PokedexEntryProgress
|
||||
val playerUUID: UUID
|
||||
val record: FormDexRecord
|
||||
@@ -37,22 +35,22 @@ sealed interface PokedexDataChangedEvent {
|
||||
fun getContext(): MutableMap<String, MoValue> {
|
||||
return mutableMapOf(
|
||||
"player" to (playerUUID.getPlayer()?.asMoLangValue() ?: DoubleValue.ZERO),
|
||||
"pokemon" to dataSource.map({ DoubleValue.ZERO }, { it.struct }),
|
||||
"data" to dataSource.map({ it.struct }, { DoubleValue.ZERO }),
|
||||
"pokemon" to dataSource.pokemon.struct,
|
||||
"disguise" to (dataSource.disguise?.struct ?: DoubleValue.ZERO),
|
||||
"knowledge" to StringValue(knowledge.name.lowercase()),
|
||||
"pokedex" to pokedexManager.struct
|
||||
)
|
||||
}
|
||||
|
||||
class Pre(
|
||||
override val dataSource: Either<PokedexEntityData, Pokemon>,
|
||||
override val dataSource: PokedexEntityData,
|
||||
override val knowledge: PokedexEntryProgress,
|
||||
override val playerUUID: UUID,
|
||||
override val record: FormDexRecord
|
||||
) : PokedexDataChangedEvent, Cancelable()
|
||||
|
||||
class Post(
|
||||
override val dataSource: Either<PokedexEntityData, Pokemon>,
|
||||
override val dataSource: PokedexEntityData,
|
||||
override val knowledge: PokedexEntryProgress,
|
||||
override val playerUUID: UUID,
|
||||
override val record: FormDexRecord
|
||||
|
||||
@@ -54,7 +54,15 @@ class BenchedMoves : Iterable<BenchedMove> {
|
||||
}
|
||||
}
|
||||
|
||||
fun add(benchedMove: BenchedMove) = doThenEmit { benchedMoves.add(benchedMove) }
|
||||
fun add(benchedMove: BenchedMove): Boolean {
|
||||
if (any { it.moveTemplate == benchedMove.moveTemplate }) {
|
||||
return false
|
||||
}
|
||||
|
||||
doThenEmit { benchedMoves.add(benchedMove) }
|
||||
return true
|
||||
}
|
||||
|
||||
fun addAll(benchedMoves: Iterable<BenchedMove>) = doThenEmit { this.benchedMoves.addAll(benchedMoves) }
|
||||
fun clear() = doThenEmit { benchedMoves.clear() }
|
||||
fun remove(benchedMove: BenchedMove) = doThenEmit { benchedMoves.remove(benchedMove) }
|
||||
|
||||
@@ -134,18 +134,21 @@ class MoveSet : Iterable<Move> {
|
||||
return json
|
||||
}
|
||||
|
||||
fun add(move: Move) {
|
||||
fun add(move: Move): Boolean {
|
||||
if (any { it.template == move.template }) {
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
for (i in 0 until MOVE_COUNT) {
|
||||
if (moves[i] == null) {
|
||||
moves[i] = move
|
||||
move.observable.subscribe { this.update() }
|
||||
update()
|
||||
return
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
fun update() {
|
||||
|
||||
@@ -57,6 +57,7 @@ class NPCClass {
|
||||
var isInvulnerable = false
|
||||
var isLeashable = true
|
||||
var allowProjectileHits = true
|
||||
var hideNameTag = false
|
||||
|
||||
// If you're adding stuff here, add it to NPCPreset and NPCClassAdapter too
|
||||
|
||||
@@ -97,6 +98,7 @@ class NPCClass {
|
||||
buffer.writeBoolean(isInvulnerable)
|
||||
buffer.writeBoolean(isLeashable)
|
||||
buffer.writeBoolean(allowProjectileHits)
|
||||
buffer.writeBoolean(hideNameTag)
|
||||
}
|
||||
|
||||
fun decode(buffer: RegistryFriendlyByteBuf) {
|
||||
@@ -148,5 +150,6 @@ class NPCClass {
|
||||
isInvulnerable = buffer.readBoolean()
|
||||
isLeashable = buffer.readBoolean()
|
||||
allowProjectileHits = buffer.readBoolean()
|
||||
hideNameTag = buffer.readBoolean()
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ class NPCPreset {
|
||||
var isInvulnerable: Boolean? = null
|
||||
var isLeashable: Boolean? = null
|
||||
var allowProjectileHits: Boolean? = null
|
||||
var hideNameTag: Boolean? = null
|
||||
|
||||
fun applyTo(npcClass: NPCClass) {
|
||||
resourceIdentifier?.let { npcClass.resourceIdentifier = it }
|
||||
@@ -63,5 +64,6 @@ class NPCPreset {
|
||||
isInvulnerable?.let { npcClass.isInvulnerable = it }
|
||||
isLeashable?.let { npcClass.isLeashable = it }
|
||||
allowProjectileHits?.let { npcClass.allowProjectileHits = it }
|
||||
hideNameTag?.let { npcClass.hideNameTag = it }
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,7 @@ any number of presets and the properties of those presets will be merged into th
|
||||
"skill": 5,
|
||||
"autoHealParty": true,
|
||||
"randomizePartyOrder": true,
|
||||
"hideNameTag": false,
|
||||
"party": {
|
||||
"type": "simple",
|
||||
"pokemon": [
|
||||
@@ -411,4 +412,7 @@ Pokémon in the party.
|
||||
|
||||
### ai
|
||||
The AI property is an array of brain configurations. This is used to configure the behaviours of the NPC. See
|
||||
the documentation for brain configurations at [AI Configuration](../ai/config/README.md).
|
||||
the documentation for brain configurations at [AI Configuration](../ai/config/README.md).
|
||||
|
||||
### hideNameTag
|
||||
Whether the NPC's nametag should be hidden or not. Defaults to false.
|
||||
+2
-2
@@ -8,8 +8,6 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.permission
|
||||
|
||||
import com.cobblemon.mod.common.command.AbandonMultiTeam
|
||||
|
||||
object CobblemonPermissions {
|
||||
|
||||
private const val COMMAND_PREFIX = "command."
|
||||
@@ -84,6 +82,8 @@ object CobblemonPermissions {
|
||||
|
||||
val RUN_MOLANG_SCRIPT = this.create("${COMMAND_PREFIX}runmolangscript", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
val COBBLEMON_CONFIG_RELOAD = this.create("${COMMAND_PREFIX}cobblemonconfig.reload", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
fun all(): Iterable<Permission> = this.permissions
|
||||
|
||||
private fun create(node: String, level: PermissionLevel): Permission {
|
||||
|
||||
@@ -202,6 +202,8 @@ object PokeBalls : JsonDataRegistry<PokeBall> {
|
||||
// Luxury ball effect, low priority as it must be triggered before soothe bell as of gen 4
|
||||
CobblemonEvents.FRIENDSHIP_UPDATED.subscribe(priority = Priority.LOW) { event ->
|
||||
var increment = (event.newFriendship - event.pokemon.friendship).toFloat()
|
||||
if (increment <= 0) //these affects are only meant to affect positive gains
|
||||
return@subscribe
|
||||
if (increment <= 1F) {
|
||||
event.pokemon.caughtBall.effects.filterIsInstance<FriendshipEarningBoostEffect>()
|
||||
.forEach { increment *= it.multiplier }
|
||||
|
||||
+4
-1
@@ -42,7 +42,10 @@ class BaseStatModifier(
|
||||
|
||||
override fun behavior(thrower: LivingEntity, pokemon: Pokemon): CatchRateModifier.Behavior = CatchRateModifier.Behavior.MULTIPLY
|
||||
|
||||
override fun isValid(thrower: LivingEntity, pokemon: Pokemon): Boolean = pokemon.form.baseStats[this.stat] != null
|
||||
override fun isValid(thrower: LivingEntity, pokemon: Pokemon): Boolean {
|
||||
val valStat = pokemon.form.baseStats[this.stat] ?: return false
|
||||
return comparator(valStat)
|
||||
}
|
||||
|
||||
override fun modifyCatchRate(currentCatchRate: Float, thrower: LivingEntity, pokemon: Pokemon): Float = this.behavior(thrower, pokemon).mutator(currentCatchRate, this.value(thrower, pokemon))
|
||||
|
||||
|
||||
+9
-3
@@ -96,15 +96,21 @@ abstract class AbstractPokedexManager {
|
||||
}
|
||||
|
||||
fun getNewInformation(pokedexEntityData: PokedexEntityData): PokedexLearnedInformation {
|
||||
val speciesRecord = getSpeciesRecord(pokedexEntityData.species.resourceIdentifier)
|
||||
val speciesRecord = getSpeciesRecord(pokedexEntityData.getApparentSpecies().resourceIdentifier)
|
||||
if (speciesRecord == null || speciesRecord.getKnowledge() == PokedexEntryProgress.NONE) {
|
||||
return PokedexLearnedInformation.SPECIES
|
||||
}
|
||||
val formRecord = speciesRecord.getFormRecord(pokedexEntityData.form.name)
|
||||
val formRecord = speciesRecord.getFormRecord(pokedexEntityData.getApparentForm().name)
|
||||
if (formRecord == null || formRecord.knowledge == PokedexEntryProgress.NONE) {
|
||||
return PokedexLearnedInformation.FORM
|
||||
}
|
||||
if (pokedexEntityData.aspects.any{ !speciesRecord.hasAspect(it) } || pokedexEntityData.gender !in formRecord.getGenders() || !formRecord.hasSeenShinyState(pokedexEntityData.shiny)) {
|
||||
|
||||
// Can't update aspects on a disguise
|
||||
if (pokedexEntityData.disguise != null) {
|
||||
return PokedexLearnedInformation.NONE
|
||||
}
|
||||
|
||||
if (pokedexEntityData.pokemon.aspects.any { !speciesRecord.hasAspect(it) } || pokedexEntityData.pokemon.gender !in formRecord.getGenders() || !formRecord.hasSeenShinyState(pokedexEntityData.pokemon.shiny)) {
|
||||
return PokedexLearnedInformation.VARIATION
|
||||
}
|
||||
return PokedexLearnedInformation.NONE
|
||||
|
||||
@@ -89,21 +89,15 @@ class FormDexRecord {
|
||||
it.knowledge = knowledge
|
||||
}
|
||||
|
||||
fun encountered(pokemon: Pokemon) {
|
||||
if (wouldBeDifferent(pokemon, PokedexEntryProgress.ENCOUNTERED)) {
|
||||
addInformation(pokemon, PokedexEntryProgress.ENCOUNTERED)
|
||||
}
|
||||
}
|
||||
|
||||
fun encountered(pokedexEntityData: PokedexEntityData) {
|
||||
if (wouldBeDifferent(pokedexEntityData, PokedexEntryProgress.ENCOUNTERED)) {
|
||||
addInformation(pokedexEntityData, PokedexEntryProgress.ENCOUNTERED)
|
||||
}
|
||||
}
|
||||
|
||||
fun caught(pokemon: Pokemon) {
|
||||
if (wouldBeDifferent(pokemon, PokedexEntryProgress.CAUGHT)) {
|
||||
addInformation(pokemon, PokedexEntryProgress.CAUGHT)
|
||||
fun caught(pokedexEntityData: PokedexEntityData) {
|
||||
if (wouldBeDifferent(pokedexEntityData, PokedexEntryProgress.CAUGHT)) {
|
||||
addInformation(pokedexEntityData, PokedexEntryProgress.CAUGHT)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,47 +119,18 @@ class FormDexRecord {
|
||||
speciesDexRecord.onFormRecordUpdated(this)
|
||||
}
|
||||
|
||||
private fun addInformation(pokemon: Pokemon, knowledge: PokedexEntryProgress) {
|
||||
(speciesDexRecord.pokedexManager as? PokedexManager)?.let { pokedexManager ->
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_PRE.postThen(
|
||||
PokedexDataChangedEvent.Pre(
|
||||
Either.right(pokemon),
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
),
|
||||
ifSucceeded = {
|
||||
genders.add(pokemon.gender)
|
||||
seenShinyStates.add(if (pokemon.shiny) "shiny" else "normal")
|
||||
if (knowledge.ordinal > this.knowledge.ordinal) {
|
||||
this.knowledge = knowledge
|
||||
}
|
||||
speciesDexRecord.addInformation(pokemon, knowledge)
|
||||
speciesDexRecord.onFormRecordUpdated(this)
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_POST.post(
|
||||
PokedexDataChangedEvent.Post(
|
||||
Either.right(pokemon),
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
)
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun addInformation(pokedexEntityData: PokedexEntityData, knowledge: PokedexEntryProgress) {
|
||||
(speciesDexRecord.pokedexManager as? PokedexManager)?.let { pokedexManager ->
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_PRE.postThen(
|
||||
PokedexDataChangedEvent.Pre(
|
||||
Either.left(pokedexEntityData),
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
pokedexEntityData,
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
),
|
||||
ifSucceeded = {
|
||||
genders.add(pokedexEntityData.gender)
|
||||
seenShinyStates.add(if (pokedexEntityData.shiny) "shiny" else "normal")
|
||||
genders.add(pokedexEntityData.pokemon.gender)
|
||||
seenShinyStates.add(if (pokedexEntityData.pokemon.shiny) "shiny" else "normal")
|
||||
if (knowledge.ordinal > this.knowledge.ordinal) {
|
||||
this.knowledge = knowledge
|
||||
}
|
||||
@@ -173,10 +138,10 @@ class FormDexRecord {
|
||||
speciesDexRecord.onFormRecordUpdated(this)
|
||||
CobblemonEvents.POKEDEX_DATA_CHANGED_POST.post(
|
||||
PokedexDataChangedEvent.Post(
|
||||
Either.left(pokedexEntityData),
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
pokedexEntityData,
|
||||
knowledge,
|
||||
pokedexManager.uuid,
|
||||
this
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -184,19 +149,10 @@ class FormDexRecord {
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns whether the given [Pokemon] and [knowledge] would add new information to the Pokédex.*/
|
||||
fun wouldBeDifferent(pokemon: Pokemon, knowledge: PokedexEntryProgress): Boolean {
|
||||
return pokemon.gender !in genders
|
||||
|| (pokemon.shiny && "shiny" !in seenShinyStates)
|
||||
|| (!pokemon.shiny && "normal" !in seenShinyStates)
|
||||
|| knowledge.ordinal > this.knowledge.ordinal
|
||||
|| speciesDexRecord.wouldBeDifferent(pokemon)
|
||||
}
|
||||
|
||||
fun wouldBeDifferent(pokedexEntityData: PokedexEntityData, knowledge: PokedexEntryProgress): Boolean {
|
||||
return pokedexEntityData.gender !in genders
|
||||
|| (pokedexEntityData.shiny && "shiny" !in seenShinyStates)
|
||||
|| (!pokedexEntityData.shiny && "normal" !in seenShinyStates)
|
||||
return pokedexEntityData.pokemon.gender !in genders
|
||||
|| (pokedexEntityData.pokemon.shiny && "shiny" !in seenShinyStates)
|
||||
|| (!pokedexEntityData.pokemon.shiny && "normal" !in seenShinyStates)
|
||||
|| knowledge.ordinal > this.knowledge.ordinal
|
||||
|| speciesDexRecord.wouldBeDifferent(pokedexEntityData)
|
||||
}
|
||||
|
||||
@@ -30,19 +30,19 @@ class PokedexManager(
|
||||
fun encounter(pokemon: Pokemon) {
|
||||
val speciesId = pokemon.species.resourceIdentifier
|
||||
val formName = pokemon.form.name
|
||||
getOrCreateSpeciesRecord(speciesId).getOrCreateFormRecord(formName).encountered(pokemon)
|
||||
getOrCreateSpeciesRecord(speciesId).getOrCreateFormRecord(formName).encountered(PokedexEntityData(pokemon = pokemon, disguise = null))
|
||||
}
|
||||
|
||||
fun encounter(pokedexEntityData: PokedexEntityData) {
|
||||
val speciesId = pokedexEntityData.species.resourceIdentifier
|
||||
val formName = pokedexEntityData.form.name
|
||||
val speciesId = pokedexEntityData.getApparentSpecies().resourceIdentifier
|
||||
val formName = pokedexEntityData.getApparentForm().name
|
||||
getOrCreateSpeciesRecord(speciesId).getOrCreateFormRecord(formName).encountered(pokedexEntityData)
|
||||
}
|
||||
|
||||
fun catch(pokemon: Pokemon) {
|
||||
val speciesId = pokemon.species.resourceIdentifier
|
||||
val formName = pokemon.form.name
|
||||
getOrCreateSpeciesRecord(speciesId).getOrCreateFormRecord(formName).caught(pokemon)
|
||||
getOrCreateSpeciesRecord(speciesId).getOrCreateFormRecord(formName).caught(PokedexEntityData(pokemon = pokemon, disguise = null))
|
||||
}
|
||||
|
||||
override fun markDirty() {
|
||||
|
||||
@@ -97,7 +97,7 @@ class SpeciesDexRecord {
|
||||
}
|
||||
|
||||
fun addInformation(pokedexEntityData: PokedexEntityData, knowledge: PokedexEntryProgress) {
|
||||
aspects.addAll(pokedexEntityData.aspects)
|
||||
aspects.addAll(pokedexEntityData.pokemon.aspects)
|
||||
}
|
||||
|
||||
fun addAspects(addedAspects: Set<String>) {
|
||||
@@ -107,7 +107,7 @@ class SpeciesDexRecord {
|
||||
/** Returns true if the given Pokémon contains new information. Internal because it's only to be called from [FormDexRecord.wouldBeDifferent]. */
|
||||
internal fun wouldBeDifferent(pokemon: Pokemon) = pokemon.aspects.any { it !in aspects }
|
||||
|
||||
internal fun wouldBeDifferent(pokedexEntityData: PokedexEntityData) = pokedexEntityData.aspects.any { it !in aspects }
|
||||
internal fun wouldBeDifferent(pokedexEntityData: PokedexEntityData) = pokedexEntityData.pokemon.aspects.any { it !in aspects }
|
||||
|
||||
fun getOrCreateFormRecord(formName: String): FormDexRecord {
|
||||
return formRecords.getOrPut(formName.lowercase()) {
|
||||
|
||||
@@ -468,6 +468,10 @@ open class PokemonProperties {
|
||||
return this.commonMatches(pokemonEntity.pokemon) && this.customProperties.none { !it.matches(pokemonEntity) }
|
||||
}
|
||||
|
||||
fun matches(properties: PokemonProperties): Boolean {
|
||||
return properties.asString() == this.asString()
|
||||
}
|
||||
|
||||
private fun commonMatches(pokemon: Pokemon): Boolean {
|
||||
level?.takeIf { it != pokemon.level }?.let { return false }
|
||||
shiny?.takeIf { it != pokemon.shiny }?.let { return false }
|
||||
@@ -805,7 +809,7 @@ open class PokemonProperties {
|
||||
private fun createAbility(id: String, form: FormData): Ability? {
|
||||
val ability = Abilities.get(id) ?: return null
|
||||
val potentialAbility = form.abilities.firstOrNull { potential -> potential.template == ability } ?: return ability.create(true)
|
||||
return potentialAbility.template.create(false)
|
||||
return potentialAbility.template.create(false, potentialAbility.priority)
|
||||
}
|
||||
|
||||
}
|
||||
+37
-13
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.CobblemonItems
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.advancement.CobblemonCriteria
|
||||
import com.cobblemon.mod.common.advancement.criterion.EvolvePokemonContext
|
||||
import com.cobblemon.mod.common.api.drop.DropTable
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.pokemon.PokemonGainedEvent
|
||||
import com.cobblemon.mod.common.api.events.pokemon.evolution.EvolutionCompleteEvent
|
||||
@@ -32,9 +33,8 @@ import com.cobblemon.mod.common.pokemon.evolution.variants.LevelUpEvolution
|
||||
import com.cobblemon.mod.common.pokemon.evolution.variants.TradeEvolution
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import com.cobblemon.mod.common.util.party
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.network.protocol.game.ClientboundSoundPacket
|
||||
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.sounds.SoundSource
|
||||
import net.minecraft.world.entity.Entity
|
||||
import net.minecraft.world.item.ItemStack
|
||||
@@ -80,6 +80,11 @@ interface Evolution : EvolutionLike {
|
||||
*/
|
||||
val learnableMoves: MutableSet<MoveTemplate>
|
||||
|
||||
/**
|
||||
* The items that will drop once the evolution finishes.
|
||||
*/
|
||||
val drops: DropTable
|
||||
|
||||
/**
|
||||
* Checks if the given [Pokemon] passes all the conditions and is ready to evolve.
|
||||
*
|
||||
@@ -100,9 +105,6 @@ interface Evolution : EvolutionLike {
|
||||
* @param pokemon The [Pokemon] being evolved.
|
||||
*/
|
||||
fun evolve(pokemon: Pokemon): Boolean {
|
||||
if (this.consumeHeldItem) {
|
||||
pokemon.swapHeldItem(ItemStack.EMPTY)
|
||||
}
|
||||
if (this.optional) {
|
||||
// All the networking is handled under the hood, see EvolutionController.
|
||||
return pokemon.evolutionProxy.server().add(this)
|
||||
@@ -198,19 +200,41 @@ interface Evolution : EvolutionLike {
|
||||
|
||||
val movesToLearn = previousSpeciesLearnableMoves + this.learnableMoves
|
||||
movesToLearn.forEach { move ->
|
||||
if (pokemon.moveSet.hasSpace()) {
|
||||
pokemon.moveSet.add(move.create())
|
||||
} else {
|
||||
pokemon.benchedMoves.add(BenchedMove(move, 0))
|
||||
}
|
||||
val couldAddMove =
|
||||
if (pokemon.moveSet.hasSpace()) {
|
||||
pokemon.moveSet.add(move.create())
|
||||
} else {
|
||||
pokemon.benchedMoves.add(BenchedMove(move, 0))
|
||||
}
|
||||
|
||||
pokemon.getOwnerPlayer()?.sendSystemMessage(lang("experience.learned_move", pokemon.getDisplayName(), move.displayName))
|
||||
val previousSpeciesKnewMove = previousSpeciesLearnableMoves.any { move.name == it.name }
|
||||
|
||||
if (couldAddMove && !previousSpeciesKnewMove) {
|
||||
pokemon.getOwnerPlayer()?.sendSystemMessage(lang("experience.learned_move", pokemon.getDisplayName(), move.displayName))
|
||||
}
|
||||
}
|
||||
|
||||
// we want to instantly tick for example you might only evolve your Bulbasaur at level 34 so Venusaur should be immediately available
|
||||
pokemon.evolutions.filterIsInstance<PassiveEvolution>().forEach { evolution -> evolution.attemptEvolution(pokemon) }
|
||||
pokemon.lockedEvolutions.filterIsInstance<PassiveEvolution>().forEach { evolution -> evolution.attemptEvolution(pokemon) }
|
||||
|
||||
this.shed(pokemon)
|
||||
|
||||
if (this.consumeHeldItem) {
|
||||
pokemon.swapHeldItem(ItemStack.EMPTY)
|
||||
}
|
||||
|
||||
val ownerPlayer = pokemon.getOwnerPlayer()
|
||||
if (ownerPlayer != null && ownerPlayer.level().gameRules.getBoolean(CobblemonGameRules.DO_POKEMON_LOOT)) {
|
||||
drops.drop(
|
||||
pokemon.entity,
|
||||
ownerPlayer.level() as ServerLevel,
|
||||
pokemon.entity?.position() ?: ownerPlayer.position(),
|
||||
ownerPlayer,
|
||||
pokemon = pokemon
|
||||
)
|
||||
}
|
||||
|
||||
CobblemonEvents.EVOLUTION_COMPLETE.post(EvolutionCompleteEvent(pokemon, this))
|
||||
CobblemonEvents.POKEMON_GAINED.post(PokemonGainedEvent(pokemon.getOwnerUUID()!!, pokemon))
|
||||
}
|
||||
@@ -218,4 +242,4 @@ interface Evolution : EvolutionLike {
|
||||
fun applyTo(pokemon: Pokemon) {
|
||||
result.apply(pokemon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+54
-26
@@ -21,6 +21,12 @@ object CobblemonPokemonLabels {
|
||||
*/
|
||||
const val LEGENDARY = "legendary"
|
||||
|
||||
/**
|
||||
* Represents a Pokémon who is typically banned or has restricted usage in competitive sanctions.
|
||||
* For example usage see this [VGC](https://www.pokemon.com/us/pokemon-news/trainers-can-once-again-use-a-restricted-pokemon-in-ranked-battles-series-10-starting-august-1-2021) page.
|
||||
*/
|
||||
const val RESTRICTED = "restricted"
|
||||
|
||||
/**
|
||||
* Represents a mythical Pokémon.
|
||||
* In Cobblemon terms they do not exist since we do not share the concept of timed event only Pokémon but the official ones are still tagged.
|
||||
@@ -28,14 +34,21 @@ object CobblemonPokemonLabels {
|
||||
const val MYTHICAL = "mythical"
|
||||
|
||||
/**
|
||||
* Represents Pokémon that originate from Ultra Space.
|
||||
* Represents Pokémon that receive a boosted catch rate from the Beast Ball. (Due to Beast Boost)
|
||||
* Does not include [thematically related](https://bulbapedia.bulbagarden.net/wiki/Ultra_Beast#Related_Pok%C3%A9mon) beasts.
|
||||
*/
|
||||
const val ULTRA_BEAST = "ultra_beast"
|
||||
|
||||
/**
|
||||
* Represents the pseudo legendary Pokémon.
|
||||
* Represents a Pokémon whose family could be derived from resurrecting a fossil.
|
||||
*/
|
||||
const val PSEUDO_LEGENDARY = "pseudo_legendary"
|
||||
const val FOSSIL = "fossil"
|
||||
|
||||
/**
|
||||
* Represents the "pseudo-legendary" Pokémon. (Slow-rate three-stage lines with a base stat total of 600)
|
||||
* Term reference on this [Pokémon Center](https://www.pokemoncenter.com/search/powerhouse) page.
|
||||
*/
|
||||
const val POWERHOUSE = "powerhouse"
|
||||
|
||||
/**
|
||||
* Represents a baby Pokémon, this is not just a first stage Pokémon species, it is also unable to breed.
|
||||
@@ -52,52 +65,55 @@ object CobblemonPokemonLabels {
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_KANTO = "kanto_regional"
|
||||
const val KANTONIAN_FORM = "kantonian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
* Source for adjectival form: [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Johto#Trivia)
|
||||
*/
|
||||
const val JOHTONIAN_FORM = "johtonian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
* Source for adjectival form:[Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Hoenn#Trivia)
|
||||
*/
|
||||
const val HOENNIAN_FORM = "hoennian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
* Source for adjectival form:[Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Sinnoh#Trivia)
|
||||
*/
|
||||
const val SINNOHAN_FORM = "sinnohan_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_JOHTO = "johto_regional"
|
||||
const val UNOVAN_FORM = "unovan_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_HOENN = "hoenn_regional"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_SINNOH = "sinnoh_regional"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_UNOVA = "unova_regional"
|
||||
|
||||
/**
|
||||
* See [REGIONAL], this has no official regionals but it consists of the "base" form that comes from the region.
|
||||
*/
|
||||
const val REGIONAL_OF_KALOS = "kalos_regional"
|
||||
const val KALOSIAN_FORM = "kalosian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL] and this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Regional_form#Alolan_Form) page.
|
||||
*/
|
||||
const val REGIONAL_OF_ALOLA = "alola_regional"
|
||||
const val ALOLAN_FORM = "alolan_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL] and this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Regional_form#Galarian_Form) page.
|
||||
*/
|
||||
const val REGIONAL_OF_GALAR = "galar_regional"
|
||||
const val GALARIAN_FORM = "galarian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL] and this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Regional_form#Hisuian_Form) page.
|
||||
*/
|
||||
const val REGIONAL_OF_HISUI = "hisui_regional"
|
||||
const val HISUIAN_FORM = "hisuian_form"
|
||||
|
||||
/**
|
||||
* See [REGIONAL] and this [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Regional_form#Paldean_Form) page.
|
||||
*/
|
||||
const val REGIONAL_OF_PALDEA = "paldea_regional"
|
||||
const val PALDEAN_FORM = "paldean_form"
|
||||
|
||||
/**
|
||||
* Represents a mega evolution.
|
||||
@@ -124,7 +140,7 @@ object CobblemonPokemonLabels {
|
||||
const val TOTEM = "totem"
|
||||
|
||||
/**
|
||||
* Represents a Paradox species.
|
||||
* Represents Pokémon that trigger the Booster Energy item (due to Protosynthesis/Quark Drive)
|
||||
* For more information see the [Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Paradox_Pok%C3%A9mon) page.
|
||||
*/
|
||||
const val PARADOX = "paradox"
|
||||
@@ -171,12 +187,24 @@ object CobblemonPokemonLabels {
|
||||
*/
|
||||
const val GENERATION_7 = "gen7"
|
||||
|
||||
/**
|
||||
* The "official" designation for Pokémon from Gen 7 (Unknown) and not the Alola region
|
||||
* This may also include forms of Pokémon that had been previously introduced
|
||||
*/
|
||||
const val GENERATION_7B = "gen7b"
|
||||
|
||||
/**
|
||||
* Pokémon from the national Pokédex of 810 to 905
|
||||
* This may also include forms of Pokémon that had been previously introduced
|
||||
*/
|
||||
const val GENERATION_8 = "gen8"
|
||||
|
||||
/**
|
||||
* The "official" designation for Pokémon from Gen 8 (Hisui) and not the Galar region
|
||||
* This may also include forms of Pokémon that had been previously introduced
|
||||
*/
|
||||
const val GENERATION_8A = "gen8a"
|
||||
|
||||
/**
|
||||
* Pokémon from the national Pokédex from 906 to 1008
|
||||
* This may also include forms of Pokémon that had been previously introduced
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.cobblemon.mod.common.api.pokemon.stats
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import net.minecraft.world.item.ItemStack
|
||||
|
||||
interface EvSource {
|
||||
|
||||
/**
|
||||
* The [Pokemon] being affected.
|
||||
*/
|
||||
val pokemon: Pokemon
|
||||
|
||||
/**
|
||||
* Utility function that checks if the source is an implementation of [BattleEvSource].
|
||||
*/
|
||||
fun isBattle() = this is BattleEvSource
|
||||
|
||||
/**
|
||||
* Utility function that checks if the source is an implementation of [ItemEvSource].
|
||||
*/
|
||||
fun isInteraction() = this is ItemEvSource
|
||||
|
||||
/**
|
||||
* Utility function that checks if the source is an implementation of [SidemodEvSource].
|
||||
*/
|
||||
fun isSidemod() = this is SidemodEvSource
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered by sidemods.
|
||||
*
|
||||
* @property sidemodId The mod ID of the sidemod triggering this source.
|
||||
* @property pokemon See [EvSource.pokemon].
|
||||
*/
|
||||
open class SidemodEvSource(
|
||||
val sidemodId: String,
|
||||
override val pokemon: Pokemon
|
||||
) : EvSource
|
||||
|
||||
/**
|
||||
* An Ev source fired when using Ev mutating items.
|
||||
*
|
||||
* @property player The [ServerPlayer] using the item.
|
||||
* @property stack The [ItemStack] being consumed.
|
||||
* @property pokemon See [EvSource.pokemon].
|
||||
*/
|
||||
open class ItemEvSource(
|
||||
val player: ServerPlayer,
|
||||
val stack: ItemStack,
|
||||
override val pokemon: Pokemon
|
||||
) : EvSource
|
||||
|
||||
/**
|
||||
* An Ev source fired in battles.
|
||||
*
|
||||
* @property battle The associated [PokemonBattle].
|
||||
* @property facedPokemon The [BattlePokemon]s that the [pokemon] faced.
|
||||
* @property pokemon See [EvSource.pokemon], comes from the original [BattlePokemon.effectedPokemon].
|
||||
*/
|
||||
open class BattleEvSource(
|
||||
val battle: PokemonBattle,
|
||||
val facedPokemon: List<BattlePokemon>,
|
||||
override val pokemon: Pokemon
|
||||
) : EvSource
|
||||
@@ -53,7 +53,7 @@ enum class Stats(override val identifier: ResourceLocation, override val display
|
||||
fun getStat(statKey: String) = when(statKey.lowercase()) {
|
||||
"hp" -> HP
|
||||
"atk", "attack" -> ATTACK // Hyper Cutter states the full stat name "Attack"
|
||||
"def", "defense" -> DEFENCE // Big Pecks states the full stat name "Defense"
|
||||
"def", "defense", "defence" -> DEFENCE // Big Pecks states the full stat name "Defense"
|
||||
"spa" -> SPECIAL_ATTACK
|
||||
"spd" -> SPECIAL_DEFENCE
|
||||
"spe", "speed" -> SPEED
|
||||
|
||||
+11
-1
@@ -11,6 +11,9 @@ package com.cobblemon.mod.common.api.serialization
|
||||
import com.google.gson.JsonDeserializationContext
|
||||
import com.google.gson.JsonDeserializer
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonPrimitive
|
||||
import com.google.gson.JsonSerializationContext
|
||||
import com.google.gson.JsonSerializer
|
||||
import java.lang.reflect.Type
|
||||
|
||||
/**
|
||||
@@ -19,6 +22,13 @@ import java.lang.reflect.Type
|
||||
* @author Hiroku
|
||||
* @since July 18th, 2022
|
||||
*/
|
||||
class StringIdentifiedObjectAdapter<T>(val fromString: (String) -> T) : JsonDeserializer<T> {
|
||||
class StringIdentifiedObjectAdapter<T>(
|
||||
val fromString: (String) -> T,
|
||||
val toString: ((T) -> String)? = null,
|
||||
) : JsonDeserializer<T>, JsonSerializer<T> {
|
||||
override fun deserialize(json: JsonElement, type: Type, ctx: JsonDeserializationContext) = fromString(json.asString)
|
||||
override fun serialize(src: T, type: Type?, ctx: JsonSerializationContext?): JsonElement? {
|
||||
val stringValue = toString?.invoke(src) ?: throw IllegalStateException("No toString function provided for serialization.")
|
||||
return JsonPrimitive(stringValue)
|
||||
}
|
||||
}
|
||||
@@ -498,7 +498,7 @@ class LookAtDirection : ParticleCameraMode {
|
||||
rotation.hamiltonProduct(Axis.ZP.rotationDegrees(particleAngle))
|
||||
|
||||
// Minecraft in 1.21 or 1.20.4 or something fucked with vertex draw order, and it flipped everything.
|
||||
rotation.hamiltonProduct(Axis.YP.rotationDegrees(180F))
|
||||
rotation.hamiltonProduct(Axis.XP.rotationDegrees(180F))
|
||||
|
||||
return rotation
|
||||
}
|
||||
|
||||
@@ -83,8 +83,9 @@ object BestSpawner {
|
||||
var defaultPokemonDespawner: Despawner<PokemonEntity> = CobblemonAgingDespawner(getAgeTicks = { it.ticksLived })
|
||||
lateinit var fishingSpawner: FishingSpawner
|
||||
|
||||
fun loadConfig() {
|
||||
fun init() {
|
||||
LOGGER.info("Starting the Best Spawner...")
|
||||
|
||||
SpawningCondition.register(BasicSpawningCondition.NAME, BasicSpawningCondition::class.java)
|
||||
SpawningCondition.register(AreaSpawningCondition.NAME, AreaSpawningCondition::class.java)
|
||||
SpawningCondition.register(SubmergedSpawningCondition.NAME, SubmergedSpawningCondition::class.java)
|
||||
@@ -94,6 +95,7 @@ object BestSpawner {
|
||||
SpawningCondition.register(FishingSpawningCondition.NAME, FishingSpawningCondition::class.java)
|
||||
|
||||
LOGGER.info("Loaded ${SpawningCondition.conditionTypes.size} spawning condition types.")
|
||||
|
||||
SpawningContextCalculator.register(GroundedSpawningContextCalculator)
|
||||
SpawningContextCalculator.register(SeafloorSpawningContextCalculator)
|
||||
SpawningContextCalculator.register(LavafloorSpawningContextCalculator)
|
||||
@@ -113,14 +115,23 @@ object BestSpawner {
|
||||
SpawnDetail.registerSpawnType(name = NPCSpawnDetail.TYPE, NPCSpawnDetail::class.java)
|
||||
LOGGER.info("Loaded ${SpawnDetail.spawnDetailTypes.size} spawn detail types.")
|
||||
|
||||
config = BestSpawnerConfig.load()
|
||||
loadConfig()
|
||||
|
||||
SpawnDetailPresets.registerPresetType(BasicSpawnDetailPreset.NAME, BasicSpawnDetailPreset::class.java)
|
||||
SpawnDetailPresets.registerPresetType(PokemonSpawnDetailPreset.NAME, PokemonSpawnDetailPreset::class.java)
|
||||
}
|
||||
|
||||
fun loadConfig() {
|
||||
config = BestSpawnerConfig.load()
|
||||
}
|
||||
|
||||
fun reloadConfig() {
|
||||
loadConfig()
|
||||
spawnerManagers.forEach(SpawnerManager::onConfigReload)
|
||||
}
|
||||
|
||||
fun onServerStarted() {
|
||||
spawnerManagers.forEach(SpawnerManager::onServerStarted)
|
||||
fishingSpawner = FishingSpawner()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,4 +96,4 @@ object SpawnDetailPresets : JsonDataRegistry<SpawnDetailPreset> {
|
||||
this.presets = data.toMutableMap()
|
||||
Cobblemon.LOGGER.info("Loaded ${presets.size} spawn detail presets.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.api.spawning
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.spawning.influence.SpawningInfluence
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.PlayerSpawner
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner
|
||||
import com.cobblemon.mod.common.util.server
|
||||
@@ -58,6 +59,12 @@ open class SpawnerManager {
|
||||
}
|
||||
}
|
||||
|
||||
open fun onConfigReload() {
|
||||
spawners.filterIsInstance<PlayerSpawner>().forEach {
|
||||
it.ticksBetweenSpawns = Cobblemon.config.ticksBetweenSpawnAttempts
|
||||
}
|
||||
}
|
||||
|
||||
open fun onServerStarted() {
|
||||
spawners.clear()
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,4 +161,4 @@ abstract class SpawningCondition<T : SpawningContext> {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -221,4 +221,4 @@ abstract class SpawningContext {
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -64,4 +64,4 @@ open class SpawningContextInput(
|
||||
val cause: SpawnCause,
|
||||
/** The [Level] the spawning context exists in. */
|
||||
val world: ServerLevel
|
||||
)
|
||||
)
|
||||
|
||||
@@ -103,4 +103,4 @@ abstract class SpawnDetail : ModDependant {
|
||||
}
|
||||
|
||||
abstract fun doSpawn(ctx: SpawningContext): SpawnAction<*>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -10,15 +10,12 @@ package com.cobblemon.mod.common.api.spawning.fishing
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.Cobblemon.LOGGER
|
||||
import com.cobblemon.mod.common.api.Priority
|
||||
import com.cobblemon.mod.common.api.abilities.Abilities
|
||||
import com.cobblemon.mod.common.api.events.CobblemonEvents
|
||||
import com.cobblemon.mod.common.api.events.fishing.BobberSpawnPokemonEvent
|
||||
import com.cobblemon.mod.common.api.fishing.FishingBait
|
||||
import com.cobblemon.mod.common.api.pokemon.Natures
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
|
||||
import com.cobblemon.mod.common.api.pokemon.egg.EggGroup
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stat
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.api.spawning.SpawnBucket
|
||||
import com.cobblemon.mod.common.api.spawning.SpawnCause
|
||||
@@ -27,7 +24,6 @@ import com.cobblemon.mod.common.api.spawning.detail.PokemonSpawnDetail
|
||||
import com.cobblemon.mod.common.api.spawning.detail.SpawnDetail
|
||||
import com.cobblemon.mod.common.api.spawning.spawner.Spawner
|
||||
import com.cobblemon.mod.common.api.types.ElementalTypes
|
||||
import com.cobblemon.mod.common.api.types.tera.TeraTypes
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.item.interactive.PokerodItem
|
||||
import com.cobblemon.mod.common.pokemon.Gender
|
||||
@@ -129,8 +125,8 @@ class FishingSpawnCause(
|
||||
}
|
||||
|
||||
fun alterFriendshipAttempt(pokemonEntity: PokemonEntity, effect: FishingBait.Effect) {
|
||||
if (pokemonEntity.pokemon.friendship + effect.value > 255)
|
||||
pokemonEntity.pokemon.setFriendship(255)
|
||||
if (pokemonEntity.pokemon.friendship + effect.value > Cobblemon.config.maxPokemonFriendship)
|
||||
pokemonEntity.pokemon.setFriendship(Cobblemon.config.maxPokemonFriendship)
|
||||
else
|
||||
pokemonEntity.pokemon.setFriendship(pokemonEntity.pokemon.friendship + effect.value.toInt())
|
||||
}
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ class BestSpawnerConfig {
|
||||
.create()
|
||||
|
||||
const val CONFIG_NAME = "best-spawner-config"
|
||||
const val INTERNAL_PATH = "data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val INTERNAL_PATH = "/data/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
const val EXTERNAL_PATH = "config/${Cobblemon.MODID}/spawning/$CONFIG_NAME.json"
|
||||
|
||||
fun load(): BestSpawnerConfig {
|
||||
@@ -77,7 +77,7 @@ class BestSpawnerConfig {
|
||||
}
|
||||
|
||||
private fun loadInternal(): BestSpawnerConfig {
|
||||
val reader = InputStreamReader(Cobblemon.javaClass.classLoader.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val reader = InputStreamReader(Cobblemon::class.java.getResourceAsStream(INTERNAL_PATH)!!)
|
||||
val config = GSON.fromJson(reader, BestSpawnerConfig::class.java)
|
||||
reader.close()
|
||||
return config
|
||||
|
||||
+9
-9
@@ -46,16 +46,16 @@ open class JSONStoreAdapter(
|
||||
|
||||
override fun <E, T : PokemonStore<E>> load(file: File, storeClass: Class<out T>, uuid: UUID, registryAccess: RegistryAccess): T? {
|
||||
return try {
|
||||
val br = BufferedReader(FileReader(file))
|
||||
val json = gson.fromJson<JsonObject>(br)
|
||||
br.close()
|
||||
val store = try {
|
||||
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
|
||||
} catch (exception: NoSuchMethodException) {
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
file.reader().use {
|
||||
val json = gson.fromJson<JsonObject>(it)
|
||||
val store = try {
|
||||
storeClass.getConstructor(UUID::class.java, UUID::class.java).newInstance(uuid, uuid)
|
||||
} catch (exception: NoSuchMethodException) {
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
}
|
||||
store.loadFromJSON(json, registryAccess)
|
||||
store
|
||||
}
|
||||
store.loadFromJSON(json, registryAccess)
|
||||
store
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
+36
-15
@@ -42,6 +42,7 @@ abstract class OneToOneFileStoreAdapter<S>(
|
||||
) : FileStoreAdapter<S>, CobblemonAdapterParent<S>() {
|
||||
abstract fun save(file: File, serialized: S)
|
||||
abstract fun <E, T : PokemonStore<E>> load(file: File, storeClass: Class<out T>, uuid: UUID, registryAccess: RegistryAccess): T?
|
||||
|
||||
fun getFile(storeClass: Class<out PokemonStore<*>>, uuid: UUID): File {
|
||||
val className = storeClass.simpleName.lowercase()
|
||||
val subfolder1 = if (folderPerClass) "$className/" else ""
|
||||
@@ -56,34 +57,54 @@ abstract class OneToOneFileStoreAdapter<S>(
|
||||
override fun save(storeClass: Class<out PokemonStore<*>>, uuid: UUID, serialized: S) {
|
||||
val file = getFile(storeClass, uuid)
|
||||
val tempFile = File(file.absolutePath + ".temp")
|
||||
val oldFile = File(file.absolutePath + ".old")
|
||||
tempFile.createNewFile()
|
||||
save(tempFile, serialized)
|
||||
if (file.exists()) {
|
||||
file.copyTo(oldFile, overwrite = true)
|
||||
}
|
||||
tempFile.copyTo(file, overwrite = true)
|
||||
tempFile.delete()
|
||||
}
|
||||
|
||||
override fun <E : StorePosition, T : PokemonStore<E>> provide(storeClass: Class<T>, uuid: UUID, registryAccess: RegistryAccess): T? {
|
||||
val file = getFile(storeClass, uuid)
|
||||
val tempFile = File(file.absolutePath + ".temp")
|
||||
if (tempFile.exists()) {
|
||||
try {
|
||||
val tempLoaded = load(tempFile, storeClass, uuid, registryAccess)
|
||||
if (tempLoaded != null) {
|
||||
save(file, serialize(tempLoaded, registryAccess))
|
||||
return tempLoaded
|
||||
}
|
||||
} finally {
|
||||
tempFile.delete()
|
||||
}
|
||||
}
|
||||
val oldFile = File(file.absolutePath + ".old")
|
||||
|
||||
return if (file.exists()) {
|
||||
return if (file.exists() && file.length() > 0L) {
|
||||
load(file, storeClass, uuid, registryAccess)
|
||||
?: let {
|
||||
LOGGER.error("Pokémon save file for ${storeClass.simpleName} ($uuid) was corrupted. A fresh file will be created.")
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
file.delete()
|
||||
if (oldFile.exists() && oldFile.length() > 0L) {
|
||||
var result = load(oldFile, storeClass, uuid, registryAccess) ?: let {
|
||||
LOGGER.error("Pokémon save file for ${storeClass.simpleName} ($uuid) was corrupted. A fresh file will be created.")
|
||||
var result = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
save(storeClass, uuid, serialize(result, registryAccess))
|
||||
oldFile.delete()
|
||||
return result
|
||||
}
|
||||
LOGGER.warn("Loading old Pokémon save file for ${storeClass.simpleName} ($uuid) due to corruption of current file.")
|
||||
oldFile.copyTo(file, overwrite = true)
|
||||
result
|
||||
}
|
||||
else {
|
||||
storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
var result = storeClass.getConstructor(UUID::class.java).newInstance(uuid)
|
||||
save(storeClass, uuid, serialize(result, registryAccess))
|
||||
oldFile.delete()
|
||||
result
|
||||
}
|
||||
}
|
||||
} else {
|
||||
file.delete()
|
||||
if (oldFile.exists() && oldFile.length() > 0L) {
|
||||
var result = load(oldFile, storeClass, uuid, registryAccess) ?: let {
|
||||
oldFile.delete()
|
||||
return null
|
||||
}
|
||||
oldFile.copyTo(file, overwrite = true)
|
||||
result
|
||||
}
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -27,15 +27,15 @@ import net.minecraft.world.entity.player.Player
|
||||
* @since February 21, 2024
|
||||
*/
|
||||
|
||||
class PlayerInstancedDataStoreManager {
|
||||
open class PlayerInstancedDataStoreManager {
|
||||
val factories = mutableMapOf<PlayerInstancedDataStoreType, PlayerInstancedDataFactory<*>>()
|
||||
val saveTasks = mutableMapOf<PlayerInstancedDataStoreType, ScheduledTask>()
|
||||
fun setFactory(factory: PlayerInstancedDataFactory<*>, dataType: PlayerInstancedDataStoreType) {
|
||||
open fun setFactory(factory: PlayerInstancedDataFactory<*>, dataType: PlayerInstancedDataStoreType) {
|
||||
factories[dataType] = factory
|
||||
}
|
||||
|
||||
|
||||
fun setup(server: MinecraftServer) {
|
||||
open fun setup(server: MinecraftServer) {
|
||||
factories.values.forEach {
|
||||
it.setup(server)
|
||||
}
|
||||
@@ -57,62 +57,62 @@ class PlayerInstancedDataStoreManager {
|
||||
.build()
|
||||
}
|
||||
|
||||
fun get(playerId: UUID, dataType: PlayerInstancedDataStoreType): InstancedPlayerData {
|
||||
open fun get(playerId: UUID, dataType: PlayerInstancedDataStoreType): InstancedPlayerData {
|
||||
if (!factories.contains(dataType)) {
|
||||
throw UnsupportedOperationException("No factory registered for $dataType")
|
||||
}
|
||||
return factories[dataType]!!.getForPlayer(playerId)
|
||||
}
|
||||
|
||||
fun get(player: Player, dataType: PlayerInstancedDataStoreType): InstancedPlayerData {
|
||||
open fun get(player: Player, dataType: PlayerInstancedDataStoreType): InstancedPlayerData {
|
||||
return get(player.uuid, dataType)
|
||||
}
|
||||
|
||||
fun saveAllOfOneType(dataType: PlayerInstancedDataStoreType) {
|
||||
open fun saveAllOfOneType(dataType: PlayerInstancedDataStoreType) {
|
||||
if (!factories.contains(dataType)) {
|
||||
throw UnsupportedOperationException("No factory registered for $dataType")
|
||||
}
|
||||
return factories[dataType]!!.saveAll()
|
||||
}
|
||||
|
||||
fun saveSingle(playerData: InstancedPlayerData, dataType: PlayerInstancedDataStoreType) {
|
||||
open fun saveSingle(playerData: InstancedPlayerData, dataType: PlayerInstancedDataStoreType) {
|
||||
if (!factories.contains(dataType)) {
|
||||
throw UnsupportedOperationException("No factory registered for $dataType")
|
||||
}
|
||||
return factories[dataType]!!.saveSingle(playerData.uuid)
|
||||
}
|
||||
|
||||
fun onPlayerDisconnect(player: ServerPlayer) {
|
||||
open fun onPlayerDisconnect(player: ServerPlayer) {
|
||||
factories.values.forEach {
|
||||
it.onPlayerDisconnect(player)
|
||||
}
|
||||
}
|
||||
|
||||
fun syncAllToPlayer(player: ServerPlayer) {
|
||||
open fun syncAllToPlayer(player: ServerPlayer) {
|
||||
factories.values.forEach {
|
||||
it.sendToPlayer(player)
|
||||
}
|
||||
}
|
||||
|
||||
fun saveAllStores() {
|
||||
open fun saveAllStores() {
|
||||
factories.values.forEach {
|
||||
it.saveAll()
|
||||
}
|
||||
}
|
||||
|
||||
fun getGenericData(player: ServerPlayer): GeneralPlayerData {
|
||||
open fun getGenericData(player: ServerPlayer): GeneralPlayerData {
|
||||
return getGenericData(player.uuid)
|
||||
}
|
||||
|
||||
fun getGenericData(playerId: UUID): GeneralPlayerData {
|
||||
open fun getGenericData(playerId: UUID): GeneralPlayerData {
|
||||
return get(playerId, PlayerInstancedDataStoreTypes.GENERAL) as GeneralPlayerData
|
||||
}
|
||||
|
||||
fun getPokedexData(player: ServerPlayer): PokedexManager {
|
||||
open fun getPokedexData(player: ServerPlayer): PokedexManager {
|
||||
return getPokedexData(player.uuid)
|
||||
}
|
||||
|
||||
fun getPokedexData(playerId: UUID): PokedexManager {
|
||||
open fun getPokedexData(playerId: UUID): PokedexManager {
|
||||
return get(playerId, PlayerInstancedDataStoreTypes.POKEDEX) as PokedexManager
|
||||
}
|
||||
}
|
||||
+63
-6
@@ -8,10 +8,12 @@
|
||||
|
||||
package com.cobblemon.mod.common.api.storage.player.adapter
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.storage.player.InstancedPlayerData
|
||||
import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreType
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.world.level.storage.LevelResource
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
import java.util.UUID
|
||||
|
||||
@@ -35,15 +37,70 @@ abstract class FileBasedPlayerDataStoreBackend<T : InstancedPlayerData>(
|
||||
savePath = server.getWorldPath(LevelResource.PLAYER_DATA_DIR).parent
|
||||
}
|
||||
|
||||
//TODO: Set file extension to be a field
|
||||
fun getSubFile(uuid: UUID): String {
|
||||
return if (useNestedStructure) {
|
||||
"${uuid.toString().substring(0, 2)}/$uuid.$fileExt"
|
||||
protected fun postSaveFileMoving(playerData: T) {
|
||||
val tempFile = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
|
||||
val oldFile = filePath(playerData.uuid, OLD_FILE_EXTENSION)
|
||||
val file = filePath(playerData.uuid)
|
||||
if (file.exists()) {
|
||||
file.copyTo(oldFile, overwrite = true)
|
||||
}
|
||||
tempFile.copyTo(file, overwrite = true)
|
||||
tempFile.delete()
|
||||
}
|
||||
|
||||
protected fun loadWithFallback(uuid: UUID, loadFunction: (File) -> T): T {
|
||||
val playerFile = filePath(uuid)
|
||||
val playerFileOld = filePath(uuid, OLD_FILE_EXTENSION)
|
||||
playerFile.parentFile.mkdirs()
|
||||
val loadFallback: () -> T = {
|
||||
playerFile.delete()
|
||||
if (playerFileOld.exists() && playerFileOld.length() > 0L) {
|
||||
try {
|
||||
var result = loadFunction(playerFileOld)
|
||||
playerFileOld.copyTo(playerFile)
|
||||
Cobblemon.LOGGER.debug("Loaded .old {} for {}", subfolder, uuid)
|
||||
result
|
||||
} catch (e: Exception) {
|
||||
Cobblemon.LOGGER.error("Failed to load .old $subfolder for $uuid due to ${e.message}. Data is lost")
|
||||
Cobblemon.LOGGER.error(e)
|
||||
playerFileOld.delete()
|
||||
defaultData.invoke(uuid).also(::save)
|
||||
}
|
||||
}
|
||||
else {
|
||||
Cobblemon.LOGGER.error(".old File $subfolder for $uuid is corrupt or missing. Data is lost")
|
||||
playerFileOld.delete()
|
||||
defaultData.invoke(uuid).also(::save)
|
||||
}
|
||||
}
|
||||
return if (playerFile.exists() && playerFile.length() > 0L) {
|
||||
try {
|
||||
loadFunction(playerFile)
|
||||
}
|
||||
catch (e: Exception) {
|
||||
Cobblemon.LOGGER.warn("Failed to load $subfolder for $uuid due to ${e.message}")
|
||||
Cobblemon.LOGGER.warn(e)
|
||||
loadFallback()
|
||||
}
|
||||
} else {
|
||||
"$uuid.$fileExt"
|
||||
loadFallback()
|
||||
}.also { it.initialize() }
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun getSubFile(uuid: UUID, extension: String? = null): String {
|
||||
return if (useNestedStructure) {
|
||||
"${uuid.toString().substring(0, 2)}/$uuid.$fileExt${if (extension != null) ".$extension" else ""}"
|
||||
} else {
|
||||
"$uuid.$fileExt.${if (extension != null) ".$extension" else ""}"
|
||||
}
|
||||
}
|
||||
|
||||
fun filePath(uuid: UUID) = savePath.resolve("$subfolder/${getSubFile(uuid)}").toFile()
|
||||
@JvmOverloads
|
||||
fun filePath(uuid: UUID, extension: String? = null): File = savePath.resolve("$subfolder/${getSubFile(uuid, extension)}").toFile()
|
||||
|
||||
companion object {
|
||||
const val OLD_FILE_EXTENSION = "old"
|
||||
const val TEMPORARY_FILE_EXTENSION = "tmp"
|
||||
}
|
||||
}
|
||||
+16
-19
@@ -28,29 +28,26 @@ abstract class JsonBackedPlayerDataStoreBackend<T : InstancedPlayerData>(
|
||||
abstract val classToken: TypeToken<T>
|
||||
|
||||
override fun save(playerData: T) {
|
||||
val file = filePath(playerData.uuid)
|
||||
file.parentFile.mkdirs()
|
||||
val pw = PrintWriter(filePath(playerData.uuid))
|
||||
pw.write(gson.toJson(playerData))
|
||||
pw.flush()
|
||||
pw.close()
|
||||
val fileTmp = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
|
||||
fileTmp.parentFile.mkdirs()
|
||||
fileTmp.printWriter().use { pw ->
|
||||
pw.write(gson.toJson(playerData))
|
||||
}
|
||||
postSaveFileMoving(playerData)
|
||||
}
|
||||
|
||||
override fun load(uuid: UUID): T {
|
||||
val playerFile = filePath(uuid)
|
||||
playerFile.parentFile.mkdirs()
|
||||
return if (playerFile.exists() && playerFile.length() > 0L) {
|
||||
gson.fromJson(BufferedReader(FileReader(playerFile)), classToken).also {
|
||||
// Resolves old data that's missing new properties
|
||||
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
|
||||
if (newProps.isNotEmpty()) {
|
||||
val defaultData = defaultData(uuid)
|
||||
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
|
||||
return loadWithFallback(uuid) {
|
||||
it.reader().use { reader ->
|
||||
gson.fromJson(reader, classToken).also {
|
||||
// Resolves old data that's missing new properties
|
||||
val newProps = it::class.memberProperties.filterIsInstance<KMutableProperty<*>>().filter { member -> member.getter.call(it) == null }
|
||||
if (newProps.isNotEmpty()) {
|
||||
val defaultData = defaultData(uuid)
|
||||
newProps.forEach { member -> member.setter.call(it, member.getter.call(defaultData)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
defaultData.invoke(uuid).also(::save)
|
||||
}.also { it.initialize() }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+11
-16
@@ -24,29 +24,24 @@ abstract class NbtBackedPlayerData<T : InstancedPlayerData>(
|
||||
type: PlayerInstancedDataStoreType
|
||||
) : FileBasedPlayerDataStoreBackend<T>(subfolder, type, "nbt") {
|
||||
abstract val codec: Codec<T>
|
||||
|
||||
override fun save(playerData: T) {
|
||||
val file = filePath(playerData.uuid)
|
||||
file.parentFile.mkdirs()
|
||||
val os = DataOutputStream(FileOutputStream(filePath(playerData.uuid)))
|
||||
val encodeResult = NbtOps.INSTANCE.withEncoder(codec).apply(playerData)
|
||||
NbtIo.write(encodeResult.result().get() as CompoundTag, os)
|
||||
os.flush()
|
||||
os.close()
|
||||
val fileTmp = filePath(playerData.uuid, TEMPORARY_FILE_EXTENSION)
|
||||
fileTmp.parentFile.mkdirs()
|
||||
val encodeResult = codec.encodeStart(NbtOps.INSTANCE, playerData)
|
||||
NbtIo.write(encodeResult.result().get() as CompoundTag, fileTmp.toPath())
|
||||
postSaveFileMoving(playerData)
|
||||
}
|
||||
|
||||
override fun load(uuid: UUID): T {
|
||||
val playerFile = filePath(uuid)
|
||||
playerFile.parentFile.mkdirs()
|
||||
return if (playerFile.exists() && playerFile.length() > 0L) {
|
||||
val input = NbtIo.read(playerFile.toPath())
|
||||
val decodeResult = NbtOps.INSTANCE.withDecoder(codec).apply(input)
|
||||
decodeResult.getPartialOrThrow {
|
||||
return loadWithFallback(uuid) {
|
||||
val input = NbtIo.read(it.toPath())
|
||||
val decodeResult = codec.decode(NbtOps.INSTANCE, input)
|
||||
decodeResult.getOrThrow {
|
||||
Cobblemon.LOGGER.error("Error decoding $subfolder for player uuid $uuid")
|
||||
Cobblemon.LOGGER.error(it)
|
||||
throw UnsupportedOperationException()
|
||||
}.first
|
||||
} else {
|
||||
defaultData.invoke(uuid).also(::save)
|
||||
}.also { it.initialize() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,30 +23,72 @@ object CobblemonBlockTags {
|
||||
|
||||
@JvmField val ALL_HANGING_SIGNS = createTag("all_hanging_signs")
|
||||
@JvmField val ALL_SIGNS = createTag("all_signs")
|
||||
@JvmField val ANCIENT_CITY_BLOCKS = createTag("ancient_city_blocks")
|
||||
@JvmField val APRICORN_LEAVES = createTag("apricorn_leaves")
|
||||
@JvmField val APRICORN_LOGS = createTag("apricorn_logs")
|
||||
@JvmField val APRICORN_SAPLINGS = createTag("apricorn_saplings")
|
||||
@JvmField val APRICORNS = createTag("apricorns")
|
||||
@JvmField val BERRY_WILD_SOIL = createTag("berry_wild_soil")
|
||||
@JvmField val BERRY_SOIL = createTag("berry_soil")
|
||||
@JvmField val BERRIES = createTag("berries")
|
||||
@JvmField val BERRY_REPLACEABLE = createTag("berry_replaceable")
|
||||
@JvmField val BERRY_SOIL = createTag("berry_soil")
|
||||
@JvmField val BERRY_WILD_SOIL = createTag("berry_wild_soil")
|
||||
@JvmField val BLACK_TUMBLESTONE_BRICKS = createTag("black_tumblestone_bricks")
|
||||
@JvmField val BLACK_TUMBLESTONES = createTag("black_tumblestones")
|
||||
@JvmField val BLUE_FLOWERS = createTag("blue_flowers")
|
||||
@JvmField val CEILING_HANGING_SIGNS = createTag("ceiling_hanging_signs")
|
||||
@JvmField val CROPS = createTag("crops")
|
||||
@JvmField val DAWN_STONE_ORES = createTag("dawn_stone_ores")
|
||||
@JvmField val DESERT_PYRAMID_BLOCKS = createTag("desert_pyramid_blocks")
|
||||
@JvmField val DRIPSTONE_GROWABLE = createTag("dripstone_growable")
|
||||
@JvmField val DRIPSTONE_REPLACEABLES = createTag("dripstone_replaceables")
|
||||
@JvmField val DUSK_STONE_ORES = createTag("dusk_stone_ores")
|
||||
@JvmField val END_CITY_BLOCKS = createTag("end_city_blocks")
|
||||
@JvmField val EVOLUTION_STONE_BLOCKS = createTag("evolution_stone_blocks")
|
||||
@JvmField val FIRE_STONE_ORES = createTag("fire_stone_ores")
|
||||
@JvmField val FLOWERS = createTag("flowers")
|
||||
@JvmField val FOSSIL_MACHINE_PARTS = createTag("fossil_machine_parts")
|
||||
@JvmField val GEMSTONES = createTag("gemstones")
|
||||
@JvmField val GILDED_CHESTS = createTag("gilded_chests")
|
||||
@JvmField val GLAZED_TERRACOTTA_BLOCKS = createTag("glazed_terracotta_blocks")
|
||||
@JvmField val ICE_STONE_ORES = createTag("ice_stone_ores")
|
||||
@JvmField val JUNGLE_PYRAMID_BLOCKS = createTag("jungle_pyramid_blocks")
|
||||
@JvmField val LEAF_STONE_ORES = createTag("leaf_stone_ores")
|
||||
@JvmField val MACHINES = createTag("machines")
|
||||
@JvmField val MANSION_BLOCKS = createTag("mansion_blocks")
|
||||
@JvmField val MEDICINAL_LEEK_PLANTABLE = createTag("medicinal_leek_plantable")
|
||||
@JvmField val MINTS = createTag("mints")
|
||||
@JvmField val ROOTS_SPREADABLE = createTag("roots_spreadable")
|
||||
@JvmField val SIGNS = createTag("signs")
|
||||
@JvmField val SMALL_FLOWERS = createTag("small_flowers")
|
||||
@JvmField val SEES_SKY = createTag("sees_sky")
|
||||
@JvmField val SNOW_BLOCK = createTag("snow_block")
|
||||
@JvmField val MOON_STONE_ORES = createTag("moon_stone_ores")
|
||||
@JvmField val NATURAL = createTag("natural")
|
||||
@JvmField val NETHER_STRUCTURE_BLOCKS = createTag("nether_structure_blocks")
|
||||
@JvmField val PINK_FLOWERS = createTag("pink_flowers")
|
||||
@JvmField val RED_FLOWERS = createTag("red_flowers")
|
||||
@JvmField val RED_TUMBLESTONE_BRICKS = createTag("red_tumblestone_bricks")
|
||||
@JvmField val RED_TUMBLESTONES = createTag("red_tumblestones")
|
||||
@JvmField val REDSTONE_BLOCKS = createTag("redstone_blocks")
|
||||
@JvmField val ROOTS = createTag("roots")
|
||||
@JvmField val ROOTS_SPREADABLE = createTag("roots_spreadable")
|
||||
@JvmField val RUINED_PORTAL_BLOCKS = createTag("ruined_portal_blocks")
|
||||
@JvmField val SEES_SKY = createTag("sees_sky")
|
||||
@JvmField val SHINY_STONE_ORES = createTag("shiny_stone_ores")
|
||||
@JvmField val SIGNS = createTag("signs")
|
||||
@JvmField val SKY_TUMBLESTONE_BRICKS = createTag("sky_tumblestone_bricks")
|
||||
@JvmField val SKY_TUMBLESTONES = createTag("sky_tumblestones")
|
||||
@JvmField val SMALL_FLOWERS = createTag("small_flowers")
|
||||
@JvmField val SNOW_BLOCK = createTag("snow_block")
|
||||
@JvmField val STANDING_SIGNS = createTag("standing_signs")
|
||||
@JvmField val SUN_STONE_ORES = createTag("sun_stone_ores")
|
||||
@JvmField val THUNDER_STONE_ORES = createTag("thunder_stone_ores")
|
||||
@JvmField val TRAIL_RUINS_BLOCKS = createTag("trail_ruins_blocks")
|
||||
@JvmField val TRASH = createTag("trash")
|
||||
@JvmField val TREES = createTag("trees")
|
||||
@JvmField val TUMBLESTONE_BRICKS = createTag("tumblestone_bricks")
|
||||
@JvmField val TUMBLESTONES = createTag("tumblestones")
|
||||
@JvmField val TUMBLESTONE_HEAT_SOURCE = createTag("tumblestone_heat_source")
|
||||
@JvmField val WALL_HANGING_SIGNS = createTag("wall_hanging_signs")
|
||||
@JvmField val WALL_SIGNS = createTag("wall_signs")
|
||||
@JvmField val WATER_STONE_ORES = createTag("water_stone_ores")
|
||||
@JvmField val WHITE_FLOWERS = createTag("white_flowers")
|
||||
@JvmField val YELLOW_FLOWERS = createTag("yellow_flowers")
|
||||
|
||||
private fun createTag(name: String) = TagKey.create(Registries.BLOCK, cobblemonResource(name))
|
||||
|
||||
|
||||
@@ -21,137 +21,108 @@ import net.minecraft.tags.TagKey
|
||||
*/
|
||||
@Suppress("unused", "HasPlatformType")
|
||||
object CobblemonItemTags {
|
||||
@JvmField
|
||||
val ANCIENT_POKE_BALLS = create("ancient_poke_balls")
|
||||
@JvmField
|
||||
val APRICORN_LOGS = create("apricorn_logs")
|
||||
@JvmField
|
||||
val APRICORN_SPROUTS = create("apricorn_sprouts")
|
||||
@JvmField
|
||||
val APRICORNS = create("apricorns")
|
||||
@JvmField
|
||||
val POKEDEX = create("pokedex")
|
||||
/**
|
||||
* This tag is only used for a Torterra aspect based easter egg evolution at the moment.
|
||||
* It simply includes the 'minecraft:azalea' and 'minecraft:flowering_azalea' items by default.
|
||||
*/
|
||||
@JvmField
|
||||
val AZALEA_TREE = create("azalea_tree")
|
||||
@JvmField
|
||||
val BERRIES = create("berries")
|
||||
@JvmField
|
||||
val BOATS = create("boats")
|
||||
@JvmField
|
||||
val COBBLEMON_SEEDS = create("cobblemon_seeds")
|
||||
/**
|
||||
* This tag is used for Fossil Machine natural materials
|
||||
*/
|
||||
@JvmField
|
||||
val COOKED_MEAT = create("cooked_meat")
|
||||
@JvmField
|
||||
val DAWN_STONE_ORES = create("dawn_stone_ores")
|
||||
@JvmField
|
||||
val DUSK_STONE_ORES = create("dusk_stone_ores")
|
||||
@JvmField
|
||||
val EVOLUTION_ITEMS = create("evolution_items")
|
||||
@JvmField
|
||||
val EVOLUTION_STONES = create("evolution_stones")
|
||||
@JvmField
|
||||
val EXPERIENCE_CANDIES = create("experience_candies")
|
||||
@JvmField
|
||||
val FIRE_STONE_ORES = create("fire_stone_ores")
|
||||
@JvmField
|
||||
val FOSSILS = create("fossils")
|
||||
@JvmField
|
||||
val HANGING_SIGNS = create("hanging_signs")
|
||||
@JvmField
|
||||
val HERBS = create("herbs")
|
||||
@JvmField
|
||||
val ICE_STONE_ORES = create("ice_stone_ores")
|
||||
@JvmField
|
||||
val LEAF_STONE_ORES = create("leaf_stone_ores")
|
||||
@JvmField
|
||||
val MINT_LEAF = create("mint_leaf")
|
||||
@JvmField
|
||||
val MINT_SEEDS = create("mint_seeds")
|
||||
@JvmField
|
||||
val MINTS = create("mints")
|
||||
@JvmField
|
||||
val MOON_STONE_ORES = create("moon_stone_ores")
|
||||
@JvmField
|
||||
val MUTATED_BERRIES = create("mutated_berries")
|
||||
@JvmField
|
||||
val PLANTS = create("plants")
|
||||
@JvmField
|
||||
val POKE_BALLS = create("poke_balls")
|
||||
@JvmField
|
||||
val PROTEIN_INGREDIENTS = create("protein_ingredients")
|
||||
@JvmField val ABILITY_CHANGERS = create("ability_changers")
|
||||
@JvmField val ANCIENT_POKE_BALLS = create("ancient_poke_balls")
|
||||
@JvmField val APPLES = create("apples")
|
||||
@JvmField val APRICORN_LOGS = create("apricorn_logs")
|
||||
@JvmField val APRICORN_POKE_BALLS = create("apricorn_poke_balls")
|
||||
@JvmField val APRICORN_SPROUTS = create("apricorn_sprouts")
|
||||
@JvmField val APRICORNS = create("apricorns")
|
||||
/** This tag is only used for a Torterra aspect based easter egg evolution at the moment.
|
||||
* It simply includes the 'minecraft:azalea' and 'minecraft:flowering_azalea' items by default. */
|
||||
@JvmField val AZALEA_TREE = create("azalea_tree")
|
||||
@JvmField val BATTLE_ITEMS = create("battle_items")
|
||||
@JvmField val BERRIES = create("berries")
|
||||
@JvmField val BLACK_TUMBLESTONE_BRICKS = create("black_tumblestone_bricks")
|
||||
@JvmField val BLACK_TUMBLESTONES = create("black_tumblestones")
|
||||
@JvmField val BOATS = create("boats")
|
||||
/** This tag is used for Fossil Machine natural materials */
|
||||
@JvmField val COOKED_MEAT = create("cooked_meat")
|
||||
@JvmField val DAWN_STONE_ORES = create("dawn_stone_ores")
|
||||
@JvmField val POTTERY_SHERDS = create("decorated_pot_sherds")
|
||||
@JvmField val DEEP_SEAS = create("deep_seas")
|
||||
@JvmField val DUSK_STONE_ORES = create("dusk_stone_ores")
|
||||
@JvmField val ETHERS = create("ethers")
|
||||
@JvmField val EVOLUTION_ITEMS = create("evolution_items")
|
||||
@JvmField val EVOLUTION_STONE_BLOCKS = create("evolution_stone_blocks")
|
||||
@JvmField val EVOLUTION_STONES = create("evolution_stones")
|
||||
@JvmField val EXPERIENCE_CANDIES = create("experience_candies")
|
||||
@JvmField val FEATHERS = create("feathers")
|
||||
@JvmField val FIRE_STONE_ORES = create("fire_stone_ores")
|
||||
@JvmField val FOSSIL_MACHINE_PARTS = create("fossil_machine_parts")
|
||||
@JvmField val FOSSILS = create("fossils")
|
||||
@JvmField val GILDED_CHESTS = create("gilded_chests")
|
||||
@JvmField val HANGING_SIGNS = create("hanging_signs")
|
||||
@JvmField val HERBS = create("herbs")
|
||||
@JvmField val ICE_STONE_ORES = create("ice_stone_ores")
|
||||
@JvmField val LEAF_STONE_ORES = create("leaf_stone_ores")
|
||||
@JvmField val MACHINES = create("machines")
|
||||
@JvmField val MINT_LEAF = create("mint_leaf")
|
||||
@JvmField val MINT_SEEDS = create("mint_seeds")
|
||||
@JvmField val MINTS = create("mints")
|
||||
@JvmField val MOON_STONE_ORES = create("moon_stone_ores")
|
||||
@JvmField val MUTATED_BERRIES = create("mutated_berries")
|
||||
@JvmField val PLANTS = create("plants")
|
||||
@JvmField val POKE_BALLS = create("poke_balls")
|
||||
@JvmField val POKE_RODS = create("poke_rods")
|
||||
@JvmField val POKEDEX = create("pokedex")
|
||||
@JvmField val POKEDEX_SCREEN = create("pokedex_screen")
|
||||
@JvmField val POTIONS = create("potions")
|
||||
@JvmField val PROTEIN_INGREDIENTS = create("protein_ingredients")
|
||||
/** See [COOKED_MEAT] */
|
||||
@JvmField
|
||||
val RAW_MEAT = create("raw_meat")
|
||||
@JvmField
|
||||
val SEEDS = create("seeds")
|
||||
@JvmField
|
||||
val SHINY_STONE_ORES = create("shiny_stone_ores")
|
||||
@JvmField
|
||||
val SIGNS = create("signs")
|
||||
@JvmField
|
||||
val SUN_STONE_ORES = create("sun_stone_ores")
|
||||
@JvmField
|
||||
val THUNDER_STONE_ORES = create("thunder_stone_ores")
|
||||
@JvmField
|
||||
val TUMBLESTONES = create("tumblestones")
|
||||
@JvmField
|
||||
val WATER_STONE_ORES = create("water_stone_ores")
|
||||
@JvmField
|
||||
val ZINC_INGREDIENTS = create("zinc_ingredients")
|
||||
@JvmField val RAW_MEAT = create("raw_meat")
|
||||
@JvmField val RED_TUMBLESTONE_BRICKS = create("red_tumblestone_bricks")
|
||||
@JvmField val RED_TUMBLESTONES = create("red_tumblestones")
|
||||
@JvmField val REMEDIES = create("remedies")
|
||||
@JvmField val RESTORES = create("restores")
|
||||
@JvmField val REVIVES = create("revives")
|
||||
@JvmField val SEEDS = create("seeds")
|
||||
@JvmField val SHINY_STONE_ORES = create("shiny_stone_ores")
|
||||
@JvmField val SIGNS = create("signs")
|
||||
@JvmField val SKY_TUMBLESTONE_BRICKS = create("sky_tumblestone_bricks")
|
||||
@JvmField val SKY_TUMBLESTONES = create("sky_tumblestones")
|
||||
@JvmField val SUN_STONE_ORES = create("sun_stone_ores")
|
||||
@JvmField val SWEETS = create("sweets")
|
||||
@JvmField val TEACUPS = create("teacups")
|
||||
@JvmField val TEAPOTS = create("teapots")
|
||||
@JvmField val THUNDER_STONE_ORES = create("thunder_stone_ores")
|
||||
@JvmField val TIER_1_POKE_BALL_MATERIALS = create("tier_1_poke_ball_materials")
|
||||
@JvmField val TIER_1_POKE_BALLS = create("tier_1_poke_balls")
|
||||
@JvmField val TIER_2_POKE_BALL_MATERIALS = create("tier_2_poke_ball_materials")
|
||||
@JvmField val TIER_2_POKE_BALLS = create("tier_2_poke_balls")
|
||||
@JvmField val TIER_3_POKE_BALL_MATERIALS = create("tier_3_poke_ball_materials")
|
||||
@JvmField val TIER_3_POKE_BALLS = create("tier_3_poke_balls")
|
||||
@JvmField val TIER_4_POKE_BALL_MATERIALS = create("tier_4_poke_ball_materials")
|
||||
@JvmField val TIER_4_POKE_BALLS = create("tier_4_poke_balls")
|
||||
@JvmField val TIER_5_POKE_BALLS = create("tier_5_poke_balls")
|
||||
@JvmField val TUMBLESTONE_BRICKS = create("tumblestone_bricks")
|
||||
@JvmField val TUMBLESTONES = create("tumblestones")
|
||||
@JvmField val TYPE_GEMS = create("type_gems")
|
||||
@JvmField val VITAMINS = create("vitamins")
|
||||
@JvmField val WATER_STONE_ORES = create("water_stone_ores")
|
||||
@JvmField val ZINC_INGREDIENTS = create("zinc_ingredients")
|
||||
|
||||
// Held Item Tags
|
||||
@JvmField
|
||||
val ANY_HELD_ITEM = create("held/is_held_item")
|
||||
@JvmField
|
||||
val EXPERIENCE_SHARE = create("held/experience_share")
|
||||
@JvmField
|
||||
val LUCKY_EGG = create("held/lucky_egg")
|
||||
@JvmField
|
||||
val DESTINY_KNOT = create("held/destiny_knot")
|
||||
@JvmField
|
||||
val EVERSTONE = create("held/everstone")
|
||||
@JvmField
|
||||
val POWER_ANKLET = create("held/power_anklet")
|
||||
@JvmField
|
||||
val POWER_BAND = create("held/power_band")
|
||||
@JvmField
|
||||
val POWER_BELT = create("held/power_belt")
|
||||
@JvmField
|
||||
val POWER_BRACER = create("held/power_bracer")
|
||||
@JvmField
|
||||
val POWER_LENS = create("held/power_lens")
|
||||
@JvmField
|
||||
val POWER_WEIGHT = create("held/power_weight")
|
||||
@JvmField
|
||||
val CONSUMED_IN_NPC_BATTLE = create("held/consumed_in_npc_battle")
|
||||
@JvmField
|
||||
val CONSUMED_IN_PVP_BATTLE = create("held/consumed_in_pvp_battle")
|
||||
@JvmField
|
||||
val CONSUMED_IN_WILD_BATTLE = create("held/consumed_in_wild_battle")
|
||||
@JvmField
|
||||
val TERRAIN_SEEDS = create("held/terrain_seeds")
|
||||
@JvmField val CONSUMED_IN_NPC_BATTLE = create("held/consumed_in_npc_battle")
|
||||
@JvmField val CONSUMED_IN_PVP_BATTLE = create("held/consumed_in_pvp_battle")
|
||||
@JvmField val CONSUMED_IN_WILD_BATTLE = create("held/consumed_in_wild_battle")
|
||||
@JvmField val DESTINY_KNOT = create("held/destiny_knot")
|
||||
@JvmField val EVERSTONE = create("held/everstone")
|
||||
@JvmField val EXPERIENCE_SHARE = create("held/experience_share")
|
||||
@JvmField val IS_FRIENDSHIP_BOOSTER = create("is_friendship_booster")
|
||||
@JvmField val ANY_HELD_ITEM = create("held/is_held_item")
|
||||
/** Tag that flags items as being able to "create" [CobblemonItems.LEFTOVERS]. */
|
||||
@JvmField val LEAVES_LEFTOVERS = create("held/leaves_leftovers")
|
||||
@JvmField val LUCKY_EGG = create("held/lucky_egg")
|
||||
@JvmField val POWER_ANKLET = create("held/power_anklet")
|
||||
@JvmField val POWER_BAND = create("held/power_band")
|
||||
@JvmField val POWER_BELT = create("held/power_belt")
|
||||
@JvmField val POWER_BRACER = create("held/power_bracer")
|
||||
@JvmField val POWER_LENS = create("held/power_lens")
|
||||
@JvmField val POWER_WEIGHT = create("held/power_weight")
|
||||
@JvmField val TERRAIN_SEEDS = create("held/terrain_seeds")
|
||||
|
||||
/**
|
||||
* Tag that flags items as being able to "create" [CobblemonItems.LEFTOVERS].
|
||||
*/
|
||||
@JvmField
|
||||
val LEAVES_LEFTOVERS = create("held/leaves_leftovers")
|
||||
|
||||
@JvmField
|
||||
val POTTERY_SHERDS = create("decorated_pot_sherds")
|
||||
|
||||
@JvmField
|
||||
val ABILITY_CHANGERS = create("ability_changers")
|
||||
|
||||
@JvmField
|
||||
val IS_FRIENDSHIP_BOOSTER = create("is_friendship_booster")
|
||||
|
||||
private fun create(path: String) = TagKey.create(Registries.ITEM, cobblemonResource(path))
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.battles.dispatch
|
||||
|
||||
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
|
||||
import org.objectweb.asm.tree.analysis.Interpreter
|
||||
|
||||
class InstructionSet {
|
||||
val instructions: MutableList<InterpreterInstruction> = mutableListOf()
|
||||
|
||||
+2
@@ -68,6 +68,8 @@ class WinInstruction(val message: BattleMessage): InterpreterInstruction {
|
||||
}
|
||||
}
|
||||
battle.dispatchGo {
|
||||
battle.winners = winners
|
||||
battle.losers = losers
|
||||
battle.end()
|
||||
CobblemonEvents.BATTLE_VICTORY.post(BattleVictoryEvent(battle, winners, losers, wasCaught))
|
||||
ShowdownInterpreter.lastCauser.remove(battle.battleId)
|
||||
|
||||
+3
-3
@@ -65,8 +65,8 @@ class GraalShowdownUnbundler {
|
||||
}
|
||||
|
||||
if (extract) {
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.zip", showdownZip.toPath())
|
||||
FileUtils.copyInternalToExternal("/data/${Cobblemon.MODID}/showdown.json", showdownMetadataFile.toPath())
|
||||
FileUtils.unzipFile(showdownZip.toPath(), showdownDir.toPath())
|
||||
showdownZip.delete()
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class GraalShowdownUnbundler {
|
||||
|
||||
private fun loadShowdownMetadata() : ShowdownMetadata? {
|
||||
try {
|
||||
val inputStream = javaClass.classLoader.getResourceAsStream("data/${Cobblemon.MODID}/showdown.json")!!
|
||||
val inputStream = javaClass.getResourceAsStream("/data/${Cobblemon.MODID}/showdown.json")!!
|
||||
return gson.fromJson<ShowdownMetadata>(InputStreamReader(inputStream))
|
||||
} catch (exception: Exception) {
|
||||
exception.printStackTrace()
|
||||
|
||||
+5
-2
@@ -308,9 +308,12 @@ class HealingMachineBlockEntity(
|
||||
} else {
|
||||
// Recharging
|
||||
if (blockEntity.healingCharge < blockEntity.maxCharge) {
|
||||
val chargePerTick = (Cobblemon.config.chargeGainedPerTick).coerceAtLeast(0F)
|
||||
val secondsToChargeHealingMachine = (Cobblemon.config.secondsToChargeHealingMachine).coerceAtLeast(0.0)
|
||||
val totalTicks = secondsToChargeHealingMachine * 20
|
||||
val chargePerTick = if (totalTicks > 0) blockEntity.maxCharge / totalTicks else 0.0
|
||||
|
||||
blockEntity.healingCharge =
|
||||
(blockEntity.healingCharge + chargePerTick).coerceIn(0F..blockEntity.maxCharge)
|
||||
(blockEntity.healingCharge + chargePerTick.toFloat()).coerceIn(0F..blockEntity.maxCharge)
|
||||
blockEntity.updateBlockChargeLevel()
|
||||
blockEntity.updateRedstoneSignal()
|
||||
blockEntity.markUpdated()
|
||||
|
||||
@@ -21,12 +21,10 @@ import com.cobblemon.mod.common.client.render.models.blockbench.ExcludedLabels
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.*
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.ModelPartTransformation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.appendage.ModelAppendageModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.wavefunction.WaveFunction
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.wavefunction.sineFunction
|
||||
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
|
||||
import com.cobblemon.mod.common.util.getBooleanOrNull
|
||||
import com.cobblemon.mod.common.util.getDoubleOrNull
|
||||
import com.cobblemon.mod.common.util.getStringOrNull
|
||||
import com.cobblemon.mod.common.util.*
|
||||
import java.util.function.Function
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance
|
||||
@@ -53,7 +51,7 @@ object ClientMoLangFunctions {
|
||||
"say" to java.util.function.Function { params -> Minecraft.getInstance().player?.sendSystemMessage(params.getString(0).text()) ?: Unit },
|
||||
)
|
||||
|
||||
val animationFunctions = hashMapOf<String, Function<PosableModel, Function<MoParams, Any>>>(
|
||||
val posableModelFunctions = hashMapOf<String, Function<PosableModel, Function<MoParams, Any>>>(
|
||||
"exclude_labels" to Function { model -> Function { params ->
|
||||
val labels = params.params.map { it.asString() }
|
||||
ObjectValue(ExcludedLabels(labels))
|
||||
@@ -244,6 +242,18 @@ object ClientMoLangFunctions {
|
||||
)
|
||||
}
|
||||
},
|
||||
"appendage_model" to Function {
|
||||
model -> Function { params ->
|
||||
val name = params.getString(0)
|
||||
ObjectValue((ModelAppendageModelRepository to name.asResource()))
|
||||
}
|
||||
},
|
||||
"vanilla_model" to Function {
|
||||
model -> Function { params ->
|
||||
val id = params.getString(0).asResource()
|
||||
ObjectValue(id)
|
||||
}
|
||||
},
|
||||
"primary_animation" to Function { model ->
|
||||
Function { params ->
|
||||
val animation = params.get<ObjectValue<ActiveAnimation>>(0)?.obj ?: return@Function DoubleValue.ZERO
|
||||
@@ -344,7 +354,7 @@ object ClientMoLangFunctions {
|
||||
}
|
||||
)
|
||||
|
||||
fun PosableModel.animationFunctions(): HashMap<String, Function<MoParams, Any>> = animationFunctions.map { (k, v) -> k to v.apply(this) }.toHashMap()
|
||||
fun PosableModel.animationFunctions(): HashMap<String, Function<MoParams, Any>> = posableModelFunctions.map { (k, v) -> k to v.apply(this) }.toHashMap()
|
||||
|
||||
fun MoLangRuntime.setupClient(): MoLangRuntime {
|
||||
environment.query.addFunctions(clientFunctions)
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.repository.MiscM
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.NPCModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokeBallModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.appendage.ModelAppendageModelRepository
|
||||
import com.cobblemon.mod.common.client.render.npc.NPCRenderer
|
||||
import com.cobblemon.mod.common.client.render.pokeball.PokeBallRenderer
|
||||
import com.cobblemon.mod.common.client.render.pokemon.PokemonRenderer
|
||||
@@ -100,7 +101,8 @@ object CobblemonClient {
|
||||
NPCModelRepository,
|
||||
FossilModelRepository,
|
||||
BlockEntityModelRepository,
|
||||
GenericBedrockEntityModelRepository
|
||||
GenericBedrockEntityModelRepository,
|
||||
ModelAppendageModelRepository
|
||||
)
|
||||
|
||||
val overlay: PartyOverlay by lazy { PartyOverlay() }
|
||||
|
||||
+13
-13
@@ -372,24 +372,24 @@ class PokemonClientDelegate : PosableState(), PokemonSideDelegate {
|
||||
|
||||
override fun tick(entity: PokemonEntity) {
|
||||
incrementAge(entity)
|
||||
if(currentEntity.ownerUUID == null && currentEntity.pokemon.shiny && secondsSinceLastShinyParticle > SHINY_PARTICLE_COOLDOWN && !currentEntity.isBattling) {
|
||||
//wild shiny not looked at
|
||||
playShinyEffect("cobblemon:shiny_sparkle_ambient_wild")
|
||||
lastShinyParticle = System.currentTimeMillis()
|
||||
}
|
||||
getClientShinyPokemon()
|
||||
playWildShinySounds()
|
||||
}
|
||||
|
||||
fun getClientShinyPokemon() {
|
||||
fun playWildShinySounds() {
|
||||
val player = Minecraft.getInstance().player ?: return
|
||||
val isWithinRange = player.position().distanceTo(currentEntity.position()) <= Cobblemon.config.shinyNoticeParticlesDistance
|
||||
|
||||
if (currentEntity.pokemon.shiny && currentEntity.ownerUUID == null && !player.isSpectator ) {
|
||||
if (isWithinRange && !shined) {
|
||||
playShinyEffect("cobblemon:wild_shiny_ring")
|
||||
shined = true
|
||||
lastShinyParticle = System.currentTimeMillis()
|
||||
} else if (!isWithinRange) {
|
||||
if (currentEntity.pokemon.shiny && currentEntity.ownerUUID == null) {
|
||||
if (isWithinRange) {
|
||||
if (secondsSinceLastShinyParticle > SHINY_PARTICLE_COOLDOWN && !currentEntity.isBattling) {
|
||||
playShinyEffect("cobblemon:shiny_sparkle_ambient_wild")
|
||||
lastShinyParticle = System.currentTimeMillis()
|
||||
}
|
||||
if (!shined && !player.isSpectator) {
|
||||
playShinyEffect("cobblemon:wild_shiny_ring")
|
||||
shined = true
|
||||
}
|
||||
} else {
|
||||
shined = false
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -191,6 +191,8 @@ class BattleTargetSelection(
|
||||
matrices.pushPose()
|
||||
matrices.translate(x + TARGET_WIDTH - (25 / 2.0) - 2, y + 5.0, 0.0)
|
||||
matrices.scale(2.5F, 2.5F, 1F)
|
||||
// Grab aspects for right variant
|
||||
state.currentAspects = battlePokemon.state.currentAspects
|
||||
drawProfilePokemon(
|
||||
species = battlePokemon.species.resourceIdentifier,
|
||||
matrixStack = matrices,
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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.gui.config
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.gui.components.EditBox
|
||||
import net.minecraft.client.gui.components.StringWidget
|
||||
import net.minecraft.client.gui.layouts.HeaderAndFooterLayout
|
||||
import net.minecraft.client.gui.layouts.LinearLayout
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.CommonComponents
|
||||
|
||||
class CobblemonConfigScreen(
|
||||
private val previousScreen: Screen?,
|
||||
) : Screen("gui.cobblemon_config.title".asTranslated()), CobblemonRenderable {
|
||||
|
||||
companion object {
|
||||
const val HEIGHT = 240
|
||||
const val HEADER_HEIGHT = 45
|
||||
const val FOOTER_HEIGHT = 33
|
||||
const val PADDING = 4
|
||||
const val SLOT_WIDTH = 340
|
||||
const val SLOT_HEIGHT = 22
|
||||
const val HALF_SLOT_WIDTH = SLOT_WIDTH / 2
|
||||
const val RESET_SLOT_WIDTH = 40
|
||||
const val WIDGET_WIDTH = 110 - RESET_SLOT_WIDTH - PADDING
|
||||
const val WIDGET_HEIGHT = SLOT_HEIGHT - PADDING
|
||||
const val LABEL_Y_OFFSET = 4
|
||||
const val WIDGET_Y_OFFSET = 0
|
||||
}
|
||||
|
||||
val clonedConfig = Cobblemon.config.clone()
|
||||
val defaultConfig = CobblemonConfig()
|
||||
|
||||
private lateinit var layout: HeaderAndFooterLayout
|
||||
private lateinit var searchEdit: EditBox
|
||||
private lateinit var variableList: CobblemonConfigVariableList
|
||||
private lateinit var doneButton: Button
|
||||
|
||||
private var searchString: String = ""
|
||||
|
||||
override fun init() {
|
||||
super.init()
|
||||
|
||||
if (::layout.isInitialized) layout.visitWidgets { removeWidget(it) }
|
||||
layout = HeaderAndFooterLayout(this, HEADER_HEIGHT, FOOTER_HEIGHT)
|
||||
|
||||
if (::variableList.isInitialized) removeWidget(variableList)
|
||||
variableList = CobblemonConfigVariableList(this)
|
||||
variableList.filterConfigurations(searchString)
|
||||
addRenderableWidget(variableList)
|
||||
|
||||
searchEdit = EditBox(
|
||||
Minecraft.getInstance().font,
|
||||
width / 2 - HALF_SLOT_WIDTH / 2,
|
||||
variableList.y,
|
||||
HALF_SLOT_WIDTH,
|
||||
SLOT_HEIGHT,
|
||||
lang("config.ui.search_configurations"),
|
||||
).also {
|
||||
it.height = WIDGET_HEIGHT
|
||||
it.setMaxLength(250)
|
||||
|
||||
it.value = searchString
|
||||
it.setResponder { text ->
|
||||
variableList.filterConfigurations(text)
|
||||
searchString = text
|
||||
}
|
||||
}
|
||||
|
||||
val linearLayout = layout.addToHeader(LinearLayout.vertical())
|
||||
linearLayout.addChild(StringWidget(lang("config.ui.search_configurations"), this.font))
|
||||
linearLayout.addChild(searchEdit)
|
||||
layout.addToHeader(linearLayout)
|
||||
|
||||
doneButton = Button.builder(CommonComponents.GUI_DONE) { doneButtonClick() }
|
||||
.pos(width / 2 - HALF_SLOT_WIDTH / 2, variableList.y + variableList.height + PADDING)
|
||||
.width(HALF_SLOT_WIDTH).build()
|
||||
layout.addToFooter(doneButton)
|
||||
|
||||
layout.visitWidgets { widget ->
|
||||
addRenderableWidget(widget)
|
||||
}
|
||||
arrangeLayoutElements()
|
||||
}
|
||||
|
||||
private fun arrangeLayoutElements() {
|
||||
layout.arrangeElements()
|
||||
variableList.updateSize(this.width, this.layout)
|
||||
}
|
||||
|
||||
private fun doneButtonClick() {
|
||||
Cobblemon.saveConfig(clonedConfig)
|
||||
Cobblemon.reloadConfig()
|
||||
onClose()
|
||||
}
|
||||
|
||||
override fun onClose() {
|
||||
minecraft?.setScreen(previousScreen)
|
||||
}
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* 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.gui.config
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.text.yellow
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.LABEL_Y_OFFSET
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.PADDING
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.SLOT_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.SLOT_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigVariableList.CobblemonConfigVariableListEntry
|
||||
import com.cobblemon.mod.common.client.gui.config.variable.*
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.config.Category
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.config.CobblemonConfigField
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
import net.minecraft.SharedConstants
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList
|
||||
import net.minecraft.client.gui.components.Tooltip
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||
import net.minecraft.client.gui.narration.NarratableEntry
|
||||
import kotlin.math.min
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.full.memberProperties
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
class CobblemonConfigVariableList(
|
||||
val parent: CobblemonConfigScreen,
|
||||
) : ContainerObjectSelectionList<CobblemonConfigVariableListEntry>(
|
||||
Minecraft.getInstance(),
|
||||
Minecraft.getInstance().window.guiScaledWidth,
|
||||
HEIGHT,
|
||||
0,
|
||||
SLOT_HEIGHT
|
||||
) {
|
||||
|
||||
val entries = mutableListOf<CobblemonConfigCategory>()
|
||||
|
||||
init {
|
||||
this.x = 0
|
||||
this.y = minecraft.window.guiScaledHeight / 2 - HEIGHT / 2
|
||||
|
||||
setRenderHeader(false, 0)
|
||||
addEntries()
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun addEntries() {
|
||||
parent.clonedConfig::class.memberProperties.map { property ->
|
||||
if (!property.javaField!!.isAnnotationPresent(CobblemonConfigField::class.java)) {
|
||||
return@map null
|
||||
}
|
||||
|
||||
val entry: CobblemonConfigVariable? =
|
||||
when (val classifier = property.returnType.classifier) {
|
||||
String::class -> CobblemonConfigStringVariable(this, property as KMutableProperty1<out CobblemonConfig, String>)
|
||||
Int::class -> CobblemonConfigIntVariable(this, property as KMutableProperty1<out CobblemonConfig, Int>)
|
||||
Float::class -> CobblemonConfigFloatVariable(this, property as KMutableProperty1<out CobblemonConfig, Float>)
|
||||
Double::class -> CobblemonConfigDoubleVariable(this, property as KMutableProperty1<out CobblemonConfig, Double>)
|
||||
Boolean::class -> CobblemonConfigBooleanVariable(this, property as KMutableProperty1<out CobblemonConfig, Boolean>)
|
||||
is KClass<*> -> if (classifier.java.isEnum) {
|
||||
CobblemonConfigEnumVariable(this, property as KMutableProperty1<out CobblemonConfig, Enum<*>>)
|
||||
} else null
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (entry == null) {
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE) {
|
||||
Cobblemon.LOGGER.warn("Widget for variable type: ${property.returnType.classifier} not registered: ${property.name}")
|
||||
}
|
||||
|
||||
return@map null
|
||||
}
|
||||
|
||||
return@map entry
|
||||
}
|
||||
.filterNotNull()
|
||||
.groupBy { it.cobblemonConfigFieldAnnotation.category }
|
||||
.toSortedMap(compareBy { it.ordinal })
|
||||
.forEach { category, variables ->
|
||||
val categoryEntry = CobblemonConfigCategory(this, category, variables)
|
||||
entries.add(categoryEntry)
|
||||
}
|
||||
|
||||
entries.forEach { entry -> entry.add() }
|
||||
}
|
||||
|
||||
override fun renderWidget(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
|
||||
super.renderWidget(guiGraphics, mouseX, mouseY, partialTick)
|
||||
|
||||
val hoveredVariableTooltip = this.hovered?.tooltip
|
||||
if (isMouseInsideScrollList(mouseX, mouseY) && hoveredVariableTooltip != null) {
|
||||
guiGraphics.renderTooltip(minecraft.font, hoveredVariableTooltip.toCharSequence(minecraft), mouseX, mouseY)
|
||||
}
|
||||
}
|
||||
|
||||
fun isMouseInsideScrollList(mouseX: Int, mouseY: Int): Boolean {
|
||||
val bottomX = parent.width / 2 - SLOT_WIDTH / 2
|
||||
val upperX = parent.width / 2 + SLOT_WIDTH / 2
|
||||
|
||||
return mouseX >= bottomX && mouseX <= upperX && mouseY >= y && mouseY <= bottom
|
||||
}
|
||||
|
||||
override fun getRowWidth(): Int = width
|
||||
override fun getScrollbarPosition(): Int = width / 2 - SLOT_WIDTH / 2 + SLOT_WIDTH + PADDING
|
||||
|
||||
fun filterConfigurations(text: String) {
|
||||
for (entry in entries) {
|
||||
entry.remove()
|
||||
}
|
||||
|
||||
for (entry in entries) {
|
||||
if (text.isBlank() || entry.filter(text)) {
|
||||
entry.add(text)
|
||||
}
|
||||
}
|
||||
|
||||
scrollAmount = min(maxScroll.toDouble(), scrollAmount)
|
||||
}
|
||||
|
||||
abstract class CobblemonConfigVariableListEntry(
|
||||
val parent: CobblemonConfigVariableList,
|
||||
) : Entry<CobblemonConfigVariableListEntry>() {
|
||||
val children = mutableListOf<GuiEventListener>()
|
||||
var tooltip: Tooltip? = null
|
||||
|
||||
fun getX(left: Int) = parent.width / 2 - SLOT_WIDTH / 2
|
||||
fun getY(top: Int) = top
|
||||
|
||||
abstract fun filter(text: String): Boolean
|
||||
|
||||
override fun children(): MutableList<out GuiEventListener> = children
|
||||
override fun narratables(): MutableList<out NarratableEntry> = children.filterIsInstance<NarratableEntry>().toMutableList()
|
||||
}
|
||||
|
||||
class CobblemonConfigCategory(
|
||||
parent: CobblemonConfigVariableList,
|
||||
val category: Category,
|
||||
val configVariables: List<CobblemonConfigVariable>
|
||||
) : CobblemonConfigVariableListEntry(parent) {
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
top: Int,
|
||||
left: Int,
|
||||
width: Int,
|
||||
height: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
hovering: Boolean,
|
||||
partialTick: Float
|
||||
) {
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = "cobblemon.config.ui.category.${category.lang}".asTranslated().yellow(),
|
||||
x = parent.width / 2,
|
||||
y = getY(top) + LABEL_Y_OFFSET,
|
||||
shadow = true,
|
||||
centered = true,
|
||||
)
|
||||
}
|
||||
|
||||
fun add(filter: String? = null) {
|
||||
parent.addEntry(this)
|
||||
configVariables.forEach { variable ->
|
||||
if (filter == null || variable.filter(filter)) {
|
||||
parent.addEntry(variable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun remove() {
|
||||
parent.removeEntry(this)
|
||||
configVariables.forEach { variable -> parent.removeEntry(variable) }
|
||||
}
|
||||
|
||||
override fun filter(text: String): Boolean = configVariables.any { it.filter(text) }
|
||||
}
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.gui.config.variable
|
||||
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.PADDING
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_Y_OFFSET
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigVariableList
|
||||
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.gui.components.Tooltip
|
||||
import net.minecraft.network.chat.CommonComponents
|
||||
import net.minecraft.network.chat.Component
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
abstract class CobblemonConfigButtonVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, *>,
|
||||
) : CobblemonConfigVariable(parent, config) {
|
||||
val button: Button =
|
||||
Button.builder(labelLang) { onButtonClick() }
|
||||
.size(WIDGET_WIDTH, WIDGET_HEIGHT)
|
||||
.build()
|
||||
|
||||
init {
|
||||
children.addFirst(button)
|
||||
}
|
||||
|
||||
abstract fun onButtonClick()
|
||||
|
||||
override fun updateConfigValueDisplay() {
|
||||
button.message = Component.literal(getConfigValueAsString())
|
||||
}
|
||||
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
top: Int,
|
||||
left: Int,
|
||||
width: Int,
|
||||
height: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
hovering: Boolean,
|
||||
partialTick: Float
|
||||
) {
|
||||
super.render(context, index, top, left, width, height, mouseX, mouseY, hovering, partialTick)
|
||||
|
||||
button.x = resetButton.x - button.width - PADDING
|
||||
button.y = getY(top) + WIDGET_Y_OFFSET
|
||||
button.render(context, mouseX, mouseY, partialTick)
|
||||
}
|
||||
}
|
||||
|
||||
class CobblemonConfigBooleanVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, Boolean>,
|
||||
) : CobblemonConfigButtonVariable(parent, config) {
|
||||
|
||||
init {
|
||||
updateConfigValueDisplay()
|
||||
}
|
||||
|
||||
override fun getConfigValueAsString(): String = (if (isSelected()) CommonComponents.GUI_YES else CommonComponents.GUI_NO).string
|
||||
override fun onButtonClick() = setConfigValue(!isSelected())
|
||||
|
||||
private fun isSelected() = (config.getter.call(parent.parent.clonedConfig) as Boolean?) ?: false
|
||||
}
|
||||
|
||||
class CobblemonConfigEnumVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, Enum<*>>,
|
||||
) : CobblemonConfigButtonVariable(parent, config) {
|
||||
|
||||
private var enumIndex = 0
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private val enumValues: Array<Enum<*>> = config.returnType.classifier
|
||||
.let { it as? KClass<Enum<*>> }
|
||||
?.java?.enumConstants ?: emptyArray()
|
||||
|
||||
init {
|
||||
val currentEnumValue = getCurrentEnumValue()
|
||||
enumValues.firstOrNull { it.name == currentEnumValue?.name }?.let {
|
||||
enumIndex = it.ordinal
|
||||
}
|
||||
updateConfigValueDisplay()
|
||||
}
|
||||
|
||||
override fun getConfigValueAsString(): String {
|
||||
return getCurrentEnumValue()?.name?.let {
|
||||
lang("$labelEntry.${it.lowercase()}").string
|
||||
} ?: ""
|
||||
}
|
||||
|
||||
private fun getConfigValueTooltipString(): String {
|
||||
return getCurrentEnumValue()?.name?.let {
|
||||
lang("$labelEntry.${it.lowercase()}.tooltip").string
|
||||
} ?: ""
|
||||
}
|
||||
|
||||
override fun onButtonClick() {
|
||||
enumIndex = (enumIndex + 1) % enumValues.size
|
||||
val newEnumValue = enumValues[enumIndex]
|
||||
|
||||
setConfigValue(newEnumValue)
|
||||
}
|
||||
|
||||
override fun updateConfigValueDisplay() {
|
||||
super.updateConfigValueDisplay()
|
||||
tooltip = Tooltip.create(Component.literal(getConfigValueTooltipString()))
|
||||
}
|
||||
|
||||
private fun getCurrentEnumValue(): Enum<*>? = (config.getter.call(parent.parent.clonedConfig) as Enum<*>?)
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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.gui.config.variable
|
||||
|
||||
import com.cobblemon.mod.common.api.text.add
|
||||
import com.cobblemon.mod.common.api.text.red
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.PADDING
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.SLOT_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_Y_OFFSET
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigVariableList
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.config.constraint.IntConstraint
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.ChatFormatting
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.EditBox
|
||||
import net.minecraft.client.gui.components.EditBox.DEFAULT_TEXT_COLOR
|
||||
import net.minecraft.client.gui.components.Tooltip
|
||||
import net.minecraft.network.chat.Component
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
abstract class CobblemonConfigEditBoxVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, *>,
|
||||
) : CobblemonConfigVariable(parent, config) {
|
||||
val editBox = EditBox(
|
||||
Minecraft.getInstance().font,
|
||||
parent.x,
|
||||
parent.y,
|
||||
WIDGET_WIDTH,
|
||||
SLOT_HEIGHT,
|
||||
labelLang,
|
||||
).also {
|
||||
it.height = WIDGET_HEIGHT
|
||||
it.setMaxLength(250)
|
||||
|
||||
it.value = getConfigValueAsString()
|
||||
}
|
||||
|
||||
init {
|
||||
children.addFirst(editBox)
|
||||
}
|
||||
|
||||
override fun updateConfigValueDisplay() {
|
||||
editBox.value = getConfigValueAsString()
|
||||
}
|
||||
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
top: Int,
|
||||
left: Int,
|
||||
width: Int,
|
||||
height: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
hovering: Boolean,
|
||||
partialTick: Float
|
||||
) {
|
||||
super.render(context, index, top, left, width, height, mouseX, mouseY, hovering, partialTick)
|
||||
|
||||
editBox.x = resetButton.x - editBox.width - PADDING
|
||||
editBox.y = getY(top) + WIDGET_Y_OFFSET
|
||||
editBox.render(context, mouseX, mouseY, partialTick)
|
||||
}
|
||||
}
|
||||
|
||||
class CobblemonConfigStringVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, String>,
|
||||
) : CobblemonConfigEditBoxVariable(parent, config) {
|
||||
override fun getConfigValueAsString(): String = (config.getter.call(parent.parent.clonedConfig) as String?) ?: ""
|
||||
|
||||
init {
|
||||
editBox.setResponder { value ->
|
||||
setConfigValue(value, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CobblemonConfigIntVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, Int>,
|
||||
) : CobblemonConfigEditBoxVariable(parent, config) {
|
||||
private val intConstraintAnnotation: IntConstraint? =
|
||||
config.javaField!!.annotations.firstOrNull{ it is IntConstraint } as IntConstraint?
|
||||
|
||||
override fun getConfigValueAsString(): String = (config.getter.call(parent.parent.clonedConfig) as Int?).toString()
|
||||
|
||||
init {
|
||||
editBox.setFilter { value -> value.toIntOrNull() != null || value.isBlank() }
|
||||
editBox.setResponder { value ->
|
||||
if (value.isBlank()) {
|
||||
return@setResponder
|
||||
}
|
||||
|
||||
val intValue = value.toInt()
|
||||
setConfigValue(intValue, false)
|
||||
|
||||
if (intConstraintAnnotation != null) {
|
||||
val isBetweenIntConstraint = intValue >= intConstraintAnnotation.min && intValue <= intConstraintAnnotation.max
|
||||
if (isBetweenIntConstraint) {
|
||||
tooltip = originalTooltip
|
||||
editBox.setTextColor(DEFAULT_TEXT_COLOR)
|
||||
} else {
|
||||
val errorLang = lang("config.ui.error.int_constraint", intConstraintAnnotation.min, intConstraintAnnotation.max).red()
|
||||
tooltip = Tooltip.create(tooltipLang.plainCopy().add(Component.literal("\n")).add(errorLang))
|
||||
ChatFormatting.RED.color?.let { editBox.setTextColor(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CobblemonConfigFloatVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, Float>,
|
||||
) : CobblemonConfigEditBoxVariable(parent, config) {
|
||||
override fun getConfigValueAsString(): String = (config.getter.call(parent.parent.clonedConfig) as Float?).toString()
|
||||
|
||||
init {
|
||||
editBox.setFilter { value -> value.toFloatOrNull() != null || value.isBlank() }
|
||||
editBox.setResponder { value ->
|
||||
if (value.toFloatOrNull() != null) {
|
||||
setConfigValue(value.toFloat(), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CobblemonConfigDoubleVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
config: KMutableProperty1<out CobblemonConfig, Double>,
|
||||
) : CobblemonConfigEditBoxVariable(parent, config) {
|
||||
override fun getConfigValueAsString(): String = (config.getter.call(parent.parent.clonedConfig) as Double?).toString()
|
||||
|
||||
init {
|
||||
editBox.setFilter { value -> value.toDoubleOrNull() != null || value.isBlank() }
|
||||
editBox.setResponder { value ->
|
||||
if (value.toDoubleOrNull() != null) {
|
||||
setConfigValue(value.toDouble(), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.config.variable
|
||||
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.LABEL_Y_OFFSET
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.RESET_SLOT_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.SLOT_WIDTH
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_HEIGHT
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen.Companion.WIDGET_Y_OFFSET
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigVariableList
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigVariableList.CobblemonConfigVariableListEntry
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.config.CobblemonConfig
|
||||
import com.cobblemon.mod.common.config.CobblemonConfigField
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.gui.components.Tooltip
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import java.text.Normalizer
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.jvm.javaField
|
||||
|
||||
abstract class CobblemonConfigVariable(
|
||||
parent: CobblemonConfigVariableList,
|
||||
val config: KMutableProperty1<out CobblemonConfig, *>,
|
||||
) : CobblemonConfigVariableListEntry(parent) {
|
||||
val cobblemonConfigFieldAnnotation: CobblemonConfigField =
|
||||
config.javaField!!.annotations.firstOrNull{ it is CobblemonConfigField } as CobblemonConfigField
|
||||
|
||||
val labelEntry = "config.ui.${cobblemonConfigFieldAnnotation.lang}"
|
||||
val tooltipEntry = "$labelEntry.tooltip"
|
||||
val labelLang: MutableComponent = lang(labelEntry)
|
||||
val tooltipLang: MutableComponent = lang(tooltipEntry)
|
||||
val originalTooltip: Tooltip? = if (!tooltipLang.string.endsWith(tooltipEntry)) Tooltip.create(tooltipLang) else null
|
||||
|
||||
val resetButton: Button =
|
||||
Button.builder(lang("config.ui.reset")) {
|
||||
val defaultValue = config.getter.call(parent.parent.defaultConfig)
|
||||
setConfigValue(defaultValue)
|
||||
}
|
||||
.size(RESET_SLOT_WIDTH, WIDGET_HEIGHT)
|
||||
.build()
|
||||
|
||||
init {
|
||||
tooltip = originalTooltip
|
||||
children.add(resetButton)
|
||||
updateResetButton()
|
||||
}
|
||||
|
||||
abstract fun getConfigValueAsString(): String
|
||||
abstract fun updateConfigValueDisplay()
|
||||
|
||||
fun setConfigValue(value: Any?, updateConfigValueDisplay: Boolean = true) {
|
||||
config.setter.call(parent.parent.clonedConfig, value)
|
||||
|
||||
if (updateConfigValueDisplay) {
|
||||
updateConfigValueDisplay()
|
||||
}
|
||||
|
||||
updateResetButton()
|
||||
}
|
||||
|
||||
private fun updateResetButton() {
|
||||
resetButton.active = config.getter.call(parent.parent.clonedConfig) != config.getter.call(parent.parent.defaultConfig)
|
||||
}
|
||||
|
||||
override fun filter(text: String): Boolean {
|
||||
val normalizedLabel = Normalizer.normalize(labelLang.string, Normalizer.Form.NFD).replace("\\p{M}+".toRegex(), "")
|
||||
return normalizedLabel.contains(text, ignoreCase = true)
|
||||
}
|
||||
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
top: Int,
|
||||
left: Int,
|
||||
width: Int,
|
||||
height: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
hovering: Boolean,
|
||||
partialTick: Float
|
||||
) {
|
||||
val x = getX(left)
|
||||
val y = getY(top)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = labelLang,
|
||||
x = getX(left),
|
||||
y = getY(top) + LABEL_Y_OFFSET,
|
||||
shadow = true
|
||||
)
|
||||
|
||||
resetButton.x = x + SLOT_WIDTH - RESET_SLOT_WIDTH
|
||||
resetButton.y = y + WIDGET_Y_OFFSET
|
||||
resetButton.render(context, mouseX, mouseY, partialTick)
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,10 @@ class GrabbedStorageSlot(
|
||||
private val pokemon: Pokemon
|
||||
) : StorageSlot(x, y, parent, {}) {
|
||||
|
||||
init {
|
||||
isSlotSelected = true
|
||||
}
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
|
||||
renderSlot(context = context, posX = mouseX - (width / 2), posY = mouseY - (height / 2), partialTicks = delta)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ import net.minecraft.sounds.SoundEvent
|
||||
class PCGUI(
|
||||
val pc: ClientPC,
|
||||
val party: ClientParty,
|
||||
val configuration: PCGUIConfiguration
|
||||
val configuration: PCGUIConfiguration,
|
||||
val openOnBox: Int = 0
|
||||
) : Screen(Component.translatable("cobblemon.ui.pc.title")), CobblemonRenderable {
|
||||
|
||||
companion object {
|
||||
@@ -110,6 +111,7 @@ class PCGUI(
|
||||
pc = pc,
|
||||
party = party
|
||||
)
|
||||
this.storageWidget.box = openOnBox
|
||||
|
||||
this.setPreviewPokemon(null)
|
||||
this.addRenderableWidget(storageWidget)
|
||||
|
||||
@@ -46,6 +46,8 @@ open class StorageSlot(
|
||||
private val slotOverlayMoveIconResource = cobblemonResource("textures/gui/pasture/pc_slot_icon_move.png")
|
||||
}
|
||||
|
||||
protected var isSlotSelected = false;
|
||||
|
||||
override fun playDownSound(soundManager: SoundManager) {
|
||||
}
|
||||
|
||||
@@ -82,50 +84,52 @@ open class StorageSlot(
|
||||
|
||||
context.disableScissor()
|
||||
|
||||
// Ensure elements are not hidden behind Pokémon render
|
||||
matrices.pushPose()
|
||||
matrices.translate(0.0, 0.0, 100.0)
|
||||
// Level
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = lang("ui.lv.number", pokemon.level),
|
||||
x = posX + 1,
|
||||
y = posY + 1,
|
||||
shadow = true,
|
||||
scale = PCGUI.SCALE
|
||||
)
|
||||
|
||||
if (pokemon.gender != Gender.GENDERLESS) {
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
texture = if (pokemon.gender == Gender.MALE) genderIconMale else genderIconFemale,
|
||||
x = (posX + 21) / PCGUI.SCALE,
|
||||
y = (posY + 1) / PCGUI.SCALE,
|
||||
width = 6,
|
||||
height = 8,
|
||||
if (!isSlotSelected) {
|
||||
// Ensure elements are not hidden behind Pokémon render
|
||||
matrices.pushPose()
|
||||
matrices.translate(0.0, 0.0, 100.0)
|
||||
// Level
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = lang("ui.lv.number", pokemon.level),
|
||||
x = posX + 1,
|
||||
y = posY + 1,
|
||||
shadow = true,
|
||||
scale = PCGUI.SCALE
|
||||
)
|
||||
}
|
||||
|
||||
// Held Item
|
||||
val heldItem = pokemon.heldItemNoCopy()
|
||||
if (!heldItem.isEmpty) {
|
||||
renderScaledGuiItemIcon(
|
||||
itemStack = heldItem,
|
||||
x = posX + 16.0,
|
||||
y = posY + 16.0,
|
||||
scale = 0.5,
|
||||
matrixStack = matrices
|
||||
)
|
||||
if (pokemon.gender != Gender.GENDERLESS) {
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
texture = if (pokemon.gender == Gender.MALE) genderIconMale else genderIconFemale,
|
||||
x = (posX + 21) / PCGUI.SCALE,
|
||||
y = (posY + 1) / PCGUI.SCALE,
|
||||
width = 6,
|
||||
height = 8,
|
||||
scale = PCGUI.SCALE
|
||||
)
|
||||
}
|
||||
|
||||
// Held Item
|
||||
val heldItem = pokemon.heldItemNoCopy()
|
||||
if (!heldItem.isEmpty) {
|
||||
renderScaledGuiItemIcon(
|
||||
itemStack = heldItem,
|
||||
x = posX + 16.0,
|
||||
y = posY + 16.0,
|
||||
scale = 0.5,
|
||||
matrixStack = matrices
|
||||
)
|
||||
}
|
||||
matrices.popPose()
|
||||
}
|
||||
matrices.popPose()
|
||||
|
||||
// Ensure overlay elements are on top
|
||||
matrices.pushPose()
|
||||
matrices.translate(0.0, 0.0, 500.0)
|
||||
|
||||
val config = parent.pcGui.configuration
|
||||
if (pokemon.tetheringId != null) {
|
||||
if (pokemon.tetheringId != null && !isSlotSelected) {
|
||||
if (isStationary()) {
|
||||
blitk(
|
||||
matrixStack = matrices,
|
||||
|
||||
@@ -286,7 +286,10 @@ class StorageWidget(
|
||||
}
|
||||
|
||||
pastureWidget?.render(context, mouseX, mouseY, delta)
|
||||
matrices.pushPose()
|
||||
matrices.translate(0.0, 0.0, 1000.0)
|
||||
grabbedSlot?.render(context, mouseX, mouseY, delta)
|
||||
matrices.popPose()
|
||||
}
|
||||
|
||||
override fun mouseClicked(pMouseX: Double, pMouseY: Double, pButton: Int): Boolean {
|
||||
|
||||
@@ -163,8 +163,8 @@ class Summary private constructor(party: Collection<Pokemon?>, private val edita
|
||||
},
|
||||
text = lang("ui.evolve"),
|
||||
resource = evolveButtonResource,
|
||||
renderRequirement = { selectedPokemon.evolutionProxy.client().isNotEmpty() },
|
||||
clickRequirement = { selectedPokemon.evolutionProxy.client().isNotEmpty() }
|
||||
renderRequirement = { selectedPokemon.evolutionProxy.client().isNotEmpty() && CobblemonClient.battle == null },
|
||||
clickRequirement = { selectedPokemon.evolutionProxy.client().isNotEmpty() && CobblemonClient.battle == null }
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
package com.cobblemon.mod.common.client.gui.toast
|
||||
|
||||
import com.cobblemon.mod.common.net.messages.client.toast.ToastPacket
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.toasts.Toast
|
||||
import net.minecraft.client.gui.components.toasts.ToastComponent
|
||||
@@ -19,6 +21,7 @@ import net.minecraft.util.Mth
|
||||
import java.util.*
|
||||
import kotlin.math.min
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
class CobblemonToast(
|
||||
val id: UUID,
|
||||
var icon: ItemStack,
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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.net.settings
|
||||
|
||||
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.client.gui.config.CobblemonConfigScreen
|
||||
import com.cobblemon.mod.common.net.messages.client.settings.OpenCobblemonConfigScreenPacket
|
||||
import net.minecraft.client.Minecraft
|
||||
|
||||
object OpenCobblemonConfigEditorHandler : ClientNetworkPacketHandler<OpenCobblemonConfigScreenPacket> {
|
||||
override fun handle(packet: OpenCobblemonConfigScreenPacket, client: Minecraft) {
|
||||
client.setScreen(CobblemonConfigScreen(Minecraft.getInstance().screen))
|
||||
}
|
||||
}
|
||||
+2
@@ -19,6 +19,8 @@ object ServerSettingsPacketHandler : ClientNetworkPacketHandler<ServerSettingsPa
|
||||
ServerSettings.displayEntityLevelLabel = packet.displayEntityLevelLabel
|
||||
ServerSettings.displayEntityNameLabel = packet.displayEntityNameLabel
|
||||
ServerSettings.maxPokemonLevel = packet.maxPokemonLevel
|
||||
ServerSettings.maxPokemonFriendship = packet.maxPokemonFriendship
|
||||
ServerSettings.maxDynamaxLevel = packet.maxDynamaxLevel
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -18,6 +18,6 @@ import net.minecraft.client.Minecraft
|
||||
object OpenPCHandler : ClientNetworkPacketHandler<OpenPCPacket> {
|
||||
override fun handle(packet: OpenPCPacket, client: Minecraft) {
|
||||
val pc = CobblemonClient.storage.pcStores[packet.storeID] ?: return
|
||||
Minecraft.getInstance().setScreen(PCGUI(pc, CobblemonClient.storage.myParty, PCGUIConfiguration()))
|
||||
Minecraft.getInstance().setScreen(PCGUI(pc, CobblemonClient.storage.myParty, PCGUIConfiguration(), packet.box))
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -116,7 +116,7 @@ class PokedexScannerRenderer {
|
||||
drawScaledText(
|
||||
context = graphics,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("ui.lv.number", pokedexEntityData.level).bold(),
|
||||
text = lang("ui.lv.number", pokedexEntityData.pokemon.level).bold(),
|
||||
x = centerX + xOffset + xOffsetText,
|
||||
y = centerY + yOffset + yOffsetText,
|
||||
shadow = true,
|
||||
@@ -126,7 +126,7 @@ class PokedexScannerRenderer {
|
||||
|
||||
if (infoDisplayedCounter == 2) {
|
||||
val hasTrainer = (usageContext.scannableEntityInFocus?.resolveEntityScan() as? PokemonEntity)?.ownerUUID !== null
|
||||
val speciesName = pokedexEntityData.species.translatedName.bold()
|
||||
val speciesName = pokedexEntityData.getApparentSpecies().translatedName.bold()
|
||||
var yOffsetName = if (hasTrainer) 2 else 0
|
||||
if (hasTrainer) {
|
||||
drawScaledText(
|
||||
@@ -149,7 +149,7 @@ class PokedexScannerRenderer {
|
||||
centered = true
|
||||
)
|
||||
|
||||
val gender = pokedexEntityData.gender
|
||||
val gender = pokedexEntityData.pokemon.gender
|
||||
val speciesNameWidth = Minecraft.getInstance().font.width(speciesName.font(CobblemonResources.DEFAULT_LARGE))
|
||||
if (gender != Gender.GENDERLESS) {
|
||||
val isMale = gender == Gender.MALE
|
||||
@@ -179,14 +179,15 @@ class PokedexScannerRenderer {
|
||||
}
|
||||
|
||||
if (infoDisplayedCounter == 3) {
|
||||
val typeText = lang("type.suffix", pokedexEntityData.form.types.map { it.displayName.copy() }.reduce { acc, next -> acc.plus("/").plus(next) }).bold()
|
||||
val typeText = lang("type.suffix", pokedexEntityData.getApparentForm().types.map { it.displayName.copy() }.reduce { acc, next -> acc.plus("/").plus(next) }).bold()
|
||||
val typeWidth = Minecraft.getInstance().font.width(typeText.font(CobblemonResources.DEFAULT_LARGE))
|
||||
// Split into 2 lines if text width is too long
|
||||
if (typeWidth > (OUTER_INFO_FRAME_WIDTH - 8) && pokedexEntityData.form.secondaryType !== null) {
|
||||
if (typeWidth > (OUTER_INFO_FRAME_WIDTH - 8) && pokedexEntityData.getApparentForm().secondaryType !== null) {
|
||||
val splitLines = typeText.string.split("/")
|
||||
drawScaledText(
|
||||
context = graphics,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("type.suffix", pokedexEntityData.form.primaryType.displayName).bold(),
|
||||
text = text(splitLines[0], "/").bold(),
|
||||
x = centerX + xOffset + xOffsetText,
|
||||
y = centerY + yOffset + yOffsetText - 4,
|
||||
shadow = true,
|
||||
@@ -196,7 +197,7 @@ class PokedexScannerRenderer {
|
||||
drawScaledText(
|
||||
context = graphics,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = lang("type.suffix", pokedexEntityData.form.secondaryType!!.displayName).bold(),
|
||||
text = text(splitLines[1]).bold(),
|
||||
x = centerX + xOffset + xOffsetText,
|
||||
y = centerY + yOffset + yOffsetText + 3,
|
||||
shadow = true,
|
||||
|
||||
@@ -10,6 +10,8 @@ package com.cobblemon.mod.common.client.render
|
||||
|
||||
import com.cobblemon.mod.common.util.math.geometry.getOrigin
|
||||
import com.cobblemon.mod.common.util.math.geometry.transformPosition
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import net.fabricmc.loader.impl.lib.sat4j.core.Vec
|
||||
import org.joml.Matrix4f
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ import com.cobblemon.mod.common.api.mulch.MulchVariant
|
||||
import com.cobblemon.mod.common.block.BerryBlock
|
||||
import com.cobblemon.mod.common.block.entity.BerryBlockEntity
|
||||
import com.cobblemon.mod.common.client.CobblemonBakingOverrides
|
||||
import com.cobblemon.mod.common.client.render.layer.CobblemonRenderLayers
|
||||
import com.cobblemon.mod.common.client.render.layer.CobblemonRenderTypes
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.BerryModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.setPosition
|
||||
import com.cobblemon.mod.common.util.math.geometry.Axis
|
||||
@@ -54,7 +54,7 @@ class BerryBlockRenderer(private val context: BlockEntityRendererProvider.Contex
|
||||
if (entity.renderState == null) {
|
||||
entity.renderState = BerryBlockEntityRenderState()
|
||||
}
|
||||
val bf = vertexConsumers.getBuffer(CobblemonRenderLayers.BERRY_LAYER)
|
||||
val bf = vertexConsumers.getBuffer(CobblemonRenderTypes.BERRY_LAYER)
|
||||
val renderState = entity.renderState as BerryBlockEntityRenderState
|
||||
// if (renderState.needsRebuild || renderState.vboLightLevel != light) {
|
||||
renderToBuffer(entity, matrices, light, overlay, renderState, bf)
|
||||
|
||||
+3
@@ -14,6 +14,8 @@ import com.cobblemon.mod.common.entity.fishing.PokeRodFishingBobberEntity
|
||||
import com.cobblemon.mod.common.item.interactive.PokerodItem
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import java.awt.Color
|
||||
import net.fabricmc.api.EnvType
|
||||
import net.fabricmc.api.Environment
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
@@ -31,6 +33,7 @@ import net.minecraft.world.entity.HumanoidArm
|
||||
import net.minecraft.world.item.ItemDisplayContext
|
||||
import org.joml.Quaternionf
|
||||
|
||||
@Environment(value = EnvType.CLIENT)
|
||||
class PokeBobberEntityRenderer(context: EntityRendererProvider.Context?) : EntityRenderer<PokeRodFishingBobberEntity>(context) {
|
||||
|
||||
override fun render(fishingBobberEntity: PokeRodFishingBobberEntity, elapsedPartialTicks: Float, tickDelta: Float, matrixStack: PoseStack, vertexConsumerProvider: MultiBufferSource, light: Int) {
|
||||
|
||||
+12
-6
@@ -15,12 +15,12 @@ import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.item.PokemonItem
|
||||
import com.cobblemon.mod.common.util.math.fromEulerXYZDegrees
|
||||
import com.mojang.blaze3d.platform.Lighting
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import net.minecraft.client.renderer.LightTexture
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.world.item.ItemDisplayContext
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import org.joml.Quaternionf
|
||||
@@ -50,7 +50,10 @@ class PokemonItemRenderer : CobblemonBuiltinItemRenderer {
|
||||
|
||||
val transformations = positions[mode]!!
|
||||
|
||||
Lighting.setupForFlatItems()
|
||||
if (mode == ItemDisplayContext.GUI) {
|
||||
Lighting.setupForFlatItems()
|
||||
}
|
||||
|
||||
matrices.scale(transformations.scale.x, transformations.scale.y, transformations.scale.z)
|
||||
matrices.translate(transformations.translation.x, transformations.translation.y, transformations.translation.z)
|
||||
state.setPoseToFirstSuitable(PoseType.PORTRAIT)
|
||||
@@ -84,7 +87,10 @@ class PokemonItemRenderer : CobblemonBuiltinItemRenderer {
|
||||
model.setDefault()
|
||||
matrices.popPose()
|
||||
matrices.popPose()
|
||||
Lighting.setupFor3DItems()
|
||||
|
||||
if (mode == ItemDisplayContext.GUI) {
|
||||
Lighting.setupFor3DItems()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ import net.minecraft.Util
|
||||
import net.minecraft.client.renderer.RenderStateShard
|
||||
import net.minecraft.client.renderer.RenderStateShard.*
|
||||
|
||||
object CobblemonRenderLayers {
|
||||
object CobblemonRenderTypes {
|
||||
val BERRY_LAYER = run {
|
||||
val multiPhaseParameters = RenderType.CompositeState.builder()
|
||||
.setLightmapState(LIGHTMAP)
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
package com.cobblemon.mod.common.client.render.layer
|
||||
|
||||
import com.cobblemon.mod.common.client.entity.PokemonClientDelegate
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.PosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.PokemonModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.RenderContext
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.VaryingModelRepository
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.repository.appendage.ModelAppendageModelRepository
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import com.mojang.math.Axis
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.MultiBufferSource
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.ItemDisplayContext
|
||||
import org.joml.Vector3f
|
||||
|
||||
object ModelAppendageRenderer {
|
||||
|
||||
fun <T> render(
|
||||
poseStack: PoseStack,
|
||||
bufferSource: MultiBufferSource,
|
||||
packedLight: Int,
|
||||
livingEntity: T,
|
||||
limbSwing: Float,
|
||||
limbSwingAmount: Float,
|
||||
ageInTicks: Float,
|
||||
netHeadYaw: Float,
|
||||
headPitch: Float,
|
||||
locator: String,
|
||||
context: RenderContext,
|
||||
parentModel: ResourceLocation
|
||||
) where T : PokemonEntity {
|
||||
val clientDelegate = livingEntity.delegate as PokemonClientDelegate
|
||||
val appendages = ModelAppendageModelRepository.getAppendagesForModelAndTarget(parentModel, locator) ?: return
|
||||
// avoid editing the original context
|
||||
val clonedContext = context.clone()
|
||||
appendages.forEach { appendage ->
|
||||
val modelObj = appendage.model.resolveObject(clientDelegate.runtime).obj
|
||||
if (modelObj is ResourceLocation) {
|
||||
poseStack.pushPose()
|
||||
clientDelegate.locatorStates[locator]?.let { bone ->
|
||||
val stack = if(modelObj.toString() == "cobblemon:held_item") livingEntity.pokemon.heldItemNoCopy() else BuiltInRegistries.ITEM.get(modelObj).defaultInstance
|
||||
val pos = bone.getOrigin().subtract(livingEntity.position())
|
||||
val scale = Vector3f()
|
||||
bone.matrix.getScale(scale)
|
||||
poseStack.scale(scale.x(), scale.y(), scale.z())
|
||||
poseStack.translate(pos.x, pos.y, pos.z)
|
||||
poseStack.mulPose(bone.clone().matrix.setTranslation(0.0f, 0.0f, 0.0f))
|
||||
poseStack.scale(
|
||||
appendage.scale.x().toFloat(), appendage.scale.y().toFloat(),
|
||||
appendage.scale.z().toFloat()
|
||||
)
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(appendage.rotation.x().toFloat()))
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(appendage.rotation.y().toFloat()))
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(appendage.rotation.z().toFloat()))
|
||||
poseStack.translate(appendage.offset.x(), appendage.offset.y(), appendage.offset.z())
|
||||
Minecraft.getInstance().itemRenderer.renderStatic(stack, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, packedLight, OverlayTexture.NO_OVERLAY, poseStack, bufferSource, livingEntity.level(), 0)
|
||||
}
|
||||
poseStack.popPose()
|
||||
} else if (modelObj is Pair<*, *>) {
|
||||
val repo = modelObj.first as ModelAppendageModelRepository
|
||||
val resLoc = modelObj.second as ResourceLocation
|
||||
val model =
|
||||
repo.getPoserNullable(resLoc, clientDelegate) ?: return
|
||||
model.context = clonedContext
|
||||
model.setLayerContext(
|
||||
bufferSource,
|
||||
clientDelegate,
|
||||
ModelAppendageModelRepository.getLayers(resLoc, clientDelegate)
|
||||
)
|
||||
poseStack.pushPose()
|
||||
clientDelegate.locatorStates[locator]?.let { bone ->
|
||||
val pos = bone.getOrigin().subtract(livingEntity.position())
|
||||
val scale = Vector3f()
|
||||
bone.matrix.getScale(scale)
|
||||
poseStack.scale(scale.x(), scale.y(), scale.z())
|
||||
poseStack.translate(pos.x, pos.y, pos.z)
|
||||
poseStack.mulPose(bone.clone().matrix.setTranslation(0.0f, 0.0f, 0.0f))
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(180f))
|
||||
poseStack.translate(0.0, -1.75, 0.0)
|
||||
poseStack.scale(
|
||||
appendage.scale.x().toFloat(), appendage.scale.y().toFloat(),
|
||||
appendage.scale.z().toFloat()
|
||||
)
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(appendage.rotation.x().toFloat()))
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(appendage.rotation.y().toFloat()))
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(appendage.rotation.z().toFloat()))
|
||||
poseStack.translate(appendage.offset.x(), appendage.offset.y(), appendage.offset.z())
|
||||
model.applyAnimations(
|
||||
livingEntity,
|
||||
clientDelegate,
|
||||
limbSwing,
|
||||
limbSwingAmount,
|
||||
ageInTicks,
|
||||
netHeadYaw,
|
||||
headPitch
|
||||
)
|
||||
val buffer = bufferSource.getBuffer(
|
||||
RenderType.entityCutout(
|
||||
ModelAppendageModelRepository.getTexture(
|
||||
resLoc,
|
||||
clientDelegate
|
||||
)
|
||||
)
|
||||
)
|
||||
model.withLayerContext(
|
||||
bufferSource,
|
||||
clientDelegate,
|
||||
ModelAppendageModelRepository.getLayers(resLoc, clientDelegate)
|
||||
) {
|
||||
model.render(clonedContext, poseStack, buffer, packedLight, OverlayTexture.NO_OVERLAY, -0x1)
|
||||
}
|
||||
|
||||
}
|
||||
model.green = 1F
|
||||
model.blue = 1F
|
||||
model.red = 1F
|
||||
|
||||
model.resetLayerContext()
|
||||
poseStack.popPose()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.cobblemon.mod.common.client.render.layer.appendage
|
||||
|
||||
import com.cobblemon.mod.common.api.molang.ExpressionLike
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
data class ModelAppendage(
|
||||
@SerializedName("target_model") val targetModel: ResourceLocation?,
|
||||
@SerializedName("model") val model: ExpressionLike,
|
||||
@SerializedName("target_locator") val targetLocator: String,
|
||||
@SerializedName("scale") val scale: Vec3 = Vec3(1.0, 1.0, 1.0),
|
||||
@SerializedName("rotation") val rotation: Vec3 = Vec3(0.0, 0.0, 0.0),
|
||||
@SerializedName("offset") val offset: Vec3 = Vec3(0.0, 0.0, 0.0)
|
||||
)
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Cobblemon Contributors
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
|
||||
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.SingleBoneLookAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.BipedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.STATIONARY_POSES
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.UI_POSES
|
||||
import com.cobblemon.mod.common.util.isBattling
|
||||
import net.minecraft.client.model.geom.ModelPart
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
class ExeggutorAlolanModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, BipedFrame {
|
||||
override val rootPart = root.registerChildWithAllChildren("exeggutor")
|
||||
override val head = getPart("head")
|
||||
|
||||
override val leftLeg = getPart("leg_left")
|
||||
override val rightLeg = getPart("leg_right")
|
||||
|
||||
val head2 = object : HeadedFrame {
|
||||
override val rootPart = this@ExeggutorAlolanModel.rootPart
|
||||
override val head: ModelPart = getPart("head2")
|
||||
}
|
||||
val head3 = object : HeadedFrame {
|
||||
override val rootPart = this@ExeggutorAlolanModel.rootPart
|
||||
override val head: ModelPart = getPart("head3")
|
||||
}
|
||||
|
||||
override var portraitScale = 1.0F
|
||||
override var portraitTranslation = Vec3(-1.4, 16.55, 0.0)
|
||||
|
||||
override var profileScale = 0.45F
|
||||
override var profileTranslation = Vec3(0.0, 1.0, -30.0)
|
||||
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
lateinit var sleep: Pose
|
||||
lateinit var battleidle: Pose
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink1 = quirk { bedrockStateful("exeggutor_alolan", "blink") }
|
||||
val blink2 = quirk { bedrockStateful("exeggutor_alolan", "blink2") }
|
||||
val blink3 = quirk { bedrockStateful("exeggutor_alolan", "blink3") }
|
||||
val blink4 = quirk { bedrockStateful("exeggutor_alolan", "blink4") }
|
||||
sleep = registerPose(
|
||||
poseType = PoseType.SLEEP,
|
||||
animations = arrayOf(bedrock("exeggutor_alolan", "sleep"))
|
||||
)
|
||||
|
||||
standing = registerPose(
|
||||
poseName = "standing",
|
||||
poseTypes = STATIONARY_POSES + UI_POSES,
|
||||
quirks = arrayOf(blink1, blink2, blink3, blink4),
|
||||
condition = { !it.isBattling },
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
SingleBoneLookAnimation(head2, false, false, disableX = false, disableY = false),
|
||||
SingleBoneLookAnimation(head3, false, false, disableX = false, disableY = false),
|
||||
bedrock("exeggutor_alolan", "ground_idle")
|
||||
)
|
||||
)
|
||||
|
||||
walk = registerPose(
|
||||
poseName = "walk",
|
||||
poseTypes = MOVING_POSES,
|
||||
quirks = arrayOf(blink1, blink2, blink3, blink4),
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
SingleBoneLookAnimation(head2, false, false, disableX = false, disableY = false),
|
||||
SingleBoneLookAnimation(head3, false, false, disableX = false, disableY = false),
|
||||
bedrock("exeggutor_alolan", "ground_walk")
|
||||
)
|
||||
)
|
||||
|
||||
battleidle = registerPose(
|
||||
poseName = "battle_idle",
|
||||
poseTypes = PoseType.STATIONARY_POSES,
|
||||
transformTicks = 10,
|
||||
quirks = arrayOf(blink1, blink2, blink3, blink4),
|
||||
condition = { it.isBattling },
|
||||
animations = arrayOf(
|
||||
singleBoneLook(),
|
||||
SingleBoneLookAnimation(head2, false, false, disableX = false, disableY = false),
|
||||
SingleBoneLookAnimation(head3, false, false, disableX = false, disableY = false),
|
||||
bedrock("exeggutor_alolan", "battle_idle")
|
||||
)
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
// override fun getFaintAnimation(
|
||||
// pokemonEntity: PokemonEntity,
|
||||
// state: PosableState<PokemonEntity>
|
||||
// ) = if (state.isPosedIn(standing, walk)) bedrockStateful("exeggutor_alolan", "faint") else null
|
||||
}
|
||||
+3
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedW
|
||||
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
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
@@ -40,6 +41,8 @@ class NidokingModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, B
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
|
||||
override val cryAnimation = CryProvider { bedrockStateful("nidoking", "cry") }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk { bedrockStateful("nidoking", "blink")}
|
||||
standing = registerPose(
|
||||
|
||||
+3
@@ -14,6 +14,7 @@ import com.cobblemon.mod.common.client.render.models.blockbench.animation.BipedW
|
||||
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
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.Pose
|
||||
import com.cobblemon.mod.common.entity.PoseType
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
@@ -40,6 +41,8 @@ class NidoqueenModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame,
|
||||
lateinit var standing: Pose
|
||||
lateinit var walk: Pose
|
||||
|
||||
override val cryAnimation = CryProvider { bedrockStateful("nidoqueen", "cry") }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk { bedrockStateful("nidoqueen", "blink")}
|
||||
val spg = quirk(secondsBetweenOccurrences = 600F to 900F) { bedrockStateful("nidoqueen", "spgs_happy_place") }
|
||||
|
||||
+3
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.render.models.blockbench.pokemon.gen1
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.animation.QuadrupedWalkAnimation
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.HeadedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.frame.QuadrupedFrame
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.CryProvider
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pokemon.PokemonPosableModel
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.pose.CobblemonPose
|
||||
import com.cobblemon.mod.common.entity.PoseType.Companion.MOVING_POSES
|
||||
@@ -37,6 +38,8 @@ class NidoranfModel(root: ModelPart) : PokemonPosableModel(root), HeadedFrame, Q
|
||||
lateinit var standing: CobblemonPose
|
||||
lateinit var walk: CobblemonPose
|
||||
|
||||
override val cryAnimation = CryProvider { bedrockStateful("nidoranf", "cry") }
|
||||
|
||||
override fun registerPoses() {
|
||||
val blink = quirk { bedrockStateful("nidoranf", "blink") }
|
||||
standing = registerPose(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user