mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-24 18:44:26 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e2b52252d | ||
|
|
f4aa04dcb6 | ||
|
|
e26f8a4a01 | ||
|
|
f3f800e166 | ||
|
|
ea8235320e | ||
|
|
8ea6c3f297 | ||
|
|
18ca0eb41d | ||
|
|
f58aed7b57 | ||
|
|
7a656420ca | ||
|
|
d0366bd5e7 | ||
|
|
9bdcc8a5b6 | ||
|
|
b8a9de00ab | ||
|
|
cfeb300808 | ||
|
|
0833425d57 | ||
|
|
5e448c3324 | ||
|
|
11a4d0b61d | ||
|
|
3a8b75f152 | ||
|
|
cb6e1ca386 | ||
|
|
edf5ff7c73 | ||
|
|
ab60fdbd12 | ||
|
|
ac953685c8 | ||
|
|
16f0022505 | ||
|
|
956410c345 | ||
|
|
79b63efa19 | ||
|
|
27a9e4c808 | ||
|
|
89f81f96bc | ||
|
|
43a52ad407 | ||
|
|
81b3d1c2d3 | ||
|
|
f25b9164d0 | ||
|
|
c0a022c5b5 | ||
|
|
ce8c9b3b94 | ||
|
|
b6e3ee8404 | ||
|
|
85d4bb2628 | ||
|
|
82128ce318 | ||
|
|
390b3446a3 | ||
|
|
f66d2f0193 | ||
|
|
53446e06c6 | ||
|
|
691a7fb2c7 | ||
|
|
57e6934fe5 | ||
|
|
335ffdd074 | ||
|
|
0906378894 | ||
|
|
7282081832 | ||
|
|
a3c7398628 | ||
|
|
07594f574b | ||
|
|
3b7798338f | ||
|
|
eae5a08932 | ||
|
|
547989a6d4 | ||
|
|
f6f19c0e48 | ||
|
|
f8a7241747 | ||
|
|
4ccec31efa | ||
|
|
b7c3c53dc9 | ||
|
|
f1f3b17402 | ||
|
|
254655cb1d | ||
|
|
a212822d45 | ||
|
|
26ae7adac5 | ||
|
|
c797fbec80 | ||
|
|
17c48fab97 | ||
|
|
bcd60d80ea | ||
|
|
71f0ee1973 | ||
|
|
8119515705 | ||
|
|
28d7b02350 | ||
|
|
be4aa2592a | ||
|
|
4b9f2e3b47 | ||
|
|
05c27c5d20 | ||
|
|
6f2288c81f | ||
|
|
88d496137a | ||
|
|
b231f65bfb | ||
|
|
15749c8ad7 | ||
|
|
5cf9b26a2e | ||
|
|
d5356a83ef | ||
|
|
19d6ec7e52 | ||
|
|
5acb371fab | ||
|
|
c6eadbd193 | ||
|
|
f18ae4e08f | ||
|
|
59ba554315 | ||
|
|
9207cc3f43 | ||
|
|
0af3bdfd04 | ||
|
|
102c4fc398 | ||
|
|
f53edb6e64 | ||
|
|
acaefbb68c | ||
|
|
09cbbe75c9 | ||
|
|
81c2b860c6 | ||
|
|
57128a8d8b | ||
|
|
6bf33e4296 | ||
|
|
3aaf54e2c2 | ||
|
|
28b8cda4cf | ||
|
|
b5cff355e6 | ||
|
|
a00dbf4b1a | ||
|
|
627b973175 | ||
|
|
0db8844b4d | ||
|
|
cd0c9640af | ||
|
|
c88bd50be9 | ||
|
|
1289778874 | ||
|
|
00be1a45ba | ||
|
|
f5a8b5c601 | ||
|
|
90c7abca5f | ||
|
|
ef01da4b5b | ||
|
|
f544236230 | ||
|
|
3a57ed57da | ||
|
|
13b71a6c48 | ||
|
|
76fb5d04f7 | ||
|
|
60213303ae | ||
|
|
5ef50c1682 | ||
|
|
57ba3236bc | ||
|
|
5717037012 | ||
|
|
4ddb6d32f3 | ||
|
|
60ea87bd2c | ||
|
|
a7d780565f | ||
|
|
3b1896a696 | ||
|
|
3859bb70cb | ||
|
|
9d65f3d20b | ||
|
|
cddd6cfe57 | ||
|
|
0cc3a48f0b | ||
|
|
9b0c364e13 | ||
|
|
4e1b4dda58 | ||
|
|
ac0bdafb16 | ||
|
|
88d34a970c | ||
|
|
9a07bb36a4 | ||
|
|
7b8ad7c6b5 | ||
|
|
fd4cebf692 | ||
|
|
a37dd308a1 | ||
|
|
30885683f2 | ||
|
|
0ae167cb4f | ||
|
|
ec152e4171 | ||
|
|
2eeb3ae398 | ||
|
|
75b4bdfed8 | ||
|
|
81d5cc25a6 | ||
|
|
ff845325c6 | ||
|
|
6688055434 | ||
|
|
f905e39af2 | ||
|
|
58a07f2ab6 | ||
|
|
c9d685d1ab | ||
|
|
63ebc409f0 | ||
|
|
c631eb8e75 | ||
|
|
96074038e9 | ||
|
|
8b1b40d0f9 | ||
|
|
486abca78b | ||
|
|
2b5b4eb2d7 | ||
|
|
54ba686380 | ||
|
|
7615eda083 | ||
|
|
779d9ce391 | ||
|
|
db909866b8 | ||
|
|
4de90ab9c1 | ||
|
|
41193dbc0d | ||
|
|
8d584f4e4e | ||
|
|
74c79e1a5c | ||
|
|
4d36e74d79 | ||
|
|
eef4e9a922 | ||
|
|
a88fed137a | ||
|
|
62c15cceff | ||
|
|
54d8aa48fb | ||
|
|
dbc276daa7 | ||
|
|
f1e4aa5b6e | ||
|
|
057ef7b80e | ||
|
|
d1d4155c88 | ||
|
|
270cb26460 | ||
|
|
18d788974a | ||
|
|
ba9ae62e51 | ||
|
|
b05a028137 | ||
|
|
f4fdde4a0b | ||
|
|
3d1a0b5418 | ||
|
|
5fda8a2de9 | ||
|
|
b6b6eb5548 | ||
|
|
248b56ec1f | ||
|
|
07ebe90437 | ||
|
|
b0168c1d55 | ||
|
|
676c0626d1 | ||
|
|
b013f412b2 | ||
|
|
86638e20b0 | ||
|
|
2dd34b21e6 | ||
|
|
3bf93a128c | ||
|
|
0244db1e5c | ||
|
|
d8b18d7058 | ||
|
|
d4e0841f16 | ||
|
|
75fcf542a0 | ||
|
|
abf5da8b66 | ||
|
|
c423ab43f1 | ||
|
|
0977f7422a | ||
|
|
5bb0d6db58 | ||
|
|
993c9d09c3 | ||
|
|
b960ef602c | ||
|
|
2f4ddb30ec | ||
|
|
029f460b75 | ||
|
|
2737b6e03b | ||
|
|
1efafeef2f | ||
|
|
f3676cd99e | ||
|
|
24532cea79 | ||
|
|
aae0e64988 | ||
|
|
5700899beb | ||
|
|
d2a13d0e66 | ||
|
|
9368c889d7 | ||
|
|
bff45bd793 | ||
|
|
69f9d218ca | ||
|
|
35b9b8e66f | ||
|
|
f015eef645 | ||
|
|
18c15b13bc | ||
|
|
45cda3cc90 | ||
|
|
d90fd568a6 | ||
|
|
7712b21faa | ||
|
|
42e27a873b | ||
|
|
3276bf9cd3 | ||
|
|
8e29350f12 | ||
|
|
7f4f672d81 | ||
|
|
40cac999c4 | ||
|
|
89fdddfd75 | ||
|
|
96372c05fd | ||
|
|
965267a770 | ||
|
|
bc448c2af2 | ||
|
|
089c6d25bc | ||
|
|
992066d19b | ||
|
|
58d9bafe7a | ||
|
|
182f7d8c9c | ||
|
|
e1afe9afb2 | ||
|
|
44dfec6283 | ||
|
|
8b00733ddf | ||
|
|
70510cf224 | ||
|
|
06dc722aca | ||
|
|
ed176cfaf5 | ||
|
|
27ea836f71 | ||
|
|
e57fab9160 | ||
|
|
8203fc7d6b | ||
|
|
879dca7391 | ||
|
|
e3fc9e8e4a | ||
|
|
dc3e25bcba | ||
|
|
4369f99225 | ||
|
|
14a4c440b6 | ||
|
|
b10dad8bcc | ||
|
|
2e21b36796 | ||
|
|
f546bd72b8 | ||
|
|
68b16fecfe | ||
|
|
c0d5bf3acc | ||
|
|
86c3277075 | ||
|
|
4457352c49 | ||
|
|
180b2d7229 | ||
|
|
4e33891ae5 | ||
|
|
393abc08ed | ||
|
|
ee7e8c17e8 | ||
|
|
f8ed7cfe19 | ||
|
|
959717fafd | ||
|
|
f01bc0a117 | ||
|
|
c00ad8e0a7 | ||
|
|
ec885d5ddb | ||
|
|
19c1458b1d | ||
|
|
5b1301aac5 | ||
|
|
e6ad49327a | ||
|
|
5669fe2fda | ||
|
|
111156da5a | ||
|
|
458162901e | ||
|
|
5ad6a429cc | ||
|
|
cdae8e5e29 | ||
|
|
437b74b353 | ||
|
|
0eeeec5d22 | ||
|
|
fb3d6546e5 | ||
|
|
34b3d9365a | ||
|
|
9f26b27210 | ||
|
|
6547225e8d | ||
|
|
f78d326102 | ||
|
|
740d675294 | ||
|
|
dabaab7675 | ||
|
|
5152be9c4e | ||
|
|
2798e54167 | ||
|
|
831ef6c4f9 | ||
|
|
98885faaa2 | ||
|
|
ef499fd7bd | ||
|
|
ac8ab9b0f0 | ||
|
|
ca7602098f | ||
|
|
ff5626530e | ||
|
|
0bc6751914 | ||
|
|
790b84e7d3 | ||
|
|
ae8dbf43b5 | ||
|
|
fbfc2eb64c | ||
|
|
0f5a191bcf | ||
|
|
948b708223 | ||
|
|
2a55c36b74 | ||
|
|
f25b9fabf8 | ||
|
|
fd25217dee | ||
|
|
fa60ec42f3 | ||
|
|
ce1ac1be84 | ||
|
|
0b1e4f9ed4 | ||
|
|
bac6eec44e | ||
|
|
ff81281337 | ||
|
|
8ccdabef47 | ||
|
|
106f886e83 | ||
|
|
c1b298e46d | ||
|
|
1d1962603b | ||
|
|
18f614d142 | ||
|
|
f0770fb7fc | ||
|
|
c11cd4a6bb | ||
|
|
a4da94792d | ||
|
|
3172e6673f | ||
|
|
eaedb1b88f | ||
|
|
100ed4ecdd | ||
|
|
7c3b823ce1 | ||
|
|
61d1efe943 | ||
|
|
4d2938ac81 | ||
|
|
d762f21c54 | ||
|
|
0a42ea6d57 | ||
|
|
ad2c8c89c1 | ||
|
|
131f0e2d74 | ||
|
|
5899ea7932 | ||
|
|
8539fe96a4 | ||
|
|
8996f2b7f1 | ||
|
|
1885308639 | ||
|
|
211f741a64 | ||
|
|
37d4b97a44 | ||
|
|
3919831857 | ||
|
|
e309794fd7 | ||
|
|
dbca3da639 | ||
|
|
6007b49271 | ||
|
|
ddb4072ac1 | ||
|
|
9cf43d9f7e | ||
|
|
82f9ecaf4a | ||
|
|
66c4b4c4c3 | ||
|
|
8c8815dc45 | ||
|
|
8b41391a5f | ||
|
|
bfcca3e6f9 | ||
|
|
5271f90fa9 | ||
|
|
12cf4b9a85 | ||
|
|
34d2533473 | ||
|
|
9b7528f723 | ||
|
|
1cf1ffd2c0 | ||
|
|
36c2326466 | ||
|
|
f02f8478da | ||
|
|
0b9abf2a57 | ||
|
|
c537a09ad1 | ||
|
|
bee84a622c | ||
|
|
b9b1b0725a | ||
|
|
e8b0c6a542 | ||
|
|
e4033481bc | ||
|
|
88d8af8b96 | ||
|
|
cf49d9a778 | ||
|
|
bed959c658 | ||
|
|
c5cd2d7ce1 | ||
|
|
5a879cd6a5 | ||
|
|
d3346111c7 | ||
|
|
a981060e9e | ||
|
|
d1b32ea8a1 | ||
|
|
2578ce1cf6 | ||
|
|
58f86058d4 | ||
|
|
24af603ce1 | ||
|
|
784fb8da65 | ||
|
|
f08e97af1f | ||
|
|
60fc7ec252 | ||
|
|
789c7f5317 | ||
|
|
2821b5da09 | ||
|
|
bd9d56943e | ||
|
|
b72e6e3466 | ||
|
|
2eecf9c230 | ||
|
|
2f33abc75c | ||
|
|
556d7daa13 | ||
|
|
9e68943b7e | ||
|
|
307a029995 | ||
|
|
54e0ca6510 | ||
|
|
2ba2372bde | ||
|
|
513956062d | ||
|
|
b59f0b8f2f | ||
|
|
6f6e080ee0 | ||
|
|
d9f100d245 | ||
|
|
c3096b320e | ||
|
|
159b740f39 | ||
|
|
9f311903e0 | ||
|
|
ee192a247f | ||
|
|
572a51ad32 | ||
|
|
7df1cfbfb9 | ||
|
|
6489f75b7d | ||
|
|
dad49f1867 | ||
|
|
36aab9e86e | ||
|
|
c16aae75e2 | ||
|
|
dfa6ccb350 | ||
|
|
702dec9c40 | ||
|
|
a5ffe34c2d | ||
|
|
26ebb69f81 | ||
|
|
6b7563cab3 | ||
|
|
4fa7a73704 | ||
|
|
6328826c9e | ||
|
|
006766bc1e | ||
|
|
109e31fd2d | ||
|
|
fbb46ae9f2 | ||
|
|
ce5c85b0ad | ||
|
|
a077c7b32f | ||
|
|
f6a8edfef1 | ||
|
|
d33276407e | ||
|
|
b95aaefe8f | ||
|
|
a5de6d80cc | ||
|
|
7e34d06103 | ||
|
|
c6c023dda7 | ||
|
|
d58e583d22 | ||
|
|
8ed04fb58b | ||
|
|
2448655fc4 | ||
|
|
6500187ca1 | ||
|
|
32fd6af04f | ||
|
|
36f7233297 | ||
|
|
edb285c90b | ||
|
|
29f0282fe4 | ||
|
|
e1be96412d | ||
|
|
d45f09c27c | ||
|
|
61d08882a9 | ||
|
|
0ad15e674a | ||
|
|
edb9686703 | ||
|
|
6eeeddad3f | ||
|
|
b406382564 | ||
|
|
eacb3f8c5f | ||
|
|
de312aaccc | ||
|
|
cf3ba63d01 | ||
|
|
e7fcc3a71a | ||
|
|
a479a9d941 | ||
|
|
d6eccdd556 | ||
|
|
40613fa56a | ||
|
|
b1d7082584 | ||
|
|
aa53d0588c | ||
|
|
6f1a837296 | ||
|
|
7202f74e78 | ||
|
|
f1a6d7488f | ||
|
|
b49316d9bb | ||
|
|
fc71fb5a33 | ||
|
|
d3d9dd352a | ||
|
|
1a0ce41e00 | ||
|
|
de2fcea154 | ||
|
|
988dbe0cd2 | ||
|
|
f71694e210 | ||
|
|
8056640102 | ||
|
|
eaec10e529 | ||
|
|
38df157c40 | ||
|
|
fed82bc932 | ||
|
|
80ab2eaae9 | ||
|
|
3bd25c689b | ||
|
|
3bbde1f748 | ||
|
|
675c4ef4f9 | ||
|
|
936dc7f0cc | ||
|
|
a7edf0e221 | ||
|
|
f1f0df425f | ||
|
|
1c02657282 | ||
|
|
3d21a7634c | ||
|
|
04e6cbe6cf | ||
|
|
6db33c3a27 | ||
|
|
7108f9c7de | ||
|
|
6a10a25389 | ||
|
|
277cc0ec2f | ||
|
|
ab7dcd0be9 | ||
|
|
acf69caf7e | ||
|
|
2f1e67660d | ||
|
|
8b1ef36dc5 | ||
|
|
1cd629f39c | ||
|
|
2e221b42a1 | ||
|
|
690336036d | ||
|
|
9791893d2b | ||
|
|
643de56cf5 | ||
|
|
099f008766 | ||
|
|
ef013e7095 | ||
|
|
9cae588b7c | ||
|
|
d050dd4c5c | ||
|
|
22ca64ccf8 | ||
|
|
81857669b0 | ||
|
|
986c308846 | ||
|
|
be50fdeda5 | ||
|
|
30be75dbae | ||
|
|
28293fd6d7 | ||
|
|
f9f1cb760c | ||
|
|
6c45957b82 | ||
|
|
4d08f85419 | ||
|
|
5b8827549f | ||
|
|
f1d902849e | ||
|
|
2ca145b264 | ||
|
|
f07ec0df33 | ||
|
|
3476f6bd94 | ||
|
|
ae265c83b0 | ||
|
|
008fca66bf | ||
|
|
d8bc3d4177 | ||
|
|
f73e8d02f9 | ||
|
|
744ffc5ab7 | ||
|
|
f877279df0 | ||
|
|
26f5a84f97 | ||
|
|
8a998c6f62 | ||
|
|
481c7ee5cb | ||
|
|
47ebc2889f | ||
|
|
92cfbbcc9d | ||
|
|
455d303971 | ||
|
|
6dce4e5cdc | ||
|
|
90735e6866 | ||
|
|
50fd3c1856 | ||
|
|
39025c41b3 | ||
|
|
01b08f9fbf | ||
|
|
3e1b4fd692 | ||
|
|
edc3fa55c8 | ||
|
|
f832b3bf2d | ||
|
|
dfd016d10c | ||
|
|
5128086ebe | ||
|
|
930b7ed423 | ||
|
|
9eadeaa611 | ||
|
|
b2f89035b9 | ||
|
|
d36ec5c259 | ||
|
|
c492e16cc8 | ||
|
|
e7b033ecf0 | ||
|
|
aa186d8b7d | ||
|
|
4dee23fea2 | ||
|
|
36f76f9cbe | ||
|
|
a023f3ec82 | ||
|
|
bf277bbdfe | ||
|
|
0c842a22b9 | ||
|
|
dd2e7f765c | ||
|
|
86541779db | ||
|
|
7c8f18f65e | ||
|
|
d45bfde162 | ||
|
|
953a706846 | ||
|
|
251c7b109f | ||
|
|
95897dc746 | ||
|
|
a107e045eb | ||
|
|
53f06ab388 | ||
|
|
d59d990b70 | ||
|
|
12850bfe36 | ||
|
|
182c00b142 | ||
|
|
63f6c7c045 | ||
|
|
5c53b7e768 | ||
|
|
fa38f93677 | ||
|
|
81c59cbaf0 | ||
|
|
6ad71a1ebf | ||
|
|
efb11dd332 | ||
|
|
5d16e79767 | ||
|
|
083d38b9d3 | ||
|
|
7d4157774a | ||
|
|
8aa16c882e | ||
|
|
2f170363de | ||
|
|
abc34b3f6f | ||
|
|
08728efcdd | ||
|
|
b360ecf4a8 | ||
|
|
5d4d21359f | ||
|
|
0eec52f6d9 | ||
|
|
aa160ba8fc | ||
|
|
1a368b2bc7 | ||
|
|
670b811e03 | ||
|
|
a724f7f12c | ||
|
|
1f76564b9d | ||
|
|
ed09511952 | ||
|
|
9a791bba25 | ||
|
|
57308e278c | ||
|
|
8e6436dc69 | ||
|
|
dbe835612d | ||
|
|
25f7114340 | ||
|
|
20168406b5 | ||
|
|
1e26cf6cb0 | ||
|
|
5cf69f90fb | ||
|
|
b84294f112 | ||
|
|
b082ccfbd7 | ||
|
|
088b1c211e | ||
|
|
fcbd2545cb | ||
|
|
03bea7461d | ||
|
|
e4fe8c5112 | ||
|
|
21cd8e9e01 | ||
|
|
f95e7afb4e | ||
|
|
37b38daa00 | ||
|
|
6abd29b12d | ||
|
|
5c42308ca3 | ||
|
|
27e9f98862 | ||
|
|
a79ba3a0e4 | ||
|
|
960b223155 | ||
|
|
20dc8e0efc | ||
|
|
adf9cd7012 | ||
|
|
b5534b4a39 | ||
|
|
25320f8de1 | ||
|
|
feecf8d991 | ||
|
|
d2d5bcc59b | ||
|
|
ec60a9bb21 | ||
|
|
da2604e3d6 | ||
|
|
0f00bd6ba3 | ||
|
|
f3fcfd96d3 | ||
|
|
57528f9590 | ||
|
|
c0ce53a814 | ||
|
|
c081efd42e | ||
|
|
2a3417e31b | ||
|
|
0c4238dfb4 | ||
|
|
23aa11e316 | ||
|
|
3de8cd49b6 | ||
|
|
4500b10d7f | ||
|
|
71dbf77def | ||
|
|
de92d57f13 | ||
|
|
f818568bd3 | ||
|
|
9a1bd5f2f8 | ||
|
|
d3ca0622e4 | ||
|
|
7b6e378121 | ||
|
|
f58a6010d9 | ||
|
|
18968bf7c7 | ||
|
|
3a8f829de9 | ||
|
|
b6749e306b | ||
|
|
b4334c2835 | ||
|
|
79fa879eb6 | ||
|
|
26da3ae2f9 | ||
|
|
61d253638a | ||
|
|
8e73428458 | ||
|
|
64e7a5153e | ||
|
|
3b198c927c | ||
|
|
51f35bae56 | ||
|
|
8873705ce7 | ||
|
|
e194bd71cd | ||
|
|
520c810476 | ||
|
|
55370b26a0 | ||
|
|
381da07b46 | ||
|
|
21f6353188 | ||
|
|
ecfedff9d2 | ||
|
|
7d5ad7abfe | ||
|
|
72c6c004b0 | ||
|
|
04679a3406 | ||
|
|
3e58013ad6 | ||
|
|
12c50d5f6a | ||
|
|
06809933ed | ||
|
|
3921b3e654 | ||
|
|
e210bac2bf | ||
|
|
aa58cf8041 | ||
|
|
0a6d9e1ef9 | ||
|
|
5b52c817d7 | ||
|
|
4dde214f94 | ||
|
|
6369cb2b65 | ||
|
|
f538cebd03 | ||
|
|
ce310da9ca | ||
|
|
9dac3d01d9 | ||
|
|
bc3a622d1b | ||
|
|
ef276b8145 | ||
|
|
1b5584c585 | ||
|
|
5c975a339d | ||
|
|
3cdc932684 | ||
|
|
185f06822a | ||
|
|
f2ac1f1817 | ||
|
|
75a58f7e74 | ||
|
|
606bc093df | ||
|
|
8648e019a9 | ||
|
|
99de894d3f | ||
|
|
94c4e76823 | ||
|
|
a18503dfe9 | ||
|
|
b3357a2751 | ||
|
|
e711a9012b | ||
|
|
acb99b5c48 | ||
|
|
36babe51cc | ||
|
|
fb938c2b7d | ||
|
|
8384b6dd64 | ||
|
|
42b7d7e42e | ||
|
|
0a85bb5a7b | ||
|
|
89e87b7656 | ||
|
|
a2e0bb50b9 | ||
|
|
88dee1f544 | ||
|
|
f620e820e8 | ||
|
|
15486a1ea8 | ||
|
|
c121d0c4e2 | ||
|
|
09c2085270 | ||
|
|
14545818bd | ||
|
|
cb57e26d04 | ||
|
|
a6265d7ba3 | ||
|
|
4bd149c01b | ||
|
|
bc9342c2eb | ||
|
|
5edc9b5047 | ||
|
|
44118ec770 | ||
|
|
877fe2b275 | ||
|
|
86fe9fd6bb | ||
|
|
747918c4dc | ||
|
|
077fc3cb1d | ||
|
|
5e24a0cf36 | ||
|
|
0d871b16bf | ||
|
|
1f31ae94c1 | ||
|
|
549dfaa1b9 | ||
|
|
fc8e2e9e7f | ||
|
|
d9b63038dd | ||
|
|
1e8844a3e9 | ||
|
|
8f76e007e4 | ||
|
|
c2f9fdb47f | ||
|
|
2929b0b37a | ||
|
|
eca9cd9d16 | ||
|
|
9ec0f767a6 | ||
|
|
d397cabd51 | ||
|
|
f7d0fbcf33 | ||
|
|
ba520c3224 | ||
|
|
235722fb3a | ||
|
|
bb7791c691 | ||
|
|
024718e7f4 | ||
|
|
6c12c9e742 | ||
|
|
4764b8eb30 | ||
|
|
a94219cd0d | ||
|
|
755a9313e4 | ||
|
|
45eee2be66 | ||
|
|
69568160bc | ||
|
|
e54a9a83bb | ||
|
|
1e45d96253 | ||
|
|
6fdf9daf24 | ||
|
|
e330b517a8 | ||
|
|
ff54c6d9af | ||
|
|
0e4afecf1d | ||
|
|
53185b4833 | ||
|
|
c3e4e2b54f | ||
|
|
e91fe89e6a | ||
|
|
e5fc58366b | ||
|
|
df6beb4f15 | ||
|
|
9f8f742a0e | ||
|
|
0e6ece56c6 | ||
|
|
40a02b73e2 | ||
|
|
48f6c162d5 | ||
|
|
1569204d83 | ||
|
|
1de1c4e710 | ||
|
|
21e920426e | ||
|
|
ca5461c94f | ||
|
|
4510b3bbd1 | ||
|
|
0512588a7a | ||
|
|
0311dc5806 | ||
|
|
2f814c1903 | ||
|
|
6514b217b9 | ||
|
|
375c41daba | ||
|
|
b4c0859759 | ||
|
|
430ff7c3a8 | ||
|
|
e2b35d6d54 | ||
|
|
f39d843c70 | ||
|
|
2bcf3b03d5 | ||
|
|
90e146e7b0 | ||
|
|
8001a14d3a | ||
|
|
c7956a24a6 | ||
|
|
bc336abf9d | ||
|
|
c6b2797b5d | ||
|
|
52269705b5 | ||
|
|
89158cb10a | ||
|
|
fb5029796f | ||
|
|
dcd9572024 | ||
|
|
071cbc9890 | ||
|
|
55149ab5d1 | ||
|
|
7ed68b7efe | ||
|
|
c07e9e7006 | ||
|
|
cbc2b73625 | ||
|
|
a296a533c9 | ||
|
|
dd6a27b915 | ||
|
|
d826206d31 | ||
|
|
6506de70b8 | ||
|
|
d1f2c9695c | ||
|
|
0ebdfafccd | ||
|
|
2a5dd6dfd6 | ||
|
|
01e18e0221 | ||
|
|
6c8e15c014 | ||
|
|
f4ad421c2e | ||
|
|
cd28f69a0e | ||
|
|
21b1571868 | ||
|
|
e722279009 | ||
|
|
071d89cc15 | ||
|
|
1ed012331b | ||
|
|
121563ba24 | ||
|
|
19e2882c4a | ||
|
|
1fb52a4ae9 | ||
|
|
248dbf66da | ||
|
|
3beaf68815 | ||
|
|
eda8931b5f | ||
|
|
ce24c0a4ff | ||
|
|
45d05b9157 | ||
|
|
89464ce6c0 | ||
|
|
2dfdfb19d1 | ||
|
|
ff9f9b9660 | ||
|
|
8c2ef1084a | ||
|
|
e466ef6771 | ||
|
|
61405add97 | ||
|
|
0f774a68fc | ||
|
|
5a9b9a1feb | ||
|
|
f8c75dd79b | ||
|
|
f03d93d6a8 | ||
|
|
3be9104ec3 | ||
|
|
a23b199e7e | ||
|
|
a1f3f5184b | ||
|
|
331361f21e | ||
|
|
19fb0ff5b7 | ||
|
|
da4ee2e20d | ||
|
|
e1eda3ce19 | ||
|
|
7009bddc20 | ||
|
|
41d3361209 | ||
|
|
85874d4eb5 | ||
|
|
2a1a5643d3 | ||
|
|
85db3df355 | ||
|
|
befebdb9f7 | ||
|
|
9fcda980ee | ||
|
|
0b0dcdc58d | ||
|
|
ab1f0d7f92 | ||
|
|
09ab6458a1 | ||
|
|
910f3b3744 | ||
|
|
f4d7861a9d | ||
|
|
185d915928 | ||
|
|
d4100c61dc | ||
|
|
f16c8ae115 | ||
|
|
ac223cbb53 | ||
|
|
bc9fd53ae8 | ||
|
|
105d274955 | ||
|
|
5d682962be | ||
|
|
0cb5a993c7 | ||
|
|
2c00ecae9e | ||
|
|
356ae65b69 | ||
|
|
68cd3cd812 | ||
|
|
9dae4bae55 | ||
|
|
0e7a6c9fe1 | ||
|
|
6f9cafa141 | ||
|
|
b13919b7b3 | ||
|
|
bf3391a1a8 | ||
|
|
2d3106a256 | ||
|
|
ab1de29e47 | ||
|
|
64ba087cc5 | ||
|
|
3500b0f55f | ||
|
|
edc63b7200 | ||
|
|
70ed5a0717 | ||
|
|
20dd01f8e6 | ||
|
|
c2c571ae7e | ||
|
|
be23823404 | ||
|
|
8a3b0b9866 | ||
|
|
5b8e5ea338 | ||
|
|
540903d71f | ||
|
|
cac27535f8 | ||
|
|
171578ad9b | ||
|
|
0dc6f9aab3 | ||
|
|
eee9b32a5b | ||
|
|
91762bb1ba | ||
|
|
bd6953008b | ||
|
|
974cfc8c56 | ||
|
|
4d19e90c0d | ||
|
|
d76f5d40a4 | ||
|
|
2387ece1ff | ||
|
|
c05b6e60b8 | ||
|
|
0fcf37542b | ||
|
|
9054abadeb | ||
|
|
e541f4145a | ||
|
|
4c5e44fb22 | ||
|
|
12380d838b | ||
|
|
74cae17ebd | ||
|
|
af02b0ab1d | ||
|
|
2e5c4c3bf4 | ||
|
|
70583743ce | ||
|
|
55cd8cc5b3 | ||
|
|
4f7773eb3f | ||
|
|
095709b9d2 | ||
|
|
572e94cf33 | ||
|
|
45a4313b70 | ||
|
|
921ec259ee | ||
|
|
ba23b9f650 | ||
|
|
0be0508c18 | ||
|
|
476c6724b9 | ||
|
|
2b7d7835bf | ||
|
|
a13791c610 | ||
|
|
ed386677ee | ||
|
|
83b86a4538 | ||
|
|
b63d76b6c0 | ||
|
|
449a10711e | ||
|
|
326626ad8e | ||
|
|
86055202a9 | ||
|
|
918025cd2b | ||
|
|
b719856762 | ||
|
|
db7ae16ee9 | ||
|
|
2b62b9406d | ||
|
|
a325c5c618 | ||
|
|
a38c2f83ef | ||
|
|
75447c62a9 | ||
|
|
9449d1d0f3 | ||
|
|
2c3ca1b5ed | ||
|
|
69ee5eae48 | ||
|
|
65e29e42dd | ||
|
|
ad4033ed62 | ||
|
|
d2713b48cc | ||
|
|
df578be0b5 | ||
|
|
bd9d0a3889 | ||
|
|
ab5dbc077b | ||
|
|
96d939ce43 | ||
|
|
8ed8b55bdc | ||
|
|
1ddb1d19f8 | ||
|
|
6ea7d0ac7d | ||
|
|
77325428fa | ||
|
|
50a0dce086 | ||
|
|
eee0ce128e | ||
|
|
c80dd448cb | ||
|
|
4eb6072a25 | ||
|
|
0e3ecb3d6e | ||
|
|
769109d046 | ||
|
|
bc4f82e55f | ||
|
|
7ee6c8aa53 | ||
|
|
7f4bc87d7a | ||
|
|
6fc0bf4d6b | ||
|
|
a49df51ad9 | ||
|
|
87d511dae1 | ||
|
|
ead3c5944c | ||
|
|
75de803700 | ||
|
|
87d511c38e | ||
|
|
f2673803ee | ||
|
|
ba7e4cc3b2 | ||
|
|
2d47aa00d8 | ||
|
|
1a8b8fb5f3 | ||
|
|
eb2d904bac | ||
|
|
4889c8b881 | ||
|
|
aa05ef75bb | ||
|
|
c5822023a0 | ||
|
|
fd85215592 | ||
|
|
b368871e4f | ||
|
|
8aa6e926f6 | ||
|
|
8fc0155df8 | ||
|
|
4f629c5679 | ||
|
|
60b846b35e | ||
|
|
dbafb2cace | ||
|
|
9db8a0b2e7 | ||
|
|
9e4692d8e4 | ||
|
|
074c780d50 | ||
|
|
4e78ffb024 | ||
|
|
d63a1b8d4c | ||
|
|
0004029de9 | ||
|
|
8985ab0f12 | ||
|
|
2c6ec0ce34 | ||
|
|
11444946cb | ||
|
|
98351bbc3c | ||
|
|
fcaf1b0017 | ||
|
|
35e76ea9eb | ||
|
|
38d305ab99 | ||
|
|
d3167df1b9 | ||
|
|
b5971f258b | ||
|
|
e030986d0d | ||
|
|
157bbcd3b4 | ||
|
|
d8e72b7da8 | ||
|
|
650a13edb1 | ||
|
|
f6342b2335 | ||
|
|
0cbc30f8cb | ||
|
|
911f185400 | ||
|
|
0ff501bb16 | ||
|
|
3651643f26 | ||
|
|
335ccd260b | ||
|
|
f127a2fa7c | ||
|
|
bcc9d790d6 | ||
|
|
b74149d98d | ||
|
|
d644f72eae | ||
|
|
0369b6de83 | ||
|
|
f91baaa6f6 | ||
|
|
bc88c88982 | ||
|
|
de5b62343d | ||
|
|
8ae3bcff1c | ||
|
|
0de310c5db | ||
|
|
0883d7fb94 | ||
|
|
3b7f9627eb | ||
|
|
9d7ad714a1 | ||
|
|
b254ad0ba9 | ||
|
|
90a542b6b1 | ||
|
|
c168702970 | ||
|
|
c39ce6b6d1 | ||
|
|
f6598205fd | ||
|
|
b7fdda6905 | ||
|
|
943605c3e7 | ||
|
|
f4db57875a | ||
|
|
2ba3bd2148 | ||
|
|
aa4e565646 | ||
|
|
00ebb626a6 | ||
|
|
3a16fc3e4e | ||
|
|
37a4b1887f | ||
|
|
119c317029 | ||
|
|
167df7688f | ||
|
|
bd0f8d8383 | ||
|
|
ffc6a070dc | ||
|
|
44f7161c9f | ||
|
|
74521c9672 | ||
|
|
86a4c15dbb | ||
|
|
07292b4d6b | ||
|
|
77be537de4 | ||
|
|
d6b7b969b3 | ||
|
|
71065fc520 | ||
|
|
e9f22dab2a | ||
|
|
245e8f8162 | ||
|
|
9b3f35f6b4 | ||
|
|
9df8fbb88d | ||
|
|
c9c44d6bf8 | ||
|
|
b9e82e4c5b | ||
|
|
17eb003a12 | ||
|
|
289baf4131 | ||
|
|
00e62be79d | ||
|
|
3ffd62c2e7 | ||
|
|
5dc27f7212 | ||
|
|
d0eef8b271 | ||
|
|
43c0a8e296 | ||
|
|
a1549abff1 | ||
|
|
3ea6303fc3 | ||
|
|
9480212c4d | ||
|
|
5182a3474e | ||
|
|
a8ca3293fd | ||
|
|
4a5b0f4995 | ||
|
|
d9bf5132e7 | ||
|
|
01e06c22ac | ||
|
|
2cac2e4add | ||
|
|
3f086c8046 | ||
|
|
1b8ad4dd90 | ||
|
|
601b0d721e | ||
|
|
71860e8dba | ||
|
|
da33baf971 | ||
|
|
babe58dc34 | ||
|
|
5350a9882b | ||
|
|
38c0519c0a | ||
|
|
a1038c0e5b | ||
|
|
55658a7956 | ||
|
|
216a3dbbf8 | ||
|
|
67237e794f | ||
|
|
c339e5edbc | ||
|
|
e73054a529 | ||
|
|
7d2bba7b95 | ||
|
|
83ccd25b33 | ||
|
|
62d87c0c66 | ||
|
|
9e04a1184c | ||
|
|
6c5a269966 | ||
|
|
969d82dff8 | ||
|
|
125a799df4 | ||
|
|
e599ed67f5 | ||
|
|
aeb0093b4d | ||
|
|
3513c92a22 | ||
|
|
c6810c05ea | ||
|
|
6d39b3c026 | ||
|
|
76fb9ee52f | ||
|
|
19cdf19a9b | ||
|
|
5795cc984b | ||
|
|
4330405f96 | ||
|
|
747aae8337 | ||
|
|
93486d306b | ||
|
|
39b53b0be7 | ||
|
|
0f44a3c6c6 | ||
|
|
0484596a91 | ||
|
|
246baa9f55 | ||
|
|
39b6304bed | ||
|
|
c858f24e67 | ||
|
|
563b6f7a26 | ||
|
|
d6d29613e8 | ||
|
|
6c7c72b0f9 | ||
|
|
606cb060fa | ||
|
|
1e96a21cca | ||
|
|
235fd3b3f3 | ||
|
|
ea8cc51eef | ||
|
|
83a54c10b8 | ||
|
|
ce7566e498 | ||
|
|
1863038019 | ||
|
|
8b5d3a2077 | ||
|
|
940dc01a7c | ||
|
|
720d0dc1b9 | ||
|
|
6f1fc08a08 | ||
|
|
651f2d0d84 | ||
|
|
4f873437d8 | ||
|
|
1b755d7c87 | ||
|
|
4245f5bbbc | ||
|
|
ac8228e4d1 | ||
|
|
8fa22e1e60 | ||
|
|
3f204d412d | ||
|
|
bd1743d069 | ||
|
|
76b6dae9d4 | ||
|
|
aae2fdb23a | ||
|
|
df0d46e63d | ||
|
|
de043f4a25 | ||
|
|
92e69bb270 | ||
|
|
9ebaf780e1 | ||
|
|
39a43a339b | ||
|
|
46b62eea56 | ||
|
|
f43b9ae186 | ||
|
|
8c125afc9c | ||
|
|
fe998ea31c | ||
|
|
b85804af98 | ||
|
|
3577701edf | ||
|
|
64c29377c4 | ||
|
|
d1621d4368 | ||
|
|
bd7cafa482 | ||
|
|
3e57b837aa | ||
|
|
5992e1badc | ||
|
|
f1a968d196 | ||
|
|
b86c0284ac | ||
|
|
a4ac6bb1c1 | ||
|
|
0d1520d951 | ||
|
|
26bf90ac66 | ||
|
|
52db241b9a | ||
|
|
d528483e9b | ||
|
|
3f6972f9f6 | ||
|
|
64f8ca657c | ||
|
|
5afa1c8959 | ||
|
|
1b9e674b36 | ||
|
|
021a32b962 | ||
|
|
8799e08c17 | ||
|
|
ff68dc9258 | ||
|
|
b7a46cab1d | ||
|
|
6d62a44be5 | ||
|
|
d3f06f8866 | ||
|
|
190fa5431f | ||
|
|
96239118e7 | ||
|
|
9cbd9fd3eb | ||
|
|
aa923fae54 | ||
|
|
a9b602713c | ||
|
|
31aac0d6b3 | ||
|
|
d560c23241 | ||
|
|
db64928f18 | ||
|
|
0f1a6028f3 | ||
|
|
587d435a6f | ||
|
|
9c9bcc8228 | ||
|
|
7ba2dc72d7 | ||
|
|
f8dc9ec1e4 | ||
|
|
a7d58bfb4e | ||
|
|
923c84e3fe | ||
|
|
ee593c62c0 | ||
|
|
bee4d18bc6 | ||
|
|
f4a5bbd1f6 | ||
|
|
638c915965 | ||
|
|
8da42e7b7c | ||
|
|
e6221c0940 | ||
|
|
dfcab1e413 | ||
|
|
13cb94d5e2 | ||
|
|
a18292b8ed | ||
|
|
cb364823a9 | ||
|
|
73f0d4e441 | ||
|
|
9ed588728b | ||
|
|
19b01e2099 | ||
|
|
e2ca76e626 | ||
|
|
7050e9b7d4 | ||
|
|
d835d2acb0 | ||
|
|
50e9f1b3e5 | ||
|
|
3f8373d76f | ||
|
|
d0dc8a4578 | ||
|
|
692b985237 | ||
|
|
04e2a57cb4 | ||
|
|
8e9d2fedc5 | ||
|
|
384b61832d | ||
|
|
4cb1eee017 | ||
|
|
f8c9faac0b | ||
|
|
af62868387 | ||
|
|
a032d24d65 | ||
|
|
4a8e6df034 | ||
|
|
f5dbe19de2 | ||
|
|
eecb5b0b3b | ||
|
|
44f71ddb81 | ||
|
|
86285ceff5 | ||
|
|
f829926f00 | ||
|
|
cda43fe67a | ||
|
|
68bc02a5d4 | ||
|
|
f6e589ac67 | ||
|
|
23c44cc5d4 | ||
|
|
2c2e13c2f7 | ||
|
|
d17534120b | ||
|
|
a44cc4f1bb | ||
|
|
26a9c99000 | ||
|
|
165e3e2d14 | ||
|
|
21e05575ad | ||
|
|
0a33f7dd12 | ||
|
|
54d0fe2b1b | ||
|
|
cc0959dcfe | ||
|
|
cd60a03544 | ||
|
|
10b6ccf427 | ||
|
|
73db727c47 | ||
|
|
fbcda09fe2 | ||
|
|
92cd894f39 | ||
|
|
275cca70c2 | ||
|
|
ba6c3e607c | ||
|
|
7b811bdea1 | ||
|
|
8c8f37e75d | ||
|
|
1df05406c8 | ||
|
|
6173e98998 | ||
|
|
fd0e20f364 | ||
|
|
71dba15270 | ||
|
|
cd92c340c7 | ||
|
|
c3e032dcf2 | ||
|
|
1372127266 | ||
|
|
ca8285e23f | ||
|
|
88d43f8199 | ||
|
|
95e7b3255e | ||
|
|
83e11a05da | ||
|
|
818acfb00b | ||
|
|
0328be57eb | ||
|
|
63c704f80a | ||
|
|
ecf1b38763 | ||
|
|
ff5ce2f556 | ||
|
|
276465a175 | ||
|
|
4311931f25 | ||
|
|
11808df036 | ||
|
|
cc94773845 | ||
|
|
828e99d427 | ||
|
|
3ef16fb2ab | ||
|
|
3dc56aba06 | ||
|
|
a0184206bf | ||
|
|
fdb2ff98d8 | ||
|
|
c7d04cb9d3 | ||
|
|
b40fec2270 | ||
|
|
f28d3483e6 | ||
|
|
479a2c5384 | ||
|
|
bd9e0fdf43 | ||
|
|
c82f7517de | ||
|
|
06aa0ce22e | ||
|
|
5b36cdac1b | ||
|
|
576401ebde | ||
|
|
0d11db729b | ||
|
|
78f7fa65f1 | ||
|
|
71050da341 | ||
|
|
a5c02e6c94 | ||
|
|
a106343a0e | ||
|
|
289c78f4de | ||
|
|
55ae325458 | ||
|
|
03935502cc | ||
|
|
95f550df0b | ||
|
|
9454af30cf | ||
|
|
c2435b350c | ||
|
|
bd0e8ad907 | ||
|
|
0f27ef2628 | ||
|
|
fb0332e5cf | ||
|
|
deec2a1986 | ||
|
|
b5df6b1709 | ||
|
|
18bab07f33 | ||
|
|
166c8aa228 | ||
|
|
1e844444cf | ||
|
|
5c604a6919 | ||
|
|
c661bc95c8 | ||
|
|
277fe3387d | ||
|
|
bfcdd3c47c | ||
|
|
176a3b6d50 | ||
|
|
5790679048 | ||
|
|
9eb30f862a | ||
|
|
e45f6b7da5 | ||
|
|
869dda34a5 | ||
|
|
99f7d05948 | ||
|
|
2632ff4bc6 | ||
|
|
7725d16e82 | ||
|
|
798e238804 | ||
|
|
8fb683ff2c | ||
|
|
57d63844c8 | ||
|
|
b74a29dc29 | ||
|
|
2311634817 | ||
|
|
7d6bacb824 | ||
|
|
c433593459 | ||
|
|
df0cc666d4 | ||
|
|
274e96af03 | ||
|
|
f0ec2b0401 | ||
|
|
3e85557984 | ||
|
|
79ed8b116e | ||
|
|
e883b77117 | ||
|
|
35c2a08228 | ||
|
|
beefd35bd9 | ||
|
|
c10fa8e17e | ||
|
|
bdda92cae0 | ||
|
|
4726c23ba1 | ||
|
|
3ee6b69eb1 | ||
|
|
edffd7aaaf | ||
|
|
9b1ffb4992 | ||
|
|
4741b58aed | ||
|
|
830f2a3d8f | ||
|
|
ce3700b820 | ||
|
|
60af203165 | ||
|
|
33442f9398 | ||
|
|
e8ef60deb4 | ||
|
|
db0aa94a3a | ||
|
|
eb660b38ae | ||
|
|
7aeb003806 | ||
|
|
a39178c75b | ||
|
|
68681931f8 | ||
|
|
a33acee117 | ||
|
|
3929888f60 | ||
|
|
5720b3a081 | ||
|
|
cd942fea30 | ||
|
|
761b59479e | ||
|
|
35ca7ca479 | ||
|
|
db14662e90 | ||
|
|
565d52729d | ||
|
|
6bc932719f | ||
|
|
b6d0d77445 | ||
|
|
662d874f2f | ||
|
|
ad5528c25a | ||
|
|
87931e6c34 | ||
|
|
4d78c6bb2e | ||
|
|
9c222b89d4 | ||
|
|
92a196d296 | ||
|
|
150ffbc896 | ||
|
|
5f4bc813db | ||
|
|
eea82a6c47 | ||
|
|
f8802114b5 | ||
|
|
eb67763d77 | ||
|
|
bc7e768d5f | ||
|
|
b267ebecb2 | ||
|
|
bbe6d9bb77 | ||
|
|
e7f6177be8 | ||
|
|
7b42ad7796 | ||
|
|
d657bab73c | ||
|
|
1221badc69 | ||
|
|
f9babf040d | ||
|
|
b3d49945f7 | ||
|
|
61a363fdba | ||
|
|
50bcbb5872 | ||
|
|
c56a8ee7d9 | ||
|
|
0d45d636b8 | ||
|
|
a36cc044bd | ||
|
|
080b41a3b9 | ||
|
|
34379929a5 | ||
|
|
6d150a9d22 | ||
|
|
db3a7de926 | ||
|
|
461e45c2eb | ||
|
|
5bc3e5451a | ||
|
|
6e602c45a9 | ||
|
|
7b7667f2c5 | ||
|
|
a496061455 | ||
|
|
77c8e418eb | ||
|
|
740c2852e5 | ||
|
|
a1de79053b | ||
|
|
d09c6b0c81 | ||
|
|
57f9b706bf | ||
|
|
c1dc58ae54 | ||
|
|
dc9d15f3e3 | ||
|
|
c9f77bed05 | ||
|
|
60b985d33d | ||
|
|
7e6b17c106 | ||
|
|
4093bf9adf | ||
|
|
cdf30af20c | ||
|
|
c647179c26 | ||
|
|
a1461665d1 | ||
|
|
c5c35a1113 | ||
|
|
1eef2f871a | ||
|
|
ac92210771 | ||
|
|
04a0fbc84d | ||
|
|
acae8d84d0 | ||
|
|
5332774c3d | ||
|
|
ff7fbd411d | ||
|
|
02ce0912c7 | ||
|
|
9886dae519 | ||
|
|
ef51f4acd8 | ||
|
|
a4112008bd | ||
|
|
bf858a7a1a | ||
|
|
297c8129de | ||
|
|
b42cd4d1a3 | ||
|
|
5163044494 | ||
|
|
82632d9131 | ||
|
|
d1db2067f8 | ||
|
|
117f85096f | ||
|
|
ea38cd23b6 | ||
|
|
47fc4ebcc1 | ||
|
|
a0de82b8e4 | ||
|
|
85d79dd786 | ||
|
|
c4d5178472 | ||
|
|
2361246f0b | ||
|
|
c0f2846907 | ||
|
|
12696996a6 | ||
|
|
79d1b74a0f | ||
|
|
f78fc30660 | ||
|
|
6948690042 | ||
|
|
cf4f4a48a0 | ||
|
|
aeda4f0f39 | ||
|
|
f3ba05068d | ||
|
|
df8833103e | ||
|
|
b613ec86fe | ||
|
|
4146b156a2 | ||
|
|
931858c554 | ||
|
|
bc6e9786da | ||
|
|
1c3a11d433 | ||
|
|
b6f69dbe8c | ||
|
|
791cb3ddc1 | ||
|
|
4f00870b9b | ||
|
|
5be3d934b7 | ||
|
|
e3228632a3 | ||
|
|
9a575919b4 | ||
|
|
4e0c5e91da | ||
|
|
fbbd53d5ff | ||
|
|
5e13f580bb | ||
|
|
ca11c3c9f6 | ||
|
|
5553ece3e6 | ||
|
|
fd160e980a | ||
|
|
369b346093 | ||
|
|
8d2d08b8cb | ||
|
|
aaaeaf4b19 | ||
|
|
d3a1535a31 | ||
|
|
75c5637aa7 | ||
|
|
96c243f6bf | ||
|
|
58cac3667c | ||
|
|
f6114dfa5e | ||
|
|
6cc78a62aa | ||
|
|
cb0b18310a | ||
|
|
1d191413fb | ||
|
|
f5deb8a823 | ||
|
|
07a10b8414 | ||
|
|
e2291f8ccc | ||
|
|
f19c53758e | ||
|
|
86da3f21e1 | ||
|
|
275a5f10c9 | ||
|
|
7b77c1935f | ||
|
|
861cdcd533 | ||
|
|
35af0bbd2d | ||
|
|
0caebb08ca | ||
|
|
71b4a6fdc4 | ||
|
|
8e283b705c | ||
|
|
dfec28ccc8 | ||
|
|
6cdb222b67 | ||
|
|
c97de07ef7 | ||
|
|
20f1c7cb66 | ||
|
|
002d2a6f15 | ||
|
|
4ff47456b7 | ||
|
|
6c0a2caa7e | ||
|
|
9b654621e8 | ||
|
|
d06e680350 | ||
|
|
185a8bc917 | ||
|
|
ce8e38b6bd | ||
|
|
ef4438fcf4 | ||
|
|
8089a5eef0 | ||
|
|
592a910cbc | ||
|
|
a7b43563cf | ||
|
|
7f010f5e0c | ||
|
|
8dad290486 | ||
|
|
f3a7f3a0ad | ||
|
|
de8c317023 | ||
|
|
096c9b0a69 | ||
|
|
370abd2f94 | ||
|
|
f3d39abfaf | ||
|
|
de094ea0a2 | ||
|
|
2065d5dde5 | ||
|
|
f0b4513105 | ||
|
|
61fb092c82 | ||
|
|
9c1fadf493 | ||
|
|
e268a99f26 | ||
|
|
d909e9e44e | ||
|
|
8240cbae9e | ||
|
|
91140d81be | ||
|
|
b84ada3a30 | ||
|
|
cd506cbc7a | ||
|
|
5899186445 | ||
|
|
bd0044a2aa | ||
|
|
d6b25127df | ||
|
|
d6ca60b121 | ||
|
|
0e2375e7f8 | ||
|
|
36e0e114fe | ||
|
|
c9e50f2cde | ||
|
|
c46d61b221 | ||
|
|
efd7d96ec7 | ||
|
|
bc05164209 | ||
|
|
96d12c360d | ||
|
|
790cfae476 | ||
|
|
7e25b1c858 | ||
|
|
2ab48129b3 | ||
|
|
595efb529c | ||
|
|
3a2bcd228f | ||
|
|
574c893f8d | ||
|
|
941cc5e3fd | ||
|
|
c2e0bbedae | ||
|
|
534ec7b2c5 | ||
|
|
e2a5d254a9 | ||
|
|
6d20f5f52c | ||
|
|
3e21757d12 | ||
|
|
b7333bcf6a | ||
|
|
9aa23ef49d | ||
|
|
c1e4e824ab | ||
|
|
8b95d61e0f | ||
|
|
323502aa5e | ||
|
|
58e2b4f591 | ||
|
|
a5ab3cb443 | ||
|
|
c398977022 | ||
|
|
ce5a67eaa2 | ||
|
|
dfc0232e99 | ||
|
|
992aea663b | ||
|
|
643b5e0d70 | ||
|
|
3b2ac768c6 | ||
|
|
6400c4a4e8 | ||
|
|
a4eb63917f | ||
|
|
794ff0c9b0 | ||
|
|
17e0782a32 | ||
|
|
1786d215ad | ||
|
|
9e21e4b47f | ||
|
|
aded664426 | ||
|
|
bacbc877bd | ||
|
|
40d35d2f20 | ||
|
|
d645ecc998 | ||
|
|
455f09ac68 | ||
|
|
9402ff5ec5 | ||
|
|
a9cd2ec7ef | ||
|
|
c4bbf6108b | ||
|
|
104a816eef | ||
|
|
50d14d757c | ||
|
|
4b06937385 | ||
|
|
448329386e | ||
|
|
4d670f31de | ||
|
|
a7ed8549a9 | ||
|
|
c694785de3 | ||
|
|
2e99dffc33 | ||
|
|
1dbeaf2c84 | ||
|
|
2ffe95dc0f | ||
|
|
bc3e8cb28e | ||
|
|
026a3dc8d3 | ||
|
|
d9d89a2f23 | ||
|
|
662d843147 | ||
|
|
c591a91857 | ||
|
|
8a0c7c5a65 | ||
|
|
fc9c9e187e | ||
|
|
50165677c7 | ||
|
|
25800e9c3d | ||
|
|
e0b4aece90 | ||
|
|
258abeec0b | ||
|
|
3982d5082d | ||
|
|
586d43f08b | ||
|
|
28761df3b2 | ||
|
|
2c645beddf | ||
|
|
a4692388a8 | ||
|
|
351e663212 | ||
|
|
741608a353 | ||
|
|
9d5c577cf4 | ||
|
|
72686b8f86 | ||
|
|
78a6a29b1c | ||
|
|
b38f193d08 | ||
|
|
92cffdf555 | ||
|
|
f5cb81ea89 | ||
|
|
cbb5f3e2ae | ||
|
|
8bcbc4c7cd | ||
|
|
76fe28e42c | ||
|
|
2ff1b3a6cf | ||
|
|
5af5793718 | ||
|
|
54cd31724d | ||
|
|
b9d1a9f657 | ||
|
|
fbf60bafb4 | ||
|
|
f6539b071c | ||
|
|
65953d77c4 | ||
|
|
d9f16fef8a | ||
|
|
9cb4c96eb3 | ||
|
|
457a8aae37 | ||
|
|
6e2fe788d2 | ||
|
|
9f30438c4f | ||
|
|
6cce314341 | ||
|
|
74fe7cb892 | ||
|
|
555fb481d3 | ||
|
|
b1799b5a22 | ||
|
|
51993c3efc | ||
|
|
358fd7e643 | ||
|
|
f785b034ff | ||
|
|
a77b550b21 | ||
|
|
242d9fa1cb | ||
|
|
c13faca8ae | ||
|
|
e0d3226945 | ||
|
|
0d03871444 | ||
|
|
83f45fe6b8 | ||
|
|
01e2c354d5 | ||
|
|
26ed55ceb5 | ||
|
|
22ce3d0a1a | ||
|
|
cf4c97fdf0 | ||
|
|
8e9087246c | ||
|
|
b9691676df | ||
|
|
1a1c2af548 | ||
|
|
976bb9af49 | ||
|
|
0dcd02c5a0 | ||
|
|
f0740c6d7a | ||
|
|
6012c103a6 | ||
|
|
85f8baeda5 | ||
|
|
b9ebaa3292 | ||
|
|
d2bc98a4c1 | ||
|
|
8220bbd327 | ||
|
|
6aebcfc63c | ||
|
|
3fb3b1dad3 | ||
|
|
2e8b96fe3a | ||
|
|
e7c7816e0c | ||
|
|
c30fb77eb6 | ||
|
|
b23bf333d9 | ||
|
|
a1e7a7ee9f | ||
|
|
0e3b0f047a | ||
|
|
51aca95590 | ||
|
|
292c695eb6 | ||
|
|
bef83f9ddb | ||
|
|
05ef31e29e | ||
|
|
ee33c0f69a | ||
|
|
5714d89c41 | ||
|
|
1b0ce874bb | ||
|
|
5508ea26ea | ||
|
|
8506239d93 | ||
|
|
96e37341c7 | ||
|
|
95909b0fd1 | ||
|
|
a05d411cba | ||
|
|
b3a64f92d7 | ||
|
|
91a6a166bb | ||
|
|
f1d21496bd | ||
|
|
49b8c2ef98 | ||
|
|
79f092ae59 | ||
|
|
6b40cbb367 | ||
|
|
9de9e799d5 | ||
|
|
06c0a364a9 | ||
|
|
e75e87dd43 | ||
|
|
6f0ccace42 | ||
|
|
918c3acf7f | ||
|
|
0124ad4fd4 | ||
|
|
7b800694db | ||
|
|
b8be3afa56 | ||
|
|
244424ea0d | ||
|
|
85b2fe24a2 | ||
|
|
9a03ccf569 | ||
|
|
ce9eb61059 | ||
|
|
c091a31022 | ||
|
|
16f894baca | ||
|
|
b4fb4765f5 | ||
|
|
67b2ba16dd | ||
|
|
4973203f72 | ||
|
|
fad17fa3bd | ||
|
|
49a5159810 | ||
|
|
af0553ba0d | ||
|
|
4b7effe2d7 | ||
|
|
05bb9c0081 | ||
|
|
39c768e965 | ||
|
|
6b8b3a0596 | ||
|
|
a91039c026 | ||
|
|
db0e7da834 | ||
|
|
4715e2ffbf | ||
|
|
7e62dbc3fa | ||
|
|
ba4a159dca | ||
|
|
d06e7df1a0 | ||
|
|
762d52f658 | ||
|
|
ec40a1c580 | ||
|
|
7f79609c18 | ||
|
|
3e8e70b292 | ||
|
|
92431ab2a9 | ||
|
|
b150cd0608 | ||
|
|
d14d6a5463 | ||
|
|
69c87404e7 | ||
|
|
ed15ae861a | ||
|
|
8514b9f980 | ||
|
|
abd639438e | ||
|
|
cf1afc9fca | ||
|
|
63ca8da22c | ||
|
|
1c7f614c3f | ||
|
|
df210367e0 | ||
|
|
950a749be6 | ||
|
|
1ac7c0e797 | ||
|
|
1702252629 | ||
|
|
780dc4ca76 | ||
|
|
2efdafe254 | ||
|
|
0cbfe526cb | ||
|
|
3568fb8a86 | ||
|
|
00eefb0887 | ||
|
|
aca9cec48c | ||
|
|
78fc2bd3fd | ||
|
|
7ec0ce6f94 | ||
|
|
825f3b4a39 | ||
|
|
c7bab53bdc | ||
|
|
e767f4f46c | ||
|
|
0fce002b52 | ||
|
|
c7c516d97e | ||
|
|
993ce4b73f | ||
|
|
94864fb19a | ||
|
|
3e28437682 | ||
|
|
cc0a329370 | ||
|
|
124d82889d | ||
|
|
ba9b86e6d0 | ||
|
|
226b95af32 | ||
|
|
9d8fd5bada | ||
|
|
37cd4f1b7a | ||
|
|
d717b00de0 | ||
|
|
7a74a599f2 | ||
|
|
2556666072 | ||
|
|
e5e8e8948a | ||
|
|
d52e82bb5b | ||
|
|
cb09deb495 | ||
|
|
cd00fcf013 | ||
|
|
ebd005c2df | ||
|
|
cd4174713a | ||
|
|
e79bf294f1 | ||
|
|
9ef4b6ecdf | ||
|
|
295e7cd9cd | ||
|
|
c171fac4be | ||
|
|
0ed150f067 | ||
|
|
8edf09f215 | ||
|
|
21a7922a95 | ||
|
|
7ccd4a57b7 | ||
|
|
d420d3228e | ||
|
|
4468293dfd | ||
|
|
79edd08ff4 | ||
|
|
6373839870 | ||
|
|
e987f596ef | ||
|
|
8a5e1fb062 | ||
|
|
52580bd1c1 | ||
|
|
492bec21c3 | ||
|
|
9afe569677 | ||
|
|
793a2753fe | ||
|
|
cec05c33cf | ||
|
|
01cbcbd026 | ||
|
|
4fa6770b64 | ||
|
|
be9bf8759a | ||
|
|
58a559e28b | ||
|
|
d774688bb6 | ||
|
|
b583608d5a | ||
|
|
1e4630c619 | ||
|
|
741ce3558d | ||
|
|
24c96cf8e1 | ||
|
|
7952661a7e | ||
|
|
2e72eb2126 | ||
|
|
19e5213f3c | ||
|
|
1ab26a9e84 | ||
|
|
10d6d0c408 | ||
|
|
4ee2bf432d | ||
|
|
3a0deb8c6d | ||
|
|
7bb5c541e3 | ||
|
|
395ed1dc4a | ||
|
|
2f6e8b9408 | ||
|
|
02be805c14 | ||
|
|
678c32e2da | ||
|
|
ca6409e3e5 | ||
|
|
5da2c75c8f | ||
|
|
8b232bec4f | ||
|
|
0220b804e8 | ||
|
|
8d4ec579a7 | ||
|
|
dceb600e52 | ||
|
|
10d4681963 | ||
|
|
e41ab8ad91 | ||
|
|
7a661df47d | ||
|
|
91a7a8bf19 | ||
|
|
2d0e16bdd8 | ||
|
|
7a20c8f3c8 | ||
|
|
a9a2ce368c | ||
|
|
cddf2c2d60 | ||
|
|
caab5da3bc | ||
|
|
72998efae5 | ||
|
|
e6423a6de0 | ||
|
|
fb7bd685d4 | ||
|
|
ae598003a8 | ||
|
|
32e82fc9c9 | ||
|
|
0f29e654aa | ||
|
|
afd2a9fb35 | ||
|
|
c062c1340b | ||
|
|
31ea784998 | ||
|
|
04d3a1339e | ||
|
|
422ebea54f | ||
|
|
4ed809989d | ||
|
|
3cbdab3dc4 | ||
|
|
d162804c64 | ||
|
|
d59e7f5d33 | ||
|
|
e261f18aa9 | ||
|
|
24733892a0 | ||
|
|
a9bfa6c120 | ||
|
|
2c91cd4286 | ||
|
|
e5e897ab1e | ||
|
|
41722a37d7 | ||
|
|
4128bbff8b | ||
|
|
a8b3c0b8d4 | ||
|
|
8a2ba6ae4e | ||
|
|
818c62bdf9 | ||
|
|
0a47eb953e | ||
|
|
18ebc607b7 | ||
|
|
c291ab174f | ||
|
|
c1cd8b0386 | ||
|
|
4d825b6cf3 | ||
|
|
93e6a92b59 | ||
|
|
ddee62f2ce | ||
|
|
7adbdd30e4 | ||
|
|
27de3c77a4 | ||
|
|
00ea0200c4 | ||
|
|
06483566cf | ||
|
|
cca69d8e1d | ||
|
|
0ef48c5477 | ||
|
|
1337aba841 | ||
|
|
b4608ffe19 | ||
|
|
f8dc8d9268 | ||
|
|
000cefdab9 | ||
|
|
d52b7b1fc2 | ||
|
|
dda993e23c | ||
|
|
0b2bf5fd04 | ||
|
|
c3651fd6f7 | ||
|
|
bdf3791e38 | ||
|
|
ee413c31b9 | ||
|
|
b13be2969a | ||
|
|
c33ac04d11 | ||
|
|
9744209938 | ||
|
|
6c84263769 | ||
|
|
6ff4814983 | ||
|
|
9a4b04ddf0 | ||
|
|
f65662efaf | ||
|
|
bed60002c3 | ||
|
|
b035f4e188 | ||
|
|
1754aa536a | ||
|
|
d00c1cf156 | ||
|
|
11e326de48 | ||
|
|
082d22ba6e | ||
|
|
3009c97bc9 | ||
|
|
179199a6bf | ||
|
|
5e8e004ef6 | ||
|
|
a7100daa77 | ||
|
|
b47a2bc1d2 | ||
|
|
323a0c454a | ||
|
|
d6a2d42fe7 | ||
|
|
3f0b93a2d2 | ||
|
|
1e190d7470 | ||
|
|
db09c9a44f | ||
|
|
aacdbb09e1 | ||
|
|
8efa1d354d | ||
|
|
0c1d9908aa | ||
|
|
557b8720a4 | ||
|
|
9df3db48ce | ||
|
|
85a117fa6a | ||
|
|
6e43c34e91 | ||
|
|
803c631f99 | ||
|
|
6e851b88d2 | ||
|
|
77ee8f8f42 | ||
|
|
b5a69b0f2a | ||
|
|
faf1019ed1 | ||
|
|
45e82877ad | ||
|
|
58437e0bbf | ||
|
|
1e7ee84098 | ||
|
|
aaa07eeec6 | ||
|
|
3d9b54ef5b | ||
|
|
e73b5f3897 | ||
|
|
0c42fb8128 | ||
|
|
b25f2b786e | ||
|
|
111f16647d | ||
|
|
a826f27909 | ||
|
|
3ca8b9664b | ||
|
|
e49e380ff7 | ||
|
|
7da4b276a5 | ||
|
|
a3a595542a | ||
|
|
7e4d0e48bb | ||
|
|
8070d8cdc4 | ||
|
|
45cae9b064 | ||
|
|
460a1c5ef9 | ||
|
|
c767c4714d | ||
|
|
d9b5aa6b3d | ||
|
|
f672583f73 | ||
|
|
9e809b2e0d | ||
|
|
598c498533 | ||
|
|
afe0e8106e | ||
|
|
ce7b3116c5 | ||
|
|
c0a8b0ee97 | ||
|
|
b457e26960 | ||
|
|
3d0c814861 | ||
|
|
68fb45edfd | ||
|
|
82e97935d9 | ||
|
|
88b5be2f25 | ||
|
|
2ae3a32ad1 | ||
|
|
5b201c0f0e | ||
|
|
065cfb152e | ||
|
|
0ddf2d1d13 | ||
|
|
7615a60932 | ||
|
|
4245fc9820 | ||
|
|
d0923752ba | ||
|
|
8068349dbe | ||
|
|
88f48c6f94 | ||
|
|
d66bc5381e | ||
|
|
b6b4b20ba8 | ||
|
|
6a31602701 | ||
|
|
77085f4c32 | ||
|
|
32c2d89f42 | ||
|
|
b083e05f16 | ||
|
|
4dcaaf9577 | ||
|
|
c233264741 | ||
|
|
4bfdd6a5c4 | ||
|
|
9c541999f3 | ||
|
|
61dc056735 | ||
|
|
2d0d7ce615 | ||
|
|
4300db8f78 | ||
|
|
f1b4f90b41 | ||
|
|
cae3d4ca2b | ||
|
|
17235c0d6f | ||
|
|
7d0b44d638 | ||
|
|
9b3c8031e7 | ||
|
|
297b19b2e5 | ||
|
|
15dee0e5b8 | ||
|
|
540508a2be | ||
|
|
5f418a6d9c | ||
|
|
74e8289cad | ||
|
|
b60d6f8eb5 | ||
|
|
39e51bc8c2 | ||
|
|
e73e785fbf | ||
|
|
2cd06193c2 | ||
|
|
d05e28918d | ||
|
|
62e11d8caa | ||
|
|
1585aa8e55 | ||
|
|
01e9122700 | ||
|
|
6a65168f4a | ||
|
|
96fcf33ae2 | ||
|
|
c2b92a836d | ||
|
|
bb0f63e44c | ||
|
|
9b5a43ab2a | ||
|
|
b3f3989d73 | ||
|
|
ebad780ea2 | ||
|
|
be70f01377 | ||
|
|
5fdb507784 | ||
|
|
bacfb5eba0 | ||
|
|
2860cc5cf3 | ||
|
|
3867ab43b7 | ||
|
|
1b76f1ab7e | ||
|
|
41d4ca8c27 | ||
|
|
3730046b3c | ||
|
|
131815ff06 | ||
|
|
e284dfa4a2 | ||
|
|
67eab285ac | ||
|
|
994cadfc3b | ||
|
|
5e9cc0444b | ||
|
|
57ffcb8b0e | ||
|
|
993a8bd57c | ||
|
|
91dc56bf87 | ||
|
|
70f0ab1e6f | ||
|
|
b37f9a7ea4 | ||
|
|
b6ac84d4c4 | ||
|
|
7c24caf004 | ||
|
|
66c4d64fb0 | ||
|
|
8a497f82a0 | ||
|
|
fb66252b2a | ||
|
|
b370ccf1de | ||
|
|
fe786babc6 | ||
|
|
aec11c617b | ||
|
|
48518998da | ||
|
|
67cc16e6ef | ||
|
|
12ad5abba5 | ||
|
|
f7489f1526 | ||
|
|
e453b023e7 | ||
|
|
d58b4bb905 | ||
|
|
fd43cd6b67 | ||
|
|
69eb728e59 | ||
|
|
b704c88f8c | ||
|
|
fa450214af | ||
|
|
1e2cf25b4d | ||
|
|
e186bb0bd0 | ||
|
|
f0a2d81d24 | ||
|
|
9e6f341d77 | ||
|
|
e6d4e1f3fd | ||
|
|
9850e4b751 | ||
|
|
5cb5e3da85 | ||
|
|
1e4ab5c03d | ||
|
|
db899fe479 | ||
|
|
5fe36cc0c6 | ||
|
|
db55dee048 | ||
|
|
23b55c343f | ||
|
|
6bad9163a0 | ||
|
|
397d16ac6e | ||
|
|
ce0f5b7a78 | ||
|
|
25ab7b2f71 | ||
|
|
18c6221dc0 | ||
|
|
6b63d89d55 | ||
|
|
3e6b37ac05 | ||
|
|
835b32daa1 | ||
|
|
8d63134a72 | ||
|
|
ffd331fbc5 | ||
|
|
5e48063311 | ||
|
|
253bfd7e17 | ||
|
|
f100fb0ab1 | ||
|
|
7786d8e271 | ||
|
|
44d76b638d | ||
|
|
50aedd8f56 | ||
|
|
c147250784 | ||
|
|
a8a8094d7e | ||
|
|
33b5de833d | ||
|
|
e017ad1f83 | ||
|
|
e0c9bfffa5 | ||
|
|
7e1374d96a | ||
|
|
ad4aac1e43 | ||
|
|
fc6c56e40d | ||
|
|
c10b37f01d | ||
|
|
c976b488f1 | ||
|
|
c1cfcc19d5 | ||
|
|
25e6f39afd | ||
|
|
6cc9aa0e78 | ||
|
|
e2f12f4bbf | ||
|
|
3e16c0a0d8 | ||
|
|
393a7fbb56 | ||
|
|
b3c9c24f42 | ||
|
|
0b2c3f6ca9 | ||
|
|
a03c4eb712 | ||
|
|
2c4a183c30 | ||
|
|
c1da5c080f | ||
|
|
253de25d5b | ||
|
|
54f85c0012 | ||
|
|
ba28f62d74 | ||
|
|
9f556ea045 | ||
|
|
6829547d3a | ||
|
|
67926477be | ||
|
|
0e8db79605 | ||
|
|
8b4892cb35 | ||
|
|
e69bbd13b0 | ||
|
|
7ea05e4ecc | ||
|
|
2bb1df968b | ||
|
|
7928c189ad | ||
|
|
47dc56c25e | ||
|
|
a52c676fcb | ||
|
|
f6e0cd8add | ||
|
|
cef0dfe45f | ||
|
|
31a25acd20 | ||
|
|
bc2bab889d | ||
|
|
6a04a0ea28 | ||
|
|
74198534af | ||
|
|
f86db24def | ||
|
|
8496c5bff2 | ||
|
|
f662d8416e | ||
|
|
78bb39e4c7 | ||
|
|
63d019dfd0 | ||
|
|
5dad2f13de | ||
|
|
38153e72d0 | ||
|
|
585ebdcc2f | ||
|
|
8296a008d4 | ||
|
|
5d4721dc20 | ||
|
|
bdbf30d328 | ||
|
|
772fc5ef6d | ||
|
|
c31843c318 | ||
|
|
5994206abd | ||
|
|
6bb1741025 | ||
|
|
213c9069de | ||
|
|
e03af5e76f | ||
|
|
fa9e5cdfe5 | ||
|
|
8ee35e8088 | ||
|
|
dd4b0c8b4b | ||
|
|
203a794950 | ||
|
|
70cc7b75e4 | ||
|
|
e001beb6ba | ||
|
|
6de09c1ee4 | ||
|
|
9322cd7429 | ||
|
|
8b3ae8d73a | ||
|
|
26e1f78fb4 | ||
|
|
8ebc372f83 | ||
|
|
a0775be65c | ||
|
|
df32f6dc50 | ||
|
|
6a21edb46b | ||
|
|
70f146cb27 | ||
|
|
7044d8ed63 | ||
|
|
43bf4d3427 | ||
|
|
e973605be6 | ||
|
|
0b60f4b455 | ||
|
|
43154bba15 | ||
|
|
5d2b667aa6 | ||
|
|
96496a40e2 | ||
|
|
fe1c21582a |
No files matched your search
@@ -0,0 +1,82 @@
|
|||||||
|
# BUILD_SYSTEM.md — Gradle Build Architecture
|
||||||
|
|
||||||
|
## Module Graph
|
||||||
|
|
||||||
|
```
|
||||||
|
Dependency flow: platform-api ←(api)── core ←(impl)── root (mc1710)
|
||||||
|
gradle-plugins/ → composite build (dts.typescript-generator)
|
||||||
|
```
|
||||||
|
|
||||||
|
- **platform-api**: Zero deps. Interfaces (`PlatformService`, `INBTCompound`). Java 8.
|
||||||
|
- **core**: Depends on platform-api (transitive). MC-free game logic. Java 8.
|
||||||
|
- **root**: Depends on core. Full MC 1.7.10/Forge via GTNH convention plugin.
|
||||||
|
- **gradle-plugins**: Isolated composite build for `dts.typescript-generator` plugin.
|
||||||
|
|
||||||
|
## Build Flow
|
||||||
|
|
||||||
|
```
|
||||||
|
updateAPI (submodule init) → decompileMc (RetroFuturaGradle) → compileJava
|
||||||
|
→ generateTypeScriptDefinitions → processResources (bundles .d.ts)
|
||||||
|
→ shadowJar (Mixin + JaninoLoader unless -Pnomixin) → build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Config Files
|
||||||
|
|
||||||
|
| File | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `build.gradle` | Plugins, version, custom tasks, TS gen config, javadoc |
|
||||||
|
| `settings.gradle` | Module includes, composite build, GTNH convention |
|
||||||
|
| `gradle.properties` | MC/Forge version, modId, mixin/shadow/spotless flags |
|
||||||
|
| `dependencies.gradle` | Runtime deps, shadow deps, core module reference |
|
||||||
|
| `repositories.gradle` | Sponge maven (Mixin), flatDir `lib/` |
|
||||||
|
|
||||||
|
## Custom Tasks (group: `CustomNPC+`)
|
||||||
|
|
||||||
|
| Task | Purpose |
|
||||||
|
|---|---|
|
||||||
|
| `updateAPI` | `git submodule update --init --recursive` — required first time |
|
||||||
|
| `buildNoMixin` | `build -Pnomixin` — jar without embedded Mixin |
|
||||||
|
| `runClientNoNashorn` / `runServerNoNashorn` | Launch without Nashorn scripting engine |
|
||||||
|
| `generateTypeScriptDefinitions` | Java API → `.d.ts` (see gradle-plugins/AGENTS.md) |
|
||||||
|
|
||||||
|
## TypeScript Generation Config
|
||||||
|
|
||||||
|
```
|
||||||
|
sourceDirectories: src/api/java, src/main/java
|
||||||
|
outputDirectory: src/main/resources/assets/customnpcs/api
|
||||||
|
apiPackages: noppes.npcs.api, net.minecraft
|
||||||
|
implementationPackages: noppes.npcs.scripted, noppes.npcs.controllers.data,
|
||||||
|
noppes.npcs.entity.data, noppes.npcs.quests, kamkeel.npcs.controllers.data
|
||||||
|
patchesDirectory: dts-patches/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dependencies (dependencies.gradle)
|
||||||
|
|
||||||
|
| Configuration | Used For |
|
||||||
|
|---|---|
|
||||||
|
| `implementation project(':core')` | Core game logic (transitively includes platform-api) |
|
||||||
|
| `shadowImplementation` | Embedded: Mixin (unless `-Pnomixin`), JaninoLoader |
|
||||||
|
| `runtimeOnlyNonPublishable` | Dev-only: NEI, Nashorn (unless `-PnoNashorn`) |
|
||||||
|
|
||||||
|
## Key gradle.properties
|
||||||
|
|
||||||
|
| Property | Value | Effect |
|
||||||
|
|---|---|---|
|
||||||
|
| `modId` | `customnpcs` | Mixin JSON, resource paths, TS output |
|
||||||
|
| `usesMixins` | `true` | Mixin AP + embed. Plugin: `mixin.CustomNPCsMixinPlugin` |
|
||||||
|
| `usesShadowedDependencies` | `true` | Enables `shadowImplementation` |
|
||||||
|
| `minimizeShadowedDependencies` | `false` | Keep all shadowed classes (reflection) |
|
||||||
|
| `disableSpotless` | `true` | No auto-formatting |
|
||||||
|
| `enableModernJavaSyntax` | `false` | Strict Java 8 (no Jabel) |
|
||||||
|
| `accessTransformersFile` | `customnpcs_at.cfg` | Forge access transformer |
|
||||||
|
|
||||||
|
## Quick Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./gradlew updateAPI # Init API submodule (first time)
|
||||||
|
./gradlew build # Full build with mixin embedding
|
||||||
|
./gradlew buildNoMixin # Without embedded Mixin
|
||||||
|
./gradlew runClient / runServer # Launch game
|
||||||
|
./gradlew generateTypeScriptDefinitions # Regen .d.ts only
|
||||||
|
./gradlew genIntellijRuns # IDE setup (add Mixin tweaker args)
|
||||||
|
```
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
|||||||
|
# Forbidden Practices — CustomNPC-Plus
|
||||||
|
|
||||||
|
Quick-reference guardrails. Prevents regressions, guides contributors.
|
||||||
|
See also: `AGENTS.md` (architecture), `SESSION_MEMORY.md` (roadmap).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. NEVER Rules
|
||||||
|
|
||||||
|
### Thread Safety
|
||||||
|
- **NEVER use mutable static fields for shared state.** Known violation: `RandomPositionGeneratorAlt.staticVector` — a mutable `Vec3` reused across calls. Do not replicate this pattern.
|
||||||
|
|
||||||
|
### Core / Platform-API Isolation
|
||||||
|
- **NEVER import MC classes in `core/` or `platform-api/`.** Use the existing platform-api interfaces (`INbt`, `IPlayer`, `IItemStack`, `IWorld`, `IEntity`, `ICustomNpc`, etc.).
|
||||||
|
- **NEVER import wrapper classes in `core/`.** Only interfaces from `platform-api/`.
|
||||||
|
- **NEVER call `getMCNBT()` / `getMCTagList()` from `core/` code.** These are escape hatches on `INbt`/`INbtList` for mc1710 code only.
|
||||||
|
- **NEVER use `new NBTTagCompound()` in `core/`.** Use `NBT.compound()` / `NBT.list()`.
|
||||||
|
- **NEVER use `CompressedStreamTools` in `core/`.** Use `PlatformServiceHolder.get().readCompressedNBT()`.
|
||||||
|
- **NEVER use `LogWriter` in `core/`.** Use `PlatformServiceHolder.get().logError()`.
|
||||||
|
- **NEVER create semantically duplicate interfaces.** Use the real interfaces from `platform-api/` (`IPlayer`, `IItemStack`, `IWorld`, `IEntity`, `ICustomNpc`, `INbt`, etc.). Do NOT invent new names like `IUser`, `IStack`, `IGameWorld` — those don't exist and never should.
|
||||||
|
|
||||||
|
### Split-Package Contract
|
||||||
|
- **NEVER break the split-package shadow.** When a class exists in both `core/` and `src/main/java/` with the same package, mc1710 shadows core at compile time. The mc1710 version adds `implements IFaction`, SyncController calls, MC-specific methods. Core version must remain MC-free.
|
||||||
|
|
||||||
|
### Naming
|
||||||
|
- **Platform interfaces:** Use the scripting API interface names as-is (`IPlayer`, `IEntity`, `IItemStack`, `IWorld`, `ICustomNpc`). These are being merged into platform-api from the scripting API. Do NOT create new names.
|
||||||
|
- **MC1710 wrappers:** `[Thing]Wrapper`. No `MC1710` prefix. `PlayerWrapper` not `MC1710PlayerWrapper`.
|
||||||
|
- **Scripting API** (`IPlayer`, `IEntity`, `ICustomNpc`) is being merged into `platform-api/` — same package (`noppes.npcs.api.*`), stripped of MC type parameters. MC-free versions live in platform-api, version-specific extensions shadow in each mc*/ leaf.
|
||||||
|
|
||||||
|
### Per-Version Code (DO NOT ABSTRACT)
|
||||||
|
- **NEVER abstract mixins** (`noppes.npcs.mixin`). Leave the current 1.7.10 mixins as-is. Each version leaf will have its own version-specific mixins.
|
||||||
|
- **NEVER abstract addon classes** (`kamkeel.npcs.addon`). These are per-version integrations. Leave 1.7.10 addons as-is. New version implementations will be created separately after migration.
|
||||||
|
- **NEVER abstract `BucketUtil` or `VaultUtil`**. These are per-version utility classes. Leave the 1.7.10 versions as-is. Each version leaf gets its own implementation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Architectural Guardrails
|
||||||
|
|
||||||
|
### Dependency Flow
|
||||||
|
```
|
||||||
|
platform-api/ (interfaces only, zero MC deps)
|
||||||
|
^
|
||||||
|
core/ (game logic, MC-free)
|
||||||
|
^
|
||||||
|
src/main/java/ (mc1710: wrappers, entities, GUI, packets)
|
||||||
|
```
|
||||||
|
Violations = build failures. Core depends on platform-api only.
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
# MC Coupling Analysis — CustomNPC-Plus
|
||||||
|
|
||||||
|
> Codebase analysis of Minecraft API coupling across `src/main/java/`.
|
||||||
|
> Generated from verified grep/search results on the repository.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. MC-Dependent Code Overview
|
||||||
|
|
||||||
|
| Metric | Count | Context |
|
||||||
|
|---|---|---|
|
||||||
|
| Total files in `src/main/java/` | ~2,170 | All Java source files |
|
||||||
|
| Files importing `net.minecraft.*` | 1,424 | 66.5% of all source files |
|
||||||
|
| Files importing `cpw.mods.fml.*` | 507 | 35.5% of MC-importing files |
|
||||||
|
| Files importing `net.minecraftforge.*` | 398 | 27.9% of MC-importing files |
|
||||||
|
| `@SideOnly` annotations | 488 | Across 398 files |
|
||||||
|
| Platform abstraction adoption | <0.2% | Almost no MC code uses `platform-api` interfaces yet |
|
||||||
|
|
||||||
|
**Key takeaway:** Two-thirds of the codebase directly imports Minecraft classes. FML and Forge imports are concentrated in registration, event handling, and networking code. The platform abstraction layer (`platform-api/`, `core/`) exists but has near-zero adoption in `src/main/java/` — the vast majority of code still calls MC APIs directly.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Top MC-Coupled Hotspots (by directory)
|
||||||
|
|
||||||
|
Directories ranked by number of files importing `net.minecraft.*`:
|
||||||
|
|
||||||
|
| Rank | Directory | Files | Notes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 | `noppes/npcs/client/gui` | 66 | GUI screens — version-locked |
|
||||||
|
| 2 | `noppes/npcs/controllers/data` | 52 | Data classes — mostly NBT boundaries |
|
||||||
|
| 3 | `noppes/npcs/client/gui/util` | 44 | GUI utilities — version-locked |
|
||||||
|
| 4 | `noppes/npcs/containers` | 42 | Inventory containers — IInventory-dependent |
|
||||||
|
| 5 | `noppes/npcs/items` | 41 | Items — registration changes, logic stable |
|
||||||
|
| 6 | `noppes/npcs/blocks` | 34 | Blocks — metadata, BlockState, registration |
|
||||||
|
| 7 | `noppes/npcs` (root) | 34 | Core mod classes, utilities |
|
||||||
|
| 8 | `noppes/npcs/controllers` | 29 | Singleton controllers — mostly light coupling |
|
||||||
|
| 9 | `noppes/npcs/ai` | 29 | AI tasks — EntityAI API throughout |
|
||||||
|
| 10 | `kamkeel/npcs/network/packets/data` | 19 | Network data packets |
|
||||||
|
|
||||||
|
**Observation:** The top 3 hotspots account for 162 files. GUI code (#1, #3) is inherently version-locked and should not be abstracted — it must be rewritten per MC version. Controllers/data (#2, #8) are the best migration candidates due to light MC coupling at boundaries only.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Flattening-Sensitive Code (Pre-1.13 Patterns)
|
||||||
|
|
||||||
|
The Flattening (1.13) eliminates block metadata, changes registration, and restructures BlockStates. These patterns will **break**:
|
||||||
|
|
||||||
|
### Block Metadata
|
||||||
|
- **Pattern:** `getMetadata()`, `damageDropped()`, `getStateFromMeta()`
|
||||||
|
- **Matches:** 29 across 27 files
|
||||||
|
- **Impact:** Every block using metadata subsets must be converted to individual block instances or BlockState properties
|
||||||
|
|
||||||
|
### GameRegistry Registration
|
||||||
|
- **Pattern:** `GameRegistry.register*`
|
||||||
|
- **Matches:** 82 across 18 files
|
||||||
|
- **Concentration:** `CustomItems.java` alone has **62** calls
|
||||||
|
- **Impact:** Registration moves to `DeferredRegister` / event-driven registration in 1.13+
|
||||||
|
|
||||||
|
### IInventory Implementations
|
||||||
|
- **Files:** 40+ in `containers/`
|
||||||
|
- **Impact:** `IInventory` replaced by capability-based `IItemHandler` pattern
|
||||||
|
|
||||||
|
### Block Renderers Using Metadata
|
||||||
|
- **Files:** 25+ renderer files
|
||||||
|
- **Impact:** Metadata-driven rendering replaced by BlockState model system
|
||||||
|
|
||||||
|
### OreDictionary
|
||||||
|
- **Files:** `NoppesUtilPlayer.java`, `CustomItems.java`
|
||||||
|
- **Impact:** Replaced by Tags system in 1.13+
|
||||||
|
|
||||||
|
### Numerical Item IDs
|
||||||
|
- **Pattern:** `getIdFromItem()`
|
||||||
|
- **Files:** `RoleCompanion.java`, `EntityProjectile.java` (2 files)
|
||||||
|
- **Impact:** Must convert to `ResourceLocation`-based identification
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. GUI/Rendering Layer
|
||||||
|
|
||||||
|
| Pattern | Matches | Files |
|
||||||
|
|---|---|---|
|
||||||
|
| `extends GuiScreen/GuiContainer/GuiButton` | 37 | 35 |
|
||||||
|
| Total client rendering files | 212 | — |
|
||||||
|
|
||||||
|
**Assessment:** The GUI and rendering layer is **completely different per MC version**:
|
||||||
|
- 1.7.10: `GuiScreen`, `GuiButton`, `Tessellator` with fixed pipeline
|
||||||
|
- 1.12.2: `GuiScreen`, `GuiButton` (similar but shifted APIs)
|
||||||
|
- 1.16.5+: `Screen`, `Button`, `MatrixStack`-based rendering
|
||||||
|
- 1.20+: `GuiGraphics` wrapper, component-based text
|
||||||
|
|
||||||
|
**Recommendation:** Do **NOT** abstract the GUI layer. Rewrite per version. For multi-version support, start with admin essentials only (NPC editor, quest editor, dialog editor) and defer cosmetic GUIs.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Registration Centralization
|
||||||
|
|
||||||
|
| Registration Type | Location | Calls/Files |
|
||||||
|
|---|---|---|
|
||||||
|
| Block/Item registration | `CustomItems.java` | 62 `GameRegistry` calls |
|
||||||
|
| Entity registration | `CustomNpcs.java` | Centralized |
|
||||||
|
| Event handler registration | 16+ files | `EVENT_BUS.register()` |
|
||||||
|
|
||||||
|
**Assessment:** Registration is already well-centralized. This is **good for porting** — only `CustomItems.java`, `CustomNpcs.java`, and a handful of event handler files need version-specific registration code. The majority of block/item/entity *logic* is separate from registration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Subsystem Coupling Categories
|
||||||
|
|
||||||
|
Classification key:
|
||||||
|
- **CORE-READY** — Could move to `core/` today with interface swaps
|
||||||
|
- **LIGHT-MC** — Uses MC types at boundaries only (EntityPlayer params, NBT)
|
||||||
|
- **HEAVY-MC** — Deep MC API usage throughout
|
||||||
|
- **VERSION-LOCKED** — Uses APIs that change fundamentally between versions
|
||||||
|
|
||||||
|
| Subsystem | Files | Coupling | Notes |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Controllers/Data | 81 | LIGHT-MC | Mostly NBT + EntityPlayer params at method signatures |
|
||||||
|
| Networking | 100+ | HEAVY-MC | Packet framework changes every version (SimpleNetworkWrapper → custom channels) |
|
||||||
|
| Blocks | 97 | VERSION-LOCKED | Metadata, BlockState, registration, rendering all change |
|
||||||
|
| Items | 41 | LIGHT-MC | Registration changes, but item logic is stable across versions |
|
||||||
|
| AI | 29 | HEAVY-MC | EntityAI API changes significantly (Goal system in 1.16+) |
|
||||||
|
| Commands | 22 | VERSION-LOCKED | Custom system in 1.7.10, Brigadier command tree in 1.13+ |
|
||||||
|
| Roles/Jobs | 19 | LIGHT-MC | Mostly game logic with entity params at boundaries |
|
||||||
|
| Config | 9 | LIGHT-MC | Forge config API changes but configuration logic is the same |
|
||||||
|
| GUI/Client | 212 | VERSION-LOCKED | Completely different rendering/widget APIs per version |
|
||||||
|
|
||||||
|
**Summary:** 41% of subsystem files (Controllers/Data + Roles/Jobs + Items + Config = 150 files) are LIGHT-MC and viable migration candidates. The remaining 59% requires version-specific implementations or deep abstraction work.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Migration Priority Recommendations
|
||||||
|
|
||||||
|
Ordered by ROI (code sharing potential vs. effort required):
|
||||||
|
|
||||||
|
| Priority | Subsystem | Files | Coupling | Rationale |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| **1st** | Controllers/Data | 81 | LIGHT-MC | Highest ROI. Most code can be shared across versions. MC types appear only at method boundaries (EntityPlayer params, NBT serialization). 52 data files + 29 controller files. |
|
||||||
|
| **2nd** | Roles/Jobs | 19 | LIGHT-MC | Small surface area, high value. Game logic is version-independent. Entity interactions are at boundaries only. |
|
||||||
|
| **3rd** | Items | 41 | LIGHT-MC | Registration is centralized in `CustomItems.java`. Item behavior logic is stable across versions — only registration mechanism changes. |
|
||||||
|
| **4th** | Networking Packets | 100+ | HEAVY-MC | Needs packet DTO abstraction. Separate serializable data from transport. High file count but patterns are repetitive — a good abstraction pays off across all packets. |
|
||||||
|
| **5th** | AI | 29 | HEAVY-MC | Needs `EntityAI` → `Goal` abstraction layer. AI *logic* (targeting, combat, pathing decisions) is version-independent but the API surface changes significantly. |
|
||||||
|
| **6th** | Commands | 22 | VERSION-LOCKED | Needs Brigadier adapter for 1.13+. Custom command hierarchy in 1.7.10 maps conceptually to Brigadier's command tree. |
|
||||||
|
| **7th** | Blocks | 97 | VERSION-LOCKED | Needs BlockState abstraction. Metadata elimination, registration changes, and rendering differences make this high-effort. |
|
||||||
|
| **Last** | GUI/Client | 212 | VERSION-LOCKED | Rewrite per version, do not abstract. Start with admin essentials (NPC editor, quest editor, dialog editor). Defer cosmetic GUIs. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix: Current Core Migration Status
|
||||||
|
|
||||||
|
As of this analysis, **183 files** have been abstracted to `core/` + `platform-api/` out of ~2,170 total source files. Migrated subsystems include:
|
||||||
|
- Faction, Magic, Transport, Tag, GlobalData controllers
|
||||||
|
- 60+ data classes
|
||||||
|
|
||||||
|
See `CORE_MIGRATION_STATUS.md` for per-file blocker analysis and `CORE_PLAN.md` for the migration roadmap.
|
||||||
@@ -0,0 +1,871 @@
|
|||||||
|
# MIGRATION EXECUTION PLAN — Core Extraction Wave 1
|
||||||
|
|
||||||
|
> **Created:** 2026-03-16
|
||||||
|
> **Status:** PLANNING (not yet executing)
|
||||||
|
> **Scope:** Whitelisted packages → core/ via the migration toolchain
|
||||||
|
> **Data Sources:** `mc_type_classifications_original.json` (37 curated types), `all_methods_export.json` (member data), `mc_usage_index.json` (usage index)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
|
||||||
|
This plan extracts ~250 files from 8 whitelisted mc1710 packages into `core/`, replacing all MC/Forge type references with platform-api abstractions. It is the **first full-scale use of the migration toolchain** and is structured into 4 sequential phases:
|
||||||
|
|
||||||
|
| Phase | What | Tool | Output |
|
||||||
|
|-------|------|------|--------|
|
||||||
|
| **1** | Create PA abstractions for all MC types used in scope | `pa_batch.py` | ~20 new PA files in `platform-api/` |
|
||||||
|
| **2** | Copy whitelisted files to core/ | `Copy-Recursive.ps1` | ~150 new files in `core/` |
|
||||||
|
| **3** | Replace MC types with PA abstractions in core/ | `Symbol-Swap`, `Static-Transform`, `Nuke-Imports` | All MC imports eliminated from core/ |
|
||||||
|
| **4** | Verify, diagnose, stabilize | `Build-Report`, `migration-diff` | Clean `:core:compileJava` build |
|
||||||
|
|
||||||
|
**Estimated new tool development before execution:** 1 new Python script (`generate_pa_manifest.py`)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 0. Current State Snapshot
|
||||||
|
|
||||||
|
### Already Migrated (DO NOT re-copy)
|
||||||
|
|
||||||
|
| Location | Count | Contents |
|
||||||
|
|----------|-------|----------|
|
||||||
|
| `platform-api/` | 239 files | Entity interfaces (IPlayer, IEntity, etc.), handlers, events, abilities, NBT, overlays, GUI, roles, scoreboard |
|
||||||
|
| `core/` | 141 files | 8 controllers (Faction, Transport, Tag, Magic, GlobalData, CategoryManager, APIRegistry, ServerTagMap), 30+ data classes, 40+ enums/constants, 6 utils, network enums |
|
||||||
|
|
||||||
|
### Whitelisted Migration Scope (mc1710 → core/)
|
||||||
|
|
||||||
|
| Package | Files in mc1710 | Already in core/ | Net New |
|
||||||
|
|---------|----------------|-----------------|---------|
|
||||||
|
| `kamkeel/npcs/controllers/` (+ data/) | 89 | ~14 (ability data/enums/profile/telegraph) | ~75 |
|
||||||
|
| `noppes/npcs/controllers/` (+ data/) | 98 | 38 (8 controllers + 30 data classes) | ~60 |
|
||||||
|
| `noppes/npcs/quests/` | 6 | 0 | 6 |
|
||||||
|
| `noppes/npcs/roles/` | 24 | 0 | 24 |
|
||||||
|
| `noppes/npcs/constants/` | 8 | 40 (most already migrated) | ~3 |
|
||||||
|
| `noppes/npcs/util/` | 10 (3 MC-free) | 6 | ~4 |
|
||||||
|
| `noppes/npcs/config/` | 15 | 0 | 15 |
|
||||||
|
| `kamkeel/npcs/network/` | 100+ | 9 (enums only) | **0** (all MC-dependent, skip) |
|
||||||
|
| **TOTAL** | **~350** | **~107** | **~187** |
|
||||||
|
|
||||||
|
### What's NOT in scope (explicitly excluded)
|
||||||
|
|
||||||
|
- `containers/`, `guis/`, `gui/`, `fx/` — Client GUI code
|
||||||
|
- `key/`, `model/`, `renderer/` — Client rendering
|
||||||
|
- Proxies, Event Handlers — Platform-specific lifecycle
|
||||||
|
- `kamkeel/npcs/network/` packets — All MC-dependent (100+ files)
|
||||||
|
- Ability type classes (extend MC Entity) — Stay in mc1710
|
||||||
|
- Script system — Deeply coupled, not planned
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. MC Type Classification Registry
|
||||||
|
|
||||||
|
### Authoritative Source: `mc_type_classifications_original.json`
|
||||||
|
|
||||||
|
This is the **hand-curated** classification of all 400 MC types. The auto-generated `classification_results.json` has inflated counts (46 INTERFACE vs 15, 95 SERVICE vs 12) because it lacks human judgment. **Always use the original.**
|
||||||
|
|
||||||
|
| Category | Count | Action |
|
||||||
|
|----------|-------|--------|
|
||||||
|
| EXISTING | 11 | Symbol-Swap ready — PA interfaces exist |
|
||||||
|
| INTERFACE | 15 | Need new PA interface files |
|
||||||
|
| SERVICE | 12 | Need PlatformService method additions |
|
||||||
|
| TRANSFORM | 10 | Need Static-Transform regex + support classes |
|
||||||
|
| SUPPRESS | 352 | Never abstract — code stays in mc1710 |
|
||||||
|
|
||||||
|
### 1A. EXISTING Types (11) — Symbol-Swap Ready
|
||||||
|
|
||||||
|
These already have PA abstractions. Just run Symbol-Swap.
|
||||||
|
|
||||||
|
| MC Type | PA Type | PA Package | Imports |
|
||||||
|
|---------|---------|------------|---------|
|
||||||
|
| `NBTTagCompound` | `INbt` | `noppes.npcs.api` | 593 |
|
||||||
|
| `EntityPlayer` | `IPlayer` | `noppes.npcs.api.entity` | 551 |
|
||||||
|
| `EntityPlayerMP` | `IPlayer` | `noppes.npcs.api.entity` | 304 |
|
||||||
|
| `Entity` | `IEntity` | `noppes.npcs.api.entity` | 262 |
|
||||||
|
| `ItemStack` | `IItemStack` | `noppes.npcs.api.item` | 228 |
|
||||||
|
| `EntityLivingBase` | `IEntityLivingBase` | `noppes.npcs.api.entity` | 201 |
|
||||||
|
| `World` | `IWorld` | `noppes.npcs.api` | 172 |
|
||||||
|
| `NBTTagList` | `INbtList` | `noppes.npcs.api` | 111 |
|
||||||
|
| `DamageSource` | `IDamageSource` | `noppes.npcs.api` | 36 |
|
||||||
|
| `WorldServer` | `IWorld` | `noppes.npcs.api` | 18 |
|
||||||
|
| `EntityLiving` | `IEntityLiving` | `noppes.npcs.api.entity` | 18 |
|
||||||
|
|
||||||
|
### 1B. INTERFACE Types (15) — Need PA Creation
|
||||||
|
|
||||||
|
New PA interfaces to create in `platform-api/`. Package rule: `net.minecraft.X` → `common.minecraft.X`, `net.minecraftforge.X` → `common.minecraftforge.X`, `cpw.mods.X` → `common.minecraftforge.X`.
|
||||||
|
|
||||||
|
| MC Type | PA Name | New Package | Imports | Priority for Scope |
|
||||||
|
|---------|---------|-------------|---------|-------------------|
|
||||||
|
| `ResourceLocation` | `IResourceLocation` | `common.minecraft.util` | 145 | **HIGH** — controllers, config |
|
||||||
|
| `ICommandSender` | `ICommandSender` | `common.minecraft.command` | 47 | **HIGH** — controllers |
|
||||||
|
| `ChatComponentText` | `ITextComponent` | `common.minecraft.util` | 20 | **HIGH** — controllers (messages) |
|
||||||
|
| `ChatComponentTranslation` | `ITextComponent` | `common.minecraft.util` | 24 | **HIGH** — controllers (messages) |
|
||||||
|
| `IChatComponent` | `ITextComponent` | `common.minecraft.util` | 10 | **HIGH** — base type |
|
||||||
|
| `NBTBase` | `INbtBase` | `common.minecraft.nbt` | 13 | **HIGH** — data classes |
|
||||||
|
| `Configuration` | `IConfiguration` | `common.minecraftforge.common.config` | 9 | **HIGH** — config system |
|
||||||
|
| `Property` | `IConfigProperty` | `common.minecraftforge.common.config` | 7 | **HIGH** — config system |
|
||||||
|
| `AxisAlignedBB` | `IBoundingBox` | `common.minecraft.util` | 59 | **MEDIUM** — some controllers |
|
||||||
|
| `Vec3` | `IVector3` | `common.minecraft.util` | 43 | **MEDIUM** — some controllers |
|
||||||
|
| `MovingObjectPosition` | `IRayTraceResult` | `common.minecraft.util` | 15 | **LOW** — mostly abilities |
|
||||||
|
| `ChatStyle` | `ITextStyle` | `common.minecraft.util` | 3 | **LOW** — text formatting |
|
||||||
|
| `Potion` | `IPotionType` | `common.minecraft.potion` | 7 | **MEDIUM** — effects system |
|
||||||
|
| `PotionEffect` | `IPotionEffect` | `common.minecraft.potion` | 6 | **MEDIUM** — effects system |
|
||||||
|
| `Explosion` | `IExplosion` | `common.minecraft.world` | 3 | **LOW** — abilities only |
|
||||||
|
|
||||||
|
**Filtering required**: Run `type-usage <Type> --scope` on each to confirm they're actually used in the whitelisted packages before creating PAs. Types with LOW scope relevance may be deferred.
|
||||||
|
|
||||||
|
### 1C. SERVICE Types (12) — PlatformService Method Additions
|
||||||
|
|
||||||
|
These are static utilities. Their methods get added to `PlatformService` (or `NBTIO`). No separate files needed — just interface method additions.
|
||||||
|
|
||||||
|
| MC Type | Routes To | Imports | Key Methods | Scope Relevance |
|
||||||
|
|---------|-----------|---------|-------------|-----------------|
|
||||||
|
| `StatCollector` | `PlatformService` | 106 | `translateToLocal()`, `translateToLocalFormatted()` | **HIGH** |
|
||||||
|
| `Item` | `PlatformService` | 72 | `getItemById()`, `getIdFromItem()` | **MEDIUM** |
|
||||||
|
| `MinecraftServer` | `PlatformService` | 26 | `getServer()`, `isDedicatedServer()`, `worldServerForDimension()` | **HIGH** |
|
||||||
|
| `EntityList` | `PlatformService` | 25 | `getEntityString()`, `createEntityByName()` | **MEDIUM** |
|
||||||
|
| `FMLCommonHandler` | `PlatformService` | 25 | `getSide()`, `getEffectiveSide()` | **HIGH** |
|
||||||
|
| `CompressedStreamTools` | `NBTIO` | 24 | `readCompressed()`, `writeCompressed()` | **HIGH** |
|
||||||
|
| `CommandBase` | `PlatformService` | 14 | `parseDouble()`, `parseInt()` | **LOW** |
|
||||||
|
| `Loader` | `PlatformService` | 11 | `isModLoaded()` | **HIGH** |
|
||||||
|
| `I18n` | `PlatformService` | 9 | `format()` | **LOW** (client) |
|
||||||
|
| `DimensionManager` | `PlatformService` | 2 | `getWorld()` | **LOW** |
|
||||||
|
| `PlayerSelector` | `PlatformService` | 2 | `matchPlayers()` | **LOW** |
|
||||||
|
| `NBTUtil` | `NBTIO` | 1 | GameProfile NBT | **LOW** |
|
||||||
|
|
||||||
|
### 1D. TRANSFORM Types (10) — Static-Transform Patterns
|
||||||
|
|
||||||
|
These get handled by regex replacement. Some need support classes created in `core/`.
|
||||||
|
|
||||||
|
| MC Type | Transform Target | Imports | Support Class Needed |
|
||||||
|
|---------|-----------------|---------|---------------------|
|
||||||
|
| `Side` + `SideOnly` | `@ClientOnly`/`@ServerOnly` | 800 | Already exist in platform-api |
|
||||||
|
| `MathHelper` | `ValueUtil.*` / `Math.*` | 98 | `ValueUtil` already in core/ |
|
||||||
|
| `EnumChatFormatting` | `TextFormatting.*` | 19 | **YES** — `TextFormatting` enum in core/ |
|
||||||
|
| `Constants` (Forge NBT) | `NbtConstants.*` | 9 | **YES** — `NbtConstants` class in core/ |
|
||||||
|
| `CommandException` | Same name, new package | 31 | **YES** — `CommandException` in platform-api |
|
||||||
|
| `SharedMonsterAttributes` | `Attributes.*` | 10 | **YES** — `Attributes` constants in core/ |
|
||||||
|
| `EnumFacing` | `Direction.*` | 3 | **YES** — `Direction` enum in core/ |
|
||||||
|
| `ChunkCoordinates` | `BlockPos`/inline | 4 | Uses existing `IPos` |
|
||||||
|
| `EnumAction` | `ItemAction.*` | 11 | **YES** — `ItemAction` enum in core/ |
|
||||||
|
|
||||||
|
**Support classes to create (6):** TextFormatting, NbtConstants, CommandException, Attributes, Direction, ItemAction
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Phase 1 — PA Abstraction Creation
|
||||||
|
|
||||||
|
### Goal
|
||||||
|
Create ALL required PA interfaces and support classes BEFORE copying any files. This ensures Symbol-Swap has targets.
|
||||||
|
|
||||||
|
### Step 1.1: Scope Verification (NEW TOOL)
|
||||||
|
|
||||||
|
Before creating PAs, verify which INTERFACE/SERVICE types are actually used in the whitelisted packages. This prevents creating unused abstractions.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For each INTERFACE type, check if it's used in scope
|
||||||
|
python tools/migration/analyze.py type-usage ResourceLocation --scope noppes/npcs/controllers/ --json
|
||||||
|
python tools/migration/analyze.py type-usage ResourceLocation --scope noppes/npcs/config/ --json
|
||||||
|
python tools/migration/analyze.py type-usage ResourceLocation --scope noppes/npcs/roles/ --json
|
||||||
|
# ... repeat for all types × all packages
|
||||||
|
```
|
||||||
|
|
||||||
|
**⚠️ TOOLING GAP:** This is manual and slow. We need `generate_pa_manifest.py` (see Section 6).
|
||||||
|
|
||||||
|
### Step 1.2: Create INTERFACE PA Files
|
||||||
|
|
||||||
|
Single `pa_batch.py` manifest with ALL INTERFACE PA files. Package mapping:
|
||||||
|
- `net.minecraft.*` → `common.minecraft.*`
|
||||||
|
- `net.minecraftforge.*` → `common.minecraftforge.*`
|
||||||
|
- `cpw.mods.*` → `common.minecraftforge.*`
|
||||||
|
|
||||||
|
**Root:** `platform-api/src/main/java`
|
||||||
|
|
||||||
|
**Manifest structure (example entries):**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"root": "platform-api/src/main/java",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"content": "package common.minecraft.util;\n\npublic interface IResourceLocation {\n String getResourceDomain();\n String getResourcePath();\n String toString();\n}\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "package common.minecraft.util;\n\npublic interface ITextComponent {\n String getText();\n String getFormattedText();\n String getUnformattedText();\n ITextComponent appendSibling(ITextComponent sibling);\n ITextComponent setChatStyle(ITextStyle style);\n}\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "package common.minecraft.nbt;\n\npublic interface INbtBase {\n byte getId();\n INbtBase copy();\n}\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "package common.minecraftforge.common.config;\n\npublic interface IConfiguration {\n IConfigProperty get(String category, String key, String defaultValue, String comment);\n IConfigProperty get(String category, String key, int defaultValue, String comment);\n IConfigProperty get(String category, String key, boolean defaultValue, String comment);\n IConfigProperty get(String category, String key, double defaultValue, String comment);\n void save();\n void load();\n boolean hasKey(String category, String key);\n boolean hasCategory(String category);\n}\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Method content source:** `all_methods_export.json` — this file has EVERY method/field/static for each MC type with usage counts. The manifest generator reads this to include only methods with usage > 0.
|
||||||
|
|
||||||
|
### Step 1.3: Add SERVICE Methods to PlatformService
|
||||||
|
|
||||||
|
For SERVICE types, we add methods to the existing `PlatformService` interface. Use `pa_editor.py` to insert method declarations.
|
||||||
|
|
||||||
|
**Methods to add to `kamkeel/npcs/platform/PlatformService.java`:**
|
||||||
|
|
||||||
|
```java
|
||||||
|
// StatCollector (106 imports)
|
||||||
|
String translateToLocal(String key);
|
||||||
|
String translateToLocalFormatted(String key, Object... args);
|
||||||
|
|
||||||
|
// MinecraftServer (26 imports)
|
||||||
|
boolean isDedicatedServer(); // may already exist
|
||||||
|
Object getServer();
|
||||||
|
IWorld getWorldForDimension(int dimensionId);
|
||||||
|
|
||||||
|
// FMLCommonHandler (25 imports)
|
||||||
|
boolean isPhysicalClient(); // already exists
|
||||||
|
boolean isLogicalClient();
|
||||||
|
|
||||||
|
// Loader (11 imports)
|
||||||
|
boolean isModLoaded(String modId);
|
||||||
|
|
||||||
|
// Item registry (72 imports)
|
||||||
|
IItemStack getItemById(int id);
|
||||||
|
int getIdFromItem(IItemStack item);
|
||||||
|
|
||||||
|
// EntityList (25 imports)
|
||||||
|
String getEntityRegistryName(IEntity entity);
|
||||||
|
IEntity createEntityByName(String name, IWorld world);
|
||||||
|
```
|
||||||
|
|
||||||
|
**Methods to add to `noppes/npcs/platform/nbt/NBTIO.java`:**
|
||||||
|
|
||||||
|
```java
|
||||||
|
// CompressedStreamTools (24 imports) — may already exist
|
||||||
|
INbt readCompressed(java.io.InputStream stream);
|
||||||
|
void writeCompressed(INbt nbt, java.io.OutputStream stream);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 1.4: Create TRANSFORM Support Classes
|
||||||
|
|
||||||
|
These go into `core/src/main/java/` (they're platform-independent).
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"root": "core/src/main/java",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"content": "package noppes.npcs.constants;\n\npublic class TextFormatting {\n public static final String BLACK = \"\\u00a70\";\n public static final String DARK_BLUE = \"\\u00a71\";\n public static final String DARK_GREEN = \"\\u00a72\";\n public static final String DARK_AQUA = \"\\u00a73\";\n public static final String DARK_RED = \"\\u00a74\";\n public static final String DARK_PURPLE = \"\\u00a75\";\n public static final String GOLD = \"\\u00a76\";\n public static final String GRAY = \"\\u00a77\";\n public static final String DARK_GRAY = \"\\u00a78\";\n public static final String BLUE = \"\\u00a79\";\n public static final String GREEN = \"\\u00a7a\";\n public static final String AQUA = \"\\u00a7b\";\n public static final String RED = \"\\u00a7c\";\n public static final String LIGHT_PURPLE = \"\\u00a7d\";\n public static final String YELLOW = \"\\u00a7e\";\n public static final String WHITE = \"\\u00a7f\";\n public static final String OBFUSCATED = \"\\u00a7k\";\n public static final String BOLD = \"\\u00a7l\";\n public static final String STRIKETHROUGH = \"\\u00a7m\";\n public static final String UNDERLINE = \"\\u00a7n\";\n public static final String ITALIC = \"\\u00a7o\";\n public static final String RESET = \"\\u00a7r\";\n}\n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"content": "package noppes.npcs.constants;\n\npublic class NbtConstants {\n public static final int TAG_END = 0;\n public static final int TAG_BYTE = 1;\n public static final int TAG_SHORT = 2;\n public static final int TAG_INT = 3;\n public static final int TAG_LONG = 4;\n public static final int TAG_FLOAT = 5;\n public static final int TAG_DOUBLE = 6;\n public static final int TAG_BYTE_ARRAY = 7;\n public static final int TAG_STRING = 8;\n public static final int TAG_LIST = 9;\n public static final int TAG_COMPOUND = 10;\n public static final int TAG_INT_ARRAY = 11;\n}\n"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Additional support classes: `CommandException`, `Attributes`, `Direction`, `ItemAction` — all simple enums/classes with no MC dependencies.
|
||||||
|
|
||||||
|
### Step 1.5: Execution Sequence
|
||||||
|
|
||||||
|
```
|
||||||
|
1. Write PA INTERFACE manifest → pa_batch.py --dry-run → pa_batch.py --force
|
||||||
|
2. Edit PlatformService with SERVICE methods → pa_editor.py --force
|
||||||
|
3. Write TRANSFORM support class manifest → pa_batch.py --force
|
||||||
|
4. Verify: ls platform-api/src/main/java/common/ — confirm structure
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Phase 2 — Core File Copy
|
||||||
|
|
||||||
|
### Goal
|
||||||
|
Copy all files from whitelisted mc1710 packages to core/, following import dependencies within scope.
|
||||||
|
|
||||||
|
### Step 2.1: Build the Sources List
|
||||||
|
|
||||||
|
Every `.java` file in the whitelisted packages that is NOT already in core/.
|
||||||
|
|
||||||
|
**Initial Sources** (explicit files to copy — the roots of the recursion):
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# noppes/npcs/controllers/ — files NOT already in core/
|
||||||
|
$controllerSources = @(
|
||||||
|
'noppes/npcs/controllers/QuestController.java',
|
||||||
|
'noppes/npcs/controllers/PlayerQuestController.java',
|
||||||
|
'noppes/npcs/controllers/PlayerDataController.java',
|
||||||
|
'noppes/npcs/controllers/DialogController.java',
|
||||||
|
'noppes/npcs/controllers/LinkedItemController.java',
|
||||||
|
'noppes/npcs/controllers/LinkedNpcController.java',
|
||||||
|
'noppes/npcs/controllers/PartyController.java',
|
||||||
|
'noppes/npcs/controllers/AuctionController.java',
|
||||||
|
'noppes/npcs/controllers/CustomEffectController.java',
|
||||||
|
'noppes/npcs/controllers/CustomGuiController.java',
|
||||||
|
'noppes/npcs/controllers/BankController.java',
|
||||||
|
'noppes/npcs/controllers/ChunkController.java',
|
||||||
|
'noppes/npcs/controllers/RecipeController.java',
|
||||||
|
'noppes/npcs/controllers/SpawnController.java',
|
||||||
|
'noppes/npcs/controllers/ServerCloneController.java',
|
||||||
|
'noppes/npcs/controllers/ScriptController.java',
|
||||||
|
'noppes/npcs/controllers/ScriptHookController.java',
|
||||||
|
'noppes/npcs/controllers/AnimationController.java',
|
||||||
|
'noppes/npcs/controllers/MarketRegistry.java',
|
||||||
|
'noppes/npcs/controllers/HookDefinition.java'
|
||||||
|
# ... + ALL data/* files not already in core/
|
||||||
|
)
|
||||||
|
|
||||||
|
# noppes/npcs/quests/ — all 6 files
|
||||||
|
$questSources = @(
|
||||||
|
'noppes/npcs/quests/QuestItem.java',
|
||||||
|
'noppes/npcs/quests/QuestKill.java',
|
||||||
|
'noppes/npcs/quests/QuestLocation.java',
|
||||||
|
'noppes/npcs/quests/QuestDialog.java',
|
||||||
|
'noppes/npcs/quests/QuestManual.java',
|
||||||
|
'noppes/npcs/quests/QuestInterface.java'
|
||||||
|
)
|
||||||
|
|
||||||
|
# noppes/npcs/roles/ — all 24 files
|
||||||
|
$roleSources = @(
|
||||||
|
'noppes/npcs/roles/RoleTrader.java',
|
||||||
|
'noppes/npcs/roles/RoleBank.java',
|
||||||
|
'noppes/npcs/roles/RoleFollower.java',
|
||||||
|
'noppes/npcs/roles/RoleCompanion.java',
|
||||||
|
# ... all 24 files
|
||||||
|
)
|
||||||
|
|
||||||
|
# noppes/npcs/config/ — all 15 files
|
||||||
|
$configSources = @(
|
||||||
|
'noppes/npcs/config/ConfigMain.java',
|
||||||
|
'noppes/npcs/config/ConfigClient.java',
|
||||||
|
'noppes/npcs/config/ConfigScript.java',
|
||||||
|
'noppes/npcs/config/ConfigMarket.java',
|
||||||
|
'noppes/npcs/config/ConfigEnergy.java',
|
||||||
|
'noppes/npcs/config/ConfigItem.java',
|
||||||
|
'noppes/npcs/config/ConfigDebug.java',
|
||||||
|
'noppes/npcs/config/ConfigExperimental.java',
|
||||||
|
'noppes/npcs/config/ConfigMixin.java',
|
||||||
|
'noppes/npcs/config/LoadConfiguration.java',
|
||||||
|
'noppes/npcs/config/StringCache.java',
|
||||||
|
'noppes/npcs/config/GlyphCache.java',
|
||||||
|
'noppes/npcs/config/legacy/LegacyLoader.java',
|
||||||
|
'noppes/npcs/config/legacy/LegacyConfig.java',
|
||||||
|
'noppes/npcs/config/legacy/ConfigProp.java'
|
||||||
|
)
|
||||||
|
|
||||||
|
# MC-free util files only
|
||||||
|
$utilSources = @(
|
||||||
|
'noppes/npcs/util/GameProfileAlt.java',
|
||||||
|
'noppes/npcs/util/JsonException.java',
|
||||||
|
'noppes/npcs/util/ScriptToStringHelper.java'
|
||||||
|
)
|
||||||
|
|
||||||
|
# kamkeel/npcs/controllers/ — files NOT already in core/
|
||||||
|
$kamkeelSources = @(
|
||||||
|
'kamkeel/npcs/controllers/AbilityController.java',
|
||||||
|
'kamkeel/npcs/controllers/EnergyController.java',
|
||||||
|
'kamkeel/npcs/controllers/ProfileController.java',
|
||||||
|
'kamkeel/npcs/controllers/AttributeController.java',
|
||||||
|
'kamkeel/npcs/controllers/TelegraphController.java',
|
||||||
|
'kamkeel/npcs/controllers/SyncController.java'
|
||||||
|
# ... + data/* files not already in core/
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2.2: AllowPaths & AllowRecursePaths
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$AllowPaths = @(
|
||||||
|
'noppes/npcs/controllers/',
|
||||||
|
'noppes/npcs/quests/',
|
||||||
|
'noppes/npcs/roles/',
|
||||||
|
'noppes/npcs/constants/',
|
||||||
|
'noppes/npcs/util/',
|
||||||
|
'noppes/npcs/config/',
|
||||||
|
'kamkeel/npcs/controllers/',
|
||||||
|
'kamkeel/npcs/util/',
|
||||||
|
'kamkeel/npcs/config/'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Only recurse into these — prevent explosion into entity/client/network
|
||||||
|
$AllowRecursePaths = @(
|
||||||
|
'noppes/npcs/controllers/',
|
||||||
|
'noppes/npcs/quests/',
|
||||||
|
'noppes/npcs/roles/',
|
||||||
|
'noppes/npcs/constants/',
|
||||||
|
'noppes/npcs/config/',
|
||||||
|
'kamkeel/npcs/controllers/'
|
||||||
|
)
|
||||||
|
# util/ is in AllowPaths but NOT AllowRecursePaths — files get copied but imports aren't chased
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2.3: Execute
|
||||||
|
|
||||||
|
**IMPORTANT:** `McRoot` defaults to `mc1710/src/main/java` but current code lives at `src/main/java`. Override required.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Copy-Recursive `
|
||||||
|
-Sources ($controllerSources + $questSources + $roleSources + $configSources + $utilSources + $kamkeelSources) `
|
||||||
|
-AllowPaths $AllowPaths `
|
||||||
|
-AllowRecursePaths $AllowRecursePaths `
|
||||||
|
-McRoot 'src/main/java'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected output:** ~150-187 files copied to `core/src/main/java/`.
|
||||||
|
|
||||||
|
### Step 2.4: What Copy-Recursive Will Skip
|
||||||
|
|
||||||
|
Files already in core/ will be reported as EXISTS (not re-copied). Files outside AllowPaths will be reported as SKIPPED. This is correct behavior.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Phase 3 — Symbol Replacement
|
||||||
|
|
||||||
|
### Goal
|
||||||
|
Replace every MC/Forge type reference in core/ with PA abstractions.
|
||||||
|
|
||||||
|
### Step 3.1: Nuke-Imports (first)
|
||||||
|
|
||||||
|
Remove all MC/Forge/platform-specific imports from core/.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Nuke-Imports -Directory 'core/src/main/java' -ForbiddenPrefixes @(
|
||||||
|
'net.minecraft.',
|
||||||
|
'cpw.mods.',
|
||||||
|
'net.minecraftforge.',
|
||||||
|
'noppes.npcs.entity.',
|
||||||
|
'noppes.npcs.client.',
|
||||||
|
'noppes.npcs.mixin.',
|
||||||
|
'kamkeel.npcs.network.',
|
||||||
|
'kamkeel.npcs.entity.',
|
||||||
|
'noppes.npcs.containers.',
|
||||||
|
'noppes.npcs.scripted.',
|
||||||
|
'noppes.npcs.janino.',
|
||||||
|
'noppes.npcs.wrapper.',
|
||||||
|
'noppes.npcs.blocks.',
|
||||||
|
'noppes.npcs.items.',
|
||||||
|
'noppes.npcs.ai.'
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.2: Symbol-Swap — EXISTING Types (11)
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Symbol-Swap -Directory 'core/src/main/java' -Swaps @(
|
||||||
|
@('NBTTagCompound', 'INbt', 'net.minecraft.nbt.NBTTagCompound', 'noppes.npcs.api.INbt'),
|
||||||
|
@('NBTTagList', 'INbtList', 'net.minecraft.nbt.NBTTagList', 'noppes.npcs.api.INbtList'),
|
||||||
|
@('EntityPlayer', 'IPlayer', 'net.minecraft.entity.player.EntityPlayer', 'noppes.npcs.api.entity.IPlayer'),
|
||||||
|
@('EntityPlayerMP', 'IPlayer', 'net.minecraft.entity.player.EntityPlayerMP', 'noppes.npcs.api.entity.IPlayer'),
|
||||||
|
@('Entity', 'IEntity', 'net.minecraft.entity.Entity', 'noppes.npcs.api.entity.IEntity'),
|
||||||
|
@('ItemStack', 'IItemStack', 'net.minecraft.item.ItemStack', 'noppes.npcs.api.item.IItemStack'),
|
||||||
|
@('EntityLivingBase', 'IEntityLivingBase', 'net.minecraft.entity.EntityLivingBase', 'noppes.npcs.api.entity.IEntityLivingBase'),
|
||||||
|
@('World', 'IWorld', 'net.minecraft.world.World', 'noppes.npcs.api.IWorld'),
|
||||||
|
@('WorldServer', 'IWorld', 'net.minecraft.world.WorldServer', 'noppes.npcs.api.IWorld'),
|
||||||
|
@('DamageSource', 'IDamageSource', 'net.minecraft.util.DamageSource', 'noppes.npcs.api.IDamageSource'),
|
||||||
|
@('EntityLiving', 'IEntityLiving', 'net.minecraft.entity.EntityLiving', 'noppes.npcs.api.entity.IEntityLiving')
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.3: Symbol-Swap — NEW INTERFACE Types
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Symbol-Swap -Directory 'core/src/main/java' -Swaps @(
|
||||||
|
@('ResourceLocation', 'IResourceLocation', 'net.minecraft.util.ResourceLocation', 'common.minecraft.util.IResourceLocation'),
|
||||||
|
@('ICommandSender', 'ICommandSender', 'net.minecraft.command.ICommandSender', 'common.minecraft.command.ICommandSender'),
|
||||||
|
@('ChatComponentText', 'ITextComponent', 'net.minecraft.util.ChatComponentText', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('ChatComponentTranslation', 'ITextComponent', 'net.minecraft.util.ChatComponentTranslation', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('IChatComponent', 'ITextComponent', 'net.minecraft.util.IChatComponent', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('ChatStyle', 'ITextStyle', 'net.minecraft.util.ChatStyle', 'common.minecraft.util.ITextStyle'),
|
||||||
|
@('NBTBase', 'INbtBase', 'net.minecraft.nbt.NBTBase', 'common.minecraft.nbt.INbtBase'),
|
||||||
|
@('Configuration', 'IConfiguration', 'net.minecraftforge.common.config.Configuration', 'common.minecraftforge.common.config.IConfiguration'),
|
||||||
|
@('Property', 'IConfigProperty', 'net.minecraftforge.common.config.Property', 'common.minecraftforge.common.config.IConfigProperty'),
|
||||||
|
@('AxisAlignedBB', 'IBoundingBox', 'net.minecraft.util.AxisAlignedBB', 'common.minecraft.util.IBoundingBox'),
|
||||||
|
@('Vec3', 'IVector3', 'net.minecraft.util.Vec3', 'common.minecraft.util.IVector3'),
|
||||||
|
@('MovingObjectPosition', 'IRayTraceResult', 'net.minecraft.util.MovingObjectPosition', 'common.minecraft.util.IRayTraceResult'),
|
||||||
|
@('Potion', 'IPotionType', 'net.minecraft.potion.Potion', 'common.minecraft.potion.IPotionType'),
|
||||||
|
@('PotionEffect', 'IPotionEffect', 'net.minecraft.potion.PotionEffect', 'common.minecraft.potion.IPotionEffect'),
|
||||||
|
@('Explosion', 'IExplosion', 'net.minecraft.world.Explosion', 'common.minecraft.world.IExplosion')
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.4: Static-Transform — SERVICE Rerouting
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Static-Transform -Directory 'core/src/main/java' -Transforms @(
|
||||||
|
# NBT constructors
|
||||||
|
@('new\s+NBTTagCompound\s*\(\)', 'NBT.compound()'),
|
||||||
|
@('new\s+NBTTagList\s*\(\)', 'NBT.list()'),
|
||||||
|
|
||||||
|
# CompressedStreamTools → NBTIO
|
||||||
|
@('CompressedStreamTools\.readCompressed\s*\(([^)]+)\)', 'NBTIO.readCompressed($1)'),
|
||||||
|
@('CompressedStreamTools\.writeCompressed\s*\(([^,]+),\s*([^)]+)\)', 'NBTIO.writeCompressed($1, $2)'),
|
||||||
|
|
||||||
|
# StatCollector → PlatformServiceHolder
|
||||||
|
@('StatCollector\.translateToLocal\s*\(([^)]+)\)', 'PlatformServiceHolder.get().translateToLocal($1)'),
|
||||||
|
@('StatCollector\.translateToLocalFormatted\s*\(([^)]+)\)', 'PlatformServiceHolder.get().translateToLocalFormatted($1)'),
|
||||||
|
|
||||||
|
# MinecraftServer
|
||||||
|
@('MinecraftServer\.getServer\s*\(\)', 'PlatformServiceHolder.get().getServer()'),
|
||||||
|
|
||||||
|
# FMLCommonHandler
|
||||||
|
@('FMLCommonHandler\.instance\(\)\.getSide\(\)\s*==\s*Side\.CLIENT', 'PlatformServiceHolder.get().isPhysicalClient()'),
|
||||||
|
@('FMLCommonHandler\.instance\(\)\.getEffectiveSide\(\)\s*==\s*Side\.CLIENT', 'PlatformServiceHolder.get().isLogicalClient()'),
|
||||||
|
|
||||||
|
# Loader
|
||||||
|
@('Loader\.isModLoaded\s*\(([^)]+)\)', 'PlatformServiceHolder.get().isModLoaded($1)'),
|
||||||
|
|
||||||
|
# MathHelper
|
||||||
|
@('MathHelper\.clamp_int\s*\(', 'ValueUtil.clampInt('),
|
||||||
|
@('MathHelper\.clamp_float\s*\(', 'ValueUtil.clampFloat('),
|
||||||
|
@('MathHelper\.clamp_double\s*\(', 'ValueUtil.clampDouble('),
|
||||||
|
@('MathHelper\.sqrt_double\s*\(', 'Math.sqrt('),
|
||||||
|
@('MathHelper\.sqrt_float\s*\(', '(float)Math.sqrt('),
|
||||||
|
@('MathHelper\.floor_double\s*\(', 'ValueUtil.floorDouble('),
|
||||||
|
@('MathHelper\.floor_float\s*\(', 'ValueUtil.floorFloat('),
|
||||||
|
@('MathHelper\.sin\s*\(', '(float)Math.sin('),
|
||||||
|
@('MathHelper\.cos\s*\(', '(float)Math.cos('),
|
||||||
|
@('MathHelper\.abs\s*\(', 'Math.abs('),
|
||||||
|
|
||||||
|
# EnumChatFormatting
|
||||||
|
@('EnumChatFormatting\.', 'TextFormatting.'),
|
||||||
|
|
||||||
|
# Constants.NBT
|
||||||
|
@('Constants\.NBT\.', 'NbtConstants.'),
|
||||||
|
|
||||||
|
# SharedMonsterAttributes
|
||||||
|
@('SharedMonsterAttributes\.maxHealth', 'Attributes.MAX_HEALTH'),
|
||||||
|
@('SharedMonsterAttributes\.movementSpeed', 'Attributes.MOVEMENT_SPEED'),
|
||||||
|
@('SharedMonsterAttributes\.attackDamage', 'Attributes.ATTACK_DAMAGE'),
|
||||||
|
@('SharedMonsterAttributes\.followRange', 'Attributes.FOLLOW_RANGE'),
|
||||||
|
@('SharedMonsterAttributes\.knockbackResistance', 'Attributes.KNOCKBACK_RESISTANCE'),
|
||||||
|
|
||||||
|
# Annotations
|
||||||
|
@('@SideOnly\s*\(\s*Side\.CLIENT\s*\)', '@ClientOnly'),
|
||||||
|
@('@SideOnly\s*\(\s*Side\.SERVER\s*\)', '@ServerOnly')
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.5: Generate-Stubs
|
||||||
|
|
||||||
|
Classes that will be referenced but aren't in scope. These are TEMPORARY placeholders.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Generate-Stubs -Stubs @(
|
||||||
|
@{ pkg='noppes.npcs'; name='CustomNpcs'; type='class';
|
||||||
|
body=' public static java.io.File Dir = new java.io.File(".");
|
||||||
|
public static int DefaultInteractLine = 0;
|
||||||
|
public static java.util.logging.Logger logger;' },
|
||||||
|
@{ pkg='noppes.npcs'; name='EventHooks'; type='class';
|
||||||
|
body=' // STUB - event dispatch stays in mc1710' },
|
||||||
|
@{ pkg='noppes.npcs'; name='LogWriter'; type='class';
|
||||||
|
body=' public static void info(String msg) {}
|
||||||
|
public static void warn(String msg) {}
|
||||||
|
public static void error(String msg) {}
|
||||||
|
public static void error(String msg, Throwable e) {}' },
|
||||||
|
@{ pkg='noppes.npcs.controllers'; name='SyncController'; type='class';
|
||||||
|
body=' // STUB - sync stays in mc1710' },
|
||||||
|
@{ pkg='noppes.npcs.entity'; name='EntityNPCInterface'; type='class';
|
||||||
|
body=' // STUB - entity stays in mc1710' }
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.6: Dedupe-Imports
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Dedupe-Imports -Directory 'core/src/main/java'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3.7: All-in-One Wave Script
|
||||||
|
|
||||||
|
**All steps 3.1–3.6 go into a single `.ps1` file:**
|
||||||
|
|
||||||
|
```
|
||||||
|
tools/migration/wave1_core_extraction.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
Execute:
|
||||||
|
```bash
|
||||||
|
powershell -ExecutionPolicy Bypass -File "tools/migration/wave1_core_extraction.ps1"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Phase 4 — Verification & Stabilization
|
||||||
|
|
||||||
|
### Goal
|
||||||
|
Get `:core:compileJava` to pass. Diagnose and fix all errors categorically.
|
||||||
|
|
||||||
|
### Step 4.1: Initial Build-Report
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
Build-Report -GradleTask ':core:compileJava' -MaxSamples 10
|
||||||
|
```
|
||||||
|
|
||||||
|
**Expected error categories and fixes:**
|
||||||
|
|
||||||
|
| Category | Likely Cause | Fix |
|
||||||
|
|----------|-------------|-----|
|
||||||
|
| `MISSING_PACKAGE` | Leftover MC import Nuke-Imports missed | Re-run Nuke with expanded prefixes |
|
||||||
|
| `MISSING_CLASS` | Transitive dep not in scope | Generate-Stubs |
|
||||||
|
| `MISSING_METHOD` | PA interface missing method | Add method to PA interface via pa_editor |
|
||||||
|
| `TYPE_MISMATCH` | Wrong PA type used | Check Symbol-Swap mapping |
|
||||||
|
| `BAD_ARGS` | Method signature changed | Static-Transform or manual fix |
|
||||||
|
| `ABSTRACT_VIOLATION` | Class implements MC interface | Remove `implements` or stub |
|
||||||
|
|
||||||
|
### Step 4.2: Batch migration-diff
|
||||||
|
|
||||||
|
Run `migration-diff` on ALL copied files to verify completeness:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For each migrated file:
|
||||||
|
python tools/migration/analyze.py migration-diff \
|
||||||
|
--old src/main/java/noppes/npcs/controllers/QuestController.java \
|
||||||
|
--new core/src/main/java/noppes/npcs/controllers/QuestController.java \
|
||||||
|
--json
|
||||||
|
```
|
||||||
|
|
||||||
|
**⚠️ TOOLING GAP:** No batch migration-diff exists. Need to script a loop or build `batch_migration_diff.py`.
|
||||||
|
|
||||||
|
### Step 4.3: Store Diagnostic Cache
|
||||||
|
|
||||||
|
All outputs cached in JSON for easy navigation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build report
|
||||||
|
python tools/migration/analyze.py coverage-report --json > tools/migration/_wave1_coverage.json
|
||||||
|
|
||||||
|
# All migration-diff results
|
||||||
|
python tools/migration/_batch_migration_diff.py --output tools/migration/_wave1_diffs.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4.4: Fix Cycle
|
||||||
|
|
||||||
|
```
|
||||||
|
WHILE build fails:
|
||||||
|
1. Build-Report → categorize errors
|
||||||
|
2. MISSING_PACKAGE → Nuke-Imports (add new prefixes)
|
||||||
|
3. MISSING_CLASS → Generate-Stubs OR Create-And-Propagate (if PA needed)
|
||||||
|
4. MISSING_METHOD → pa_editor (add to PA) OR Static-Transform (rename)
|
||||||
|
5. TYPE_MISMATCH → Symbol-Swap (fix mapping) OR manual cast
|
||||||
|
6. Dedupe-Imports
|
||||||
|
7. Build-Report → verify error count dropped
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4.5: Final Verification
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build must pass
|
||||||
|
./gradlew :core:compileJava
|
||||||
|
|
||||||
|
# Coverage should improve significantly
|
||||||
|
python tools/migration/analyze.py coverage-report --detailed
|
||||||
|
|
||||||
|
# mc1710 build must also still pass
|
||||||
|
./gradlew build
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Missing Tools — Build Before Execution
|
||||||
|
|
||||||
|
### 6A. `generate_pa_manifest.py` (HIGH PRIORITY)
|
||||||
|
|
||||||
|
**Purpose:** Bridge the gap between analysis data → executable pa_batch manifest.
|
||||||
|
|
||||||
|
**Input:**
|
||||||
|
- `mc_type_classifications_original.json` — which types need PAs
|
||||||
|
- `all_methods_export.json` — what methods each type has
|
||||||
|
- `mc_usage_index.json` — which files use which types
|
||||||
|
- Package scope filter — list of package prefixes to restrict to
|
||||||
|
|
||||||
|
**Output:**
|
||||||
|
- `pa_batch` manifest JSON with complete Java interface/class content
|
||||||
|
- Swap table (old → new symbol mappings) for Symbol-Swap
|
||||||
|
- Static-Transform pattern list for SERVICE types
|
||||||
|
|
||||||
|
**Key behavior:**
|
||||||
|
1. Read classifications, filter to INTERFACE types
|
||||||
|
2. For each INTERFACE type, filter to types used in specified packages (via usage index)
|
||||||
|
3. For each filtered type, read methods from `all_methods_export.json`
|
||||||
|
4. Generate Java interface content with correct package mapping:
|
||||||
|
- `net.minecraft.X` → `common.minecraft.X`
|
||||||
|
- `net.minecraftforge.X` → `common.minecraftforge.X`
|
||||||
|
- `cpw.mods.X` → `common.minecraftforge.X`
|
||||||
|
5. Output pa_batch manifest JSON
|
||||||
|
|
||||||
|
**Estimated development time:** 2-3 hours
|
||||||
|
|
||||||
|
**Why this is critical:** Without it, composing the manifest for ~15-20 PA interfaces is manual and error-prone. Each interface needs the RIGHT methods (from all_methods_export), the RIGHT package, and the RIGHT imports. This tool automates the entire process.
|
||||||
|
|
||||||
|
### 6B. `batch_migration_diff.py` (MEDIUM PRIORITY)
|
||||||
|
|
||||||
|
**Purpose:** Run `migration-diff` on ALL migrated files in one command, output unified JSON.
|
||||||
|
|
||||||
|
**Input:**
|
||||||
|
- Source root (mc1710 path)
|
||||||
|
- Target root (core path)
|
||||||
|
- List of migrated file paths (or auto-discover by comparing directories)
|
||||||
|
|
||||||
|
**Output:**
|
||||||
|
- JSON with per-file PASS/WARN/FAIL verdicts
|
||||||
|
- Aggregate statistics
|
||||||
|
- Cached for agent navigation
|
||||||
|
|
||||||
|
**Estimated development time:** 1-2 hours
|
||||||
|
|
||||||
|
### 6C. `generate_wave_script.py` (LOW PRIORITY — nice to have)
|
||||||
|
|
||||||
|
**Purpose:** Auto-generate the complete `.ps1` wave script from classification data.
|
||||||
|
|
||||||
|
**Input:**
|
||||||
|
- Type classifications
|
||||||
|
- Package scope
|
||||||
|
- Phase parameters
|
||||||
|
|
||||||
|
**Output:**
|
||||||
|
- Complete `.ps1` file with Copy-Recursive + Nuke + Swap + Transform + Stubs + Dedupe + Build
|
||||||
|
|
||||||
|
**Estimated development time:** 2-3 hours
|
||||||
|
|
||||||
|
**Why low priority:** The wave script can be composed manually from the plan. Automation saves time on FUTURE waves but is not blocking for Wave 1.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Execution Checklist
|
||||||
|
|
||||||
|
### Pre-Flight
|
||||||
|
|
||||||
|
- [ ] **Tool development:** Build `generate_pa_manifest.py`
|
||||||
|
- [ ] **Scope verification:** Run `type-usage` for each INTERFACE/SERVICE type against whitelisted packages
|
||||||
|
- [ ] **Confirm existing PAs:** Verify all 11 EXISTING types have complete PA interfaces (run `surface-miner --compare-existing`)
|
||||||
|
- [ ] **Git clean state:** Ensure working tree is clean before starting
|
||||||
|
|
||||||
|
### Phase 1 Execution
|
||||||
|
|
||||||
|
- [ ] Generate PA manifest via `generate_pa_manifest.py`
|
||||||
|
- [ ] Dry-run: `pa_batch.py manifest.json --dry-run`
|
||||||
|
- [ ] Create PAs: `pa_batch.py manifest.json --force`
|
||||||
|
- [ ] Edit PlatformService with SERVICE methods: `pa_editor.py`
|
||||||
|
- [ ] Create TRANSFORM support classes: `pa_batch.py`
|
||||||
|
- [ ] Verify: `ls platform-api/src/main/java/common/`
|
||||||
|
|
||||||
|
### Phase 2 Execution
|
||||||
|
|
||||||
|
- [ ] Write wave script with Copy-Recursive params
|
||||||
|
- [ ] Execute: Copy ~150-187 files to core/
|
||||||
|
- [ ] Verify: count files in core/ (should increase by ~150)
|
||||||
|
|
||||||
|
### Phase 3 Execution
|
||||||
|
|
||||||
|
- [ ] Execute wave script (Nuke + Swap + Transform + Stubs + Dedupe)
|
||||||
|
- [ ] Initial Build-Report
|
||||||
|
|
||||||
|
### Phase 4 Execution
|
||||||
|
|
||||||
|
- [ ] Fix cycle until `:core:compileJava` passes
|
||||||
|
- [ ] Run batch migration-diff
|
||||||
|
- [ ] Store diagnostic cache
|
||||||
|
- [ ] Run `coverage-report` — measure improvement
|
||||||
|
- [ ] Verify mc1710 build still passes: `./gradlew build`
|
||||||
|
- [ ] **Human commits** (agent does NOT commit)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Risk Assessment
|
||||||
|
|
||||||
|
| Risk | Impact | Mitigation |
|
||||||
|
|------|--------|------------|
|
||||||
|
| Script system files copied (deeply MC-coupled) | Build explosion | AllowRecursePaths prevents recursion into script packages |
|
||||||
|
| Symbol-Swap replaces too aggressively (e.g., `Entity` → `IEntity` in non-type contexts) | Broken code | Word-boundary regex in Symbol-Swap handles this. Verify with migration-diff. |
|
||||||
|
| Some controllers have too many MC deps to clean up | Phase 3 stalls | Generate-Stubs for anything not in scope. Fix cycle handles residuals. |
|
||||||
|
| Config system needs Forge Configuration deeply | Config files can't compile | IConfiguration PA must match Forge API surface closely. Use surface-miner to verify. |
|
||||||
|
| Role/Quest files reference EntityNPCInterface | Missing stubs | Generate-Stubs for EntityNPCInterface. Core version is a placeholder. |
|
||||||
|
| Copy-Recursive pulls in too many transitive deps | Scope explosion | AllowPaths + AllowRecursePaths constrain the recursion tightly |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Success Criteria
|
||||||
|
|
||||||
|
| Metric | Before | Target |
|
||||||
|
|--------|--------|--------|
|
||||||
|
| Files in core/ | 141 | ~290-330 |
|
||||||
|
| PA type coverage (types with abstractions) | 11/400 (2.8%) | ~30/400 (7.5%) |
|
||||||
|
| PA import coverage (imports to abstracted types) | 37.1% | ~55-60% |
|
||||||
|
| `:core:compileJava` | PASS | PASS |
|
||||||
|
| `:build` (mc1710) | PASS | PASS |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix A: Complete Swap Table
|
||||||
|
|
||||||
|
This is the full `-Swaps` parameter for Symbol-Swap, combining EXISTING + new INTERFACE types.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$AllSwaps = @(
|
||||||
|
# === EXISTING (11) ===
|
||||||
|
@('NBTTagCompound', 'INbt', 'net.minecraft.nbt.NBTTagCompound', 'noppes.npcs.api.INbt'),
|
||||||
|
@('NBTTagList', 'INbtList', 'net.minecraft.nbt.NBTTagList', 'noppes.npcs.api.INbtList'),
|
||||||
|
@('EntityPlayer', 'IPlayer', 'net.minecraft.entity.player.EntityPlayer', 'noppes.npcs.api.entity.IPlayer'),
|
||||||
|
@('EntityPlayerMP', 'IPlayer', 'net.minecraft.entity.player.EntityPlayerMP', 'noppes.npcs.api.entity.IPlayer'),
|
||||||
|
@('Entity', 'IEntity', 'net.minecraft.entity.Entity', 'noppes.npcs.api.entity.IEntity'),
|
||||||
|
@('ItemStack', 'IItemStack', 'net.minecraft.item.ItemStack', 'noppes.npcs.api.item.IItemStack'),
|
||||||
|
@('EntityLivingBase', 'IEntityLivingBase', 'net.minecraft.entity.EntityLivingBase', 'noppes.npcs.api.entity.IEntityLivingBase'),
|
||||||
|
@('World', 'IWorld', 'net.minecraft.world.World', 'noppes.npcs.api.IWorld'),
|
||||||
|
@('WorldServer', 'IWorld', 'net.minecraft.world.WorldServer', 'noppes.npcs.api.IWorld'),
|
||||||
|
@('DamageSource', 'IDamageSource', 'net.minecraft.util.DamageSource', 'noppes.npcs.api.IDamageSource'),
|
||||||
|
@('EntityLiving', 'IEntityLiving', 'net.minecraft.entity.EntityLiving', 'noppes.npcs.api.entity.IEntityLiving'),
|
||||||
|
|
||||||
|
# === NEW INTERFACE (15) ===
|
||||||
|
@('ResourceLocation', 'IResourceLocation', 'net.minecraft.util.ResourceLocation', 'common.minecraft.util.IResourceLocation'),
|
||||||
|
@('ICommandSender', 'ICommandSender', 'net.minecraft.command.ICommandSender', 'common.minecraft.command.ICommandSender'),
|
||||||
|
@('ChatComponentText', 'ITextComponent', 'net.minecraft.util.ChatComponentText', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('ChatComponentTranslation', 'ITextComponent', 'net.minecraft.util.ChatComponentTranslation', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('IChatComponent', 'ITextComponent', 'net.minecraft.util.IChatComponent', 'common.minecraft.util.ITextComponent'),
|
||||||
|
@('ChatStyle', 'ITextStyle', 'net.minecraft.util.ChatStyle', 'common.minecraft.util.ITextStyle'),
|
||||||
|
@('NBTBase', 'INbtBase', 'net.minecraft.nbt.NBTBase', 'common.minecraft.nbt.INbtBase'),
|
||||||
|
@('Configuration', 'IConfiguration', 'net.minecraftforge.common.config.Configuration', 'common.minecraftforge.common.config.IConfiguration'),
|
||||||
|
@('Property', 'IConfigProperty', 'net.minecraftforge.common.config.Property', 'common.minecraftforge.common.config.IConfigProperty'),
|
||||||
|
@('AxisAlignedBB', 'IBoundingBox', 'net.minecraft.util.AxisAlignedBB', 'common.minecraft.util.IBoundingBox'),
|
||||||
|
@('Vec3', 'IVector3', 'net.minecraft.util.Vec3', 'common.minecraft.util.IVector3'),
|
||||||
|
@('MovingObjectPosition', 'IRayTraceResult', 'net.minecraft.util.MovingObjectPosition', 'common.minecraft.util.IRayTraceResult'),
|
||||||
|
@('Potion', 'IPotionType', 'net.minecraft.potion.Potion', 'common.minecraft.potion.IPotionType'),
|
||||||
|
@('PotionEffect', 'IPotionEffect', 'net.minecraft.potion.PotionEffect', 'common.minecraft.potion.IPotionEffect'),
|
||||||
|
@('Explosion', 'IExplosion', 'net.minecraft.world.Explosion', 'common.minecraft.world.IExplosion')
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Appendix B: Static-Transform Registry
|
||||||
|
|
||||||
|
Complete list from Section 4, Step 3.4. All patterns use .NET regex syntax for PowerShell.
|
||||||
|
|
||||||
|
## Appendix C: File Inventory by Package
|
||||||
|
|
||||||
|
### Files to copy (not already in core/)
|
||||||
|
|
||||||
|
**noppes/npcs/controllers/** (estimated ~60 new):
|
||||||
|
- QuestController, PlayerQuestController, PlayerDataController, DialogController
|
||||||
|
- LinkedItemController, LinkedNpcController, PartyController, AuctionController
|
||||||
|
- CustomEffectController, CustomGuiController, BankController, ChunkController
|
||||||
|
- RecipeController, SpawnController, ServerCloneController, AnimationController
|
||||||
|
- ScriptController, ScriptHookController, MarketRegistry, HookDefinition
|
||||||
|
- + ~40 data/* classes (Quest, Dialog, PlayerData, etc.)
|
||||||
|
|
||||||
|
**noppes/npcs/quests/** (6 new):
|
||||||
|
- QuestItem, QuestKill, QuestLocation, QuestDialog, QuestManual, QuestInterface
|
||||||
|
|
||||||
|
**noppes/npcs/roles/** (24 new):
|
||||||
|
- RoleTrader, RoleBank, RoleFollower, RoleCompanion, RoleTransporter, RolePostman
|
||||||
|
- RoleMount, RoleInterface, RoleInnkeeper, RoleAuctioneer
|
||||||
|
- JobBard, JobGuard, JobHealer, JobSpawner, JobItemGiver, JobFollower, JobConversation, JobChunkLoader, JobInterface
|
||||||
|
- companion/* (5 files)
|
||||||
|
|
||||||
|
**noppes/npcs/config/** (15 new):
|
||||||
|
- ConfigMain, ConfigClient, ConfigScript, ConfigMarket, ConfigEnergy, ConfigItem
|
||||||
|
- ConfigDebug, ConfigExperimental, ConfigMixin, LoadConfiguration, StringCache, GlyphCache
|
||||||
|
- legacy/* (3 files)
|
||||||
|
|
||||||
|
**noppes/npcs/util/** (3 new MC-free):
|
||||||
|
- GameProfileAlt, JsonException, ScriptToStringHelper
|
||||||
|
|
||||||
|
**kamkeel/npcs/controllers/** (estimated ~75 new):
|
||||||
|
- AbilityController, EnergyController, ProfileController, AttributeController
|
||||||
|
- TelegraphController, SyncController
|
||||||
|
- + ~69 data/* classes (abilities, ability types, conditions, etc.)
|
||||||
|
|
||||||
|
**noppes/npcs/constants/** (~3 new):
|
||||||
|
- ScriptContext, EnumPotionType, EnumNotificationType (others already in core/)
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,271 @@
|
|||||||
|
|
||||||
|
**Related documents:**
|
||||||
|
- `MIGRATION_ROADMAP.md` — Phased migration plan with milestones
|
||||||
|
- `MULTI_VERSION_RESEARCH.md` — Detailed external research (tools, repos, real implementations)
|
||||||
|
- `MC_COUPLING_ANALYSIS.md` — Quantified MC-dependency breakdown by subsystem
|
||||||
|
- `BUILD_SYSTEM.md` — Gradle architecture, version-specific build requirements
|
||||||
|
- `SCRIPTING_TOOLCHAIN.md` — Java → TypeScript → Editor pipeline
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Owner's Vision
|
||||||
|
|
||||||
|
**Goal:** Port CustomNPC-Plus from 1.7.10 to **1.12.2, 1.16.5, and 1.20.1 simultaneously**.
|
||||||
|
|
||||||
|
**Key Constraints (from owner):**
|
||||||
|
- **NOT sequential** — refuses to spend 2-3 months per version one at a time
|
||||||
|
- Must tackle all versions at once, to the highest possible degree
|
||||||
|
- 1.7.10 remains the primary/active build during porting
|
||||||
|
- Time and budget are limited — efficiency is paramount
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Current State Assessment
|
||||||
|
|
||||||
|
### Abstraction Progress
|
||||||
|
- **183 / ~1,810 files abstracted** (~10%) into `core/` + `platform-api/`
|
||||||
|
- `platform-api/`: 48 interface files (NBT, entity wrapping, file I/O, logging, scheduling)
|
||||||
|
- `core/`: 140 files (8 controllers, 60+ data classes, enums, utils)
|
||||||
|
- `PlatformService` exists but is used in <0.2% of MC-dependent code
|
||||||
|
|
||||||
|
### MC-Dependent Code Distribution (~1,424 files import net.minecraft.*)
|
||||||
|
|
||||||
|
| Subsystem | File Count | Coupling Level | Porting Difficulty |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **GUI/Client/Rendering** | 212 | VERSION-LOCKED | Extreme — rewrite per version |
|
||||||
|
| **Networking/Packets** | 100+ | HEAVY-MC | High — framework changes every version |
|
||||||
|
| **Blocks + Tiles** | 97 | VERSION-LOCKED | High — Flattening breaks everything |
|
||||||
|
| **Controllers/Data** | 81 | LIGHT-MC | Medium — mostly NBT + EntityPlayer params |
|
||||||
|
| **Scripting Wrappers** | 50+ | HEAVY-MC | Medium — API surface stable-ish |
|
||||||
|
| **Abilities** | 44 | HEAVY-MC | High — DO NOT TOUCH yet |
|
||||||
|
| **Items** | 41 | LIGHT-MC | Medium — registration centralized in CustomItems.java |
|
||||||
|
| **AI** | 29 | HEAVY-MC | Medium — EntityAI API changes significantly |
|
||||||
|
| **Commands** | 22 | VERSION-LOCKED | Medium — Brigadier in 1.13+ |
|
||||||
|
| **Roles/Jobs** | 19 | LIGHT-MC | Low — mostly game logic with entity params |
|
||||||
|
| **Config** | 9 | LIGHT-MC | Low — Forge config API changes but logic same |
|
||||||
|
|
||||||
|
### 1.7.10 → 1.12.2 API Differences (Verified Against This Codebase)
|
||||||
|
|
||||||
|
| Pattern | Change Level | Files Affected | Details |
|
||||||
|
|---|---|---|---|
|
||||||
|
| FML package (cpw.mods.fml → net.minecraftforge.fml) | MINOR_CHANGE | 524 files | Mass rename, mechanical |
|
||||||
|
| Entity registration | MINOR_CHANGE | 1 file (CustomNpcs.java) | Signature change (added tracking params) |
|
||||||
|
| Event system (@SubscribeEvent, EVENT_BUS) | IDENTICAL | 16+ files | Same API |
|
||||||
|
| GUI handler (NetworkRegistry) | IDENTICAL | 1 file | Same API |
|
||||||
|
| NBT (NBTTagCompound) | IDENTICAL | Hundreds | Same API |
|
||||||
|
| World save data (WorldSavedData) | IDENTICAL | Several | Same API |
|
||||||
|
| @Mod, @EventHandler, @SidedProxy | MINOR_CHANGE | ~5 files | Package rename |
|
||||||
|
| **ItemStack null→EMPTY** (1.11+) | **BREAKING_CHANGE** | **37+ null checks, 390+ files ref ItemStack** | **stack==null must become stack.isEmpty(). MASSIVE — the plan originally missed this entirely** |
|
||||||
|
| Packet system (SimpleNetworkWrapper) | BREAKING_CHANGE | 100+ files | Becomes SimpleChannel |
|
||||||
|
| IInventory → IItemHandler (Capabilities) | BREAKING_CHANGE | 59+ files | New capability system alongside old |
|
||||||
|
| Block/Item registration (GameRegistry) | BREAKING_CHANGE | 18 files (62 calls in CustomItems.java) | Deprecated in 1.12; must use RegistryEvent.Register<Block/Item> |
|
||||||
|
| **World.getBlock → getBlockState** | BREAKING_CHANGE | 59+ files | Block metadata → IBlockState system |
|
||||||
|
| **getUnlocalizedName → getTranslationKey** | BREAKING_CHANGE | 59+ files | Deprecated in 1.11+ |
|
||||||
|
|
||||||
|
> **⚠️ CORRECTION (2026-03-15):** The previous version of this table listed GameRegistry as "IDENTICAL" and was missing ItemStack nullability, getBlockState, and getTranslationKey changes entirely. The 1.12.2 port is NOT 95% mechanical — it's ~60-70% mechanical (the 524 renames are real), with 30-40% requiring real code changes that will cause crashes if missed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical Research Findings
|
||||||
|
|
||||||
|
### The Hard Truth: Nobody Has Done This Before
|
||||||
|
|
||||||
|
**No Minecraft mod in existence successfully shares code between 1.7.10 and modern (1.16+) versions.** Exhaustive GitHub search confirmed:
|
||||||
|
|
||||||
|
| Pattern | Example | Lowest MC Version | Shared Code? |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Preprocessor multi-version | Polyfrost/OneConfig (280★) | **1.8.9** (not 1.7.10) | Yes, via `#if MC>=` |
|
||||||
|
| Multi-module per-loader | JEI (Core/Common/NeoForge/Fabric) | Per-branch only | Yes, within one version |
|
||||||
|
| Branch-per-version | Applied Energistics 2 | 1.15+ (no 1.7.10 branch) | No — independent codebases |
|
||||||
|
| Separate repos | GregTechCEu (1.12) + GT-Modern (1.20) | 1.12 / 1.20 separately | No — complete rewrites |
|
||||||
|
| 1.7.10 only | GTNH ecosystem (93 repos) | 1.7.10 | N/A |
|
||||||
|
|
||||||
|
**CustomNPC-Plus's platform-api/core approach is genuinely novel** — it's the JEI Core/Common pattern applied retroactively to 1.7.10, which nobody else has attempted.
|
||||||
|
|
||||||
|
### Build System: Composite Builds, NOT Separate Wrappers
|
||||||
|
|
||||||
|
Oracle recommended separate Gradle wrappers. **This is wrong.** Evidence from real implementations:
|
||||||
|
|
||||||
|
| Tool | What It Does | Status |
|
||||||
|
|---|---|---|
|
||||||
|
| **Gradle Composite Builds** (`includeBuild`) | Each version is an independent build with its own plugin classpath | VERIFIED — only stable way to mix RFG + FG |
|
||||||
|
| **Gradle Toolchains** | Run Gradle on JDK 21, compile with JDK 8 or 17 per subproject | VERIFIED — standard Gradle feature |
|
||||||
|
| **ModStitch** (github.com/isXander/modstitch) | Unifies RFG + ForgeGradle + NeoGradle in one build | **UNVERIFIED** — RFG support is still an unmerged PR (#42). Do not rely on this. |
|
||||||
|
| **ReplayMod Preprocessor** | `#if MC>=` directives in Java comments | VERIFIED — works, but build tooling doesn't support 1.7.10 via Loom |
|
||||||
|
| **Essential Gradle Toolkit** | Wraps preprocessor with cleaner DSL | VERIFIED — plugin `gg.essential.multi-version` v0.6.7 |
|
||||||
|
| **Deftu multiversion** | Production multi-version plugin (used by OneConfig) | VERIFIED — `dev.deftu.gradle.multiversion-root` v2.73.0 |
|
||||||
|
|
||||||
|
**Key constraint:** RFG and ForgeGradle/NeoGradle CANNOT share a Gradle classpath in multi-project builds. Composite builds (`includeBuild`) are required.
|
||||||
|
|
||||||
|
### Preprocessor Limitations for 1.7.10
|
||||||
|
|
||||||
|
The ReplayMod preprocessor **syntax** supports 1.7.10 (version `10710`). But:
|
||||||
|
- The **build tooling** (Architectury Loom, Essential Loom) does NOT support 1.7.10
|
||||||
|
- ReplayMod itself dropped 1.7.10 support when moving to Gradle 7
|
||||||
|
- The preprocessor is a text tool — it works on any Java file regardless of MC version
|
||||||
|
- **For CustomNPC-Plus:** The preprocessor could process source files for 1.7.10 IF combined with RetroFuturaGradle (not Loom). This needs prototyping.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Corrected Architecture (Post-Critical-Review)
|
||||||
|
|
||||||
|
### Oracle's Recommendation vs Evidence-Based Correction
|
||||||
|
|
||||||
|
| Aspect | Oracle Said | Evidence Says | Decision |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Build system | Separate Gradle wrappers per leaf | Composite builds + single wrapper | **Composite builds** |
|
||||||
|
| Layer count | 6 layers (platform-api → core → legacy-common → modern-common → leaves) | Preprocessor can replace family-common layers | **5 layers with optional preprocessor in version leaves** |
|
||||||
|
| legacy-common / modern-common | Dedicated modules | ~100+ files could go here, BUT preprocessor handles syntactic diffs | **Start without them; add only if code duplication proves >50 files** |
|
||||||
|
| 1.7.10→1.12.2 gap | Treated as equivalent to other gaps | Easier than 1.16+ but NOT trivial — 524 renames + 5 breaking changes (ItemStack null→EMPTY, IInventory, getBlockState, getTranslationKey, GameRegistry events) | **1.12.2 is ~60-70% mechanical, 30-40% real code changes** |
|
||||||
|
|
||||||
|
### Recommended Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
CustomNPC-Plus/
|
||||||
|
platform-api/ → Plain Java 8 library (interfaces) — SHARED BY ALL
|
||||||
|
core/ → Plain Java 8 library (game logic) — SHARED BY ALL
|
||||||
|
mc1710/ → Current src/main/java/ (RetroFuturaGradle) — COMPOSITE BUILD
|
||||||
|
mc1122/ → 1.12.2 (RetroFuturaGradle — yes, RFG handles 1.12.2) — COMPOSITE BUILD
|
||||||
|
mc1165/ → 1.16.5 (ForgeGradle 6) — COMPOSITE BUILD
|
||||||
|
mc1201/ → 1.20.1 (NeoGradle/ModDevGradle 2) — COMPOSITE BUILD
|
||||||
|
gradle-plugins/ → TypeScript .d.ts generator (unchanged)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Why no legacy-common/modern-common initially:**
|
||||||
|
- The preprocessor can handle syntactic differences within version leaves
|
||||||
|
- Most LIGHT-MC code should be migrated to `core/` with platform interfaces instead of duplicated in a family-common layer
|
||||||
|
- If >50 files of genuine version-family-specific code emerges during porting, THEN add the intermediate layers
|
||||||
|
- Simpler architecture = less overhead = faster iteration
|
||||||
|
|
||||||
|
### Build System Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
Root settings.gradle:
|
||||||
|
include 'platform-api', 'core' → Plain Java libraries (multi-project)
|
||||||
|
includeBuild 'mc1710' → Composite build (RetroFuturaGradle)
|
||||||
|
includeBuild 'mc1122' → Composite build (RetroFuturaGradle)
|
||||||
|
includeBuild 'mc1165' → Composite build (ForgeGradle 6)
|
||||||
|
includeBuild 'mc1201' → Composite build (NeoGradle)
|
||||||
|
includeBuild 'gradle-plugins' → Already composite
|
||||||
|
|
||||||
|
Each mc*/ has its own:
|
||||||
|
settings.gradle → Declares dependency on root platform-api/core via includeBuild '..'
|
||||||
|
build.gradle → Applies version-specific Gradle plugin
|
||||||
|
gradle.properties → MC version, Forge version, mappings
|
||||||
|
src/main/java/ → Version-specific implementations
|
||||||
|
```
|
||||||
|
|
||||||
|
**Gradle Toolchains** handle JDK differences (8 for legacy, 17 for 1.20.1).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Revised Abstraction Order (Maximum Parallelism)
|
||||||
|
|
||||||
|
The key insight: **1.12.2 is significantly closer to 1.7.10 than 1.16.5+, but it is NOT trivial.** Beyond the 524 mechanical renames, there are 5 breaking API changes affecting 200+ files total. Still, it is the easiest version jump and should be tackled first.
|
||||||
|
|
||||||
|
### Track A: Core Abstraction (enables ALL versions)
|
||||||
|
1. Finish mc1710 shadow files for migrated controllers
|
||||||
|
2. Expand `IPlayer` / `IItemStack` / `IWorld` usage in core (use the real platform-api interfaces — DO NOT create duplicates)
|
||||||
|
3. Dialog cluster → Quest cluster → PlayerData migration to core
|
||||||
|
4. Packet DTO abstraction in core
|
||||||
|
5. Command abstraction in core
|
||||||
|
|
||||||
|
### Track B: 1.12.2 Port (CAN START IMMEDIATELY — easier than 1.16+ but NOT trivial)
|
||||||
|
1. Copy mc1710/ → mc1122/
|
||||||
|
2. Mass-rename cpw.mods.fml → net.minecraftforge.fml (524 files, mechanical)
|
||||||
|
3. **Replace all ItemStack null checks with isEmpty()** (37+ files with null checks, 390+ files reference ItemStack — the BIGGEST hidden change)
|
||||||
|
4. Update block/item registration to RegistryEvent pattern (18 files, 62 calls in CustomItems.java)
|
||||||
|
5. Update entity registration signature (1 file)
|
||||||
|
6. Replace getUnlocalizedName → getTranslationKey (59+ files)
|
||||||
|
7. Address World.getBlock → getBlockState usage (59+ files)
|
||||||
|
8. Refactor packet system (SimpleNetworkWrapper → SimpleChannel — structural rewrite)
|
||||||
|
9. Begin IInventory → IItemHandler migration for containers (59+ files, can be incremental)
|
||||||
|
10. Set up RetroFuturaGradle for 1.12.2 (confirmed: RFG supports 1.12.2)
|
||||||
|
11. Test and iterate
|
||||||
|
|
||||||
|
### Track C: 1.16.5 Port (start after Track A Phase 1-3)
|
||||||
|
1. Create mc1165/ with ForgeGradle 6
|
||||||
|
2. Implement PlatformService for 1.16.5
|
||||||
|
3. Port core controllers (they just work — MC-free)
|
||||||
|
4. Port networking (new packet system)
|
||||||
|
5. Port commands (Brigadier adapter)
|
||||||
|
6. Port blocks (BlockState — the Flattening work)
|
||||||
|
7. Port essential admin GUIs (rewrite, not port)
|
||||||
|
|
||||||
|
### Track D: 1.20.1 Port (start after Track C is 50% done)
|
||||||
|
1. Create mc1201/ based on mc1165/ (close enough)
|
||||||
|
2. Implement PlatformService for 1.20.1
|
||||||
|
3. Adapt for NeoForge API differences
|
||||||
|
4. Mostly rides on 1.16.5 work
|
||||||
|
|
||||||
|
**Tracks A and B can run in parallel immediately.** Track C starts when core interfaces exist. Track D is incremental from C.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## MVP Targets Per Version
|
||||||
|
|
||||||
|
### 1.7.10 — Full Primary (unchanged)
|
||||||
|
All features, full parity. This is the production build.
|
||||||
|
|
||||||
|
### 1.12.2 — "Bridge Build" (Closest to 1.7.10, but has real breaking changes)
|
||||||
|
- NPC spawn, persist, despawn lifecycle
|
||||||
|
- Dialog system, Quest system, Faction system
|
||||||
|
- Core networking (NPC sync, player data)
|
||||||
|
- Basic AI + combat
|
||||||
|
- Essential editor/admin GUIs
|
||||||
|
- Commands (`/kam` hierarchy)
|
||||||
|
- **NOT initially:** Abilities, auction, animation maker, scripting IDE
|
||||||
|
|
||||||
|
### 1.16.5 — "NPC Core" Modern
|
||||||
|
- Same feature set as 1.12.2 MVP
|
||||||
|
- Server-first: commands and admin workflows before full GUI
|
||||||
|
- Basic NPC editor screen
|
||||||
|
- **NOT initially:** Full GUI suite, abilities, auction, custom models
|
||||||
|
|
||||||
|
### 1.20.1 — "NPC Core" Latest
|
||||||
|
- Same as 1.16.5 — incremental from it
|
||||||
|
- Client polish lags behind server feature parity
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical Warnings
|
||||||
|
|
||||||
|
1. **You're the first to do this** — no existing mod shares code between 1.7.10 and modern. Expect uncharted territory.
|
||||||
|
2. **Don't mirror Minecraft class-for-class in platform-api** — keep interfaces coarse and purpose-driven
|
||||||
|
3. **Don't promise full GUI parity on modern versions first** — 212 files, completely different per version, do LAST
|
||||||
|
4. **Don't let preprocessor guards spread into core/** — only in version-leaf code
|
||||||
|
5. **1.12.2 is easier than 1.16+ but NOT trivial** — 524 mechanical renames + 5 breaking changes (ItemStack null→EMPTY, IInventory, getBlockState, getTranslationKey, GameRegistry events) affecting 200+ files
|
||||||
|
6. **Composite builds, not separate wrappers** — one Gradle wrapper, `includeBuild` per version leaf
|
||||||
|
7. **API merge is a phased operation** — move MC-free interfaces first (~131), then strip MC imports from the remaining 71. Don't try to move everything in one shot.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Open Questions / Future Decisions
|
||||||
|
|
||||||
|
1. Can the ReplayMod preprocessor be made to work with RetroFuturaGradle (instead of Loom)? Needs prototyping.
|
||||||
|
2. Should version leaves share a single `build.gradle.kts` via the preprocessor's pattern (all versions point to `../../build.gradle.kts`)? Or keep independent build files?
|
||||||
|
3. Scripting API compatibility — can the same `.js`/`.java` scripts work across versions?
|
||||||
|
4. Addon compatibility — DBC Addon, Gecko Addon, AW Addon need version-specific builds
|
||||||
|
5. Data format compatibility — can NPC save files from 1.7.10 load on 1.20.1?
|
||||||
|
6. When to add `legacy-common/` and `modern-common/` layers — set threshold at >50 duplicated files
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Research Agent Summary (12 agents deployed)
|
||||||
|
|
||||||
|
| Agent | Type | Key Finding |
|
||||||
|
|---|---|---|
|
||||||
|
| explore #1 | MC-dependent code | 1,424 files import net.minecraft.*, GUI is biggest hotspot (212 files) |
|
||||||
|
| explore #2 | Build system | Single-version locked, GTNH Convention + RFG |
|
||||||
|
| explore #3 | Subsystem coupling | Controllers/data are LIGHT-MC, AI/networking are HEAVY-MC |
|
||||||
|
| explore #4 | 1.7.10→1.12.2 API diff | 95% identical, only packets break, 524 files need package rename |
|
||||||
|
| explore #5 | legacy-common validation | ~100+ files use pre-Flattening patterns (metadata, IInventory) |
|
||||||
|
| librarian #1 | Porting strategies | Architectury 1.16.5+ only, preprocessor for syntactic diffs |
|
||||||
|
| librarian #2 | Real multi-version repos | Essential Mod gold standard, modstitch bridges RFG+FG, Loom consumes plain Java libs |
|
||||||
|
| librarian #3 | ForgeGradle matrix | RFG handles 1.7.10+1.12.2, FG6 for 1.16.5, ModDevGradle for 1.20.1, composite builds required |
|
||||||
|
| unspecified-high #1 | Preprocessor research | ReplayMod preprocessor syntax supports 1.7.10 (10710), but Loom doesn't; Essential wraps it |
|
||||||
|
| unspecified-high #2 | Real multi-version mods | **Nobody shares code between 1.7.10 and modern** — CustomNPC+ approach is genuinely novel |
|
||||||
|
| unspecified-high #3 | Write MULTI_VERSION_RESEARCH.md | Compiled all external research to permanent doc |
|
||||||
|
| unspecified-high #4 | Write MC_COUPLING_ANALYSIS.md | Compiled all coupling data to permanent doc |
|
||||||
|
| Oracle | Architecture strategy | Two-family monorepo (partially overridden by evidence) |
|
||||||
@@ -0,0 +1,263 @@
|
|||||||
|
## Migration Roadmap (Added 2026-03-15 — Post-Critical-Review)
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
|
This roadmap is organized into **4 phases** with **parallel tracks** where possible. Each phase has concrete milestones, estimated scope, dependencies, and a verification strategy.
|
||||||
|
|
||||||
|
**Key principle:** Maximize code sharing early (platform-api + core), then build version leaves on top. The more code that lives in platform-api/core before starting version leaves, the less per-version work there is.
|
||||||
|
|
||||||
|
```
|
||||||
|
Timeline (approximate):
|
||||||
|
Phase 0 ████░░░░░░░░░░░░░░░░ Foundation (API merge + build system)
|
||||||
|
Phase 1 ░░░░████████░░░░░░░░ Core expansion + 1.12.2 leaf
|
||||||
|
Phase 2 ░░░░░░░░░░░░████████ 1.16.5 + 1.20.1 leaves
|
||||||
|
Phase 3 ░░░░░░░░░░░░░░░░████ Feature parity + polish
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 0: Foundation (Prerequisites for everything else)
|
||||||
|
|
||||||
|
**Goal:** Get the build system working for multi-version and merge the scripting API into platform-api.
|
||||||
|
|
||||||
|
#### 0A. Composite Build Setup
|
||||||
|
- [ ] Create `mc1710/` directory, move current `src/main/java/` and `src/main/resources/` into it
|
||||||
|
- [ ] Create `mc1710/settings.gradle` and `mc1710/build.gradle` with RFG
|
||||||
|
- [ ] Update root `settings.gradle` to use `includeBuild 'mc1710'` instead of direct source
|
||||||
|
- [ ] Verify `mc1710/` builds and runs identically to current root build
|
||||||
|
- [ ] Verify `platform-api` and `core` are consumed correctly via composite build dependency
|
||||||
|
|
||||||
|
**Scope:** ~5-10 files (build configs only). No Java changes.
|
||||||
|
**Risk:** Medium — build system restructure can surface classpath/dependency issues.
|
||||||
|
**Verification:** `./gradlew build` succeeds, `runClient` launches, existing tests pass.
|
||||||
|
|
||||||
|
#### 0B. Scripting API → platform-api Merge (Phase 1 of API merge: MC-free interfaces)
|
||||||
|
- [ ] Identify the ~131 MC-free interfaces in `src/api/java/` (no `net.minecraft.*` or `cpw.mods.fml.*` imports)
|
||||||
|
- [ ] Move them into `platform-api/` retaining exact package structure (`noppes.npcs.api.*`)
|
||||||
|
- [ ] Reconcile the 30 existing split-package shadows (platform-api already has MC-free versions of these)
|
||||||
|
- [ ] Strip generic type parameters from 5 entity interfaces (`IEntity`, `IEntityLivingBase`, `IEntityLiving`, `ICustomNpc`, `IPlayer`)
|
||||||
|
- [ ] Update `core/` imports if any were pointing at the old location
|
||||||
|
- [ ] Update `mc1710/` to shadow the moved interfaces where MC-specific extensions are needed
|
||||||
|
|
||||||
|
**Scope:** ~131 file moves + 30 reconciliations + 5 generics strips.
|
||||||
|
**Risk:** Low-Medium — package structure preserved, no behavioral changes.
|
||||||
|
**Verification:** `core/` compiles, `mc1710/` compiles, no new import errors.
|
||||||
|
**Dependency:** Phase 0A must be complete (mc1710 is a separate build).
|
||||||
|
|
||||||
|
#### 0C. Scripting API → platform-api Merge (Phase 2: MC-contaminated interfaces)
|
||||||
|
- [ ] Identify 71 MC-contaminated interfaces in `src/api/java/`
|
||||||
|
- [ ] For each, replace MC type references with platform-api equivalents or Object returns
|
||||||
|
- [ ] Handle event interfaces: create platform `@Cancelable` annotation (or use the planned custom annotation parser)
|
||||||
|
- [ ] Refactor `AbstractNpcAPI` — split into MC-free interface in platform-api + mc1710 implementation class
|
||||||
|
- [ ] Move cleaned interfaces to `platform-api/`
|
||||||
|
- [ ] Drop the 5 vendored MC class stubs (`net/minecraft/` in api/)
|
||||||
|
- [ ] Update all `mc1710/` code importing these interfaces
|
||||||
|
|
||||||
|
**Scope:** 71 files, each needs individual review and MC-stripping.
|
||||||
|
**Risk:** Medium-High — method signature changes ripple through 276 files in mc1710 that import the API (743 import sites).
|
||||||
|
**Verification:** Full `mc1710/` build succeeds, scripting engine tests pass.
|
||||||
|
**Dependency:** Phase 0B complete.
|
||||||
|
|
||||||
|
#### 0D. Complete Existing Core TODOs (mc1710 shadow files)
|
||||||
|
|
||||||
|
The previous core migration left 22 TODOs across 8 files — all are incomplete mc1710 shadow implementations that need to be created or finished:
|
||||||
|
|
||||||
|
**Controllers needing mc1710 shadows (4 files, 11 TODOs):**
|
||||||
|
- [ ] `FactionController.java` — create mc1710 shadow that `implements IFactionHandler`, adds SyncController calls in save/delete
|
||||||
|
- [ ] `MagicController.java` — create mc1710 shadow that `implements IMagicHandler`, adds ItemStack resolution, SyncController calls in save/delete
|
||||||
|
- [ ] `TransportController.java` — create mc1710 shadow that `implements ITransportHandler`
|
||||||
|
- [ ] `TagController.java` — create mc1710 shadow that `implements ITagHandler`
|
||||||
|
|
||||||
|
**Data classes needing mc1710 shadows (2 files, 5 TODOs):**
|
||||||
|
- [ ] `Faction.java` — create mc1710 shadow that `implements IFaction`
|
||||||
|
- [ ] `Magic.java` — create mc1710 shadow that `implements IMagic`, adds ItemStack field and GameRegistry resolution in readNBT/writeNBT
|
||||||
|
|
||||||
|
**Utility needing mc1710 version (1 file, 4 TODOs):**
|
||||||
|
- [ ] `NBTTags.java` — mc1710 version needs: ItemStack list methods, nbtDoubleList (uses NBTTagDouble), Script methods (uses IScriptHandler/NBTTagCompound), getIntAt (uses NBTTagInt)
|
||||||
|
|
||||||
|
**Data needing completion (1 file, 2 TODOs):**
|
||||||
|
- [ ] `PlayerEffect.java` — needs CustomEffectController integration + IPlayer callback mechanism
|
||||||
|
|
||||||
|
**Scope:** 8 files with 22 TODOs. Creates ~6-8 new mc1710 shadow files + completes 2 existing stubs.
|
||||||
|
**Risk:** Low — these are well-understood patterns (split-package shadow). Each TODO explicitly describes what the mc1710 version must add.
|
||||||
|
**Verification:** Per file: mc1710 shadow compiles, controller loads/saves correctly, no regressions in NPC behavior.
|
||||||
|
**Dependency:** Can run in parallel with 0B/0C, or immediately.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 1: Core Expansion + 1.12.2 Leaf (Parallel tracks)
|
||||||
|
|
||||||
|
**Goal:** Migrate the bulk of game logic to core/ while simultaneously standing up the 1.12.2 version leaf.
|
||||||
|
|
||||||
|
#### Track 1A: Core Controller Migration
|
||||||
|
|
||||||
|
Now that subsystem restrictions are lifted, the migration order is by ROI:
|
||||||
|
|
||||||
|
| Priority | Subsystem | Files | Blockers | Unlocks |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| 1 | Remaining Controllers/Data | ~35 unmigrated | Need `IPlayer`, `IItemStack` coverage expanded in platform-api | Quest, Dialog, PlayerData sharing |
|
||||||
|
| 2 | Roles/Jobs | 19 | Entity param abstraction via existing interfaces | Role/Job logic shared across versions |
|
||||||
|
| 3 | Items (logic only) | ~25 | `IItemStack` abstraction | Item behavior shared (registration stays per-version) |
|
||||||
|
| 4 | Quest system | ~10 | Dialog + PlayerData in core | Quest logic shared |
|
||||||
|
| 5 | Dialog system | ~8 | Controller/Data in core | Dialog logic shared |
|
||||||
|
| 6 | Script system (containers/hooks) | ~30 | ScriptContainer needs platform abstraction | Scripting behavior shared |
|
||||||
|
| 7 | Profile system | ~5 | `IPlayer` + PlayerData in core | Profile logic shared |
|
||||||
|
| 8 | Packet DTOs | ~50 | INetworkService in platform-api | Packet data shared (transport per-version) |
|
||||||
|
| 9 | Command abstraction | ~22 | ICommandService in platform-api | Command logic shared (dispatch per-version) |
|
||||||
|
|
||||||
|
**New platform-api interfaces needed:**
|
||||||
|
- `INetworkService` — packet registration, sending, channel management
|
||||||
|
- `ICommandService` — command registration and dispatch
|
||||||
|
- `IRegistryService` — block/item/entity registration abstraction
|
||||||
|
- `IEventBus` — event subscription and dispatch abstraction
|
||||||
|
- Expand `IPlayer` and `IItemStack` coverage as needed by core migration (use the EXISTING interfaces — do NOT create duplicates)
|
||||||
|
|
||||||
|
**Scope:** ~200 files migrated to core over this phase.
|
||||||
|
**Risk:** High — each controller migration can surface hidden MC dependencies.
|
||||||
|
**Verification:** Per-controller: core compiles, mc1710 shadow compiles, controller tests pass.
|
||||||
|
|
||||||
|
#### Track 1B: 1.12.2 Version Leaf (parallel with 1A)
|
||||||
|
|
||||||
|
- [ ] Create `mc1122/` directory structure with RFG build config
|
||||||
|
- [ ] Copy mc1710 source → mc1122 as starting point
|
||||||
|
- [ ] **Mechanical changes (can be scripted/automated):**
|
||||||
|
- Mass-rename `cpw.mods.fml` → `net.minecraftforge.fml` (524 files)
|
||||||
|
- Replace `getUnlocalizedName` → `getTranslationKey` (59+ files)
|
||||||
|
- [ ] **Breaking changes (require manual work):**
|
||||||
|
- ItemStack null→isEmpty(): audit and fix 37+ null-check sites, 390+ files that handle ItemStack
|
||||||
|
- GameRegistry → RegistryEvent.Register pattern (18 files, 62 calls)
|
||||||
|
- Entity registration signature update (1 file)
|
||||||
|
- World.getBlock → getBlockState adaptation (59+ files)
|
||||||
|
- SimpleNetworkWrapper → SimpleChannel packet rewrite (100+ files)
|
||||||
|
- IInventory → IItemHandler for containers (59+ files, can be incremental — IInventory still works in 1.12)
|
||||||
|
- [ ] Set up 1.12.2 Forge MDK mappings in `mc1122/gradle.properties`
|
||||||
|
- [ ] Build, fix compilation errors, iterate
|
||||||
|
- [ ] Test core NPC lifecycle: spawn, persist, despawn
|
||||||
|
|
||||||
|
**Scope:** Full mc1710 codebase copy (~1,722 files) + modifications.
|
||||||
|
**Risk:** Medium — most changes are well-understood patterns, but the volume is large.
|
||||||
|
**Verification:** `mc1122/` builds, basic NPC spawns in 1.12.2 client, save/load works.
|
||||||
|
**Key insight:** IInventory still works in 1.12.2 (just deprecated), so container migration can be deferred. Focus on the 4 truly breaking items first: ItemStack null→EMPTY, GameRegistry events, packet system, entity registration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 2: Modern Version Leaves (1.16.5 + 1.20.1)
|
||||||
|
|
||||||
|
**Goal:** Stand up 1.16.5 and 1.20.1 version leaves. These benefit from all the core/ work done in Phase 1.
|
||||||
|
|
||||||
|
**Dependency:** Phase 1A should be at least 50% complete (controllers, data, roles/jobs in core).
|
||||||
|
|
||||||
|
#### Track 2A: 1.16.5 Version Leaf
|
||||||
|
|
||||||
|
- [ ] Create `mc1165/` with ForgeGradle 6 build config
|
||||||
|
- [ ] Implement `PlatformService` for 1.16.5 (MC type wrappers, NBT, file I/O)
|
||||||
|
- [ ] Core controllers work automatically — they depend only on platform-api
|
||||||
|
- [ ] Port networking (entirely new packet system in 1.16)
|
||||||
|
- [ ] Port commands (Brigadier adapter — command tree maps conceptually)
|
||||||
|
- [ ] Port blocks (BlockState — the Flattening. Metadata → block properties. DeferredRegister for registration)
|
||||||
|
- [ ] Port items (DeferredRegister, no metadata)
|
||||||
|
- [ ] Port AI (EntityAI → Goal system)
|
||||||
|
- [ ] Port essential admin GUIs: NPC editor, Quest editor, Dialog editor (rewrite, not port — Screen/Button/MatrixStack API)
|
||||||
|
- [ ] Port entity registration (DeferredRegister + EntityType.Builder)
|
||||||
|
|
||||||
|
**Scope:** ~800-1000 files (version-specific implementations of what core doesn't cover).
|
||||||
|
**Risk:** High — this is the biggest version gap (1.7.10 → post-Flattening). Every block, item, entity, and GUI changes.
|
||||||
|
**Verification:** NPC spawns, basic dialog works, quests work, save/load works.
|
||||||
|
|
||||||
|
#### Track 2B: 1.20.1 Version Leaf (start when 2A is ~50% done)
|
||||||
|
|
||||||
|
- [ ] Create `mc1201/` based on `mc1165/` (1.16.5 → 1.20.1 is much smaller than 1.7.10 → 1.16.5)
|
||||||
|
- [ ] Implement `PlatformService` for 1.20.1
|
||||||
|
- [ ] Adapt for NeoForge API differences (1.20.1 is the Forge→NeoForge transition)
|
||||||
|
- [ ] Update rendering (GuiGraphics wrapper, component-based text)
|
||||||
|
- [ ] Update registration patterns (NeoForge DeferredRegister differences)
|
||||||
|
|
||||||
|
**Scope:** ~200-400 files of delta from 1.16.5.
|
||||||
|
**Risk:** Medium — incremental from 1.16.5, mostly API surface changes.
|
||||||
|
**Verification:** Same as 1.16.5 milestones.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 3: Feature Parity + Polish
|
||||||
|
|
||||||
|
**Goal:** Bring all version leaves to MVP feature parity, then expand.
|
||||||
|
|
||||||
|
#### Per-version MVP checklist:
|
||||||
|
- [ ] NPC lifecycle (spawn, persist, despawn, AI, combat)
|
||||||
|
- [ ] Dialog system (create, edit, trigger, branching)
|
||||||
|
- [ ] Quest system (all quest types, tracking, rewards)
|
||||||
|
- [ ] Faction system (points, NPC reactions, conditions)
|
||||||
|
- [ ] Networking (NPC sync, player data, editor packets)
|
||||||
|
- [ ] Commands (`/kam` hierarchy, all subcommands)
|
||||||
|
- [ ] Essential GUIs (NPC editor, Quest editor, Dialog editor, Cloner)
|
||||||
|
- [ ] Config system
|
||||||
|
- [ ] Basic scripting (JS engine, script hooks for NPC/Player)
|
||||||
|
|
||||||
|
#### Post-MVP (per version, prioritized):
|
||||||
|
1. Full scripting engine + script editor GUI
|
||||||
|
2. Ability system (entity types, energy system, telegraph)
|
||||||
|
3. Animation system
|
||||||
|
4. Auction/Economy system
|
||||||
|
5. Profile system
|
||||||
|
6. Full GUI suite (all editor screens, HUD, overlays)
|
||||||
|
7. Custom models / addon compatibility (Gecko, AW, DBC)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Risk Register
|
||||||
|
|
||||||
|
| Risk | Likelihood | Impact | Mitigation |
|
||||||
|
|---|---|---|---|
|
||||||
|
| API merge breaks addon mods | High | High | Coordinate with addon authors. Ship platform-api as Maven artifact. Provide migration guide. |
|
||||||
|
| ItemStack null→EMPTY changes cause subtle runtime bugs | High | Medium | Automated grep + manual audit. Write a test suite for ItemStack handling. |
|
||||||
|
| Build system complexity (4 Gradle plugins, composite builds) | Medium | High | Get Phase 0A working and stable BEFORE any Java changes. Document build setup. |
|
||||||
|
| Core migration surfaces hidden MC dependencies in "LIGHT-MC" code | Medium | Medium | Migrate one controller at a time. Verify compilation after each. |
|
||||||
|
| 1.16.5 port takes much longer than estimated (Flattening impact) | High | High | Start with server-only (commands + data), defer GUI. Track 2B (1.20.1) doesn't start until 2A proves the pattern. |
|
||||||
|
| Preprocessor+RFG integration doesn't work | Medium | Low | Preprocessor is optional. The platform-api/core/leaf architecture works without it. |
|
||||||
|
| Script API behavior differences across MC versions | Medium | Medium | Define a compatibility spec: which script APIs are guaranteed cross-version vs. version-specific. |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Milestone Summary
|
||||||
|
|
||||||
|
| Milestone | Phase | Deliverable | Success Criteria |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **M0: Multi-build compiles** | 0A | mc1710/ as composite build | `./gradlew build` works, runClient launches |
|
||||||
|
| **M0.5: Core TODOs complete** | 0D | All 22 TODOs in core/ resolved, mc1710 shadows created | All 8 files have no remaining TODOs, mc1710 compiles, controllers save/load correctly |
|
||||||
|
| **M1: API in platform-api** | 0B+0C | All 202 API interfaces in platform-api | core/ and mc1710/ compile, no MC imports in platform-api |
|
||||||
|
| **M2: Core 50%** | 1A | Controllers, data, roles, items in core | ~200 files in core, mc1710 shadows compile |
|
||||||
|
| **M3: 1.12.2 compiles** | 1B | mc1122/ builds successfully | Gradle build succeeds |
|
||||||
|
| **M4: 1.12.2 NPC spawns** | 1B | Basic NPC lifecycle on 1.12.2 | NPC spawns, persists, loads, has AI |
|
||||||
|
| **M5: 1.16.5 compiles** | 2A | mc1165/ builds successfully | Gradle build succeeds |
|
||||||
|
| **M6: 1.16.5 NPC spawns** | 2A | Basic NPC lifecycle on 1.16.5 | NPC spawns, persists, loads, has AI |
|
||||||
|
| **M7: 1.20.1 compiles** | 2B | mc1201/ builds successfully | Gradle build succeeds |
|
||||||
|
| **M8: All versions MVP** | 3 | NPC + Dialog + Quest + Faction on all versions | Full MVP checklist passes on each |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### What This Roadmap Does NOT Cover (Future Planning Needed)
|
||||||
|
|
||||||
|
1. **Addon porting strategy** — DBC, Gecko, AW addons each need version-specific builds. Requires separate planning.
|
||||||
|
2. **Data migration** — Can NPC save files from 1.7.10 load on 1.20.1? Needs a data format compatibility analysis.
|
||||||
|
3. **CI/CD** — Automated builds for all 4 versions, artifact publishing, test matrix.
|
||||||
|
4. **Scripting compatibility spec** — Which script APIs are guaranteed cross-version.
|
||||||
|
5. **Client-side scripting** — The client script system has version-specific rendering hooks. Needs per-version analysis.
|
||||||
|
6. **Performance testing** — Core abstraction layer adds indirection. Measure overhead on large NPC populations.
|
||||||
|
|
||||||
|
**USER REVIEW FOR WHATS UNCOVERED**
|
||||||
|
1) Addon porting shouldn't be handled on CNPC+ side, but on addon side. Skip
|
||||||
|
2) Data migration is ESSENTIAL. Must be fleshed out ASAP.
|
||||||
|
3) Multi-version builds are also ESSENTIAL. One of the first things that must be tackled (paralelly while working on the refactor)
|
||||||
|
4) Handle this after migration
|
||||||
|
5) There is no client script system, but if you see one just migrate it as is. This will be handled after the migration
|
||||||
|
6) This too is after migration
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical Review Agent Summary (Session 2 — 2026-03-15, 4 agents deployed)
|
||||||
|
|
||||||
|
| Agent | Type | Key Finding |
|
||||||
|
|---|---|---|
|
||||||
|
| unspecified-high #1 | Verify abstraction state | 188 files abstracted (claim ~correct). PlatformService adoption near-zero in mc1710 (1 file). ~50 files are trivial enums. NBT abstraction pattern works well. |
|
||||||
|
| unspecified-high #2 | Assess API merge feasibility | 202 API files total. 71 MC-contaminated. 30 naming conflicts (split-package shadow). 5 generics to strip. 743 import sites in mc1710. Move is feasible in phases. |
|
||||||
|
| librarian #1 | Validate build system claims | RFG 1.12.2 VERIFIED. Composite builds VERIFIED. ModStitch UNVERIFIED (PR not merged). Essential single-wrapper VERIFIED. Java toolchains VERIFIED. |
|
||||||
|
| explore #1 | Verify 1.12.2 mechanical port claim | "95% mechanical" is WRONG. Found 5 breaking changes plan missed: ItemStack null→EMPTY (37+ files), IInventory (59+), getBlockState (59+), getTranslationKey (59+), GameRegistry events (18). Corrected to ~60-70% mechanical. |
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# Multi-Version Mod Architecture Research
|
||||||
|
|
||||||
|
> Permanent reference document. Findings marked **VERIFIED** come from real repositories; **THEORETICAL** findings need validation.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Real-World Multi-Version Mod Architectures
|
||||||
|
|
||||||
|
### Essential Mod (Gold Standard) — VERIFIED
|
||||||
|
|
||||||
|
- **Repo:** SparkUniverse/Essential-Mod (formerly EssentialGG)
|
||||||
|
- **Toolkit:** [Essential Gradle Toolkit](https://github.com/EssentialGG/essential-gradle-toolkit)
|
||||||
|
- Uses **ReplayMod Preprocessor** at scale
|
||||||
|
- **Structure:** `versions/` folder with sub-projects per MC version
|
||||||
|
- Single modern Gradle wrapper (8.x) with **Java toolchains** for Java 8/17/21
|
||||||
|
- Does **NOT** use separate `gradlew` files — uses one unified build
|
||||||
|
|
||||||
|
### ReplayMod Preprocessor — VERIFIED
|
||||||
|
|
||||||
|
- **Repo:** [github.com/ReplayMod/preprocessor](https://github.com/ReplayMod/preprocessor)
|
||||||
|
- **Structure:**
|
||||||
|
- `common/src/main/java` — shared code with `#if` directives
|
||||||
|
- `versions/` — subprojects per MC version
|
||||||
|
- Each version subproject applies its own Gradle plugin (ForgeGradle / RFG / Loom)
|
||||||
|
- `settings.json` defines version variables
|
||||||
|
- Root `build.gradle` wires common to version nodes via `preprocess {}` DSL
|
||||||
|
- **Real example:** Fallen-Breath/fast-ip-ping
|
||||||
|
|
||||||
|
### Essential Gradle Toolkit — VERIFIED
|
||||||
|
|
||||||
|
- **Plugin IDs:** `gg.essential.multi-version.root` / `gg.essential.multi-version`
|
||||||
|
- Wraps ReplayMod Preprocessor with cleaner DSL
|
||||||
|
- Supports version branching with `version(10710)`, `version(12001)`, etc.
|
||||||
|
|
||||||
|
### ModStitch Plugin — VERIFIED
|
||||||
|
|
||||||
|
- **Repo:** [github.com/isXander/modstitch](https://github.com/isXander/modstitch)
|
||||||
|
- Designed to unify Official Tooling (NeoGradle / ForgeGradle) with RetroFuturaGradle
|
||||||
|
- Enables single build system spanning 1.7.10 to 1.20.1
|
||||||
|
- Used by Archipelago CoreClient (bridging 1.7.10 RFG and 1.20.1 NeoGradle)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Build System Findings
|
||||||
|
|
||||||
|
| Finding | Status |
|
||||||
|
|---|---|
|
||||||
|
| Architectury Loom CAN consume plain Java libraries (`core/`, `platform-api/`) as standard project dependencies — no remapping needed since they have no MC imports | **VERIFIED** |
|
||||||
|
| Modern Gradle 8.x CAN compile Java 8 code using Java Toolchains — no need for separate Gradle wrappers | **VERIFIED** |
|
||||||
|
| RetroFuturaGradle and ForgeGradle CAN potentially coexist in one build via modstitch | **THEORETICAL** — modstitch repo confirms design intent; needs validation with CustomNPC-Plus specifically |
|
||||||
|
| Single unified Gradle wrapper is the recommended approach (Essential mod proves this at scale) | **VERIFIED** |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Preprocessor Syntax
|
||||||
|
|
||||||
|
The ReplayMod Preprocessor uses comment-based directives that are valid Java (comments), so code compiles without the preprocessor too. Inactive branches are prefixed with `//$$ ` to comment them out.
|
||||||
|
|
||||||
|
```java
|
||||||
|
//#if MC>=11600
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
//#else
|
||||||
|
//$$ import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
//#endif
|
||||||
|
```
|
||||||
|
|
||||||
|
Key syntax elements:
|
||||||
|
- `//#if MC>=11600` — conditional on version variable
|
||||||
|
- `//#else` — else branch
|
||||||
|
- `//#endif` — end conditional
|
||||||
|
- `//$$ ` — prefix for inactive code (commented out by preprocessor)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Key Insight: Oracle Was Wrong About Separate Gradle Wrappers
|
||||||
|
|
||||||
|
Oracle recommended separate Gradle wrappers per version leaf. Real-world evidence shows:
|
||||||
|
|
||||||
|
- **Essential Mod** uses **ONE** Gradle wrapper for **ALL** versions
|
||||||
|
- **Java Toolchains** handle JDK version differences (Java 8 for 1.7.10, Java 17 for 1.18+, Java 21 for 1.20.5+)
|
||||||
|
- **modstitch** plugin unifies RFG + ForgeGradle in one build
|
||||||
|
- Separate wrappers add unnecessary complexity and maintenance burden
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Project Structure Template (Based on Real Implementations)
|
||||||
|
|
||||||
|
```
|
||||||
|
CustomNPC-Plus/
|
||||||
|
platform-api/ → Plain Java 8 library (interfaces)
|
||||||
|
core/ → Plain Java 8 library (game logic)
|
||||||
|
common/ → Shared MC-aware code with preprocessor directives
|
||||||
|
versions/
|
||||||
|
1.7.10/ → RetroFuturaGradle
|
||||||
|
1.12.2/ → ForgeGradle or RFG
|
||||||
|
1.16.5/ → ForgeGradle 5/6 or Architectury Loom
|
||||||
|
1.20.1/ → NeoGradle or Architectury Loom
|
||||||
|
gradle-plugins/ → TypeScript .d.ts generator
|
||||||
|
settings.json → Preprocessor version definitions
|
||||||
|
build.gradle → Root wiring
|
||||||
|
```
|
||||||
|
|
||||||
|
- `platform-api/` and `core/` are consumed as plain `implementation project(":core")` dependencies by all version leaves
|
||||||
|
- `common/` contains MC-aware code that uses `#if` directives for version differences
|
||||||
|
- Each `versions/<ver>/` subproject applies the appropriate Gradle plugin for that MC version
|
||||||
|
- One `gradlew` at root, one `settings.gradle`, one unified build
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Corrected Architecture (vs Oracle's 6-Layer Recommendation)
|
||||||
|
|
||||||
|
**Oracle recommended:**
|
||||||
|
```
|
||||||
|
platform-api → core → legacy-common → modern-common → version leaves
|
||||||
|
```
|
||||||
|
|
||||||
|
**Evidence suggests:**
|
||||||
|
```
|
||||||
|
platform-api → core → common (with preprocessor) → version leaves
|
||||||
|
```
|
||||||
|
|
||||||
|
### Why the preprocessor replaces separate common modules:
|
||||||
|
|
||||||
|
- The preprocessor **REPLACES** the need for separate `legacy-common` / `modern-common` modules
|
||||||
|
- Syntactic differences (import paths, method signatures, rendering APIs) are handled by `#if` directives in a single `common/` module
|
||||||
|
- Only truly version-specific code (entity registration, rendering pipelines, network handlers) goes in version leaves
|
||||||
|
- This is proven at scale by Essential Mod, which supports 10+ MC versions with a single `common/` source set
|
||||||
|
|
||||||
|
### What goes where:
|
||||||
|
|
||||||
|
| Layer | Contents | MC Dependencies |
|
||||||
|
|---|---|---|
|
||||||
|
| `platform-api/` | Interfaces only (`IPlayer`, `INbt`, `PlatformService`) | None |
|
||||||
|
| `core/` | MC-free game logic (controllers, data classes, enums, utils) | None |
|
||||||
|
| `common/` | Shared MC-aware code with `#if` preprocessor directives | Yes (version-gated) |
|
||||||
|
| `versions/<ver>/` | Entity registration, rendering, version-specific implementations | Full MC + Forge/NeoForge |
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
# Phase 0A Report — Build Restructure: mc1710 as Gradle Subproject
|
||||||
|
|
||||||
|
**Date:** 2026-03-15
|
||||||
|
**Status:** COMPLETE
|
||||||
|
**Build verification:** `./gradlew :mc1710:build` ✅ | `./gradlew build` ✅
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Phase 0A restructures the CustomNPC-Plus build system so that the MC 1.7.10 Forge mod lives in a Gradle multi-project subproject (`mc1710/`), while the root project becomes a lightweight coordinator. This enables future MC version leaves (mc1122, mc1165, mc1201) to be added as additional subprojects or composite builds.
|
||||||
|
|
||||||
|
**Zero Java source files were modified.** This was purely a build system restructure.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## What Changed
|
||||||
|
|
||||||
|
### New Directory Structure
|
||||||
|
```
|
||||||
|
Root/
|
||||||
|
build.gradle → Minimal coordinator (buildscript repos + idea plugin only)
|
||||||
|
settings.gradle → includes 'platform-api', 'core', 'mc1710' + includeBuild 'gradle-plugins'
|
||||||
|
gradle.properties → Settings-level props only (blowdryerTag, modName/Id/Group for GTNH settings convention)
|
||||||
|
platform-api/ → Unchanged (plain Java 8 library)
|
||||||
|
core/ → Unchanged (plain Java 8 library, depends on platform-api)
|
||||||
|
mc1710/ → NEW: Minecraft 1.7.10 Forge mod subproject
|
||||||
|
build.gradle → GTNH convention + RFG + dts.typescript-generator
|
||||||
|
gradle.properties → All mod-specific properties (forgeVersion, mixins, shadows, etc.)
|
||||||
|
dependencies.gradle → Moved from root
|
||||||
|
repositories.gradle → Moved from root
|
||||||
|
src/main/java/ → Moved from root src/main/java/
|
||||||
|
src/main/resources/ → Moved from root src/main/resources/
|
||||||
|
src/api/ → Git submodule (re-added at new path)
|
||||||
|
tools/ → Moved from root tools/
|
||||||
|
dts-patches/ → Moved from root dts-patches/
|
||||||
|
gradle-plugins/ → Unchanged (composite build, TypeScript .d.ts generator)
|
||||||
|
.github/ → Unchanged (javadoc theme files referenced by mc1710 via ../)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Files Created
|
||||||
|
| File | Purpose |
|
||||||
|
|------|---------|
|
||||||
|
| `mc1710/build.gradle` | GTNH convention + RFG plugin application, TypeScript generation, javadoc config |
|
||||||
|
| `mc1710/gradle.properties` | All mod-specific properties (MC version, Forge, mixins, shadows, publishing) |
|
||||||
|
|
||||||
|
### Files Modified
|
||||||
|
| File | Change |
|
||||||
|
|------|--------|
|
||||||
|
| `build.gradle` | Replaced with minimal coordinator (buildscript repos + `apply plugin: 'idea'`) |
|
||||||
|
| `settings.gradle` | Changed `include 'core', 'platform-api'` → `include 'platform-api', 'core', 'mc1710'` |
|
||||||
|
| `gradle.properties` | Stripped to settings-level props only; added modName/modId/modGroup for GTNH settings convention |
|
||||||
|
| `.gitmodules` | API submodule path changed from `src/api` → `mc1710/src/api` |
|
||||||
|
|
||||||
|
### Files Moved
|
||||||
|
| From | To |
|
||||||
|
|------|------|
|
||||||
|
| `src/main/` | `mc1710/src/main/` |
|
||||||
|
| `src/api` (submodule) | `mc1710/src/api` (submodule, re-added) |
|
||||||
|
| `tools/` | `mc1710/tools/` |
|
||||||
|
| `dts-patches/` | `mc1710/dts-patches/` |
|
||||||
|
| `dependencies.gradle` | `mc1710/dependencies.gradle` |
|
||||||
|
| `repositories.gradle` | `mc1710/repositories.gradle` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Key Decisions & Discoveries
|
||||||
|
|
||||||
|
### 1. GTNH Settings Convention Requires Root Properties
|
||||||
|
The `gtnhsettingsconvention` plugin validates `modName`, `modId`, and `modGroup` at settings evaluation time — **before** subproject gradle.properties are loaded. These three properties must remain in root gradle.properties even though they're also in mc1710/gradle.properties.
|
||||||
|
|
||||||
|
### 2. IDE Integration Module Incompatible with Multi-Project
|
||||||
|
The GTNH convention's `IdeIntegrationModule` calls `idea.getProject()` which returns `null` for non-root projects in Gradle. This causes a `NullPointerException` when the convention is applied to a subproject. **Fix:** Set `gtnh.modules.ideIntegration = false` in mc1710/gradle.properties. IDE setup will need to be handled at root level separately if needed.
|
||||||
|
|
||||||
|
### 3. Root Needs `idea` Plugin and Buildscript Repositories
|
||||||
|
The GTNH settings convention adds plugin version mappings that require classpath resolution. The root project needs:
|
||||||
|
- `buildscript.repositories` block with GTNH Maven + Gradle Plugin Portal
|
||||||
|
- `apply plugin: 'idea'` to prevent NPE in subproject convention modules that reference root IDEA model
|
||||||
|
|
||||||
|
### 4. Code Style Disabled at Root
|
||||||
|
`gtnh.modules.codeStyle = false` at root level prevents the settings convention from attempting to resolve Spotless/Checkstyle for the root project. mc1710/gradle.properties has `disableSpotless = true` and `disableCheckstyle = true` (same as before).
|
||||||
|
|
||||||
|
### 5. API Submodule Pinned to Correct Commit
|
||||||
|
The API submodule was re-added via `git submodule add`. The `dev` branch HEAD had newer commits with API changes that the existing code doesn't implement yet. The submodule was pinned to the exact commit (`d2194bb`) that was checked out before the restructure.
|
||||||
|
|
||||||
|
### 6. mc1710/build.gradle Adjustments from Original
|
||||||
|
| Change | Reason |
|
||||||
|
|--------|--------|
|
||||||
|
| `commandLine gradleWrapper, ':mc1710:build', '-Pnomixin'` | buildNoMixin task targets mc1710 specifically |
|
||||||
|
| `commandLine gradleWrapper, ':mc1710:runClient', '-PnoNashorn'` | runClientNoNashorn targets mc1710 |
|
||||||
|
| `commandLine gradleWrapper, ':mc1710:runServer', '-PnoNashorn'` | runServerNoNashorn targets mc1710 |
|
||||||
|
| `file('../.github/javadoc/...')` | Javadoc resources are at repo root, not in mc1710 |
|
||||||
|
| Removed `id 'idea'` from plugins | GTNH convention applies IDEA internally; standalone caused conflicts |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build Output
|
||||||
|
|
||||||
|
```
|
||||||
|
mc1710/build/libs/
|
||||||
|
CustomNPC-Plus-1.11.1.jar (17.7 MB, production JAR)
|
||||||
|
CustomNPC-Plus-1.11.1-dev.jar (17.6 MB, development JAR)
|
||||||
|
CustomNPC-Plus-1.11.1-dev-preshadow.jar (15.4 MB, pre-shadow JAR)
|
||||||
|
CustomNPC-Plus-1.11.1-sources.jar (12.9 MB, sources)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build Commands (Updated)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build mc1710 module only
|
||||||
|
./gradlew :mc1710:build
|
||||||
|
|
||||||
|
# Build all modules (platform-api, core, mc1710)
|
||||||
|
./gradlew build
|
||||||
|
|
||||||
|
# Build without mixin embedding
|
||||||
|
./gradlew :mc1710:buildNoMixin
|
||||||
|
|
||||||
|
# Run the game
|
||||||
|
./gradlew :mc1710:runClient
|
||||||
|
./gradlew :mc1710:runServer
|
||||||
|
|
||||||
|
# Run without Nashorn
|
||||||
|
./gradlew :mc1710:runClientNoNashorn
|
||||||
|
./gradlew :mc1710:runServerNoNashorn
|
||||||
|
|
||||||
|
# Update API submodule
|
||||||
|
./gradlew :mc1710:updateAPI
|
||||||
|
|
||||||
|
# Generate TypeScript definitions
|
||||||
|
./gradlew :mc1710:generateTypeScriptDefinitions
|
||||||
|
|
||||||
|
# IDE setup
|
||||||
|
./gradlew :mc1710:genIntellijRuns
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Self-Review Checklist
|
||||||
|
|
||||||
|
| # | Check | Status |
|
||||||
|
|---|-------|--------|
|
||||||
|
| 1 | `./gradlew :mc1710:build` exits 0 and produces JAR in mc1710/build/libs/ | ✅ |
|
||||||
|
| 2 | `./gradlew build` exits 0 (all modules build) | ✅ |
|
||||||
|
| 3 | No files remain in root `src/` directory | ✅ (directory removed) |
|
||||||
|
| 4 | Root build.gradle does NOT apply `com.gtnewhorizons.gtnhconvention` | ✅ |
|
||||||
|
| 5 | mc1710/src/main/java/noppes/npcs/ exists | ✅ |
|
||||||
|
| 6 | mc1710/src/main/java/noppes/npcs/mixin/ exists | ✅ |
|
||||||
|
| 7 | mc1710/tools/ exists with JaninoLoader JAR | ✅ |
|
||||||
|
| 8 | mc1710/dts-patches/ exists | ✅ |
|
||||||
|
| 9 | `git submodule status` shows mc1710/src/api with valid commit hash | ✅ (d2194bb) |
|
||||||
|
| 10 | Root gradle.properties only has settings-level properties | ✅ (+ required modName/Id/Group) |
|
||||||
|
| 11 | mc1710/gradle.properties has all mod-specific properties | ✅ (57 properties) |
|
||||||
|
| 12 | .AGENTS/PHASE_0A_REPORT.md exists and is complete | ✅ (this file) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Known Residual Issues
|
||||||
|
|
||||||
|
1. **Locked file:** `tools/standalone-JaninoLoader-1.0.2.jar` at root level was locked by a process during the move. It is removed from git tracking but the physical file may persist until the lock is released. It's in `.gitignore` territory and won't affect the build.
|
||||||
|
|
||||||
|
2. **`gtnh.modules.ideIntegration = false`:** IntelliJ run configurations won't be auto-generated for mc1710. Users need to manually configure run configs with `--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json` as before. This can be addressed in a follow-up by configuring IDE integration at root level.
|
||||||
|
|
||||||
|
3. **Root gradle.properties duplication:** `modName`, `modId`, `modGroup` are duplicated between root and mc1710 gradle.properties. This is necessary because the GTNH settings convention validates them before subproject properties are loaded. Future MC version modules will have their own modId values — the root values serve as defaults for the settings convention.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Next Phase
|
||||||
|
|
||||||
|
**Phase 0B/0C:** Merge scripting API interfaces into platform-api, expanding the abstraction layer for multi-version support.
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
# Phase 0B Report — Move Scripting API Interfaces to platform-api
|
||||||
|
|
||||||
|
**Date:** 2026-03-15
|
||||||
|
**Agent:** Sisyphus-Junior (claude-opus-4.6)
|
||||||
|
|
||||||
|
## What Was Done
|
||||||
|
|
||||||
|
All 232 scripting API interfaces from `mc1710/src/api/java/noppes/npcs/api/` are now present in `platform-api/src/main/java/noppes/npcs/api/` as MC-free versions. Platform-api compiles as a pure Java library with zero Minecraft/Forge dependencies.
|
||||||
|
|
||||||
|
### Key changes:
|
||||||
|
1. **168 MC-free files** — Already present in platform-api (copied in a prior operation). Verified identical to API submodule versions.
|
||||||
|
2. **26 entity interfaces** — Stripped generic type parameters bound to MC Entity classes (`<T extends Entity>` → raw types), replaced `T getMCEntity()` → `Object getMCEntity()`, removed MC imports.
|
||||||
|
3. **37 non-entity MC-contaminated files** — Replaced all MC types with `Object` returns/params (e.g., `ItemStack` → `Object`, `NBTTagCompound` → `Object`, `BlockPos` → `Object`, `DamageSource` → `Object`, etc.)
|
||||||
|
4. **Created `@Cancelable` annotation** — Platform-api replacement for `cpw.mods.fml.common.eventhandler.Cancelable` used by 14 event interfaces.
|
||||||
|
5. **AbstractNpcAPI** — Rewrote to remove all 12 MC/FML imports; `IsAvailable()` uses reflection instead of `Loader.isModLoaded()`.
|
||||||
|
6. **ISlot** — Used `INbt` instead of `Object` for NBT-typed methods (matching core's implementation).
|
||||||
|
7. **ILine.formatTarget()** and **IPlayerEffect.performEffect()** — Made default methods to avoid breaking core implementations that don't override them.
|
||||||
|
|
||||||
|
## Files Changed (63 modified, 1 created)
|
||||||
|
|
||||||
|
### Created
|
||||||
|
- `platform-api/src/main/java/noppes/npcs/api/Cancelable.java` — Platform annotation replacing FML's `@Cancelable`
|
||||||
|
|
||||||
|
### Entity Interfaces — Generics Stripped (26 files)
|
||||||
|
**Hierarchy (5):**
|
||||||
|
- `entity/IEntity.java` — `<T extends Entity>` → raw, `T getMCEntity()` → `Object`, `IEntity<?>[]` → `IEntity[]`
|
||||||
|
- `entity/IEntityLivingBase.java` — `<T extends EntityLivingBase>` → raw, `T getMCEntity()` → `Object`
|
||||||
|
- `entity/IEntityLiving.java` — `<T extends EntityLiving>` → raw, `T getMCEntity()` → `Object`
|
||||||
|
- `entity/ICustomNpc.java` — `<T extends EntityCreature>` → raw
|
||||||
|
- `entity/IPlayer.java` — `<T extends EntityPlayerMP>` → raw, `mountEntity(Entity)` → `mountEntity(Object)`
|
||||||
|
|
||||||
|
**Other entity interfaces (21):**
|
||||||
|
- `entity/IAnimal.java`, `IArrow.java`, `IEnergyAbility.java`, `IEnergyBarrier.java`, `IEnergyBeam.java`, `IEnergyDisc.java`, `IEnergyDome.java`, `IEnergyExplosion.java`, `IEnergyLaser.java`, `IEnergyOrb.java`, `IEnergyPanel.java`, `IEnergyProjectile.java`, `IEnergySlicer.java`, `IEnergySweeper.java`, `IEnergyZone.java`, `IEntityItem.java`, `IFishHook.java`, `IMonster.java`, `IPixelmon.java`, `IThrowable.java`, `IVillager.java` — All stripped of `<T extends MC_Entity>` and MC imports
|
||||||
|
|
||||||
|
### MC Type Replacements (37 files)
|
||||||
|
**Root package (8):**
|
||||||
|
- `AbstractNpcAPI.java` — Full rewrite: 12 MC imports removed, MC-typed params → Object, `IsAvailable()` uses reflection
|
||||||
|
- `IBlock.java` — `Block getMCBlock()` → `Object`, `TileEntity getMCTileEntity()` → `Object`
|
||||||
|
- `IContainer.java` — `IInventory getMCInventory()` → `Object`, `Container getMCContainer()` → `Object`
|
||||||
|
- `IDamageSource.java` — `DamageSource getMCDamageSource()` → `Object`
|
||||||
|
- `INbt.java` — `NBTTagCompound getMCNBT()` → `Object`
|
||||||
|
- `IPos.java` — `BlockPos getMCPos()` → `Object`
|
||||||
|
- `ITileEntity.java` — `TileEntity getMCTileEntity()` → `Object`
|
||||||
|
- `IWorld.java` — `WorldServer getMCWorld()` → `Object`
|
||||||
|
|
||||||
|
**Events (15):**
|
||||||
|
- `event/IAbilityEvent.java`, `IAnimationEvent.java`, `IAuctionEvent.java`, `IBlockEvent.java`, `ICustomGuiEvent.java`, `ICustomNPCsEvent.java`, `IDialogEvent.java`, `IFactionEvent.java`, `IItemEvent.java`, `INpcEvent.java`, `IPartyEvent.java`, `IPlayerEvent.java`, `IQuestEvent.java`, `IRecipeEvent.java` — `cpw.mods.fml.common.eventhandler.Cancelable` → `noppes.npcs.api.Cancelable`
|
||||||
|
- `event/IForgeEvent.java` — `Event getEvent()` → `Object getEvent()`
|
||||||
|
|
||||||
|
**GUI (3):**
|
||||||
|
- `gui/ICustomGui.java` — `NBTTagCompound` → `Object`
|
||||||
|
- `gui/ICustomGuiComponent.java` — `NBTTagCompound` → `Object`
|
||||||
|
- `gui/IItemSlot.java` — `Slot getMCSlot()` → `Object getMCSlot()`
|
||||||
|
|
||||||
|
**Handler/data (5):**
|
||||||
|
- `handler/IRecipeHandler.java` — `ItemStack` → `Object`
|
||||||
|
- `handler/data/IRecipe.java` — `ItemStack` → `Object`
|
||||||
|
- `handler/data/IAnvilRecipe.java` — `ItemStack` → `Object`
|
||||||
|
- `handler/data/ISlot.java` — `NBTTagCompound` → `INbt` (matching core implementation)
|
||||||
|
- `handler/data/IProfile.java` — `NBTTagCompound` → `Object`
|
||||||
|
|
||||||
|
**Item (1):**
|
||||||
|
- `item/IItemStack.java` — `ItemStack getMCItemStack()` → `Object`, `NBTTagCompound getMCNbt()` → `Object`, `setMCNbt(NBTTagCompound)` → `setMCNbt(Object)`
|
||||||
|
|
||||||
|
**Others (5):**
|
||||||
|
- `jobs/IJobSpawner.java` — Stripped `IEntityLivingBase<?>` → `IEntityLivingBase`, `IPlayer<EntityPlayerMP>` → `IPlayer`
|
||||||
|
- `overlay/ICustomOverlay.java` — `NBTTagCompound` → `Object`
|
||||||
|
- `overlay/ICustomOverlayComponent.java` — `NBTTagCompound` → `Object`
|
||||||
|
- `roles/IRole.java` — `INpc getNpc()` → `Object getNpc()`
|
||||||
|
- `roles/IRoleTransporter.java` — `IPlayer<EntityPlayerMP>` → `IPlayer`
|
||||||
|
|
||||||
|
### Core Compatibility (2 files — default methods added)
|
||||||
|
- `handler/data/ILine.java` — `formatTarget(IEntityLivingBase)` made default (returns `this`)
|
||||||
|
- `handler/data/IPlayerEffect.java` — `performEffect(IPlayer)` made default (no-op)
|
||||||
|
|
||||||
|
### Package Info (1 file)
|
||||||
|
- `package-info.java` — Removed `@API` annotation (FML-specific)
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
| Check | Result |
|
||||||
|
|---|---|
|
||||||
|
| `./gradlew :platform-api:compileJava` | **PASS** |
|
||||||
|
| `./gradlew :core:compileJava` | **PASS** |
|
||||||
|
| `./gradlew :mc1710:build` | **PASS** |
|
||||||
|
| Zero MC imports in platform-api | **PASS** (0 files) |
|
||||||
|
| All 232 files retained in mc1710/src/api/java | **PASS** |
|
||||||
|
| platform-api file count | 233 (232 API + 1 Cancelable annotation) |
|
||||||
|
| Package structure preserved | **PASS** — exact `noppes.npcs.api.*` structure |
|
||||||
|
|
||||||
|
## Discoveries / Notes
|
||||||
|
|
||||||
|
1. **Prior full copy**: A previous operation had already copied all 232 API files to platform-api (including MC-contaminated ones). Phase 0B's actual work was making ALL files MC-free, not just copying the MC-free subset.
|
||||||
|
|
||||||
|
2. **Scope expansion**: The task described moving ~100 MC-free files. In practice, all 232 files were already present, and 63 of them needed MC imports stripped. This was necessary because MC-free files depend on MC-contaminated interfaces (e.g., many files import `IItemStack` which had MC imports). Removing them would break compilation.
|
||||||
|
|
||||||
|
3. **Entity generics stripping** applied to all 26 entity interfaces (not just the 5 hierarchy ones), because all entity interfaces used `<T extends MC_Entity>` generics.
|
||||||
|
|
||||||
|
4. **ISlot used INbt instead of Object**: The core `Slot` class implements `ISlot` using `INbt` types. Using `Object` (as a blanket MC-type replacement) broke core. Changed to `INbt` for NBT-typed methods.
|
||||||
|
|
||||||
|
5. **Default methods for new API methods**: Two methods (`ILine.formatTarget`, `IPlayerEffect.performEffect`) existed in the API submodule but not in the older platform-api versions. Core implementations don't override them. Made them `default` to maintain backward compatibility.
|
||||||
|
|
||||||
|
6. **AbstractNpcAPI.IsAvailable()**: Changed from `Loader.isModLoaded("customnpcs")` to reflection-based `Class.forName()` check, making it MC-free.
|
||||||
|
|
||||||
|
7. **Split-package shadow works correctly**: mc1710 still compiles because its API submodule has the full MC-typed versions that shadow the platform-api versions at compile time. The mc1710 build sees its own generic/MC-typed interfaces, not the stripped ones.
|
||||||
|
|
||||||
|
8. **Phase 0C scope reduced**: Since all MC-contaminated files were handled in this phase (stripped to MC-free), Phase 0C's remaining work is limited to any NEW interfaces that may need to be created, rather than stripping existing ones.
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
# Phase 0C Report — Assessment Complete, No Remaining Work
|
||||||
|
|
||||||
|
**Date:** 2026-03-15
|
||||||
|
**Agent:** Sisyphus-Junior (claude-opus-4.6)
|
||||||
|
|
||||||
|
## Verdict: Phase 0C is COMPLETE. Zero new interfaces needed.
|
||||||
|
|
||||||
|
Phase 0B's work fully subsumed Phase 0C's original scope. All 232 scripting API interfaces are present in `platform-api/` as MC-free versions, the modules compile cleanly, and every interface referenced by `core/` resolves to an existing file.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Assessment Methodology
|
||||||
|
|
||||||
|
Five questions were systematically verified:
|
||||||
|
|
||||||
|
### Q1: Are there interfaces in `core/src/main/java/noppes/npcs/api/` that need to be in platform-api but aren't?
|
||||||
|
|
||||||
|
**Result: No.** There are zero `.java` files under `core/src/main/java/noppes/npcs/api/`. Core does not define any API interfaces — it only *imports and implements* them from platform-api.
|
||||||
|
|
||||||
|
### Q2: Are there TODO comments indicating missing interface definitions?
|
||||||
|
|
||||||
|
**Result: No missing interfaces.** There are 22 TODO comments across 8 core files, but they all describe **mc1710 shadow behavior** (e.g., "mc1710 version implements IFactionHandler and adds:"), not missing interfaces. These are expected split-package documentation. Zero TODO/FIXME/STUB comments exist in platform-api.
|
||||||
|
|
||||||
|
Specific TODO categories found in core:
|
||||||
|
- **Controller shadow notes** (7): FactionController, MagicController, TransportController, TagController — documenting that mc1710 versions implement handler interfaces
|
||||||
|
- **Data class shadow notes** (3): Faction, Magic — documenting mc1710 versions implement data interfaces and add ItemStack fields
|
||||||
|
- **MC-only method notes** (4): NBTTags — methods that stay in mc1710 version due to direct MC type usage
|
||||||
|
- **Platform service TODOs** (2): PlayerEffect — methods requiring CustomEffectController, to be implemented via callback/platform service in mc1710 override
|
||||||
|
|
||||||
|
None of these indicate missing interfaces.
|
||||||
|
|
||||||
|
### Q3: Are there interface references in core pointing to non-existent files?
|
||||||
|
|
||||||
|
**Result: No.** All 98 `import noppes.npcs.api.*` statements across 53 core files resolve to existing platform-api interfaces. Every unique interface was verified:
|
||||||
|
|
||||||
|
| Interface | Package | Exists in platform-api |
|
||||||
|
|-----------|---------|----------------------|
|
||||||
|
| `INbt` | `noppes.npcs.api` | Yes |
|
||||||
|
| `INbtList` | `noppes.npcs.api` | Yes |
|
||||||
|
| `IPos` | `noppes.npcs.api` | Yes |
|
||||||
|
| `ISkinOverlay` | `noppes.npcs.api` | Yes |
|
||||||
|
| `ISlot` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ICustomAttribute` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IAttributeDefinition` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IDialogImage` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IFrame` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IFramePart` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ILine` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ILines` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IMagicCycle` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IMagicData` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IPartyOptions` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IPlayerEffect` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IProfileOptions` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ITag` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ITransportCategory` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `ITransportLocation` | `noppes.npcs.api.handler.data` | Yes |
|
||||||
|
| `IHitboxData` | `noppes.npcs.api.entity.data` | Yes |
|
||||||
|
| `ITintData` | `noppes.npcs.api.entity.data` | Yes |
|
||||||
|
| `IPlayerDialogData` | `noppes.npcs.api.handler` | Yes |
|
||||||
|
| `IPlayerTransportData` | `noppes.npcs.api.handler` | Yes |
|
||||||
|
| `IEnergyCombatData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
| `IEnergyAnchorData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
| `IEnergyHomingData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
| `IEnergyDisplayData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
| `IEnergyLifespanData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
| `IEnergyLightningData` | `noppes.npcs.api.ability.data` | Yes |
|
||||||
|
|
||||||
|
### Q4: Do all handler interfaces exist in platform-api?
|
||||||
|
|
||||||
|
**Result: Yes.** All four target handler interfaces exist and are referenced by `AbstractNpcAPI`:
|
||||||
|
|
||||||
|
| Handler Interface | Location | Referenced By |
|
||||||
|
|-------------------|----------|---------------|
|
||||||
|
| `IFactionHandler` | `platform-api/.../handler/IFactionHandler.java` | `AbstractNpcAPI.getFactions()` |
|
||||||
|
| `IMagicHandler` | `platform-api/.../handler/IMagicHandler.java` | `AbstractNpcAPI.getMagicHandler()` |
|
||||||
|
| `ITransportHandler` | `platform-api/.../handler/ITransportHandler.java` | `AbstractNpcAPI.getLocations()` |
|
||||||
|
| `ITagHandler` | `platform-api/.../handler/ITagHandler.java` | Present in platform-api |
|
||||||
|
|
||||||
|
### Q5: Does platform-api have complete interface contracts for all data classes?
|
||||||
|
|
||||||
|
**Result: Yes.** All 27 `implements` clauses in core resolve to existing platform-api interfaces:
|
||||||
|
|
||||||
|
- `Slot implements ISlot`
|
||||||
|
- `PlayerAttribute implements ICustomAttribute`
|
||||||
|
- `AttributeDefinition implements IAttributeDefinition`
|
||||||
|
- `EnergyAnchorData implements IEnergyAnchorData`
|
||||||
|
- `EnergyDisplayData implements IEnergyDisplayData`
|
||||||
|
- `EnergyLightningData implements IEnergyLightningData`
|
||||||
|
- `EnergyHomingData implements IEnergyHomingData`
|
||||||
|
- `EnergyCombatData implements IEnergyCombatData`
|
||||||
|
- `EnergyLifespanData implements IEnergyLifespanData`
|
||||||
|
- `TransportLocation implements ITransportLocation`
|
||||||
|
- `TransportCategory implements ITransportCategory`
|
||||||
|
- `TintData implements ITintData`
|
||||||
|
- `Tag implements ITag`
|
||||||
|
- `SkinOverlay implements ISkinOverlay`
|
||||||
|
- `FramePart implements IFramePart`
|
||||||
|
- `Frame implements IFrame`
|
||||||
|
- `ProfileOptions implements IProfileOptions`
|
||||||
|
- `DialogImage implements IDialogImage`
|
||||||
|
- `PlayerTransportData implements IPlayerTransportData`
|
||||||
|
- `PlayerEffect implements IPlayerEffect`
|
||||||
|
- `MagicCycle implements IMagicCycle`
|
||||||
|
- `MagicData implements IMagicData`
|
||||||
|
- `Line implements ILine`
|
||||||
|
- `Lines implements ILines`
|
||||||
|
- `PlayerDialogData implements IPlayerDialogData`
|
||||||
|
- `PartyOptions implements IPartyOptions`
|
||||||
|
- `HitboxData implements IHitboxData`
|
||||||
|
|
||||||
|
Additionally, `IFaction` and `IMagic` exist in platform-api for the split-package shadow pattern used by `Faction.java` and `Magic.java` (mc1710 versions add `implements IFaction`/`implements IMagic`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build Verification
|
||||||
|
|
||||||
|
```
|
||||||
|
> Task :platform-api:compileJava UP-TO-DATE
|
||||||
|
> Task :core:compileJava UP-TO-DATE
|
||||||
|
BUILD SUCCESSFUL
|
||||||
|
```
|
||||||
|
|
||||||
|
Both modules compile with zero errors. No Minecraft/Forge dependencies leak into platform-api or core.
|
||||||
|
|
||||||
|
## Platform-API Coverage
|
||||||
|
|
||||||
|
- **239 interfaces** (excluding package-info.java) in platform-api
|
||||||
|
- **236 interfaces** in API submodule (`mc1710/src/api/java/`)
|
||||||
|
- **Delta: +1** — `Cancelable.java` annotation (platform-api only, replaces FML's `@Cancelable`)
|
||||||
|
- Platform-api is a **complete superset** of the API submodule. No gaps.
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
Phase 0C had no remaining scope after Phase 0B completed. The original Phase 0C plan was to handle MC-contaminated interfaces that needed stripping — Phase 0B already performed this work for all 63 MC-contaminated files (26 entity interfaces + 37 other files). No new interfaces need to be created for platform-api. The migration can proceed directly to Phase 1 (additional core extractions).
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
# Phase 0D Report — Sync Missing Methods from mc1710 Shadows into core/
|
||||||
|
|
||||||
|
**Date:** 2026-03-15 (corrected)
|
||||||
|
**Agent:** Sisyphus-Junior (claude-opus-4.6)
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Full method-level diff of all 8 core files against their mc1710 shadows. Added missing methods, fixed return types, cleaned TODO/OLD comments. Both `:core:compileJava` and `:mc1710:compileJava` pass.
|
||||||
|
|
||||||
|
## Changes Per File
|
||||||
|
|
||||||
|
### 1. FactionController.java
|
||||||
|
|
||||||
|
**Missing methods added:**
|
||||||
|
- `public List<Faction> list()` — returns all factions as a list (mc1710 returns `List<IFaction>`)
|
||||||
|
- `public Faction delete(int id)` — changed from `void` to `Faction` return type, matching mc1710's `IFaction delete(int id)` logic (remove, save, set id=-1, return)
|
||||||
|
|
||||||
|
**Cleanup:** Removed all TODO/OLD comments (SyncController notes, DataInputStream notes, LogWriter notes). SyncController calls remain mc1710-only (added by shadow).
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific, stay in mc1710 shadow):**
|
||||||
|
- SyncController.syncUpdate/syncRemove calls (network layer)
|
||||||
|
|
||||||
|
### 2. MagicController.java
|
||||||
|
|
||||||
|
**No missing methods.** Core already had all methods matching mc1710.
|
||||||
|
|
||||||
|
**Cleanup:** Removed all TODO/OLD comments (8 blocks: IMagicHandler note, ItemStack defaults, SyncController calls, DataInputStream, CompressedStreamTools, LogWriter). Made `createDefaults()` protected so mc1710 can override to add ItemStack items.
|
||||||
|
|
||||||
|
### 3. TransportController.java
|
||||||
|
|
||||||
|
**Missing methods added:**
|
||||||
|
- `public TransportCategory[] categories()` — returns all categories as array
|
||||||
|
- `public void createCategory(String title)` — delegates to `saveCategory(title, -1)`
|
||||||
|
- `public TransportCategory getCategory(String title)` — finds category by title
|
||||||
|
- `public void removeCategory(String title)` — removes category by title
|
||||||
|
|
||||||
|
**Cleanup:** Removed all TODO/OLD comments (ITransportHandler note, CompressedStreamTools, NBTWrapper, LogWriter).
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific):**
|
||||||
|
- `saveLocation(int categoryId, NBTTagCompound compound, EntityNPCInterface npc)` — uses EntityNPCInterface, RoleTransporter, EnumRoleType
|
||||||
|
|
||||||
|
### 4. TagController.java
|
||||||
|
|
||||||
|
**Missing methods added:**
|
||||||
|
- `public List<Tag> list()` — returns all tags as a list (mc1710 returns `List<ITag>`)
|
||||||
|
|
||||||
|
**Return type fixed:**
|
||||||
|
- `public Tag delete(int id)` — changed from `void` to `Tag` return type, matching mc1710's `ITag delete(int id)` logic
|
||||||
|
|
||||||
|
**Cleanup:** Removed all TODO/OLD comments (ITagHandler note, DataInputStream, NBTWrapper, CompressedStreamTools, LogWriter).
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific):**
|
||||||
|
- `sendCategoryTagMap(EntityPlayerMP, HashMap<String, HashSet<UUID>>)` — uses EntityPlayerMP, GuiDataPacket
|
||||||
|
|
||||||
|
### 5. Faction.java (data)
|
||||||
|
|
||||||
|
**Missing methods added:**
|
||||||
|
- `public int playerStatus(IPlayer player)` — returns 1/0/-1 for friendly/neutral/enemy using IPlayerFactionData
|
||||||
|
- `public boolean isAggressiveToNpc(ICustomNpc npc)` — checks if faction attacks NPC's faction
|
||||||
|
- `public boolean isEnemyFaction(IFaction faction)` — IFaction-parameter overload
|
||||||
|
- `public Faction[] getEnemyFactions()` — returns array of enemy factions (core returns `Faction[]`, mc1710 shadows to `IFaction[]`)
|
||||||
|
- `public void addEnemyFaction(IFaction faction)` — IFaction-parameter overload
|
||||||
|
- `public void removeEnemyFaction(IFaction faction)` — IFaction-parameter overload
|
||||||
|
- `public void save()` — delegates to `FactionController.getInstance().saveFaction(this)`
|
||||||
|
|
||||||
|
**Imports added:** `ICustomNpc`, `IPlayer`, `IPlayerFactionData`, `IFaction`, `FactionController`, `ArrayList`
|
||||||
|
|
||||||
|
**Cleanup:** Removed TODO block listing 9 mc1710-only methods.
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific, stay in mc1710 shadow):**
|
||||||
|
- `isFriendlyToPlayer(EntityPlayer)` — uses PlayerData.get(EntityPlayer)
|
||||||
|
- `isAggressiveToPlayer(EntityPlayer)` — uses PlayerData.get(EntityPlayer)
|
||||||
|
- `isNeutralToPlayer(EntityPlayer)` — uses PlayerData.get(EntityPlayer)
|
||||||
|
- `isAggressiveToNpc(EntityNPCInterface)` — uses entity.faction.id
|
||||||
|
- `isFriendlyToPlayer(IPlayer)` — delegates to EntityPlayer overload via getMCEntity()
|
||||||
|
- `isNeutralToPlayer(IPlayer)` — delegates to EntityPlayer overload via getMCEntity()
|
||||||
|
- `isAggressiveToPlayer(IPlayer)` — delegates to EntityPlayer overload via getMCEntity()
|
||||||
|
|
||||||
|
### 6. Magic.java (data)
|
||||||
|
|
||||||
|
**No missing methods.** Core already had all MC-free methods.
|
||||||
|
|
||||||
|
**Cleanup:** Removed 4 TODO/OLD comment blocks (ItemStack field note, GameRegistry notes in readNBT/writeNBT, IMagic setItem/getItem note).
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific):**
|
||||||
|
- `public void setItem(ItemStack item)` — uses GameRegistry.findUniqueIdentifierFor
|
||||||
|
- `public ItemStack getItem()` — returns MC ItemStack
|
||||||
|
|
||||||
|
### 7. NBTTags.java
|
||||||
|
|
||||||
|
**No missing methods.** All MC-free utility methods were already present.
|
||||||
|
|
||||||
|
**Cleanup:** Removed 4 TODO/OLD comment blocks (ItemStack methods, nbtDoubleList, Script methods, getIntAt).
|
||||||
|
|
||||||
|
**Methods intentionally NOT added (MC-specific):**
|
||||||
|
- `getItemStackList/getItemStackArray` — use NoppesUtilServer.readItem
|
||||||
|
- `nbtItemStackList/nbtItemStackArray` — use NoppesUtilServer.writeItem
|
||||||
|
- `nbtDoubleList` — uses NBTTagDouble directly
|
||||||
|
- `GetScriptOld/GetScript/NBTScript` — use IScriptHandler/IScriptUnit
|
||||||
|
- `getIntAt` — uses NBTTagInt.func_150287_d()
|
||||||
|
|
||||||
|
### 8. PlayerEffect.java
|
||||||
|
|
||||||
|
**Signature fixed:**
|
||||||
|
- `performEffect(Object player)` → `performEffect(IPlayer player)` — now matches the `IPlayerEffect` interface default method signature from platform-api
|
||||||
|
|
||||||
|
**Import added:** `noppes.npcs.api.entity.IPlayer`
|
||||||
|
|
||||||
|
**Cleanup:** Removed TODO/OLD comments from getName() and performEffect().
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
```
|
||||||
|
:core:compileJava → BUILD SUCCESSFUL
|
||||||
|
:mc1710:compileJava → BUILD SUCCESSFUL
|
||||||
|
```
|
||||||
|
|
||||||
|
## Method Surface Comparison Summary
|
||||||
|
|
||||||
|
| File | Core Methods Before | Core Methods After | mc1710 MC-Only Methods |
|
||||||
|
|------|--------------------|--------------------|----------------------|
|
||||||
|
| FactionController | 16 | 18 (+list, delete→Faction) | 0 (SyncController calls in shadow) |
|
||||||
|
| MagicController | 16 | 16 (no change) | 0 |
|
||||||
|
| TransportController | 14 | 18 (+categories, createCategory, getCategory, removeCategory(String)) | 1 (saveLocation with NBT+Entity) |
|
||||||
|
| TagController | 16 | 18 (+list, delete→Tag) | 1 (sendCategoryTagMap) |
|
||||||
|
| Faction | 20 | 27 (+save, playerStatus, isAggressiveToNpc, isEnemyFaction(IF), getEnemyFactions, addEnemyFaction(IF), removeEnemyFaction(IF)) | 7 (EntityPlayer/EntityNPCInterface methods) |
|
||||||
|
| Magic | 16 | 16 (no change) | 2 (setItem/getItem with ItemStack) |
|
||||||
|
| NBTTags | 33 | 33 (no change) | 7 (ItemStack, Script, Double, IntAt) |
|
||||||
|
| PlayerEffect | 10 | 10 (signature fix only) | 0 |
|
||||||
|
|
||||||
|
## Design Decisions
|
||||||
|
|
||||||
|
1. **`getEnemyFactions()` returns `Faction[]` in core, not `IFaction[]`.** Core's Faction doesn't implement IFaction (mc1710 shadow adds `implements IFaction`). The mc1710 shadow overrides this to return `IFaction[]`.
|
||||||
|
|
||||||
|
2. **`list()` returns `List<Faction>` / `List<Tag>` in core**, not `List<IFaction>` / `List<ITag>`. Same reason — the interface implementation is added by the mc1710 shadow.
|
||||||
|
|
||||||
|
3. **`delete()` returns concrete type** (`Faction` / `Tag`), not interface type. mc1710 shadow widens to `IFaction` / `ITag`.
|
||||||
|
|
||||||
|
4. **`playerStatus(IPlayer)` compiles in core** because `IPlayer.getData().getFactionData().getPoints(int)` is fully defined in platform-api interfaces.
|
||||||
|
|
||||||
|
5. **`performEffect(IPlayer)` now properly overrides** the interface default method instead of using `Object` parameter.
|
||||||
@@ -0,0 +1,506 @@
|
|||||||
|
# Phase 0E Report — Complete Core vs MC1710 Diff Analysis
|
||||||
|
|
||||||
|
**Date:** 2026-03-15
|
||||||
|
**Agent:** Sisyphus-Junior (claude-opus-4.6)
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
|
||||||
|
Exhaustive file-by-file comparison of all 100 core/ classes against their mc1710 counterparts.
|
||||||
|
|
||||||
|
| Metric | Count |
|
||||||
|
|---|---|
|
||||||
|
| **Total core files analyzed** | 100 |
|
||||||
|
| **Files with mc1710 shadow (dual existence)** | 14 |
|
||||||
|
| **Core-only files (no mc1710 shadow)** | 86 |
|
||||||
|
| **MC1710-only files (no core counterpart)** | 53+ (controllers/data only) |
|
||||||
|
| **Differences found in dual files** | 12 files with meaningful diffs |
|
||||||
|
| **Identical dual files** | 2 files (CategoryManager, APIRegistry) |
|
||||||
|
| **Migration completeness** | ~95% correct — most differences are intentional |
|
||||||
|
|
||||||
|
### Key Finding
|
||||||
|
The core/mc1710 split is **well-executed**. The vast majority of differences are **correctly placed** — MC-specific code stays in mc1710 shadows, and MC-free logic lives in core. Only a handful of items warrant review.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Categorization Legend
|
||||||
|
|
||||||
|
- 🟢 **GREEN**: Already correct — no action needed
|
||||||
|
- 🔴 **RED**: Correctly stays in mc1710 shadow only (MC-dependent)
|
||||||
|
- 🟡 **YELLOW**: Needs review — potentially should be in core or has a gap
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 1: Controllers (8 files compared)
|
||||||
|
|
||||||
|
### 1. FactionController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `IFactionHandler` | 🔴 RED — API interface, mc1710 only |
|
||||||
|
| **loadFactions param** | `INbt` | `DataInputStream` | 🟢 GREEN — abstracted correctly |
|
||||||
|
| **getNBT return** | `INbt` | `NBTTagCompound` | 🟢 GREEN — abstracted correctly |
|
||||||
|
| **saveFactions I/O** | `PlatformServiceHolder` | `CompressedStreamTools` + `FileOutputStream` | 🟢 GREEN — abstracted correctly |
|
||||||
|
| **list() return** | `List<Faction>` | `List<IFaction>` | 🟢 GREEN — mc1710 casts to API type |
|
||||||
|
| **delete() return** | `Faction` | `IFaction` | 🟢 GREEN — mc1710 casts to API type |
|
||||||
|
| **saveFaction sync** | (none) | `SyncController.syncUpdate` | 🔴 RED — network sync, mc1710 only |
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. MagicController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `IMagicHandler` | 🔴 RED — API interface, mc1710 only |
|
||||||
|
| **createDefaults** | `protected` | `public` (with ItemStack assigns) | 🟢 GREEN — mc1710 overrides to add items |
|
||||||
|
| **loadMagic param** | `INbt` | `DataInputStream` | 🟢 GREEN |
|
||||||
|
| **getNBT return** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **saveMagic sync** | (none) | `SyncController.syncUpdate` | 🔴 RED |
|
||||||
|
| **removeMagic sync** | (none) | `SyncController.syncRemove` | 🔴 RED |
|
||||||
|
| **saveCycle/removeCycle sync** | (none) | `SyncController` calls | 🔴 RED |
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. TagController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `ITagHandler` | 🔴 RED |
|
||||||
|
| **list() return** | `List<Tag>` | `List<ITag>` | 🟢 GREEN |
|
||||||
|
| **delete() return** | `Tag` | `ITag` | 🟢 GREEN |
|
||||||
|
| **writeTagUUIDs param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **readTagUUIDs param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **sendCategoryTagMap** | MISSING | `EntityPlayerMP, HashMap` | 🔴 RED — MC networking |
|
||||||
|
|
||||||
|
**Missing in core**: `sendCategoryTagMap(EntityPlayerMP, HashMap)` — uses `EntityPlayerMP`, `GuiDataPacket`. **Correctly mc1710-only.**
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. TransportController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `ITransportHandler` | 🔴 RED |
|
||||||
|
| **categories() return** | `TransportCategory[]` | `ITransportCategory[]` | 🟢 GREEN |
|
||||||
|
| **getCategory return** | `TransportCategory` | `ITransportCategory` | 🟢 GREEN |
|
||||||
|
| **saveLocation overload** | MISSING | `(int, NBTTagCompound, EntityNPCInterface)` | 🔴 RED |
|
||||||
|
|
||||||
|
**Missing in core**: `saveLocation(int categoryId, NBTTagCompound compound, EntityNPCInterface npc)` — uses `EntityNPCInterface`, `RoleTransporter`, `EnumRoleType`. **Correctly mc1710-only.**
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. GlobalDataController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **loadData I/O** | `PlatformServiceHolder` | `CompressedStreamTools` | 🟢 GREEN |
|
||||||
|
| **saveData I/O** | `PlatformServiceHolder` | `CompressedStreamTools` | 🟢 GREEN |
|
||||||
|
|
||||||
|
**No missing methods. No interface differences.**
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 6. ServerTagMapController.java
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **loadTagMaps** | MISSING | `DataInputStream` param | 🔴 RED — MC stream type |
|
||||||
|
| **saveTagMap I/O** | `PlatformServiceHolder` | `CompressedStreamTools` + `NBTWrapper` | 🟢 GREEN |
|
||||||
|
|
||||||
|
**Missing in core**: `loadTagMaps(DataInputStream)` — uses MC I/O. **Correctly mc1710-only.**
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. CategoryManager.java
|
||||||
|
|
||||||
|
**IDENTICAL** in core and mc1710. Fully MC-free. No differences at all.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Perfect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 8. APIRegistry.java
|
||||||
|
|
||||||
|
**IDENTICAL** in core and mc1710. Fully MC-free. No differences at all.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Perfect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 2: Controllers/Data Classes (3 files with dual existence)
|
||||||
|
|
||||||
|
### 9. Faction.java (data)
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `IFaction` | 🔴 RED — API interface |
|
||||||
|
| **readNBT param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **writeNBT param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **writeNBT tag method** | `compound.setTagList(...)` | `compound.setTag(...)` | 🟢 GREEN — API difference |
|
||||||
|
| **isFriendlyToPlayer(EntityPlayer)** | MISSING | Uses `PlayerData.get(player).factionData` | 🔴 RED — uses EntityPlayer |
|
||||||
|
| **isAggressiveToPlayer(EntityPlayer)** | MISSING | Uses `PlayerData.get(player).factionData` | 🔴 RED — uses EntityPlayer |
|
||||||
|
| **isNeutralToPlayer(EntityPlayer)** | MISSING | Uses `PlayerData.get(player).factionData` | 🔴 RED — uses EntityPlayer |
|
||||||
|
| **isAggressiveToNpc(EntityNPCInterface)** | MISSING | Uses `entity.faction.id` directly | 🔴 RED — uses EntityNPCInterface |
|
||||||
|
| **isFriendlyToPlayer(IPlayer)** | MISSING | Delegates to EntityPlayer version | 🔴 RED — casts IPlayer.getMCEntity() |
|
||||||
|
| **isNeutralToPlayer(IPlayer)** | MISSING | Delegates to EntityPlayer version | 🔴 RED — casts IPlayer.getMCEntity() |
|
||||||
|
| **isAggressiveToPlayer(IPlayer)** | MISSING | Delegates to EntityPlayer version | 🔴 RED — casts IPlayer.getMCEntity() |
|
||||||
|
| **isAggressiveToNpc(ICustomNpc)** | Uses `npc.getFaction().getId()` | Same logic | 🟢 GREEN — exists in both |
|
||||||
|
| **isEnemyFaction(int)** | EXISTS | MISSING | 🟡 YELLOW — core has overload mc1710 lacks |
|
||||||
|
| **addEnemyFaction(int)** | EXISTS | MISSING | 🟡 YELLOW — core has int overload |
|
||||||
|
| **removeEnemyFaction(int)** | EXISTS | MISSING | 🟡 YELLOW — core has int overload |
|
||||||
|
| **getEnemyFactions return** | `Faction[]` | `IFaction[]` | 🟢 GREEN — mc1710 uses API type |
|
||||||
|
| **addEnemyFaction(IFaction)** | EXISTS | EXISTS | 🟢 GREEN |
|
||||||
|
| **removeEnemyFaction(IFaction)** | EXISTS | EXISTS | 🟢 GREEN |
|
||||||
|
|
||||||
|
**Core has methods mc1710 lacks**:
|
||||||
|
- `isEnemyFaction(int factionId)` — int overload
|
||||||
|
- `addEnemyFaction(int factionId)` — int overload
|
||||||
|
- `removeEnemyFaction(int factionId)` — int overload
|
||||||
|
|
||||||
|
These are convenience overloads added in core. **The int-parameter versions are MC-free and useful.** mc1710 shadow should ideally also have them (or inherit from core).
|
||||||
|
|
||||||
|
**Core method using API types (correctly in core)**:
|
||||||
|
- `playerStatus(IPlayer)` — uses `IPlayerFactionData`, fully MC-free ✅
|
||||||
|
- `isAggressiveToNpc(ICustomNpc)` — uses `ICustomNpc`, MC-free ✅
|
||||||
|
|
||||||
|
**Verdict**: 🟡 Minor gap — core has 3 extra int-overload convenience methods that mc1710 doesn't. These will be inherited via the split-package shadow pattern (mc1710 extends core), so this is actually correct behavior.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 10. Magic.java (data)
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | (none) | `IMagic` | 🔴 RED — API interface |
|
||||||
|
| **readNBT param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **writeNBT param** | `INbt` | `NBTTagCompound` | 🟢 GREEN |
|
||||||
|
| **Field: item** | MISSING | `public ItemStack item = null` | 🔴 RED — MC ItemStack |
|
||||||
|
| **readNBT GameRegistry** | MISSING | `GameRegistry.findItem()` + `new ItemStack()` | 🔴 RED — MC registry |
|
||||||
|
| **writeNBT GameRegistry** | MISSING | `GameRegistry.findItem()` + `new ItemStack()` | 🔴 RED — MC registry |
|
||||||
|
| **setItem(ItemStack)** | MISSING | Uses `GameRegistry.findUniqueIdentifierFor()` | 🔴 RED — MC ItemStack |
|
||||||
|
| **getItem(): ItemStack** | MISSING | Returns MC `ItemStack` | 🔴 RED — MC ItemStack |
|
||||||
|
| **@Override annotations** | Not present | Present on API methods | 🟢 GREEN — mc1710 implements interface |
|
||||||
|
|
||||||
|
**Missing in core**: `ItemStack item` field, `setItem(ItemStack)`, `getItem()` — all MC-specific. **Correctly mc1710-only.**
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 11. PlayerEffect.java (data)
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Implements** | `IPlayerEffect` | `IPlayerEffect` | 🟢 GREEN — both implement API |
|
||||||
|
| **getName()** | Returns `"UNKNOWN"` | Uses `CustomEffectController.getInstance().get()` | 🔴 RED — uses CustomEffect |
|
||||||
|
| **performEffect(IPlayer)** | No-op (stub) | Casts to `EntityPlayer`, calls `effect.onTick()` | 🔴 RED — uses EntityPlayer cast |
|
||||||
|
|
||||||
|
**Core is a correct base implementation** with stubs. MC1710 shadow overrides `getName()` and `performEffect()` with MC-specific logic.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split. No action needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 3: Controllers/Data — Core-Only Classes (30 files, no mc1710 shadow)
|
||||||
|
|
||||||
|
These files exist ONLY in core. They are fully MC-free and use `INbt`/`INbtList` abstractions.
|
||||||
|
|
||||||
|
| File | Status | Notes |
|
||||||
|
|---|---|---|
|
||||||
|
| AbilityHotbarData.java | Core-only ✅ | No mc1710 shadow needed |
|
||||||
|
| AuctionFilter.java | Core-only ✅ | Pure data class |
|
||||||
|
| Category.java | Core-only ✅ | Base category class |
|
||||||
|
| CloneFolder.java | Core-only ✅ | Filesystem management |
|
||||||
|
| DialogColorData.java | Core-only ✅ | Color config data |
|
||||||
|
| DialogImage.java | Core-only ✅ | Dialog image config |
|
||||||
|
| EffectKey.java | Core-only ✅ | Effect lookup key |
|
||||||
|
| Frame.java | Core-only ✅ | Animation frame data |
|
||||||
|
| FramePart.java | Core-only ✅ | Animation part data |
|
||||||
|
| HitboxData.java | Core-only ✅ | Hitbox config |
|
||||||
|
| InnDoorData.java | Core-only ✅ | Inn door config |
|
||||||
|
| ItemDisplayData.java | Core-only ✅ | Display config |
|
||||||
|
| Line.java | Core-only ✅ | Dialog line data |
|
||||||
|
| Lines.java | Core-only ✅ | Dialog lines collection |
|
||||||
|
| MagicAssociation.java | Core-only ✅ | Magic association data |
|
||||||
|
| MagicCycle.java | Core-only ✅ | Implements IMagicCycle |
|
||||||
|
| MagicData.java | Core-only ✅ | Implements IMagicData |
|
||||||
|
| MagicEntry.java | Core-only ✅ | Magic entry data |
|
||||||
|
| PartyOptions.java | Core-only ✅ | Implements IPartyOptions |
|
||||||
|
| PlayerDialogData.java | Core-only ✅ | Implements IPlayerDialogData |
|
||||||
|
| PlayerEffectData.java | Core-only ✅ | Effect tracking |
|
||||||
|
| PlayerTransportData.java | Core-only ✅ | Implements IPlayerTransportData |
|
||||||
|
| ProfileOptions.java | Core-only ✅ | Implements IProfileOptions |
|
||||||
|
| SkinOverlay.java | Core-only ✅ | Implements ISkinOverlay |
|
||||||
|
| Tag.java | Core-only ✅ | Implements ITag |
|
||||||
|
| TagMap.java | Core-only ✅ | Tag map management |
|
||||||
|
| TintData.java | Core-only ✅ | Implements ITintData |
|
||||||
|
| TraderStock.java | Core-only ✅ | Stock management |
|
||||||
|
| TransportCategory.java | Core-only ✅ | Implements ITransportCategory |
|
||||||
|
| TransportLocation.java | Core-only ✅ | Implements ITransportLocation |
|
||||||
|
|
||||||
|
**Verdict**: ✅ All properly abstracted. No mc1710 shadow needed for any of these.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 4: NBTTags.java
|
||||||
|
|
||||||
|
This is the **most significant difference** between core and mc1710.
|
||||||
|
|
||||||
|
| Metric | Core | MC1710 |
|
||||||
|
|---|---|---|
|
||||||
|
| **Total methods** | ~36 | ~47 |
|
||||||
|
| **NBT type** | `INbt` / `INbtList` | `NBTTagCompound` / `NBTTagList` |
|
||||||
|
| **Return types** | `INbtList` | `NBTTagList` / `NBTBase` |
|
||||||
|
|
||||||
|
### Methods in mc1710 but NOT in core:
|
||||||
|
|
||||||
|
| Method | MC Type Used | Category |
|
||||||
|
|---|---|---|
|
||||||
|
| `getItemStackList(NBTTagList)` | `ItemStack` | 🔴 RED |
|
||||||
|
| `getItemStackArray(NBTTagList)` | `ItemStack` | 🔴 RED |
|
||||||
|
| `nbtItemStackList(HashMap<Integer, ItemStack>)` | `ItemStack` | 🔴 RED |
|
||||||
|
| `nbtItemStackArray(ItemStack[])` | `ItemStack` | 🔴 RED |
|
||||||
|
| `nbtDoubleList(double...)` | `NBTTagList` | 🟡 YELLOW — logic is MC-free, just wraps doubles |
|
||||||
|
| `GetScriptOld(NBTTagList, IScriptHandler)` | `IScriptHandler` | 🔴 RED — scripting system |
|
||||||
|
| `GetScript(NBTTagCompound, IScriptHandler)` | `IScriptHandler` | 🔴 RED — scripting system |
|
||||||
|
| `NBTScript(List<IScriptUnit>)` | `IScriptUnit` | 🔴 RED — scripting system |
|
||||||
|
| `getIntAt(NBTTagList, int)` | `NBTTagList` | 🟡 YELLOW — could be abstracted with INbtList |
|
||||||
|
|
||||||
|
### Methods with different signatures:
|
||||||
|
|
||||||
|
| Method | Core Return | MC1710 Return |
|
||||||
|
|---|---|---|
|
||||||
|
| `nbtIntegerStringMap` | `INbtList` | `NBTBase` |
|
||||||
|
| `NBTMerge` | `INbt` / `INbt` params | `NBTTagCompound` / `NBTTagCompound` params |
|
||||||
|
| All others | `INbtList` | `NBTTagList` |
|
||||||
|
|
||||||
|
**Core's `copyTag` helper**: Private method in core for `NBTMerge` — handles type-safe tag copying via `INbt` methods. MC1710 uses `NBTTagCompound.getTag()` and `set()` directly.
|
||||||
|
|
||||||
|
**Verdict**: 🟢 Mostly correct. The 4 ItemStack methods and 3 Script methods are **correctly mc1710-only**. The `nbtDoubleList` and `getIntAt` methods are potentially abstractable but low priority.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 5: Constants (Enums)
|
||||||
|
|
||||||
|
### EnumStockReset.java (both exist)
|
||||||
|
|
||||||
|
| Aspect | Core | MC1710 | Category |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **Enum values** | IDENTICAL (7 values) | IDENTICAL | 🟢 GREEN |
|
||||||
|
| **getLangKey()** | EXISTS | MISSING | 🟡 YELLOW — core has extra helper |
|
||||||
|
| **getDisplayName()** | Returns lang key string | Returns `StatCollector.translateToLocal()` | 🟢 GREEN — mc1710 adds translation |
|
||||||
|
| **getDisplayNames()** | Returns lang key array | Returns translated string array | 🟢 GREEN |
|
||||||
|
|
||||||
|
**Core's `getLangKey()`** is a convenience method that returns the untranslated key. MC1710 doesn't have it because it uses `StatCollector` directly in `getDisplayName()`. This is fine — mc1710 shadows core and adds the translated version.
|
||||||
|
|
||||||
|
**MC1710-only constants** (7 files, no core counterpart):
|
||||||
|
- `ScriptContext.java` — scripting system
|
||||||
|
- `EnumPotionType.java` — MC potion types
|
||||||
|
- `EnumNotificationType.java` — notification UI
|
||||||
|
- `EnumCompanionTalent.java` — companion system
|
||||||
|
- `EnumClaimType.java` — claim system
|
||||||
|
- `EnumAuctionStatus.java` — auction system
|
||||||
|
- `EnumAuctionLogAction.java` — auction logging
|
||||||
|
|
||||||
|
All 7 are **correctly mc1710-only** (use MC types or coupled to MC systems).
|
||||||
|
|
||||||
|
**Core-only constants** (~38 files): All game enums (EnumRoleType, EnumQuestType, EnumAnimation, etc.). No mc1710 shadow needed — fully MC-free.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Properly split.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 6: Utility Classes
|
||||||
|
|
||||||
|
### noppes.npcs.util/ (6 core files)
|
||||||
|
|
||||||
|
| File | mc1710 Shadow? | Status |
|
||||||
|
|---|---|---|
|
||||||
|
| ValueUtil.java | No | Core-only ✅ |
|
||||||
|
| SizeOfObjectUtil.java | No | Core-only ✅ |
|
||||||
|
| MillisTimer.java | No | Core-only ✅ |
|
||||||
|
| LRUHashMap.java | No | Core-only ✅ |
|
||||||
|
| CustomNPCsThreader.java | No | Core-only ✅ |
|
||||||
|
| CacheHashMap.java | No | Core-only ✅ |
|
||||||
|
|
||||||
|
All 6 are MC-free. No mc1710 shadows exist (mc1710's util/ has completely different MC-specific files like Vec3NPC, NBTJsonUtil, etc.).
|
||||||
|
|
||||||
|
**Verdict**: ✅ Perfect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### kamkeel.npcs.util/ (3 core files)
|
||||||
|
|
||||||
|
| File | mc1710 Shadow? | Status |
|
||||||
|
|---|---|---|
|
||||||
|
| CNPCDebug.java | Yes — **IDENTICAL** | ✅ |
|
||||||
|
| TextSplitter.java | No | Core-only ✅ |
|
||||||
|
| FileNameHelper.java | No | Core-only ✅ |
|
||||||
|
|
||||||
|
**CNPCDebug.java**: Exists in both, completely identical. Both are MC-free debug logging utilities.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Perfect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Part 7: Core-Only Infrastructure
|
||||||
|
|
||||||
|
### noppes.npcs.core/ (3 files)
|
||||||
|
|
||||||
|
| File | Purpose | mc1710 Shadow? |
|
||||||
|
|---|---|---|
|
||||||
|
| NBT.java | Factory: `NBT.compound()`, `NBT.list()` | No — core-only ✅ |
|
||||||
|
| CoreConfig.java | Static config values | No — core-only ✅ |
|
||||||
|
| package-info.java | Package documentation | No — core-only ✅ |
|
||||||
|
|
||||||
|
### noppes.npcs.scripted.constants/ (4 files)
|
||||||
|
|
||||||
|
| File | mc1710 Shadow? | Status |
|
||||||
|
|---|---|---|
|
||||||
|
| RoleType.java | Yes — **IDENTICAL** | ✅ |
|
||||||
|
| JobType.java | Yes — **IDENTICAL** | ✅ |
|
||||||
|
| EntityType.java | Yes — **IDENTICAL** | ✅ |
|
||||||
|
| AnimationType.java | Yes — **IDENTICAL** | ✅ |
|
||||||
|
|
||||||
|
All 4 scripted constants exist in both and are **completely identical**. These are pure enum/constant classes with no MC imports.
|
||||||
|
|
||||||
|
**Verdict**: ✅ Perfect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary of All Findings
|
||||||
|
|
||||||
|
### By Category
|
||||||
|
|
||||||
|
| Category | Count | Description |
|
||||||
|
|---|---|---|
|
||||||
|
| 🟢 **GREEN (Already Correct)** | 94 | No action needed — properly split or core-only |
|
||||||
|
| 🔴 **RED (Correctly mc1710-only)** | 27 items | MC-specific code that belongs in mc1710 shadow |
|
||||||
|
| 🟡 **YELLOW (Needs Review)** | 5 items | Minor gaps or potential improvements |
|
||||||
|
|
||||||
|
### 🟡 YELLOW Items (Detailed)
|
||||||
|
|
||||||
|
1. **Faction.java** — Core has `isEnemyFaction(int)`, `addEnemyFaction(int)`, `removeEnemyFaction(int)` int-overloads that mc1710 doesn't. **Low priority** — mc1710 inherits from core via split-package shadow, so these are accessible.
|
||||||
|
|
||||||
|
2. **NBTTags.java** — `nbtDoubleList(double...)` could be abstracted to core with `INbtList`. **Very low priority** — only used by entity code which stays mc1710.
|
||||||
|
|
||||||
|
3. **NBTTags.java** — `getIntAt(NBTTagList, int)` could be abstracted to core with `INbtList`. **Very low priority** — same reason.
|
||||||
|
|
||||||
|
4. **EnumStockReset.java** — Core has `getLangKey()` that mc1710 doesn't. **Non-issue** — mc1710 shadows core and inherits it.
|
||||||
|
|
||||||
|
5. **Faction.java** — Core's `isAggressiveToNpc(ICustomNpc)` overload and mc1710's `isAggressiveToNpc(EntityNPCInterface)` overload — correct split, but naming could be confusing. **Non-issue** — different param types, correct behavior.
|
||||||
|
|
||||||
|
### 🔴 RED Items (Correctly in mc1710 only)
|
||||||
|
|
||||||
|
All of these use MC types and **should NOT be moved to core**:
|
||||||
|
|
||||||
|
**MC Entity types**: `EntityPlayer`, `EntityPlayerMP`, `EntityNPCInterface`
|
||||||
|
- `Faction.isFriendlyToPlayer(EntityPlayer)`
|
||||||
|
- `Faction.isAggressiveToPlayer(EntityPlayer)`
|
||||||
|
- `Faction.isNeutralToPlayer(EntityPlayer)`
|
||||||
|
- `Faction.isAggressiveToNpc(EntityNPCInterface)`
|
||||||
|
- `Faction.isFriendlyToPlayer(IPlayer)` (casts to EntityPlayer)
|
||||||
|
- `Faction.isNeutralToPlayer(IPlayer)` (casts to EntityPlayer)
|
||||||
|
- `Faction.isAggressiveToPlayer(IPlayer)` (casts to EntityPlayer)
|
||||||
|
- `TagController.sendCategoryTagMap(EntityPlayerMP, HashMap)`
|
||||||
|
- `PlayerEffect.getName()` (uses CustomEffectController)
|
||||||
|
- `PlayerEffect.performEffect(IPlayer)` (casts to EntityPlayer)
|
||||||
|
|
||||||
|
**MC ItemStack**:
|
||||||
|
- `Magic.item` field, `Magic.setItem(ItemStack)`, `Magic.getItem()`
|
||||||
|
- `NBTTags.getItemStackList/Array`, `nbtItemStackList/Array`
|
||||||
|
|
||||||
|
**MC I/O**: `DataInputStream`, `CompressedStreamTools`, `FileOutputStream`
|
||||||
|
- All `loadXxx(DataInputStream)` method variants in controllers
|
||||||
|
|
||||||
|
**MC Networking**: `SyncController.syncUpdate/syncRemove` calls
|
||||||
|
- Added in mc1710 shadows of all controllers that sync
|
||||||
|
|
||||||
|
**MC Registry**: `GameRegistry.findItem()`, `GameRegistry.findUniqueIdentifierFor()`
|
||||||
|
- Magic.readNBT/writeNBT item resolution
|
||||||
|
|
||||||
|
**MC Translation**: `StatCollector.translateToLocal()`
|
||||||
|
- EnumStockReset.getDisplayName()
|
||||||
|
|
||||||
|
**API Interfaces**: `IFaction`, `IMagic`, `IPlayerEffect`, `IFactionHandler`, `IMagicHandler`, `ITagHandler`, `ITransportHandler`
|
||||||
|
- `implements` clauses added in mc1710 shadows
|
||||||
|
|
||||||
|
**Scripting**: `IScriptHandler`, `IScriptUnit`
|
||||||
|
- NBTTags script-related methods
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Recommendations
|
||||||
|
|
||||||
|
### No Immediate Action Required
|
||||||
|
|
||||||
|
The core/mc1710 split is **well-architected**. All significant differences are intentional:
|
||||||
|
|
||||||
|
1. **Core abstracts correctly** using `INbt`/`INbtList` and `PlatformServiceHolder`
|
||||||
|
2. **MC1710 shadows add** the MC-specific implementations (networking, ItemStack, entity casts, API interfaces)
|
||||||
|
3. **Split-package pattern works** — mc1710 inherits core methods while adding MC-specific overloads
|
||||||
|
|
||||||
|
### Low-Priority Improvements (Optional)
|
||||||
|
|
||||||
|
1. **NBTTags.nbtDoubleList**: Could abstract to core if ever needed by core logic (currently not)
|
||||||
|
2. **NBTTags.getIntAt**: Could abstract to core if ever needed (currently not)
|
||||||
|
3. **Identical dual files** (CategoryManager, APIRegistry, CNPCDebug, 4 scripted constants): Consider removing mc1710 copies if the build system properly inherits from core — reduces maintenance burden
|
||||||
|
|
||||||
|
### Architecture Notes
|
||||||
|
|
||||||
|
- The **14 dual-existence files** follow the split-package shadow pattern correctly
|
||||||
|
- The **86 core-only files** are properly MC-free with no MC imports
|
||||||
|
- The **53+ mc1710-only data files** are correctly on the MC side (scripts, recipes, entity data, etc.)
|
||||||
|
- All **controllers** use `PlatformServiceHolder` for I/O in core, `CompressedStreamTools` in mc1710
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Build Verification
|
||||||
|
|
||||||
|
See build verification section below (run separately).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix: Complete File Inventory
|
||||||
|
|
||||||
|
### Files With Dual Existence (14 files)
|
||||||
|
|
||||||
|
| # | File | Same Package | Differences |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 1 | `controllers/FactionController.java` | Yes | INbt vs NBTTagCompound, implements IFactionHandler, SyncController |
|
||||||
|
| 2 | `controllers/MagicController.java` | Yes | INbt vs NBTTagCompound, implements IMagicHandler, SyncController |
|
||||||
|
| 3 | `controllers/TagController.java` | Yes | INbt vs NBTTagCompound, implements ITagHandler, sendCategoryTagMap |
|
||||||
|
| 4 | `controllers/TransportController.java` | Yes | INbt vs NBTTagCompound, implements ITransportHandler, saveLocation overload |
|
||||||
|
| 5 | `controllers/GlobalDataController.java` | Yes | PlatformServiceHolder vs CompressedStreamTools |
|
||||||
|
| 6 | `controllers/ServerTagMapController.java` | Yes | PlatformServiceHolder vs CompressedStreamTools, loadTagMaps |
|
||||||
|
| 7 | `controllers/CategoryManager.java` | Yes | **IDENTICAL** |
|
||||||
|
| 8 | `controllers/APIRegistry.java` | Yes | **IDENTICAL** |
|
||||||
|
| 9 | `controllers/data/Faction.java` | Yes | INbt vs NBTTagCompound, implements IFaction, EntityPlayer methods |
|
||||||
|
| 10 | `controllers/data/Magic.java` | Yes | INbt vs NBTTagCompound, implements IMagic, ItemStack field/methods |
|
||||||
|
| 11 | `controllers/data/PlayerEffect.java` | Yes | Both implement IPlayerEffect, mc1710 has CustomEffectController logic |
|
||||||
|
| 12 | `NBTTags.java` | Yes | INbt/INbtList vs NBTTagCompound/NBTTagList, ItemStack/Script methods |
|
||||||
|
| 13 | `constants/EnumStockReset.java` | Yes | Core has getLangKey(), mc1710 uses StatCollector |
|
||||||
|
| 14 | `kamkeel/npcs/util/CNPCDebug.java` | Yes | **IDENTICAL** |
|
||||||
|
|
||||||
|
Plus 4 identical scripted constants: RoleType, JobType, EntityType, AnimationType.
|
||||||
|
|
||||||
|
### Core-Only Files (86 files, no mc1710 shadow)
|
||||||
|
|
||||||
|
- 38 constants/enums
|
||||||
|
- 30 controllers/data classes
|
||||||
|
- 6 utility classes
|
||||||
|
- 3 core infrastructure (NBT, CoreConfig, package-info)
|
||||||
|
- 2 kamkeel utils (TextSplitter, FileNameHelper)
|
||||||
|
- 4 scripted constants
|
||||||
|
- 3 kamkeel additions (various)
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
# Phase 1A Report — mc1122 Workspace Setup
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
Created the `mc1122/` Gradle module as a parallel Minecraft 1.12.2 leaf alongside `mc1710/`, using the same GTNH Convention Plugin + RetroFuturaGradle (RFG) build system.
|
||||||
|
|
||||||
|
**Result: BUILD SUCCESSFUL**
|
||||||
|
|
||||||
|
## What Was Created
|
||||||
|
|
||||||
|
### Directory Structure
|
||||||
|
```
|
||||||
|
mc1122/
|
||||||
|
├── .settings/
|
||||||
|
│ └── org.eclipse.jdt.core.prefs (Java 8 Eclipse compiler settings)
|
||||||
|
├── src/
|
||||||
|
│ └── main/
|
||||||
|
│ ├── java/
|
||||||
|
│ │ └── noppes/npcs/ (empty — required by GTNH convention plugin modGroup validation)
|
||||||
|
│ └── resources/
|
||||||
|
│ ├── META-INF/ (empty — for access transformers later)
|
||||||
|
│ ├── assets/customnpcs/ (empty — for mod assets later)
|
||||||
|
│ └── mcmod.info (1.12.2 mod metadata with token substitution)
|
||||||
|
├── dts-patches/ (empty — for TypeScript definition patches later)
|
||||||
|
├── tools/ (empty — for build tools later)
|
||||||
|
├── build.gradle (GTNH convention plugin, minimal config)
|
||||||
|
├── dependencies.gradle (core dependency only)
|
||||||
|
├── repositories.gradle (Sponge maven for mixins later)
|
||||||
|
└── gradle.properties (1.12.2 RFG configuration — the critical file)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Files Modified
|
||||||
|
- `settings.gradle` (root) — Added `'mc1122'` to the `include` statement
|
||||||
|
|
||||||
|
## RFG Configuration Choices
|
||||||
|
|
||||||
|
| Property | Value | Rationale |
|
||||||
|
|---|---|---|
|
||||||
|
| `minecraftVersion` | `1.12.2` | Target MC version |
|
||||||
|
| `forgeVersion` | `14.23.5.2860` | Latest stable Forge for 1.12.2 |
|
||||||
|
| `channel` | `stable` | MCP mapping channel |
|
||||||
|
| `mappingsVersion` | `39` | `stable_39` — standard/latest stable MCP mappings for 1.12.2 |
|
||||||
|
| `enableModernJavaSyntax` | `false` | Java 8 strict — no Jabel |
|
||||||
|
| `enableGenericInjection` | `false` | Matching mc1710 config |
|
||||||
|
| `usesMixins` | `false` | Disabled initially — will enable in Phase 1B when mixin porting begins |
|
||||||
|
| `usesShadowedDependencies` | `false` | Disabled initially — no embedded deps yet |
|
||||||
|
| `disableSpotless` | `true` | No code style enforcement for now |
|
||||||
|
| `disableCheckstyle` | `true` | No checkstyle enforcement for now |
|
||||||
|
| `gtnh.modules.ideIntegration` | `false` | IDE setup handled at root level |
|
||||||
|
|
||||||
|
### Key Design Decision: GTNH Convention Plugin (not raw RFG)
|
||||||
|
The mc1122 module uses `com.gtnewhorizons.gtnhconvention` (same as mc1710), NOT the raw `com.gtnewhorizons.retrofuturagradle` plugin. This is critical because:
|
||||||
|
1. The settings-level `com.gtnewhorizons.gtnhsettingsconvention` plugin (v1.0.27) is already applied in root `settings.gradle`
|
||||||
|
2. The convention plugin automatically reads `gradle.properties` to configure RFG, MCP mappings, Forge version, mixin setup, etc.
|
||||||
|
3. It also sets up `dependencies.gradle` and `repositories.gradle` loading conventions
|
||||||
|
4. Using the same plugin stack ensures consistent build behavior across mc1710 and mc1122
|
||||||
|
|
||||||
|
## Build Verification
|
||||||
|
|
||||||
|
### Build Command
|
||||||
|
```
|
||||||
|
./gradlew :mc1122:build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Result: **PASS**
|
||||||
|
```
|
||||||
|
BUILD SUCCESSFUL in 3m 3s
|
||||||
|
27 actionable tasks: 19 executed, 8 up-to-date
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Tasks Executed
|
||||||
|
The RFG pipeline ran the full MC 1.12.2 decompile/patch cycle:
|
||||||
|
1. `mergeVanillaSidedJars` — Merged client/server MC 1.12.2 JARs
|
||||||
|
2. `deobfuscateMergedJarToSrg` — Applied SRG mappings + access transformers
|
||||||
|
3. `decompileSrgJar` — FernFlower decompilation (cached)
|
||||||
|
4. `cleanupDecompSrgJar` — Applied FF patches, MCP patches, MCP cleanup
|
||||||
|
5. `patchDecompiledJar` — Applied 311 Forge patches
|
||||||
|
6. `remapDecompiledJar` — Remapped with MCP stable_39
|
||||||
|
7. `compilePatchedMcJava` — Compiled patched MC source
|
||||||
|
8. `compileJava` — NO-SOURCE (empty src, expected)
|
||||||
|
9. `jar` — Produced output JARs
|
||||||
|
10. `reobfJar` — Re-obfuscated for distribution
|
||||||
|
|
||||||
|
### JARs Produced
|
||||||
|
```
|
||||||
|
mc1122/build/libs/CustomNPC-Plus-1.12.2-1.11.1.jar (1,279 bytes — obfuscated, distribution)
|
||||||
|
mc1122/build/libs/CustomNPC-Plus-1.12.2-1.11.1-dev.jar (1,175 bytes — development, SRG names)
|
||||||
|
mc1122/build/libs/CustomNPC-Plus-1.12.2-1.11.1-sources.jar (1,377 bytes — sources)
|
||||||
|
```
|
||||||
|
JARs are minimal (empty mod, only metadata) — expected for Phase 1A.
|
||||||
|
|
||||||
|
### Cross-Module Verification
|
||||||
|
- `./gradlew :mc1710:build` — **PASS** (still builds correctly, no regressions)
|
||||||
|
- `./gradlew :mc1122:build` — **PASS**
|
||||||
|
|
||||||
|
## Known Issue: `:core:compileJava` Standalone Failure
|
||||||
|
|
||||||
|
The `:core` module has a pre-existing compile error in `Faction.java:149` where `Faction` (which doesn't implement `IFaction` in core) is added to a `List<IFaction>`. This is a known consequence of the split-package shadow architecture:
|
||||||
|
- In `mc1710`, the shadow version of `Faction.java` adds `implements IFaction`, making the code valid
|
||||||
|
- Standalone `core` compilation fails because the core `Faction` class doesn't implement the interface
|
||||||
|
|
||||||
|
**Impact on mc1122:** None currently. The `:core:compileJava` task uses cached outputs from a previous successful mc1710 build. When mc1122 gets its own shadow `Faction.java` (Phase 1B), the same split-package mechanism will apply.
|
||||||
|
|
||||||
|
**Mitigation for CI:** If a clean build environment has no cached core classes, `mc1122:build` will fail on `:core:compileJava`. Solutions:
|
||||||
|
1. Build `mc1710` first (which compiles core with shadows), then `mc1122`
|
||||||
|
2. Or fix the core `Faction.java` to not require the shadow (e.g., cast to raw `List`)
|
||||||
|
|
||||||
|
## Deviations from mc1710
|
||||||
|
|
||||||
|
| Aspect | mc1710 | mc1122 | Reason |
|
||||||
|
|---|---|---|---|
|
||||||
|
| TypeScript generation | Yes (`dts.typescript-generator` plugin) | No | Not needed until source porting |
|
||||||
|
| API submodule | Yes (`src/api/java`) | No | API will be added in Phase 1B |
|
||||||
|
| Mixin embedding | Yes (shadow mixin 0.7.11) | No | Different mixin version for 1.12.2; deferred |
|
||||||
|
| Access transformers | Yes (`customnpcs_at.cfg`) | No | Will be ported in Phase 1B |
|
||||||
|
| `buildNoMixin` task | Yes | No | Deferred until mixins are configured |
|
||||||
|
| `archivesBaseName` | `CustomNPC-Plus` | `CustomNPC-Plus-1.12.2` | Disambiguate artifacts between versions |
|
||||||
|
| `mcmod.info` format | JSON object wrapper | JSON array (1.12.2 format) | 1.12.2 uses array-style mcmod.info |
|
||||||
|
|
||||||
|
## Notes on 1.12.2-Specific Tooling
|
||||||
|
|
||||||
|
1. **MCP Mappings**: 1.12.2 uses `stable_39` (vs `stable_12` for 1.7.10). These are the latest stable MCP mappings available for 1.12.2.
|
||||||
|
2. **Forge Version**: `14.23.5.2860` is the latest recommended Forge for 1.12.2 (last build of the 14.23.5 series).
|
||||||
|
3. **FernFlower Cache**: RFG cached the decompiled 1.12.2 jar, so subsequent builds are fast (~4s for cached builds).
|
||||||
|
4. **Forge Patches**: 311 patches applied to decompiled MC source (vs fewer for 1.7.10), reflecting the larger Forge surface area in 1.12.2.
|
||||||
|
5. **Mixin Version**: 1.12.2 typically uses SpongePowered Mixin 0.8.x (vs 0.7.11 for 1.7.10). This will be configured in Phase 1B.
|
||||||
|
|
||||||
|
## Next Steps (Phase 1B)
|
||||||
|
|
||||||
|
1. Port `CustomNpcs.java` entry point (`@Mod` class) with 1.12.2 registration patterns
|
||||||
|
2. Port `PlatformService` implementation for 1.12.2
|
||||||
|
3. Add access transformer file if needed
|
||||||
|
4. Configure mixins with Mixin 0.8.x
|
||||||
|
5. Begin porting entity, data, and controller classes with 1.12.2 API differences
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,77 @@
|
|||||||
|
# Scripting Toolchain — Java → TypeScript → Editor
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
Pipeline that turns Java API interfaces into `.d.ts` TypeScript definitions, loaded at runtime
|
||||||
|
by the in-game script editor for autocomplete, hover info, and error detection.
|
||||||
|
Addons can ship their own `.d.ts` files for full editor integration.
|
||||||
|
|
||||||
|
## Pipeline Flow
|
||||||
|
```
|
||||||
|
Java API interfaces (src/api/java)
|
||||||
|
▼
|
||||||
|
dts.typescript-generator (Gradle plugin)
|
||||||
|
1. JavaToTypeScriptConverter → .d.ts per file
|
||||||
|
2. ImplementationFieldEnricher → inject impl fields
|
||||||
|
3. hooks.d.ts → event hooks with param types
|
||||||
|
4. dts-patches/ → ECMAScript built-in overrides
|
||||||
|
▼
|
||||||
|
src/main/resources/assets/customnpcs/api/**/*.d.ts (in mod JAR)
|
||||||
|
▼
|
||||||
|
Runtime: JSTypeRegistry (client-side)
|
||||||
|
1. DtsModScanner → scan ALL loaded mods for assets/<id>/api/
|
||||||
|
2. TypeScriptDefinitionParser → parse .d.ts into JSTypeInfo
|
||||||
|
3. DtsJavaBridge → map .d.ts types to Java reflection
|
||||||
|
▼
|
||||||
|
Script editor: autocomplete, hover, error detection
|
||||||
|
```
|
||||||
|
|
||||||
|
## Gradle Plugin (`gradle-plugins/`)
|
||||||
|
| File | Role |
|
||||||
|
|------|------|
|
||||||
|
| `TypeScriptGeneratorPlugin.groovy` | Plugin entry — registers `generateTypeScriptDefinitions` task |
|
||||||
|
| `GenerateTypeScriptTask.groovy` | Task orchestration — generation, patches, enrichment |
|
||||||
|
| `JavaToTypeScriptConverter.groovy` | Core converter — Java source → `.d.ts` with Javadoc, generics, nested types, `hooks.d.ts` |
|
||||||
|
| `ImplementationFieldEnricher.groovy` | Injects public impl fields into API interface `.d.ts` |
|
||||||
|
|
||||||
|
### Configuration (root `build.gradle`)
|
||||||
|
| Option | Purpose |
|
||||||
|
|--------|---------|
|
||||||
|
| `apiPackages` | Packages to generate `.d.ts` for (`noppes.npcs.api`, `net.minecraft`) |
|
||||||
|
| `implementationPackages` | Impl classes scanned for field enrichment (`noppes.npcs.scripted`, `noppes.npcs.controllers.data`, etc.) |
|
||||||
|
| `patchesDirectory` | Hand-written `.d.ts` overrides copied to `assets/<modid>/api/patches` |
|
||||||
|
| `cleanOutputFirst` | Deletes old generated `.d.ts` before regenerating |
|
||||||
|
| `mapJavaPrimitivesToJS` | `false` = preserve `int`/`float`/`double`; `true` = map all to `number` |
|
||||||
|
|
||||||
|
`processResources.dependsOn generateTypeScriptDefinitions` — runs automatically during build.
|
||||||
|
|
||||||
|
### Implementation Enrichment
|
||||||
|
Scripts access `event.npc`, `event.player` — public fields on impl classes, not API interfaces.
|
||||||
|
The enricher scans impl packages, and if exactly one implementer exists for an API interface,
|
||||||
|
injects its public instance fields. `final` → `readonly`. Multiple implementers → skipped.
|
||||||
|
|
||||||
|
## dts-patches Directory
|
||||||
|
Hand-written ECMAScript 5.1 built-in `.d.ts` files: `Array`, `Boolean`, `Date`, `Error`,
|
||||||
|
`GlobalFunctions`, `JSON`, `Math`, `Number`, `Object`, `RegExp`, `String`.
|
||||||
|
Provides autocomplete for standard JS globals in the Nashorn environment.
|
||||||
|
|
||||||
|
## Addon API Support
|
||||||
|
1. Place `.d.ts` files at `assets/<your-modid>/api/**/*.d.ts` in your mod JAR
|
||||||
|
2. `DtsModScanner` discovers them automatically (priority: `customnpcs` > `npcdbc` > others)
|
||||||
|
3. Register hooks via `IScriptHookHandler.registerHookDefinition()` for sidebar + stub generation
|
||||||
|
|
||||||
|
## Generated Output Structure
|
||||||
|
```
|
||||||
|
assets/customnpcs/api/
|
||||||
|
├── hooks.d.ts # Hook signatures organized by context
|
||||||
|
├── entity/ # IPlayer.d.ts, ICustomNpc.d.ts, IEntity.d.ts
|
||||||
|
├── event/ # INpcEvent.d.ts, IPlayerEvent.d.ts (with @hookName)
|
||||||
|
├── handler/data/ # IQuest.d.ts, IDialog.d.ts, IFaction.d.ts
|
||||||
|
├── patches/ecmascript/ # Math.d.ts, JSON.d.ts, etc.
|
||||||
|
└── index.d.ts # Re-exports all generated types
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running
|
||||||
|
```bash
|
||||||
|
./gradlew generateTypeScriptDefinitions # Generate only
|
||||||
|
./gradlew build # Generates as part of build
|
||||||
|
```
|
||||||
@@ -0,0 +1,531 @@
|
|||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
## 🔴 VITAL AGENT CONTEXT — MIGRATION WORKFLOW (READ BEFORE ANY MIGRATION WORK)
|
||||||
|
|
||||||
|
### 🚨 ABSOLUTE NON-NEGOTIABLE RULE — TOOLCHAIN ONLY (UPDATED 2026-03-16)
|
||||||
|
**Agents MUST use the migration toolchain scripts for ALL write operations during migration. NEVER use internal write/edit tools.**
|
||||||
|
|
||||||
|
The following tools exist in `tools/migration/` and MUST be used:
|
||||||
|
|
||||||
|
| Operation | Tool | NEVER Use Instead |
|
||||||
|
|-----------|------|-------------------|
|
||||||
|
| Create PA interface files | `pa_batch.py` | `write()` |
|
||||||
|
| Edit PlatformService | `pa_editor.py` | `edit()` |
|
||||||
|
| Copy files to core/ | `Copy-Recursive.ps1` | `cp` / `write()` |
|
||||||
|
| Replace MC types | `Symbol-Swap.ps1` | `edit()` / `ast_grep_replace` |
|
||||||
|
| Remove forbidden imports | `Nuke-Imports.ps1` | `edit()` |
|
||||||
|
| Regex transforms | `Static-Transform.ps1` | `edit()` / `sed` |
|
||||||
|
| Create stub classes | `Generate-Stubs.ps1` | `write()` |
|
||||||
|
| Deduplicate imports | `Dedupe-Imports.ps1` | manual |
|
||||||
|
| Create PA + propagate | `Create-And-Propagate.ps1` | `write()` + `edit()` |
|
||||||
|
| Build diagnostics | `Build-Report.ps1` | manual |
|
||||||
|
| Generate PA manifests | `generate_pa_manifest.py` | manual |
|
||||||
|
| Generate wave scripts | `generate_wave_script.py` | manual |
|
||||||
|
| Generate type mappings | `analyze.py generate-mappings` | manual |
|
||||||
|
| Batch diff all files | `batch_migration_diff.py` | manual |
|
||||||
|
|
||||||
|
**WHY**: The internal write/edit tools are 100-1000x SLOWER and produce inconsistent results. The toolchain scripts are BATCH operations that process hundreds of files in milliseconds. This is the ONLY acceptable approach.
|
||||||
|
|
||||||
|
**VIOLATION = IMMEDIATE REJECTION OF WORK.**
|
||||||
|
|
||||||
|
### Sisyphus Execution Model (UPDATED 2026-03-16)
|
||||||
|
**Sisyphus delegates migration Parts to agents that MUST use the toolchain. Agents run PowerShell/Python commands via `bash()` tool ONLY.**
|
||||||
|
|
||||||
|
### 🚀 CRITICAL EXECUTION RULES — DO NOT DEVIATE
|
||||||
|
|
||||||
|
**1. TOOLCHAIN-ONLY Writes (MANDATORY — NON-NEGOTIABLE)**
|
||||||
|
- ALL file creation → `pa_batch.py`, `Generate-Stubs.ps1`, `Create-And-Propagate.ps1`
|
||||||
|
- ALL file edits → `Symbol-Swap.ps1`, `Static-Transform.ps1`, `Nuke-Imports.ps1`, `Dedupe-Imports.ps1`
|
||||||
|
- ALL PlatformService changes → `pa_editor.py`
|
||||||
|
- Agents use `bash()` to invoke these tools. They may use `read()` and `grep` to inspect files.
|
||||||
|
- The ONLY acceptable use of `edit()` is for fixing individual LSP errors AFTER toolchain scripts have run.
|
||||||
|
|
||||||
|
**2. Parallel Bulk Edits via Toolchain (MANDATORY)**
|
||||||
|
- Copy-Recursive copies ALL files in one command
|
||||||
|
- Symbol-Swap replaces ALL types in one command
|
||||||
|
- Static-Transform applies ALL patterns in one command
|
||||||
|
- Result: surgical edits, formatting preserved, comments intact, minimal diff bloat
|
||||||
|
|
||||||
|
**2. LSP-Driven Development (MANDATORY — THIS IS THE ONLY VERIFICATION)**
|
||||||
|
- LSP is the PRIMARY and ONLY source of truth — NOT code analysis, NOT grepping
|
||||||
|
- After applying ALL edits for a Part, run `lsp_diagnostics` on EVERY moved file
|
||||||
|
- **Do NOT proceed until LSP shows ZERO errors**
|
||||||
|
- If LSP shows errors → STOP and fix those specific errors immediately (same response or next)
|
||||||
|
- **If LSP is broken, unresponsive, or malfunctioning → STOP WORK and notify human immediately**
|
||||||
|
- Per-wave rule: **Do NOT move to next Part/Wave until LSP shows zero errors for current Part**
|
||||||
|
|
||||||
|
**3. NO Commits by Sisyphus (MANDATORY)**
|
||||||
|
- DO NOT commit after Parts complete
|
||||||
|
- Committing requires build verification (which is slow and blocking)
|
||||||
|
- Human will verify build afterward and commit
|
||||||
|
- Sisyphus responsibility: code correctness via LSP. Human responsibility: build verification + commit.
|
||||||
|
- Just complete the Part, report status, move to next
|
||||||
|
|
||||||
|
**4. Error Recovery (MANDATORY)**
|
||||||
|
- If LSP shows errors after edits: analyze the error, fix the `oldString` pattern, re-apply edit
|
||||||
|
- If multiple errors: fix them all in ONE response, then re-run LSP
|
||||||
|
- **Do NOT create partial fixes** — fix the entire pattern once
|
||||||
|
|
||||||
|
### Execution Pattern (Per Part)
|
||||||
|
|
||||||
|
```
|
||||||
|
PART N:
|
||||||
|
Response 1: Read ALL files for Part N (parallel)
|
||||||
|
Response 2:
|
||||||
|
- Apply ALL edits (parallel edit() calls, bulk changes per file)
|
||||||
|
- Run lsp_diagnostics on ALL moved files
|
||||||
|
Response 3+ (if needed):
|
||||||
|
- IF LSP shows errors → FIX and re-run lsp_diagnostics
|
||||||
|
- REPEAT until zero errors
|
||||||
|
When LSP ✅ ZERO errors → Part N COMPLETE, move to Part N+1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parallel Capability
|
||||||
|
- Sisyphus can edit 8-10 files in a single response
|
||||||
|
- All `edit()` calls execute concurrently
|
||||||
|
- Typical Part has 3-8 files → all edited at once
|
||||||
|
|
||||||
|
### Why This Matters
|
||||||
|
- **Speed:** No agent spawn overhead, bulk edits, parallel execution → ~2-3 hours total
|
||||||
|
- **Quality:** LSP verification ensures correctness, format preservation ensures clean diffs
|
||||||
|
- **Reliability:** Sisyphus maintains full context and can fix errors immediately
|
||||||
|
- **Human Control:** Build verification and committing stays with human (prevents broken builds)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Human-Agent Division of Labor (OLD — OUTDATED, KEPT FOR REFERENCE)
|
||||||
|
~~**The human (project owner) will manually move all packages/files from m7 → core/.**~~
|
||||||
|
**UPDATED: Sisyphus moves files + fixes them via LSP verification.**
|
||||||
|
|
||||||
|
### Why LSP is Essential (REAFFIRMED)
|
||||||
|
- After files are moved to core/, they will have broken MC imports
|
||||||
|
- `lsp_diagnostics` produces the EXACT list of what's broken: file, line, column, error message
|
||||||
|
- This is the ONLY reliable guide — NOT guessing, NOT grepping
|
||||||
|
- Sisyphus MUST run `lsp_diagnostics` after applying ALL edits for a Part
|
||||||
|
- Sisyphus MUST re-run `lsp_diagnostics` after EACH fix until convergence to zero errors
|
||||||
|
|
||||||
|
### PA Package Placement Rule (UPDATED 2026-03-15)
|
||||||
|
- If the abstraction interface already exists under `noppes.npcs.api.*` → use it as-is
|
||||||
|
- If it's a NEW abstraction for MC classes → create under `common.minecraft.*` in platform-api (NOT `noppes.npcs.common.minecraft`, just `common.minecraft`)
|
||||||
|
|
||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
## ⚠️ MIGRATION ORCHESTRATION RULES (APPLY TO ALL MIGRATION WORK)
|
||||||
|
|
||||||
|
These rules govern how ALL agents operate during the multi-version migration. Every delegated task MUST follow them.
|
||||||
|
|
||||||
|
### 1. Self-Review Protocol
|
||||||
|
Every agent completing migration work MUST self-review before reporting completion:
|
||||||
|
- **Compile check**: Does `./gradlew build` still succeed? (or at minimum, do the affected modules compile?)
|
||||||
|
- **Pattern check**: Does the change follow existing codebase conventions? (split-package shadow, naming, etc.)
|
||||||
|
- **Regression check**: Did the change break any existing behavior or imports?
|
||||||
|
- **Completeness check**: Are there any loose ends, missed files, or incomplete stubs?
|
||||||
|
|
||||||
|
### 2. Orchestrator Verification
|
||||||
|
The orchestrating agent (Sisyphus) will manually verify ALL delegated work:
|
||||||
|
- Read key changed files to confirm correctness
|
||||||
|
- Run `./gradlew build` after each phase
|
||||||
|
- Check that no forbidden practices were introduced (see FORBIDDEN_PRACTICES.md)
|
||||||
|
- Verify the deliverables match the expected outcome exactly
|
||||||
|
|
||||||
|
### 3. Incremental Commits
|
||||||
|
- Each sub-phase (0A, 0B, 0C, 0D) gets its own commit upon successful verification
|
||||||
|
- Never combine multiple phases into one commit
|
||||||
|
- Commit messages follow: `migration(phase-X): <concise description>`
|
||||||
|
|
||||||
|
### 4. Fail-Safe Rules
|
||||||
|
- If a build breaks during any phase, STOP and fix before proceeding
|
||||||
|
- If a change would affect >100 files, get orchestrator approval first
|
||||||
|
- If uncertain about a pattern, check 2-3 existing examples before proceeding
|
||||||
|
- NEVER delete or modify files outside the stated scope without explicit approval
|
||||||
|
|
||||||
|
### 5. Context Passing
|
||||||
|
- Every delegated agent MUST receive the full content of SESSION_MEMORY.md in their prompt
|
||||||
|
- Every agent must be of the UNSPECIFIED HIGH CATEGORY, unless explicitly told to use another
|
||||||
|
- This ensures every agent understands the vision, architecture, constraints, and forbidden practices
|
||||||
|
|
||||||
|
### 6. Phase Reports
|
||||||
|
- Upon completing a phase, the agent MUST create `.AGENTS/PHASE_0X_REPORT.md` (e.g., `PHASE_0A_REPORT.md`)
|
||||||
|
- Report format:
|
||||||
|
```
|
||||||
|
# Phase 0X Report — [Title]
|
||||||
|
**Date:** YYYY-MM-DD
|
||||||
|
**Agent:** [agent type]
|
||||||
|
|
||||||
|
## What Was Done
|
||||||
|
- [list of concrete changes]
|
||||||
|
|
||||||
|
## Files Changed
|
||||||
|
- [file paths with brief description of change]
|
||||||
|
|
||||||
|
## Files Created
|
||||||
|
- [new file paths]
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
- Build status: [PASS/FAIL]
|
||||||
|
- Tests: [PASS/FAIL/N/A]
|
||||||
|
- Self-review findings: [any issues found and fixed]
|
||||||
|
|
||||||
|
## Discoveries / Notes
|
||||||
|
- [anything unexpected, deviations from plan, or future considerations]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. Documentation Updates
|
||||||
|
- Update AGENTS.md, SESSION_MEMORY.md, and MIGRATION_ROADMAP.md checkboxes as phases complete
|
||||||
|
- Record any discoveries, surprises, or deviations in SESSION_MEMORY.md
|
||||||
|
|
||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
MAIN USER VISION:
|
||||||
|
|
||||||
|
## 1) MINECRAFT/FORGE PLATFORM ABSTRACTION:
|
||||||
|
|
||||||
|
### package: platform-api/
|
||||||
|
- Context: Before the migration plan, this was previously (and currently, we only just started migrating) just used for the Scripting API, but as it has much more use cases, and it's already solid general abstraction of Minecraft and CNPC+ classes.
|
||||||
|
|
||||||
|
1) This should host the Minecraft abstraction like @ClientOnly, @ServerOnly, and ALL other mc classes so that other versions like 1.7.10, 1.12.2, 1.16.5 and 1.20.1 can replace them completely with their own versions.
|
||||||
|
For annotations, we will write a custom annotation parser later to replace those annotations with their platform-correct implementations
|
||||||
|
|
||||||
|
2) We already have systems in place, like IPlayer to represent a player, IItemStack, INbt, ICustomNpc, etc. (check src/api/java/noppes/npcs/api/) that will all be used and recycled into this. Move these kinds of classes into the platform-api.
|
||||||
|
- Don't worry about the parameterized interfaces, strip them of parameterization entirely and make them return Object in their parameterized methods. I have personally made sure that most parameters are unused (99.9% functions use raw interfaces) and we have confirmed that
|
||||||
|
it would be incredibly easy to convert the returned Object to its platform specific type with simple casting when needed.
|
||||||
|
|
||||||
|
> **AGENT REVIEW (2026-03-15):**
|
||||||
|
> The scripting API (src/api/java/) has 202 files total. Key data for planning the move:
|
||||||
|
>
|
||||||
|
> | Category | Count | Action Needed |
|
||||||
|
> |---|---|---|
|
||||||
|
> | Already in platform-api (split-package shadow) | 30 | Already done — merge/reconcile |
|
||||||
|
> | MC-free interfaces (no MC imports) | ~131 | Move directly, strip generics from 5 entity interfaces |
|
||||||
|
> | MC-contaminated (import net.minecraft/cpw.mods.fml) | 71 | Strip MC imports, replace with platform-api equivalents or Object returns |
|
||||||
|
> | MC class stubs (net/minecraft/ vendored) | 5 | Drop — platform-api shouldn't need these |
|
||||||
|
>
|
||||||
|
> **Technical considerations for the move:**
|
||||||
|
> 1. **Generics stripping** — Only 5 interfaces use generics (entity hierarchy: IEntity, IEntityLivingBase, IEntityLiving, ICustomNpc, IPlayer). All bound to MC Entity classes. Already stripped in platform-api copies. Straightforward.
|
||||||
|
> 2. **71 MC-contaminated files** — These need method signatures rewritten to use platform-api types (Object returns where MC types were, or existing platform interfaces like `IPlayer`, `IItemStack`, `IWorld`). Biggest offenders: AbstractNpcAPI (10 MC imports), event interfaces (17 use @Cancelable from FML), entity/handler interfaces referencing MC types.
|
||||||
|
> 3. **Event system** — 20 event interfaces all use `@Cancelable` from `cpw.mods.fml`. Options: (a) create a platform `@Cancelable` annotation, (b) use the custom annotation parser mentioned in the plan, or (c) move events to a separate platform-events module.
|
||||||
|
> 4. **AbstractNpcAPI** — Abstract class (not interface) with 10 MC imports and static singleton. Needs to become an interface or be split into MC-free interface + mc1710 implementation.
|
||||||
|
> 5. **Addon impact** — The API is a git submodule used by DBC/Gecko/AW addons. Moving it means those addons need to depend on platform-api instead. Plan the transition: ship platform-api as a published artifact, update addon build files.
|
||||||
|
> 6. **30 existing split-package shadows** — These need reconciliation. The platform-api version is the MC-free base; the API version adds MC-specific methods. After the move, there should be ONE authoritative version per interface in platform-api.
|
||||||
|
>
|
||||||
|
> **Recommended execution order:** Move MC-free interfaces first (~131 files, low risk) → then tackle the 71 MC-contaminated files in batches (entity hierarchy → handlers → events → AbstractNpcAPI).
|
||||||
|
|
||||||
|
|
||||||
|
### package: src/
|
||||||
|
- The main project source. Currently, everything in the source is jumbled up in here. This will be completely refactored and the appropriately diagnosed systems will be moved to either platform-api/ or core/ or remains in the new src/
|
||||||
|
- This contains the implementation of the platform-api/ abstractions for each version of the game
|
||||||
|
- The GOAL is to HOST the LEAST amount of POSSIBLE files necessary, typically rendering, entity construction, events, etc.
|
||||||
|
- In each version, let's take 1.7.10 for example: the API abstractions in the platform-api/ noppes.npcs.api packages are represented by WRAPPERS like, ScriptNpc, ScriptItemStack, ScriptPlayer, etc. (check src/main/java/noppes/npcs/scripted/wrapper/)
|
||||||
|
that are registered to the PlatformService in Platform-API. These are the PER-VERSION implementations of our wrappers. So when in Core, when we move all logic, controllers, etc. We can simply use PlatformAPI
|
||||||
|
to supply us with an ICustomNpc or an IPlayer, etc. which represent the system.
|
||||||
|
- We should also consider abstracting a NetworkService into platform-api/ and Core system thus Packet Handling and Sync Controllers can also be fully adapted.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 2) CORE CNPC+ THAT IS ISOLATED FROM PLATFORM IMPLEMENTATION IN src/.
|
||||||
|
- package: core/
|
||||||
|
- This is where all the CORE CNPC+ classes and logic will be implemented BASED ON the abstraction layer in platform-api
|
||||||
|
1) MUST ONLY USE platform-api/ abstractions AND NOT any of the platform implementations in src/. NO MINECRAFT WHATSOEVER.
|
||||||
|
2) All Data, Controller and Registry systems and other isolated CNPC+ system are completely ported to Core.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 3) What's currently required + ROADMAP:
|
||||||
|
1) We want the current src/api package to be moved to platform-api/. You must retain the same package structure of noppes.npcs.api and everything it encapsulates.
|
||||||
|
DO NOT CHANGE THEIR NAMES AND DO NOT CREATE SEMANTICALLY DUPLICATE INTERFACES/CLASSES .
|
||||||
|
2) TO BE DECIDED BY YOU.
|
||||||
|
|
||||||
|
> **AGENT RECOMMENDATION — SEE .AGENTS/MIGRATION_ROADMAP.md*
|
||||||
|
|
||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
VERY FIRST USER PROMPT:
|
||||||
|
|
||||||
|
I want you to create a permanent memory session .md for this session and hook it up to the root project AGENTS.md so you always refer to it. In that memory session I want all my critical requests,
|
||||||
|
ideas and visions for whats next noted, as well as your own essential responses, as well as any important research data found by you or any subagent spawned.
|
||||||
|
|
||||||
|
Ok so this mod is currently for minecraft forge 1.7.10. As you noticed, I am trying to upport this mod to modern minecraft versions like 1.12.2, 1.16.5 and 1.20.1 SIMULTANEOUSLY. I dont just want to work on the upport
|
||||||
|
for one version at a time for like 2-3 months, then after im done start working on the next, that's too expensive and I don't have time. I want to tackle all of them at once, to the highest possible degree.
|
||||||
|
For that purpose, I want you to give me your best suggestions for how to create a roadmap on tackling this
|
||||||
|
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# SESSION_MEMORY.md — Multi-Version Porting Strategy
|
||||||
|
|
||||||
|
**Created:** 2026-03-15
|
||||||
|
**Last updated:** 2026-03-15
|
||||||
|
**Purpose:** Persistent memory of critical decisions, research, and roadmap for porting CustomNPC-Plus to multiple Minecraft versions simultaneously.
|
||||||
|
|
||||||
|
|
||||||
|
**Related documents:**
|
||||||
|
- `MIGRATION_ROADMAP.md` — Phased migration plan with milestones
|
||||||
|
- `MULTI_VERSION_RESEARCH.md` — Detailed external research (tools, repos, real implementations)
|
||||||
|
- `MC_COUPLING_ANALYSIS.md` — Quantified MC-dependency breakdown by subsystem
|
||||||
|
- `BUILD_SYSTEM.md` — Gradle architecture, version-specific build requirements
|
||||||
|
- `SCRIPTING_TOOLCHAIN.md` — Java → TypeScript → Editor pipeline
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Owner's Vision
|
||||||
|
|
||||||
|
**Goal:** Port CustomNPC-Plus from 1.7.10 to **1.12.2, 1.16.5, and 1.20.1 simultaneously**.
|
||||||
|
|
||||||
|
**Key Constraints (from owner):**
|
||||||
|
- **NOT sequential** — refuses to spend 2-3 months per version one at a time
|
||||||
|
- Must tackle all versions at once, to the highest possible degree
|
||||||
|
- 1.7.10 remains the primary/active build during porting
|
||||||
|
- Time and budget are limited — efficiency is paramount
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Current State Assessment
|
||||||
|
|
||||||
|
### Abstraction Progress
|
||||||
|
- **183 / ~1,810 files abstracted** (~10%) into `core/` + `platform-api/`
|
||||||
|
- `platform-api/`: 48 interface files (NBT, entity wrapping, file I/O, logging, scheduling)
|
||||||
|
- `core/`: 140 files (8 controllers, 60+ data classes, enums, utils)
|
||||||
|
- `PlatformService` exists but is used in <0.2% of MC-dependent code
|
||||||
|
|
||||||
|
### MC-Dependent Code Distribution (~1,424 files import net.minecraft.*)
|
||||||
|
|
||||||
|
| Subsystem | File Count | Coupling Level | Porting Difficulty |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **GUI/Client/Rendering** | 212 | VERSION-LOCKED | Extreme — rewrite per version |
|
||||||
|
| **Networking/Packets** | 100+ | HEAVY-MC | High — framework changes every version |
|
||||||
|
| **Blocks + Tiles** | 97 | VERSION-LOCKED | High — Flattening breaks everything |
|
||||||
|
| **Controllers/Data** | 81 | LIGHT-MC | Medium — mostly NBT + EntityPlayer params |
|
||||||
|
| **Scripting Wrappers** | 50+ | HEAVY-MC | Medium — API surface stable-ish |
|
||||||
|
| **Abilities** | 44 | HEAVY-MC | High — DO NOT TOUCH yet |
|
||||||
|
| **Items** | 41 | LIGHT-MC | Medium — registration centralized in CustomItems.java |
|
||||||
|
| **AI** | 29 | HEAVY-MC | Medium — EntityAI API changes significantly |
|
||||||
|
| **Commands** | 22 | VERSION-LOCKED | Medium — Brigadier in 1.13+ |
|
||||||
|
| **Roles/Jobs** | 19 | LIGHT-MC | Low — mostly game logic with entity params |
|
||||||
|
| **Config** | 9 | LIGHT-MC | Low — Forge config API changes but logic same |
|
||||||
|
|
||||||
|
### 1.7.10 → 1.12.2 API Differences (Verified Against This Codebase)
|
||||||
|
|
||||||
|
| Pattern | Change Level | Files Affected | Details |
|
||||||
|
|---|---|---|---|
|
||||||
|
| FML package (cpw.mods.fml → net.minecraftforge.fml) | MINOR_CHANGE | 524 files | Mass rename, mechanical |
|
||||||
|
| Entity registration | MINOR_CHANGE | 1 file (CustomNpcs.java) | Signature change (added tracking params) |
|
||||||
|
| Event system (@SubscribeEvent, EVENT_BUS) | IDENTICAL | 16+ files | Same API |
|
||||||
|
| GUI handler (NetworkRegistry) | IDENTICAL | 1 file | Same API |
|
||||||
|
| NBT (NBTTagCompound) | IDENTICAL | Hundreds | Same API |
|
||||||
|
| World save data (WorldSavedData) | IDENTICAL | Several | Same API |
|
||||||
|
| @Mod, @EventHandler, @SidedProxy | MINOR_CHANGE | ~5 files | Package rename |
|
||||||
|
| **ItemStack null→EMPTY** (1.11+) | **BREAKING_CHANGE** | **37+ null checks, 390+ files ref ItemStack** | **stack==null must become stack.isEmpty(). MASSIVE — the plan originally missed this entirely** |
|
||||||
|
| Packet system (SimpleNetworkWrapper) | BREAKING_CHANGE | 100+ files | Becomes SimpleChannel |
|
||||||
|
| IInventory → IItemHandler (Capabilities) | BREAKING_CHANGE | 59+ files | New capability system alongside old |
|
||||||
|
| Block/Item registration (GameRegistry) | BREAKING_CHANGE | 18 files (62 calls in CustomItems.java) | Deprecated in 1.12; must use RegistryEvent.Register<Block/Item> |
|
||||||
|
| **World.getBlock → getBlockState** | BREAKING_CHANGE | 59+ files | Block metadata → IBlockState system |
|
||||||
|
| **getUnlocalizedName → getTranslationKey** | BREAKING_CHANGE | 59+ files | Deprecated in 1.11+ |
|
||||||
|
|
||||||
|
> **⚠️ CORRECTION (2026-03-15):** The previous version of this table listed GameRegistry as "IDENTICAL" and was missing ItemStack nullability, getBlockState, and getTranslationKey changes entirely. The 1.12.2 port is NOT 95% mechanical — it's ~60-70% mechanical (the 524 renames are real), with 30-40% requiring real code changes that will cause crashes if missed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical Research Findings
|
||||||
|
|
||||||
|
### The Hard Truth: Nobody Has Done This Before
|
||||||
|
|
||||||
|
**No Minecraft mod in existence successfully shares code between 1.7.10 and modern (1.16+) versions.** Exhaustive GitHub search confirmed:
|
||||||
|
|
||||||
|
| Pattern | Example | Lowest MC Version | Shared Code? |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Preprocessor multi-version | Polyfrost/OneConfig (280★) | **1.8.9** (not 1.7.10) | Yes, via `#if MC>=` |
|
||||||
|
| Multi-module per-loader | JEI (Core/Common/NeoForge/Fabric) | Per-branch only | Yes, within one version |
|
||||||
|
| Branch-per-version | Applied Energistics 2 | 1.15+ (no 1.7.10 branch) | No — independent codebases |
|
||||||
|
| Separate repos | GregTechCEu (1.12) + GT-Modern (1.20) | 1.12 / 1.20 separately | No — complete rewrites |
|
||||||
|
| 1.7.10 only | GTNH ecosystem (93 repos) | 1.7.10 | N/A |
|
||||||
|
|
||||||
|
**CustomNPC-Plus's platform-api/core approach is genuinely novel** — it's the JEI Core/Common pattern applied retroactively to 1.7.10, which nobody else has attempted.
|
||||||
|
|
||||||
|
### Build System: Composite Builds, NOT Separate Wrappers
|
||||||
|
|
||||||
|
Oracle recommended separate Gradle wrappers. **This is wrong.** Evidence from real implementations:
|
||||||
|
|
||||||
|
| Tool | What It Does | Status |
|
||||||
|
|---|---|---|
|
||||||
|
| **Gradle Composite Builds** (`includeBuild`) | Each version is an independent build with its own plugin classpath | VERIFIED — only stable way to mix RFG + FG |
|
||||||
|
| **Gradle Toolchains** | Run Gradle on JDK 21, compile with JDK 8 or 17 per subproject | VERIFIED — standard Gradle feature |
|
||||||
|
| **ModStitch** (github.com/isXander/modstitch) | Unifies RFG + ForgeGradle + NeoGradle in one build | **UNVERIFIED** — RFG support is still an unmerged PR (#42). Do not rely on this. |
|
||||||
|
| **ReplayMod Preprocessor** | `#if MC>=` directives in Java comments | VERIFIED — works, but build tooling doesn't support 1.7.10 via Loom |
|
||||||
|
| **Essential Gradle Toolkit** | Wraps preprocessor with cleaner DSL | VERIFIED — plugin `gg.essential.multi-version` v0.6.7 |
|
||||||
|
| **Deftu multiversion** | Production multi-version plugin (used by OneConfig) | VERIFIED — `dev.deftu.gradle.multiversion-root` v2.73.0 |
|
||||||
|
|
||||||
|
**Key constraint:** RFG and ForgeGradle/NeoGradle CANNOT share a Gradle classpath in multi-project builds. Composite builds (`includeBuild`) are required.
|
||||||
|
|
||||||
|
### Preprocessor Limitations for 1.7.10
|
||||||
|
|
||||||
|
The ReplayMod preprocessor **syntax** supports 1.7.10 (version `10710`). But:
|
||||||
|
- The **build tooling** (Architectury Loom, Essential Loom) does NOT support 1.7.10
|
||||||
|
- ReplayMod itself dropped 1.7.10 support when moving to Gradle 7
|
||||||
|
- The preprocessor is a text tool — it works on any Java file regardless of MC version
|
||||||
|
- **For CustomNPC-Plus:** The preprocessor could process source files for 1.7.10 IF combined with RetroFuturaGradle (not Loom). This needs prototyping.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Corrected Architecture (Post-Critical-Review)
|
||||||
|
|
||||||
|
### Oracle's Recommendation vs Evidence-Based Correction
|
||||||
|
|
||||||
|
| Aspect | Oracle Said | Evidence Says | Decision |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Build system | Separate Gradle wrappers per leaf | Composite builds + single wrapper | **Composite builds** |
|
||||||
|
| Layer count | 6 layers (platform-api → core → legacy-common → modern-common → leaves) | Preprocessor can replace family-common layers | **5 layers with optional preprocessor in version leaves** |
|
||||||
|
| legacy-common / modern-common | Dedicated modules | ~100+ files could go here, BUT preprocessor handles syntactic diffs | **Start without them; add only if code duplication proves >50 files** |
|
||||||
|
| 1.7.10→1.12.2 gap | Treated as equivalent to other gaps | Easier than 1.16+ but NOT trivial — 524 renames + 5 breaking changes (ItemStack null→EMPTY, IInventory, getBlockState, getTranslationKey, GameRegistry events) | **1.12.2 is ~60-70% mechanical, 30-40% real code changes** |
|
||||||
|
|
||||||
|
### Recommended Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
CustomNPC-Plus/
|
||||||
|
platform-api/ → Plain Java 8 library (interfaces) — SHARED BY ALL
|
||||||
|
core/ → Plain Java 8 library (game logic) — SHARED BY ALL
|
||||||
|
mc1710/ → Current src/main/java/ (RetroFuturaGradle) — COMPOSITE BUILD
|
||||||
|
mc1122/ → 1.12.2 (RetroFuturaGradle — yes, RFG handles 1.12.2) — COMPOSITE BUILD
|
||||||
|
mc1165/ → 1.16.5 (ForgeGradle 6) — COMPOSITE BUILD
|
||||||
|
mc1201/ → 1.20.1 (NeoGradle/ModDevGradle 2) — COMPOSITE BUILD
|
||||||
|
gradle-plugins/ → TypeScript .d.ts generator (unchanged)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Why no legacy-common/modern-common initially:**
|
||||||
|
- The preprocessor can handle syntactic differences within version leaves
|
||||||
|
- Most LIGHT-MC code should be migrated to `core/` with platform interfaces instead of duplicated in a family-common layer
|
||||||
|
- If >50 files of genuine version-family-specific code emerges during porting, THEN add the intermediate layers
|
||||||
|
- Simpler architecture = less overhead = faster iteration
|
||||||
|
|
||||||
|
### Build System Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
Root settings.gradle:
|
||||||
|
include 'platform-api', 'core' → Plain Java libraries (multi-project)
|
||||||
|
includeBuild 'mc1710' → Composite build (RetroFuturaGradle)
|
||||||
|
includeBuild 'mc1122' → Composite build (RetroFuturaGradle)
|
||||||
|
includeBuild 'mc1165' → Composite build (ForgeGradle 6)
|
||||||
|
includeBuild 'mc1201' → Composite build (NeoGradle)
|
||||||
|
includeBuild 'gradle-plugins' → Already composite
|
||||||
|
|
||||||
|
Each mc*/ has its own:
|
||||||
|
settings.gradle → Declares dependency on root platform-api/core via includeBuild '..'
|
||||||
|
build.gradle → Applies version-specific Gradle plugin
|
||||||
|
gradle.properties → MC version, Forge version, mappings
|
||||||
|
src/main/java/ → Version-specific implementations
|
||||||
|
```
|
||||||
|
|
||||||
|
**Gradle Toolchains** handle JDK differences (8 for legacy, 17 for 1.20.1).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Revised Abstraction Order (Maximum Parallelism)
|
||||||
|
|
||||||
|
The key insight: **1.12.2 is significantly closer to 1.7.10 than 1.16.5+, but it is NOT trivial.** Beyond the 524 mechanical renames, there are 5 breaking API changes affecting 200+ files total. Still, it is the easiest version jump and should be tackled first.
|
||||||
|
|
||||||
|
### Track A: Core Abstraction (enables ALL versions)
|
||||||
|
1. Finish mc1710 shadow files for migrated controllers
|
||||||
|
2. Expand `IPlayer` / `IItemStack` / `IWorld` usage in core (use the real platform-api interfaces — DO NOT create duplicates)
|
||||||
|
3. Dialog cluster → Quest cluster → PlayerData migration to core
|
||||||
|
4. Packet DTO abstraction in core
|
||||||
|
5. Command abstraction in core
|
||||||
|
|
||||||
|
### Track B: 1.12.2 Port (CAN START IMMEDIATELY — easier than 1.16+ but NOT trivial)
|
||||||
|
1. Copy mc1710/ → mc1122/
|
||||||
|
2. Mass-rename cpw.mods.fml → net.minecraftforge.fml (524 files, mechanical)
|
||||||
|
3. **Replace all ItemStack null checks with isEmpty()** (37+ files with null checks, 390+ files reference ItemStack — the BIGGEST hidden change)
|
||||||
|
4. Update block/item registration to RegistryEvent pattern (18 files, 62 calls in CustomItems.java)
|
||||||
|
5. Update entity registration signature (1 file)
|
||||||
|
6. Replace getUnlocalizedName → getTranslationKey (59+ files)
|
||||||
|
7. Address World.getBlock → getBlockState usage (59+ files)
|
||||||
|
8. Refactor packet system (SimpleNetworkWrapper → SimpleChannel — structural rewrite)
|
||||||
|
9. Begin IInventory → IItemHandler migration for containers (59+ files, can be incremental)
|
||||||
|
10. Set up RetroFuturaGradle for 1.12.2 (confirmed: RFG supports 1.12.2)
|
||||||
|
11. Test and iterate
|
||||||
|
|
||||||
|
### Track C: 1.16.5 Port (start after Track A Phase 1-3)
|
||||||
|
1. Create mc1165/ with ForgeGradle 6
|
||||||
|
2. Implement PlatformService for 1.16.5
|
||||||
|
3. Port core controllers (they just work — MC-free)
|
||||||
|
4. Port networking (new packet system)
|
||||||
|
5. Port commands (Brigadier adapter)
|
||||||
|
6. Port blocks (BlockState — the Flattening work)
|
||||||
|
7. Port essential admin GUIs (rewrite, not port)
|
||||||
|
|
||||||
|
### Track D: 1.20.1 Port (start after Track C is 50% done)
|
||||||
|
1. Create mc1201/ based on mc1165/ (close enough)
|
||||||
|
2. Implement PlatformService for 1.20.1
|
||||||
|
3. Adapt for NeoForge API differences
|
||||||
|
4. Mostly rides on 1.16.5 work
|
||||||
|
|
||||||
|
**Tracks A and B can run in parallel immediately.** Track C starts when core interfaces exist. Track D is incremental from C.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## MVP Targets Per Version
|
||||||
|
|
||||||
|
### 1.7.10 — Full Primary (unchanged)
|
||||||
|
All features, full parity. This is the production build.
|
||||||
|
|
||||||
|
### 1.12.2 — "Bridge Build" (Closest to 1.7.10, but has real breaking changes)
|
||||||
|
- NPC spawn, persist, despawn lifecycle
|
||||||
|
- Dialog system, Quest system, Faction system
|
||||||
|
- Core networking (NPC sync, player data)
|
||||||
|
- Basic AI + combat
|
||||||
|
- Essential editor/admin GUIs
|
||||||
|
- Commands (`/kam` hierarchy)
|
||||||
|
- **NOT initially:** Abilities, auction, animation maker, scripting IDE
|
||||||
|
|
||||||
|
### 1.16.5 — "NPC Core" Modern
|
||||||
|
- Same feature set as 1.12.2 MVP
|
||||||
|
- Server-first: commands and admin workflows before full GUI
|
||||||
|
- Basic NPC editor screen
|
||||||
|
- **NOT initially:** Full GUI suite, abilities, auction, custom models
|
||||||
|
|
||||||
|
### 1.20.1 — "NPC Core" Latest
|
||||||
|
- Same as 1.16.5 — incremental from it
|
||||||
|
- Client polish lags behind server feature parity
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Critical Warnings
|
||||||
|
|
||||||
|
1. **You're the first to do this** — no existing mod shares code between 1.7.10 and modern. Expect uncharted territory.
|
||||||
|
2. **Don't mirror Minecraft class-for-class in platform-api** — keep interfaces coarse and purpose-driven
|
||||||
|
3. **Don't promise full GUI parity on modern versions first** — 212 files, completely different per version, do LAST
|
||||||
|
4. **Don't let preprocessor guards spread into core/** — only in version-leaf code
|
||||||
|
5. **1.12.2 is easier than 1.16+ but NOT trivial** — 524 mechanical renames + 5 breaking changes (ItemStack null→EMPTY, IInventory, getBlockState, getTranslationKey, GameRegistry events) affecting 200+ files
|
||||||
|
6. **Composite builds, not separate wrappers** — one Gradle wrapper, `includeBuild` per version leaf
|
||||||
|
7. **API merge is a phased operation** — move MC-free interfaces first (~131), then strip MC imports from the remaining 71. Don't try to move everything in one shot.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Open Questions / Future Decisions
|
||||||
|
|
||||||
|
1. Can the ReplayMod preprocessor be made to work with RetroFuturaGradle (instead of Loom)? Needs prototyping.
|
||||||
|
2. Should version leaves share a single `build.gradle.kts` via the preprocessor's pattern (all versions point to `../../build.gradle.kts`)? Or keep independent build files?
|
||||||
|
3. Scripting API compatibility — can the same `.js`/`.java` scripts work across versions?
|
||||||
|
4. Addon compatibility — DBC Addon, Gecko Addon, AW Addon need version-specific builds
|
||||||
|
5. Data format compatibility — can NPC save files from 1.7.10 load on 1.20.1?
|
||||||
|
6. When to add `legacy-common/` and `modern-common/` layers — set threshold at >50 duplicated files
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Research Agent Summary (12 agents deployed)
|
||||||
|
|
||||||
|
| Agent | Type | Key Finding |
|
||||||
|
|---|---|---|
|
||||||
|
| explore #1 | MC-dependent code | 1,424 files import net.minecraft.*, GUI is biggest hotspot (212 files) |
|
||||||
|
| explore #2 | Build system | Single-version locked, GTNH Convention + RFG |
|
||||||
|
| explore #3 | Subsystem coupling | Controllers/data are LIGHT-MC, AI/networking are HEAVY-MC |
|
||||||
|
| explore #4 | 1.7.10→1.12.2 API diff | 95% identical, only packets break, 524 files need package rename |
|
||||||
|
| explore #5 | legacy-common validation | ~100+ files use pre-Flattening patterns (metadata, IInventory) |
|
||||||
|
| librarian #1 | Porting strategies | Architectury 1.16.5+ only, preprocessor for syntactic diffs |
|
||||||
|
| librarian #2 | Real multi-version repos | Essential Mod gold standard, modstitch bridges RFG+FG, Loom consumes plain Java libs |
|
||||||
|
| librarian #3 | ForgeGradle matrix | RFG handles 1.7.10+1.12.2, FG6 for 1.16.5, ModDevGradle for 1.20.1, composite builds required |
|
||||||
|
| unspecified-high #1 | Preprocessor research | ReplayMod preprocessor syntax supports 1.7.10 (10710), but Loom doesn't; Essential wraps it |
|
||||||
|
| unspecified-high #2 | Real multi-version mods | **Nobody shares code between 1.7.10 and modern** — CustomNPC+ approach is genuinely novel |
|
||||||
|
| unspecified-high #3 | Write MULTI_VERSION_RESEARCH.md | Compiled all external research to permanent doc |
|
||||||
|
| unspecified-high #4 | Write MC_COUPLING_ANALYSIS.md | Compiled all coupling data to permanent doc |
|
||||||
|
| Oracle | Architecture strategy | Two-family monorepo (partially overridden by evidence) |
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
// Fix uppercase text in table cells
|
||||||
|
// Javadoc 11: method names are in th[scope="row"] a, not td a
|
||||||
|
function fixCase() {
|
||||||
|
document.querySelectorAll("th[scope='row'] a, td a, .memberNameLink a").forEach(function(el) {
|
||||||
|
var t = el.textContent.trim();
|
||||||
|
if (t.length > 2 && t === t.toUpperCase() && t.indexOf(" ") === -1) {
|
||||||
|
el.textContent = t.toLowerCase();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Correct navPadding = topNav height + subNav height
|
||||||
|
// Uses !important to override jQuery's inline style
|
||||||
|
function fixPadding() {
|
||||||
|
var topNav = document.querySelector(".topNav");
|
||||||
|
var subNav = document.querySelector(".subNav");
|
||||||
|
var pad = document.querySelector(".navPadding");
|
||||||
|
if (!pad) return;
|
||||||
|
var h = (topNav ? topNav.offsetHeight : 0) + (subNav ? subNav.offsetHeight : 0);
|
||||||
|
if (h > 0) {
|
||||||
|
pad.style.setProperty("padding-top", h + "px", "important");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
fixCase();
|
||||||
|
// Run fixPadding after jQuery has had its chance
|
||||||
|
setTimeout(fixPadding, 0);
|
||||||
|
setTimeout(fixPadding, 50);
|
||||||
|
setTimeout(fixPadding, 200);
|
||||||
|
|
||||||
|
// Use MutationObserver to permanently override any further jQuery writes
|
||||||
|
var pad = document.querySelector(".navPadding");
|
||||||
|
if (pad) {
|
||||||
|
var observer = new MutationObserver(function() {
|
||||||
|
fixPadding();
|
||||||
|
});
|
||||||
|
observer.observe(pad, { attributes: true, attributeFilter: ["style"] });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<div id="javadoc-header">
|
||||||
|
<a href="/CustomNPC-Plus/" class="header-brand">
|
||||||
|
<div class="header-title">
|
||||||
|
CustomNPC+
|
||||||
|
<span>Javadoc Reference</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<a href="/CustomNPC-Plus/" class="header-back">
|
||||||
|
Back to Index
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,954 @@
|
|||||||
|
/* ============================================================
|
||||||
|
CustomNPC+ — Javadoc Theme (Javadoc 11)
|
||||||
|
Tokyo Night — Styled Edition
|
||||||
|
============================================================ */
|
||||||
|
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');
|
||||||
|
|
||||||
|
:root {
|
||||||
|
/* ── Tokyo Night palette ── */
|
||||||
|
--bg: #1a1b26;
|
||||||
|
--bg2: #1f2335;
|
||||||
|
--bg3: #24283b;
|
||||||
|
--bg-elevated: #292e42;
|
||||||
|
--border: #3b4261;
|
||||||
|
--border2: #414868;
|
||||||
|
--text: #c0caf5;
|
||||||
|
--text-mid: #a9b1d6;
|
||||||
|
--text-dim: #565f89;
|
||||||
|
--green: #9ece6a;
|
||||||
|
--green-dim: rgba(158, 206, 106, 0.12);
|
||||||
|
--blue: #7aa2f7;
|
||||||
|
--blue-dim: rgba(122, 162, 247, 0.12);
|
||||||
|
--amber: #e0af68;
|
||||||
|
--amber-dim: rgba(224, 175, 104, 0.10);
|
||||||
|
--purple: #bb9af7;
|
||||||
|
--purple-dim: rgba(187, 154, 247, 0.10);
|
||||||
|
--cyan: #7dcfff;
|
||||||
|
--cyan-dim: rgba(125, 207, 255, 0.10);
|
||||||
|
--red: #f7768e;
|
||||||
|
--highlight-bg: rgba(122, 162, 247, 0.08);
|
||||||
|
--hover-bg: rgba(187, 154, 247, 0.08);
|
||||||
|
--nav-h: 44px;
|
||||||
|
--subnav-h: 36px;
|
||||||
|
|
||||||
|
/* ── Font stacks ── */
|
||||||
|
--font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
|
--font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box !important; }
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: var(--bg) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.6 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
min-height: 100vh !important;
|
||||||
|
display: flex !important;
|
||||||
|
flex-direction: column !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skipNav { display: none !important; }
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
NAVIGATION
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
.fixedNav {
|
||||||
|
position: fixed !important;
|
||||||
|
top: 0 !important; left: 0 !important; right: 0 !important;
|
||||||
|
z-index: 100 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Top bar — gradient accent stripe on top */
|
||||||
|
.topNav {
|
||||||
|
position: relative !important;
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
margin: 0 !important; padding: 0 !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: stretch !important;
|
||||||
|
overflow: visible !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gradient accent line across the very top */
|
||||||
|
.topNav::before {
|
||||||
|
content: '' !important;
|
||||||
|
position: absolute !important;
|
||||||
|
top: 0 !important; left: 0 !important; right: 0 !important;
|
||||||
|
height: 2px !important;
|
||||||
|
background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan)) !important;
|
||||||
|
z-index: 10 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nav list — leave room on right for brand */
|
||||||
|
.topNav > ul.navList {
|
||||||
|
list-style: none !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 2px 0 0 8px !important;
|
||||||
|
padding-right: 320px !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: stretch !important;
|
||||||
|
flex-shrink: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topNav > ul.navList > li {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 16px !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0.01em !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
border-bottom: 2px solid transparent !important;
|
||||||
|
transition: color 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topNav > ul.navList > li > a {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
margin: 0 -16px !important;
|
||||||
|
padding: 0 16px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0.01em !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
border-bottom: 2px solid transparent !important;
|
||||||
|
transition: color 0.2s, border-color 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topNav > ul.navList > li > a:hover {
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-bottom-color: var(--purple) !important;
|
||||||
|
background: transparent !important;
|
||||||
|
text-shadow: none !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Active item — gradient underline */
|
||||||
|
.topNav > ul.navList > li.navBarCell1Rev {
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-image: linear-gradient(90deg, var(--blue), var(--purple)) 1 !important;
|
||||||
|
border-bottom-width: 2px !important;
|
||||||
|
border-bottom-style: solid !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Brand — pinned to far right of topNav ── */
|
||||||
|
.topNav > .aboutLanguage {
|
||||||
|
position: absolute !important;
|
||||||
|
top: 0 !important; right: 0 !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 12px !important;
|
||||||
|
padding: 0 16px !important;
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border-left: 1px solid var(--border) !important;
|
||||||
|
z-index: 5 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide the duplicate in bottom nav */
|
||||||
|
.bottomNav > .aboutLanguage,
|
||||||
|
.bottomNav .aboutLanguage {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#javadoc-header {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-brand { text-decoration: none !important; }
|
||||||
|
|
||||||
|
/* Brand title — gradient text */
|
||||||
|
.header-title {
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 14px !important;
|
||||||
|
font-weight: 700 !important;
|
||||||
|
background: linear-gradient(135deg, var(--blue), var(--purple)) !important;
|
||||||
|
-webkit-background-clip: text !important;
|
||||||
|
-webkit-text-fill-color: transparent !important;
|
||||||
|
background-clip: text !important;
|
||||||
|
line-height: 1.4 !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title span {
|
||||||
|
display: block !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 9px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
background: none !important;
|
||||||
|
-webkit-text-fill-color: var(--text-dim) !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
margin-top: 1px !important;
|
||||||
|
letter-spacing: 0.1em !important;
|
||||||
|
text-transform: uppercase !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-back {
|
||||||
|
display: inline-flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
padding: 5px 12px !important;
|
||||||
|
border: 1px solid var(--border2) !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
transition: all 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-back:hover {
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-color: var(--purple) !important;
|
||||||
|
background: var(--purple-dim) !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
text-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Sub nav ── */
|
||||||
|
.subNav {
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
height: var(--subnav-h) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 14px !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 12px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search first */
|
||||||
|
.subNav > ul.navListSearch {
|
||||||
|
order: -1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav ul,
|
||||||
|
.subNav ul.navList,
|
||||||
|
.subNav ul.subNavList,
|
||||||
|
.subNav ul.navListSearch {
|
||||||
|
list-style: none !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav li {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
padding: 0 6px !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
border: none !important;
|
||||||
|
height: auto !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav a {
|
||||||
|
color: var(--blue) !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
transition: color 0.15s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subNav a:hover { color: var(--purple) !important; text-shadow: none !important; }
|
||||||
|
|
||||||
|
.subNav label {
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
margin-right: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
CONTENT
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
main {
|
||||||
|
background: var(--bg) !important;
|
||||||
|
padding: 28px !important;
|
||||||
|
flex: 1 0 auto !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentContainer, div.contentContainer {
|
||||||
|
background: var(--bg) !important;
|
||||||
|
padding: 0 28px 0px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
padding: 0 28px 0 !important;
|
||||||
|
margin-bottom: 20px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Subtitle under h1 on help/overview pages */
|
||||||
|
.header .subTitle,
|
||||||
|
div.subTitle {
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.7 !important;
|
||||||
|
margin-top: 8px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.packageLabelInType {
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Headings ── */
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: -0.01em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Page title — gradient accent bar */
|
||||||
|
h1.title, h2.title {
|
||||||
|
font-size: 22px !important;
|
||||||
|
font-weight: 700 !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
padding-bottom: 16px !important;
|
||||||
|
padding-left: 16px !important;
|
||||||
|
margin-bottom: 24px !important;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
border-left: 4px solid transparent !important;
|
||||||
|
border-image: linear-gradient(180deg, var(--blue), var(--purple)) 1 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Section h2 — colored panel */
|
||||||
|
section > h2,
|
||||||
|
li.blockList > section > h2 {
|
||||||
|
font-size: 14px !important;
|
||||||
|
color: var(--green) !important;
|
||||||
|
border-left: 3px solid var(--green) !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
background: var(--green-dim) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Generic h2 (table section headers like "Method Summary") */
|
||||||
|
h2 {
|
||||||
|
font-size: 14px !important;
|
||||||
|
color: var(--amber) !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
border-left: 3px solid var(--amber) !important;
|
||||||
|
padding: 8px 12px !important;
|
||||||
|
margin-top: 28px !important;
|
||||||
|
margin-bottom: 12px !important;
|
||||||
|
background: var(--amber-dim) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* h3 — table section headers inside blockList */
|
||||||
|
h3 {
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* h4 — method detail names */
|
||||||
|
h4 {
|
||||||
|
font-size: 13px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
color: var(--cyan) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
border-left: 3px solid var(--cyan) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── blockList sections — card-like containers ── */
|
||||||
|
ul.blockList > li.blockList,
|
||||||
|
ul.blockListLast > li.blockList {
|
||||||
|
border: 1px solid var(--border) !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
margin-bottom: 14px !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Help page: section cards with padding around their content */
|
||||||
|
ul.blockList > li.blockList > section {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.blockList > li.blockList > section > p,
|
||||||
|
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) {
|
||||||
|
padding: 14px 18px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nested lists inside section content */
|
||||||
|
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) > li {
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
padding: 3px 0 !important;
|
||||||
|
list-style: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.blockList > li.blockList > section > ul:not(.blockList):not(.blockListLast) > li::before {
|
||||||
|
content: '\203A' !important;
|
||||||
|
color: var(--purple) !important;
|
||||||
|
margin-right: 8px !important;
|
||||||
|
font-weight: 700 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Inherited methods block ── */
|
||||||
|
ul.blockList > li.blockList > h3,
|
||||||
|
ul.blockList > li.blockList > ul.blockList > li.blockList > h3 {
|
||||||
|
font-size: 11px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
padding: 8px 14px !important;
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The comma-separated code block of inherited method names */
|
||||||
|
ul.blockList > li.blockList > code,
|
||||||
|
li.blockList > code {
|
||||||
|
display: block !important;
|
||||||
|
padding: 10px 16px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
background: var(--bg) !important;
|
||||||
|
border: none !important;
|
||||||
|
line-height: 1.8 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Inheritance chain ── */
|
||||||
|
ul.inheritance {
|
||||||
|
list-style: none !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 0 16px !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
}
|
||||||
|
ul.inheritance li { padding-left: 16px !important; }
|
||||||
|
ul.inheritance li:first-child { padding-left: 0 !important; }
|
||||||
|
|
||||||
|
/* ── General content lists (help page) ── */
|
||||||
|
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
margin: 4px 0 4px 12px !important;
|
||||||
|
list-style: none !important;
|
||||||
|
}
|
||||||
|
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) > li {
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
padding: 3px 0 !important;
|
||||||
|
line-height: 1.7 !important;
|
||||||
|
}
|
||||||
|
main ul:not(.blockList):not(.blockListLast):not(.navList):not(.subNavList):not(.navListSearch):not(.inheritance) > li::before {
|
||||||
|
content: '\203A' !important;
|
||||||
|
color: var(--purple) !important;
|
||||||
|
margin-right: 8px !important;
|
||||||
|
font-weight: 700 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* General paragraphs in content */
|
||||||
|
main > div p, .contentContainer p {
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.7 !important;
|
||||||
|
margin: 8px 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Emphasized phrase */
|
||||||
|
.emphasizedPhrase {
|
||||||
|
display: block !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-style: italic !important;
|
||||||
|
border-left: 2px solid var(--purple) !important;
|
||||||
|
padding: 8px 14px !important;
|
||||||
|
margin-top: 16px !important;
|
||||||
|
background: var(--purple-dim) !important;
|
||||||
|
border-radius: 0 4px 4px 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bottom footer subNav */
|
||||||
|
footer {
|
||||||
|
/*margin-top: auto;*/
|
||||||
|
}
|
||||||
|
footer .subNav {
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border-top: 1px solid var(--border) !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
height: var(--subnav-h) !important;
|
||||||
|
padding: 0 14px !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
gap: 12px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
TABLES
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100% !important;
|
||||||
|
border-collapse: collapse !important;
|
||||||
|
border: 1px solid var(--border) !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
margin: 16px 0 !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
caption {
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
padding: 8px 14px !important;
|
||||||
|
text-align: left !important;
|
||||||
|
border-bottom: 1px solid var(--border2) !important;
|
||||||
|
caption-side: top !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Table tabs — pill style */
|
||||||
|
.activeTableTab, .tableTab {
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
padding: 4px 12px !important;
|
||||||
|
border: 1px solid var(--border2) !important;
|
||||||
|
border-radius: 20px !important;
|
||||||
|
display: inline-block !important;
|
||||||
|
margin-right: 6px !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
transition: all 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activeTableTab {
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-color: var(--blue) !important;
|
||||||
|
background: var(--blue-dim) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tableTab { color: var(--text-dim) !important; background: var(--bg3) !important; }
|
||||||
|
.tableTab a { color: var(--text-dim) !important; text-decoration: none !important; }
|
||||||
|
.tableTab a:hover { color: var(--text) !important; text-shadow: none !important; }
|
||||||
|
|
||||||
|
/* Column headers */
|
||||||
|
th[scope="col"] {
|
||||||
|
background: var(--bg-elevated) !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 10px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
letter-spacing: 0.06em !important;
|
||||||
|
text-transform: uppercase !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
border-bottom: 2px solid var(--border2) !important;
|
||||||
|
text-align: left !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Data cells */
|
||||||
|
th[scope="row"], td {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
vertical-align: top !important;
|
||||||
|
text-align: left !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 400 !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0 !important;
|
||||||
|
transition: background 0.15s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Stronger alternating row contrast */
|
||||||
|
tr.altColor > td, tr.altColor > th[scope="row"] { background: var(--bg) !important; }
|
||||||
|
tr.rowColor > td, tr.rowColor > th[scope="row"] { background: var(--bg2) !important; }
|
||||||
|
|
||||||
|
tr:hover > td, tr:hover > th[scope="row"] {
|
||||||
|
background: var(--purple-dim) !important;
|
||||||
|
border-bottom-color: rgba(187, 154, 247, 0.25) !important;
|
||||||
|
}
|
||||||
|
tr:hover > td a, tr:hover > th[scope="row"] a {
|
||||||
|
color: var(--purple) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Links ── */
|
||||||
|
a, a:visited { color: var(--blue) !important; text-decoration: none !important; transition: color 0.15s !important; }
|
||||||
|
a:hover { color: var(--purple) !important; text-decoration: none !important; }
|
||||||
|
.memberNameLink a { color: var(--cyan) !important; font-weight: 500 !important; }
|
||||||
|
.memberNameLink a:hover { color: var(--purple) !important; }
|
||||||
|
.externalLink { color: var(--blue) !important; }
|
||||||
|
|
||||||
|
/* ── Description blocks ── */
|
||||||
|
div.block {
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 13px !important;
|
||||||
|
line-height: 1.7 !important;
|
||||||
|
padding: 4px 0 !important;
|
||||||
|
}
|
||||||
|
ul.blockList > li.blockList > div.block{ padding: 12px 16px !important; margin: 0 !important; }
|
||||||
|
|
||||||
|
/* ── Method detail ── */
|
||||||
|
ul.blockList, ul.blockListLast { list-style: none !important; padding: 0 !important; margin: 0 !important; }
|
||||||
|
ul.blockList > li.blockList, ul.blockListLast > li.blockList {
|
||||||
|
border: 1px solid var(--border) !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
margin-bottom: 12px !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Method/type signatures — accent left bar */
|
||||||
|
pre.methodSignature, pre.typeSignature {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border: none !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
border-left: 3px solid var(--cyan) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 14px 18px !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
overflow-x: auto !important;
|
||||||
|
white-space: pre-wrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border: 1px solid var(--border) !important;
|
||||||
|
border-left: 3px solid var(--blue) !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
padding: 14px 18px !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
overflow-x: auto !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
white-space: pre-wrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
color: var(--cyan) !important;
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
padding: 2px 6px !important;
|
||||||
|
border-radius: 4px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl { padding: 12px 16px !important; margin: 0 !important; }
|
||||||
|
dt { margin-bottom: 4px !important; }
|
||||||
|
dd { margin: 0 0 8px 16px !important; color: var(--text-mid) !important; font-size: 12px !important; }
|
||||||
|
|
||||||
|
.paramLabel, .returnLabel, .throwsLabel, .seeLabel, .simpleTagLabel {
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 10px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
color: var(--purple) !important;
|
||||||
|
text-transform: uppercase !important;
|
||||||
|
letter-spacing: 0.06em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.typeNameLabel { color: var(--cyan) !important; }
|
||||||
|
|
||||||
|
.deprecationBlock {
|
||||||
|
background: var(--amber-dim) !important;
|
||||||
|
border-left: 3px solid var(--amber) !important;
|
||||||
|
border-radius: 0 6px 6px 0 !important;
|
||||||
|
padding: 10px 14px !important;
|
||||||
|
color: var(--amber) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Inputs ── */
|
||||||
|
input[type="text"] {
|
||||||
|
background: var(--bg) !important;
|
||||||
|
border: 1px solid var(--border2) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
padding: 5px 12px !important;
|
||||||
|
outline: none !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
transition: border-color 0.2s, box-shadow 0.2s !important;
|
||||||
|
}
|
||||||
|
input[type="text"]:focus {
|
||||||
|
border-color: var(--blue) !important;
|
||||||
|
box-shadow: 0 0 0 2px var(--blue-dim) !important;
|
||||||
|
}
|
||||||
|
input[type="reset"] {
|
||||||
|
background: var(--bg3) !important;
|
||||||
|
border: 1px solid var(--border2) !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
padding: 5px 12px !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
transition: all 0.2s !important;
|
||||||
|
}
|
||||||
|
input[type="reset"]:hover {
|
||||||
|
border-color: var(--text-dim) !important;
|
||||||
|
color: var(--text-mid) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
BOTTOM NAV
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
.bottomNav {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border-top: 1px solid var(--border) !important;
|
||||||
|
min-height: var(--nav-h) !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin-top: 32px !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
position: relative !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gradient accent line on bottom nav too */
|
||||||
|
.bottomNav::after {
|
||||||
|
content: '' !important;
|
||||||
|
position: absolute !important;
|
||||||
|
bottom: 0 !important; left: 0 !important; right: 0 !important;
|
||||||
|
height: 2px !important;
|
||||||
|
background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav ul.navList[title="Navigation"] {
|
||||||
|
list-style: none !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 0 0 8px !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: stretch !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav ul.navList[title="Navigation"] li {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
padding: 0 16px !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-transform: none !important;
|
||||||
|
letter-spacing: 0.01em !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
border-top: 2px solid transparent !important;
|
||||||
|
transition: color 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav ul.navList[title="Navigation"] li > a {
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
height: var(--nav-h) !important;
|
||||||
|
margin: 0 -16px !important;
|
||||||
|
padding: 0 16px !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
text-decoration: none !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 500 !important;
|
||||||
|
transition: color 0.2s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav ul.navList[title="Navigation"] li > a:hover {
|
||||||
|
color: var(--text) !important;
|
||||||
|
text-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav ul.navList[title="Navigation"] li.navBarCell1Rev {
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-image: linear-gradient(90deg, var(--blue), var(--purple)) 1 !important;
|
||||||
|
border-top-width: 2px !important;
|
||||||
|
border-top-style: solid !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottomNav .aboutLanguage {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legalCopy {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
padding: 14px 18px !important;
|
||||||
|
text-align: center !important;
|
||||||
|
border-top: 1px solid var(--border) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
SEARCH RESULTS DROPDOWN (jQuery UI Autocomplete)
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
.ui-autocomplete {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
border: 1px solid var(--border2) !important;
|
||||||
|
border-radius: 8px !important;
|
||||||
|
max-height: 400px !important;
|
||||||
|
overflow-y: auto !important;
|
||||||
|
overflow-x: hidden !important;
|
||||||
|
z-index: 9999 !important;
|
||||||
|
list-style: none !important;
|
||||||
|
padding: 4px 0 !important;
|
||||||
|
margin: 4px 0 0 !important;
|
||||||
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(122, 162, 247, 0.05) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Category headers */
|
||||||
|
.ui-autocomplete .ui-autocomplete-category {
|
||||||
|
background: var(--bg-elevated) !important;
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-family: var(--font-ui) !important;
|
||||||
|
font-size: 10px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
text-transform: uppercase !important;
|
||||||
|
letter-spacing: 0.06em !important;
|
||||||
|
padding: 6px 14px !important;
|
||||||
|
border-bottom: 1px solid var(--border) !important;
|
||||||
|
border-top: 1px solid var(--border) !important;
|
||||||
|
cursor: default !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Individual result items */
|
||||||
|
.ui-autocomplete .ui-menu-item {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
list-style: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-autocomplete .ui-menu-item > div,
|
||||||
|
.ui-autocomplete .ui-menu-item-wrapper {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
padding: 7px 14px !important;
|
||||||
|
border: none !important;
|
||||||
|
border-left: 2px solid transparent !important;
|
||||||
|
cursor: pointer !important;
|
||||||
|
line-height: 1.5 !important;
|
||||||
|
transition: all 0.1s !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover / focus state */
|
||||||
|
.ui-autocomplete .ui-menu-item > div.ui-state-active,
|
||||||
|
.ui-autocomplete .ui-menu-item > div.ui-state-focus,
|
||||||
|
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
|
||||||
|
.ui-autocomplete .ui-menu-item-wrapper.ui-state-focus,
|
||||||
|
.ui-autocomplete .ui-state-active,
|
||||||
|
.ui-autocomplete .ui-state-focus {
|
||||||
|
background: var(--purple-dim) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
border: none !important;
|
||||||
|
border-left: 2px solid var(--purple) !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Highlighted matching text */
|
||||||
|
.resultHighlight {
|
||||||
|
color: var(--cyan) !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search tag result extras */
|
||||||
|
.searchTagHolderResult {
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searchTagDescResult {
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-size: 11px !important;
|
||||||
|
font-style: italic !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* "No results found" */
|
||||||
|
.ui-autocomplete .ui-menu-item:only-child > div {
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
font-style: italic !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Override jQuery UI defaults */
|
||||||
|
.ui-widget {
|
||||||
|
font-family: var(--font-mono) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-widget-content {
|
||||||
|
background: var(--bg2) !important;
|
||||||
|
color: var(--text) !important;
|
||||||
|
border-color: var(--border2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-menu .ui-menu-item {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Watermark style for search input placeholder */
|
||||||
|
.watermark {
|
||||||
|
color: var(--text-dim) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ══════════════════════════════════════════════
|
||||||
|
MISC
|
||||||
|
══════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
::-webkit-scrollbar { width: 8px; height: 8px; }
|
||||||
|
::-webkit-scrollbar-track { background: var(--bg); }
|
||||||
|
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
|
||||||
|
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
|
||||||
|
::selection { background: rgba(187, 154, 247, 0.25); color: var(--text); }
|
||||||
|
hr { border: none !important; border-top: 1px solid var(--border) !important; margin: 24px 0 !important; }
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Javadoc Index</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&family=IBM+Plex+Sans:ital,wght@0,300;0,600;1,300&display=swap" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Generated
+1679
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "javadoc-index",
|
||||||
|
"private": true,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
|
"vite": "^7.3.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import styles from './App.module.css'
|
||||||
|
import { useDocs } from './useDocs'
|
||||||
|
import TerminalHeader from './components/TerminalHeader'
|
||||||
|
import Section from './components/Section'
|
||||||
|
import { ReleaseCard, ExperimentalCard } from './components/Card'
|
||||||
|
import { LoadingState, ErrorState, EmptyState } from './components/States'
|
||||||
|
import Footer from './components/Footer'
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
const { data, loading, error } = useDocs()
|
||||||
|
|
||||||
|
const releases = data?.releases || []
|
||||||
|
const experimental = data?.experimental || []
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.root}>
|
||||||
|
<TerminalHeader />
|
||||||
|
|
||||||
|
{/* ── Releases ── */}
|
||||||
|
<Section
|
||||||
|
label="Release"
|
||||||
|
variant="releases"
|
||||||
|
count={loading ? undefined : releases.length}
|
||||||
|
>
|
||||||
|
{loading ? (
|
||||||
|
<LoadingState />
|
||||||
|
) : error ? (
|
||||||
|
<ErrorState message={error} />
|
||||||
|
) : releases.length === 0 ? (
|
||||||
|
<EmptyState label="releases" />
|
||||||
|
) : (
|
||||||
|
<div className={styles.grid}>
|
||||||
|
{releases.map((r, i) => (
|
||||||
|
<ReleaseCard key={r.id} release={r} index={i} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{/* ── Experimental ── */}
|
||||||
|
<Section
|
||||||
|
label="Experimental"
|
||||||
|
variant="experimental"
|
||||||
|
count={loading ? undefined : experimental.length}
|
||||||
|
>
|
||||||
|
{loading ? (
|
||||||
|
<LoadingState />
|
||||||
|
) : error ? null : experimental.length === 0 ? (
|
||||||
|
<EmptyState label="experimental branches" />
|
||||||
|
) : (
|
||||||
|
<div className={styles.grid}>
|
||||||
|
{experimental.map((b, i) => (
|
||||||
|
<ExperimentalCard key={b.id} branch={b} index={i} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
{!loading && !error && (
|
||||||
|
<Footer source={data?.source} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
.root {
|
||||||
|
max-width: 1100px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 48px 32px 96px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.root { padding: 24px 16px 64px; }
|
||||||
|
.grid { grid-template-columns: 1fr; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
import styles from './Card.module.css'
|
||||||
|
import { REPO_NAME } from '../config'
|
||||||
|
|
||||||
|
const BASE_PATH = `/${REPO_NAME}`
|
||||||
|
|
||||||
|
function formatDate(iso) {
|
||||||
|
if (!iso) return null
|
||||||
|
try {
|
||||||
|
return new Intl.DateTimeFormat('en-GB', {
|
||||||
|
day: '2-digit', month: 'short', year: 'numeric'
|
||||||
|
}).format(new Date(iso))
|
||||||
|
} catch (e) { return null }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ReleaseCard({ release, index }) {
|
||||||
|
const isLatest = release.isLatest
|
||||||
|
const date = formatDate(release.date)
|
||||||
|
const cardClass = isLatest
|
||||||
|
? styles.card + ' ' + styles.latest
|
||||||
|
: styles.card + ' ' + styles.release
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={BASE_PATH + '/' + release.path + '/'}
|
||||||
|
className={cardClass}
|
||||||
|
style={{ animationDelay: (index * 50) + 'ms' }}
|
||||||
|
>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<div className={styles.badges}>
|
||||||
|
{isLatest && (
|
||||||
|
<span className={styles.badge + ' ' + styles.badgeLatest}>● latest</span>
|
||||||
|
)}
|
||||||
|
<span className={styles.badge + ' ' + styles.badgeRelease}>release</span>
|
||||||
|
</div>
|
||||||
|
<span className={styles.arrow}>→</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.version}>
|
||||||
|
v{release.version}
|
||||||
|
</div>
|
||||||
|
<div className={styles.meta}>
|
||||||
|
{date && (
|
||||||
|
<div className={styles.metaRow}>
|
||||||
|
<span className={styles.metaKey}>date</span>
|
||||||
|
<span className={styles.metaVal}>{date}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className={styles.metaRow}>
|
||||||
|
<span className={styles.metaKey}>path</span>
|
||||||
|
<span className={styles.metaVal}>{release.path}/</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ExperimentalCard({ branch, index }) {
|
||||||
|
const date = formatDate(branch.date)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={BASE_PATH + '/' + branch.path + '/'}
|
||||||
|
className={styles.card + ' ' + styles.experimental}
|
||||||
|
style={{ animationDelay: (index * 50) + 'ms' }}
|
||||||
|
>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<span className={styles.badge + ' ' + styles.badgeExperimental}>
|
||||||
|
experimental
|
||||||
|
</span>
|
||||||
|
<span className={styles.arrow}>→</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.version + ' ' + styles.versionBranch}>
|
||||||
|
{branch.branch}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.meta}>
|
||||||
|
{date && (
|
||||||
|
<div className={styles.metaRow}>
|
||||||
|
<span className={styles.metaKey}>date</span>
|
||||||
|
<span className={styles.metaVal}>{date}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{branch.hash && (
|
||||||
|
<div className={styles.metaRow}>
|
||||||
|
<span className={styles.metaKey}>sha</span>
|
||||||
|
<span className={styles.metaVal + ' ' + styles.hash}>{branch.hash}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className={styles.metaRow}>
|
||||||
|
<span className={styles.metaKey}>path</span>
|
||||||
|
<span className={styles.metaVal}>{branch.path}/</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
.card {
|
||||||
|
display: block;
|
||||||
|
text-decoration: none;
|
||||||
|
background: var(--bg2);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 20px 22px;
|
||||||
|
transition: border-color 0.15s, background 0.15s, transform 0.15s;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
animation: fadeUp 0.35s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0; left: 0; right: 0;
|
||||||
|
height: 2px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.release::before { background: var(--green); }
|
||||||
|
.latest::before { background: linear-gradient(90deg, var(--green), var(--blue)); }
|
||||||
|
.experimental::before { background: var(--amber); }
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
border-color: var(--border2);
|
||||||
|
background: var(--bg3);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover::before { opacity: 1; }
|
||||||
|
|
||||||
|
/* ── Header ── */
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badges {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.12em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badgeLatest {
|
||||||
|
color: var(--green);
|
||||||
|
border-color: var(--green-dim);
|
||||||
|
background: rgba(57, 211, 83, 0.08);
|
||||||
|
animation: pulseBorder 2s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badgeRelease {
|
||||||
|
color: var(--text-dim);
|
||||||
|
border-color: var(--border2);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badgeExperimental {
|
||||||
|
color: var(--amber);
|
||||||
|
border-color: var(--amber-dim);
|
||||||
|
background: rgba(240, 160, 48, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--border2);
|
||||||
|
transition: color 0.15s, transform 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover .arrow {
|
||||||
|
color: var(--text-mid);
|
||||||
|
transform: translateX(3px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Version ── */
|
||||||
|
.version {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.latest .version { color: var(--green); }
|
||||||
|
.versionBranch { font-size: 16px; color: var(--amber); }
|
||||||
|
|
||||||
|
/* ── Meta ── */
|
||||||
|
.meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 3px;
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.metaRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.metaKey {
|
||||||
|
min-width: 36px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.metaVal {
|
||||||
|
color: var(--text-mid);
|
||||||
|
font-family: 'IBM Plex Mono', monospace;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hash { color: var(--blue); }
|
||||||
|
|
||||||
|
/* ── Animations ── */
|
||||||
|
@keyframes fadeUp {
|
||||||
|
from { opacity: 0; transform: translateY(10px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulseBorder {
|
||||||
|
0%, 100% { border-color: var(--green-dim); }
|
||||||
|
50% { border-color: var(--green); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import styles from './Footer.module.css'
|
||||||
|
import { REPO_OWNER, REPO_NAME } from '../useDocs'
|
||||||
|
|
||||||
|
export default function Footer({ source }) {
|
||||||
|
const now = new Intl.DateTimeFormat('en-GB', {
|
||||||
|
day: '2-digit', month: 'short', year: 'numeric',
|
||||||
|
hour: '2-digit', minute: '2-digit', timeZoneName: 'short'
|
||||||
|
}).format(new Date())
|
||||||
|
|
||||||
|
return (
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<span>
|
||||||
|
<span className={styles.dot} />
|
||||||
|
Auto-generated · {source === 'manifest' ? 'manifest.json' : 'GitHub API'}
|
||||||
|
</span>
|
||||||
|
<span>{now}</span>
|
||||||
|
<span>Template by:
|
||||||
|
<a
|
||||||
|
href={`https://github.com/somehussar/`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={styles.link}
|
||||||
|
>
|
||||||
|
github.com/somehussar
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
.footer {
|
||||||
|
margin-top: 64px;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--green);
|
||||||
|
margin-right: 6px;
|
||||||
|
animation: blink 2s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
color: var(--blue);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
0%, 100% { opacity: 1; }
|
||||||
|
50% { opacity: 0.3; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import styles from './Section.module.css'
|
||||||
|
|
||||||
|
export default function Section({ label, count, variant, children }) {
|
||||||
|
return (
|
||||||
|
<section className={styles.section}>
|
||||||
|
<div className={styles.header}>
|
||||||
|
<span className={`${styles.tag} ${styles[variant]}`}>{label}</span>
|
||||||
|
<div className={styles.line} />
|
||||||
|
{count !== undefined && (
|
||||||
|
<span className={styles.count}>
|
||||||
|
{count} {label.toLowerCase()}{count !== 1 ? 's' : ''}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
{children}
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
.section {
|
||||||
|
margin-top: 40px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.15em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.releases {
|
||||||
|
color: var(--green);
|
||||||
|
border-color: var(--green-dim);
|
||||||
|
background: rgba(57, 211, 83, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.experimental {
|
||||||
|
color: var(--amber);
|
||||||
|
border-color: var(--amber-dim);
|
||||||
|
background: rgba(240, 160, 48, 0.06);
|
||||||
|
}
|
||||||
|
|
||||||
|
.line {
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.count {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import styles from './States.module.css'
|
||||||
|
|
||||||
|
export function LoadingState() {
|
||||||
|
return (
|
||||||
|
<div className={styles.box}>
|
||||||
|
<div className={styles.spinner} />
|
||||||
|
<p className={styles.label}>Fetching documentation index...</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ErrorState({ message }) {
|
||||||
|
return (
|
||||||
|
<div className={styles.box}>
|
||||||
|
<div className={styles.errorIcon}>⚠</div>
|
||||||
|
<p className={styles.errorMsg}>{message}</p>
|
||||||
|
<p className={styles.errorSub}>
|
||||||
|
Check that the gh-pages branch exists and is publicly accessible.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function EmptyState({ label }) {
|
||||||
|
return (
|
||||||
|
<div className={`${styles.box} ${styles.empty}`}>
|
||||||
|
<p className={styles.label}>No {label} found.</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
.box {
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 48px;
|
||||||
|
text-align: center;
|
||||||
|
background: var(--bg2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner {
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border: 2px solid var(--border2);
|
||||||
|
border-top-color: var(--green);
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 0.75s linear infinite;
|
||||||
|
margin: 0 auto 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorIcon {
|
||||||
|
font-size: 22px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: var(--red);
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorMsg {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--red);
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorSub {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import styles from './TerminalHeader.module.css'
|
||||||
|
import { PROJECT_NAME, REPO_NAME, LINKS, AUTHORS } from '../config'
|
||||||
|
|
||||||
|
function useGitHubProfile(username) {
|
||||||
|
const [profile, setProfile] = useState(null)
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const cacheKey = 'gh-profile-' + username
|
||||||
|
|
||||||
|
// Check sessionStorage first — avoids hammering the API on every render
|
||||||
|
try {
|
||||||
|
const cached = sessionStorage.getItem(cacheKey)
|
||||||
|
if (cached) {
|
||||||
|
setProfile(JSON.parse(cached))
|
||||||
|
setLoading(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
|
||||||
|
fetch('https://api.github.com/users/' + username)
|
||||||
|
.then(r => {
|
||||||
|
if (!r.ok) throw new Error('HTTP ' + r.status)
|
||||||
|
return r.json()
|
||||||
|
})
|
||||||
|
.then(d => {
|
||||||
|
// Don't cache error responses like rate limit messages
|
||||||
|
if (!d.message) {
|
||||||
|
try { sessionStorage.setItem(cacheKey, JSON.stringify(d)) } catch (e) {}
|
||||||
|
}
|
||||||
|
setProfile(d)
|
||||||
|
setLoading(false)
|
||||||
|
})
|
||||||
|
.catch(() => setLoading(false))
|
||||||
|
}, [username])
|
||||||
|
|
||||||
|
return { profile, loading }
|
||||||
|
}
|
||||||
|
|
||||||
|
function AuthorTile({ username, active }) {
|
||||||
|
const { profile, loading } = useGitHubProfile(username)
|
||||||
|
const tileClass = styles.authorTile + (active ? ' ' + styles.authorTileActive : '')
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className={tileClass}>
|
||||||
|
<div className={styles.authorAvatarSkeleton} />
|
||||||
|
<div className={styles.authorInfo}>
|
||||||
|
<div className={styles.authorSkeleton} style={{ width: '60px' }} />
|
||||||
|
<div className={styles.authorSkeleton} style={{ width: '80px', marginTop: '4px' }} />
|
||||||
|
<div className={styles.authorBioPlaceholder} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!profile || profile.message) {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={'https://github.com/' + username}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={tileClass}
|
||||||
|
>
|
||||||
|
<div className={styles.authorAvatarSkeleton} />
|
||||||
|
<div className={styles.authorInfo}>
|
||||||
|
<span className={styles.authorName}>{username}</span>
|
||||||
|
<span className={styles.authorLogin}>@{username}</span>
|
||||||
|
<div className={styles.authorBioPlaceholder} />
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={profile.html_url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={tileClass}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={profile.avatar_url}
|
||||||
|
alt={profile.login}
|
||||||
|
className={styles.authorAvatar}
|
||||||
|
/>
|
||||||
|
<div className={styles.authorInfo}>
|
||||||
|
<span className={styles.authorName}>{profile.name || profile.login}</span>
|
||||||
|
<span className={styles.authorLogin}>@{profile.login}</span>
|
||||||
|
{profile.bio
|
||||||
|
? <span className={styles.authorBio}>{profile.bio}</span>
|
||||||
|
: <div className={styles.authorBioPlaceholder} />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function AuthorsTiles() {
|
||||||
|
const [active, setActive] = useState(0)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (AUTHORS.length <= 1) return
|
||||||
|
const t = setInterval(() => {
|
||||||
|
setActive(i => (i + 1) % AUTHORS.length)
|
||||||
|
}, 4000)
|
||||||
|
return () => clearInterval(t)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.authors}>
|
||||||
|
<div className={styles.outputLine}>
|
||||||
|
<span className={styles.chevron}>›</span> Authors:
|
||||||
|
</div>
|
||||||
|
<div className={styles.authorRow}>
|
||||||
|
{AUTHORS.map((username, i) => (
|
||||||
|
<AuthorTile
|
||||||
|
key={username}
|
||||||
|
username={username}
|
||||||
|
active={i === active}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function TerminalHeader() {
|
||||||
|
return (
|
||||||
|
<div className={styles.wrap}>
|
||||||
|
<div className={styles.bar}>
|
||||||
|
<div className={styles.dot + ' ' + styles.red} />
|
||||||
|
<div className={styles.dot + ' ' + styles.amber} />
|
||||||
|
<div className={styles.dot + ' ' + styles.green} />
|
||||||
|
<span className={styles.title}>javadoc-index — bash</span>
|
||||||
|
</div>
|
||||||
|
<div className={styles.body}>
|
||||||
|
<h1 className={styles.heading}>
|
||||||
|
{PROJECT_NAME}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className={styles.promptLine}>
|
||||||
|
<span className={styles.prompt}>$</span>
|
||||||
|
<span className={styles.cmd}>browse-docs</span>
|
||||||
|
<span className={styles.arg}>{REPO_NAME}</span>
|
||||||
|
<span className={styles.flag}>--all-versions</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.outputLine}>
|
||||||
|
<span className={styles.chevron}>›</span> Fetching available documentation builds...
|
||||||
|
</div>
|
||||||
|
<div className={styles.outputLine}>
|
||||||
|
<span className={styles.chevron}>›</span> Found project links:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.links}>
|
||||||
|
{LINKS.map(function(l) {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
key={l.tag}
|
||||||
|
href={l.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className={styles.link}
|
||||||
|
>
|
||||||
|
<span className={styles.linkTag} style={{ color: l.color, borderColor: l.color }}>
|
||||||
|
{l.tag}
|
||||||
|
</span>
|
||||||
|
<span className={styles.linkLabel}>{l.label}</span>
|
||||||
|
<span className={styles.linkArrow} style={{ color: l.color }}>↗</span>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AuthorsTiles />
|
||||||
|
|
||||||
|
<div className={styles.promptLine} style={{ marginTop: '16px' }}>
|
||||||
|
<span className={styles.prompt}>$</span>
|
||||||
|
<span className={styles.cursor} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,303 @@
|
|||||||
|
.wrap {
|
||||||
|
margin-bottom: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: var(--bg3);
|
||||||
|
border: 1px solid var(--border2);
|
||||||
|
border-bottom: none;
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
padding: 10px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.red { background: #ff5f57; }
|
||||||
|
.amber { background: #febc2e; }
|
||||||
|
.green { background: #28c840; }
|
||||||
|
|
||||||
|
.title {
|
||||||
|
margin-left: 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
background: var(--bg2);
|
||||||
|
border: 1px solid var(--border2);
|
||||||
|
border-radius: 0 0 8px 8px;
|
||||||
|
padding: 16px 36px 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Heading ── */
|
||||||
|
.heading {
|
||||||
|
font-family: 'IBM Plex Sans', sans-serif;
|
||||||
|
font-size: clamp(28px, 5vw, 52px);
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
color: var(--text);
|
||||||
|
line-height: 1.05;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading strong {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--green);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Prompt ── */
|
||||||
|
.promptLine {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 10px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.prompt { color: var(--green); font-weight: 600; }
|
||||||
|
.cmd { color: var(--text); }
|
||||||
|
.arg { color: var(--blue); }
|
||||||
|
.flag { color: var(--amber); }
|
||||||
|
|
||||||
|
/* ── Output lines ── */
|
||||||
|
.outputLine {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
line-height: 1.8;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chevron {
|
||||||
|
color: var(--text-mid);
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Links ── */
|
||||||
|
.links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
padding-left: 36px;
|
||||||
|
margin-top: 4px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 3px 0;
|
||||||
|
width: fit-content;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link:hover { opacity: 0.8; }
|
||||||
|
|
||||||
|
.link:hover .linkLabel {
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkTag {
|
||||||
|
font-size: 9px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
border: 1px solid;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 1px 5px;
|
||||||
|
min-width: 28px;
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0.9;
|
||||||
|
font-family: 'IBM Plex Mono', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkLabel {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-mid);
|
||||||
|
font-family: 'IBM Plex Mono', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.linkArrow {
|
||||||
|
font-size: 11px;
|
||||||
|
opacity: 0.6;
|
||||||
|
transition: opacity 0.15s, transform 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link:hover .linkArrow {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translate(2px, -2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Authors ── */
|
||||||
|
.authors {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorRow {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 8px;
|
||||||
|
padding-left: 36px;
|
||||||
|
margin-top: 6px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Author tile ── */
|
||||||
|
.authorTile {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
background: var(--bg3);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
|
/* width is dynamic — grows with content */
|
||||||
|
width: max-content;
|
||||||
|
min-width: 140px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: border-color 0.2s, background 0.2s, transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorTile::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0; left: 0; right: 0;
|
||||||
|
height: 2px;
|
||||||
|
background: var(--green);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorTileActive::before,
|
||||||
|
.authorTile:hover::before {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorTileActive {
|
||||||
|
border-color: var(--green-dim);
|
||||||
|
background: rgba(57, 211, 83, 0.04);
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorTile:hover {
|
||||||
|
border-color: var(--border2);
|
||||||
|
background: #161b22;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Author content ── */
|
||||||
|
.authorAvatar {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid var(--border2);
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorAvatarSkeleton {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--border2);
|
||||||
|
flex-shrink: 0;
|
||||||
|
animation: shimmer 1.5s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorInfo {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorName {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
font-family: 'IBM Plex Sans', sans-serif;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorLogin {
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--blue);
|
||||||
|
font-family: 'IBM Plex Mono', monospace;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bio — always reserves vertical height, width animates open */
|
||||||
|
.authorBio {
|
||||||
|
display: block;
|
||||||
|
font-size: 10px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
font-family: 'IBM Plex Sans', sans-serif;
|
||||||
|
margin-top: 2px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* always reserve vertical space */
|
||||||
|
height: 14px;
|
||||||
|
/* collapsed horizontally */
|
||||||
|
width: 0;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.25s ease, width 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorTileActive .authorBio,
|
||||||
|
.authorTile:hover .authorBio {
|
||||||
|
width: 200px;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Placeholder for loading/no-profile/no-bio states */
|
||||||
|
.authorBioPlaceholder {
|
||||||
|
height: 14px;
|
||||||
|
margin-top: 2px;
|
||||||
|
width: 0; /* never takes horizontal space, never expands */
|
||||||
|
}
|
||||||
|
|
||||||
|
.authorSkeleton {
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: var(--border2);
|
||||||
|
animation: shimmer 1.5s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Cursor ── */
|
||||||
|
.cursor {
|
||||||
|
display: inline-block;
|
||||||
|
width: 8px;
|
||||||
|
height: 13px;
|
||||||
|
background: var(--green);
|
||||||
|
margin-left: 2px;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
animation: blink 1s step-end infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Animations ── */
|
||||||
|
@keyframes blink {
|
||||||
|
0%, 100% { opacity: 1; }
|
||||||
|
50% { opacity: 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes shimmer {
|
||||||
|
0%, 100% { opacity: 0.4; }
|
||||||
|
50% { opacity: 0.8; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.body { padding: 20px; }
|
||||||
|
.links { padding-left: 20px; }
|
||||||
|
.authorRow { padding-left: 20px; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// ─── Project Configuration ───────────────────────────────────
|
||||||
|
// This is the ONLY file that should differ between projects.
|
||||||
|
// Everything else in the pages app is generic.
|
||||||
|
// ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
export const PROJECT_NAME = 'CustomNPC+'
|
||||||
|
export const REPO_OWNER = 'KAMKEEL'
|
||||||
|
export const REPO_NAME = 'CustomNPC-Plus'
|
||||||
|
|
||||||
|
export const LINKS = [
|
||||||
|
{
|
||||||
|
tag: 'GH',
|
||||||
|
label: 'github.com/KAMKEEL/CustomNPC-Plus',
|
||||||
|
href: 'https://github.com/KAMKEEL/CustomNPC-Plus',
|
||||||
|
color: '#e6edf3',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: 'DC',
|
||||||
|
label: 'discord.gg/94qmjEDxkp',
|
||||||
|
href: 'https://discord.gg/94qmjEDxkp',
|
||||||
|
color: '#5865f2',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: 'CF',
|
||||||
|
label: 'curseforge.com/minecraft/mc-mods/customnpc-plus',
|
||||||
|
href: 'https://www.curseforge.com/minecraft/mc-mods/customnpc-plus',
|
||||||
|
color: '#f16436',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: 'MR',
|
||||||
|
label: 'modrinth.com/mod/customnpc-plus',
|
||||||
|
href: 'https://modrinth.com/mod/customnpc-plus/',
|
||||||
|
color: '#1bd96a',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// GitHub usernames — profiles are fetched at runtime
|
||||||
|
export const AUTHORS = ['kamkeel', 'c0508383', 'bigguy345', 'somehussar']
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--bg: #080b0f;
|
||||||
|
--bg2: #0d1117;
|
||||||
|
--bg3: #131920;
|
||||||
|
--border: #1e2936;
|
||||||
|
--border2: #253040;
|
||||||
|
--green: #39d353;
|
||||||
|
--green-dim: #1a6b2a;
|
||||||
|
--amber: #f0a030;
|
||||||
|
--amber-dim: #7a4e10;
|
||||||
|
--blue: #58a6ff;
|
||||||
|
--blue-dim: #1a3a6b;
|
||||||
|
--text: #cdd9e5;
|
||||||
|
--text-dim: #636e7b;
|
||||||
|
--text-mid: #8b949e;
|
||||||
|
--red: #f85149;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: 'IBM Plex Mono', monospace;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scanlines */
|
||||||
|
body::after {
|
||||||
|
content: '';
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: repeating-linear-gradient(
|
||||||
|
0deg,
|
||||||
|
transparent,
|
||||||
|
transparent 2px,
|
||||||
|
rgba(0,0,0,0.025) 2px,
|
||||||
|
rgba(0,0,0,0.025) 4px
|
||||||
|
);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
a { color: inherit; text-decoration: none; }
|
||||||
|
|
||||||
|
::-webkit-scrollbar { width: 6px; }
|
||||||
|
::-webkit-scrollbar-track { background: var(--bg2); }
|
||||||
|
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
|
||||||
|
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom/client'
|
||||||
|
import App from './App'
|
||||||
|
import { PROJECT_NAME } from './config'
|
||||||
|
import './index.css'
|
||||||
|
|
||||||
|
document.title = `${PROJECT_NAME} — Javadoc Index`
|
||||||
|
|
||||||
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>
|
||||||
|
)
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import { useState, useEffect } from 'react'
|
||||||
|
import { REPO_OWNER, REPO_NAME } from './config'
|
||||||
|
|
||||||
|
const BASE_PATH = `/${REPO_NAME}`
|
||||||
|
const API_BASE = `https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}`
|
||||||
|
|
||||||
|
// Cache bust on every page load — appends current timestamp to manifest URL
|
||||||
|
// so the browser never serves a stale manifest.json
|
||||||
|
async function fetchFromManifest() {
|
||||||
|
const bust = `?t=${Date.now()}`
|
||||||
|
const res = await fetch(`${BASE_PATH}/manifest.json${bust}`, {
|
||||||
|
cache: 'no-store', // tells browser not to cache this request at all
|
||||||
|
})
|
||||||
|
if (!res.ok) throw new Error('No manifest')
|
||||||
|
return res.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchFromGitHubAPI() {
|
||||||
|
const refRes = await fetch(`${API_BASE}/git/ref/heads/gh-pages`)
|
||||||
|
if (!refRes.ok) throw new Error('gh-pages branch not found')
|
||||||
|
const refData = await refRes.json()
|
||||||
|
const sha = refData.object.sha
|
||||||
|
|
||||||
|
const treeRes = await fetch(`${API_BASE}/git/trees/${sha}?recursive=1`)
|
||||||
|
if (!treeRes.ok) throw new Error('Could not fetch tree')
|
||||||
|
const treeData = await treeRes.json()
|
||||||
|
|
||||||
|
const commitsRes = await fetch(`${API_BASE}/commits?sha=gh-pages&per_page=100`)
|
||||||
|
const commits = commitsRes.ok ? await commitsRes.json() : []
|
||||||
|
|
||||||
|
const commitMap = {}
|
||||||
|
commits.forEach(c => {
|
||||||
|
const date = c.commit?.committer?.date || c.commit?.author?.date || ''
|
||||||
|
const hash = c.sha?.slice(0, 7) || ''
|
||||||
|
const msg = c.commit?.message || ''
|
||||||
|
const vMatch = msg.match(/releases\/([\d.]+)/)
|
||||||
|
if (vMatch) commitMap[`releases/${vMatch[1]}`] = { date, hash }
|
||||||
|
const eMatch = msg.match(/experimental\/([\w-]+)/)
|
||||||
|
if (eMatch) commitMap[`experimental/${eMatch[1]}`] = { date, hash }
|
||||||
|
})
|
||||||
|
|
||||||
|
const releaseDirs = new Set()
|
||||||
|
const experimentalDirs = new Set()
|
||||||
|
|
||||||
|
treeData.tree.forEach(item => {
|
||||||
|
if (item.type !== 'tree') return
|
||||||
|
const parts = item.path.split('/')
|
||||||
|
if (parts[0] === 'releases' && parts.length === 2) releaseDirs.add(parts[1])
|
||||||
|
if (parts[0] === 'experimental' && parts.length === 2) experimentalDirs.add(parts[1])
|
||||||
|
})
|
||||||
|
|
||||||
|
// Sort releases newest first, mark first as latest
|
||||||
|
const sortedReleases = [...releaseDirs]
|
||||||
|
.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }))
|
||||||
|
|
||||||
|
const releases = sortedReleases.map((v, i) => {
|
||||||
|
const c = commitMap[`releases/${v}`] || {}
|
||||||
|
return {
|
||||||
|
id: v,
|
||||||
|
version: v,
|
||||||
|
path: `releases/${v}`,
|
||||||
|
date: c.date,
|
||||||
|
hash: c.hash,
|
||||||
|
isLatest: i === 0, // newest version is always latest
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const experimental = [...experimentalDirs].sort().map(b => {
|
||||||
|
const c = commitMap[`experimental/${b}`] || {}
|
||||||
|
return { id: b, branch: b, path: `experimental/${b}`, date: c.date, hash: c.hash }
|
||||||
|
})
|
||||||
|
|
||||||
|
return { releases, experimental, source: 'api' }
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useDocs() {
|
||||||
|
const [data, setData] = useState(null)
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
const [error, setError] = useState(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchFromManifest()
|
||||||
|
.then(d => { setData(d); setLoading(false) })
|
||||||
|
.catch(() =>
|
||||||
|
fetchFromGitHubAPI()
|
||||||
|
.then(d => { setData(d); setLoading(false) })
|
||||||
|
.catch(e => { setError(e.message); setLoading(false) })
|
||||||
|
)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return { data, loading, error }
|
||||||
|
}
|
||||||
|
|
||||||
|
export { BASE_PATH, REPO_OWNER, REPO_NAME }
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
import { REPO_NAME } from './src/config.js'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
base: `/${REPO_NAME}/`,
|
||||||
|
build: {
|
||||||
|
outDir: '../../.github/pages-dist',
|
||||||
|
emptyOutDir: true,
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# -----------------------------------------------
|
||||||
|
# doc-config.sh — shared config for javadoc deploy
|
||||||
|
#
|
||||||
|
# Sourced by:
|
||||||
|
# - resolve-doc-path.sh
|
||||||
|
# - javadoc.yml (via sanity-check job)
|
||||||
|
#
|
||||||
|
# ADD WHITELISTED BRANCHES HERE AND NOWHERE ELSE.
|
||||||
|
# main is always handled automatically.
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
MAIN_BRANCH_NAME="master"
|
||||||
|
|
||||||
|
EXPERIMENTAL_WHITELIST=(
|
||||||
|
"dev"
|
||||||
|
# "new-branch"
|
||||||
|
)
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
RELEASES=()
|
||||||
|
EXPERIMENTAL=()
|
||||||
|
|
||||||
|
# Collect releases
|
||||||
|
if [ -d "./releases" ]; then
|
||||||
|
for dir in ./releases/*/; do
|
||||||
|
[ -d "$dir" ] || continue
|
||||||
|
name=$(basename "$dir")
|
||||||
|
RELEASES+=("$name")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect experimental branches
|
||||||
|
if [ -d "./experimental" ]; then
|
||||||
|
for dir in ./experimental/*/; do
|
||||||
|
[ -d "$dir" ] || continue
|
||||||
|
name=$(basename "$dir")
|
||||||
|
EXPERIMENTAL+=("$name")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sort releases in reverse semver order (newest first)
|
||||||
|
if [ ${#RELEASES[@]} -gt 0 ]; then
|
||||||
|
IFS=$'\n' RELEASES=($(sort -rV <<< "${RELEASES[*]}")); unset IFS
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Store source commit metadata for this deploy ───────────────
|
||||||
|
# DEPLOY_PATH, SOURCE_HASH, SOURCE_DATE are passed in as env vars from the workflow
|
||||||
|
if [ -n "$DEPLOY_PATH" ] && [ -n "$SOURCE_HASH" ]; then
|
||||||
|
mkdir -p ".doc-meta"
|
||||||
|
META_KEY="${DEPLOY_PATH//\//_}"
|
||||||
|
cat > ".doc-meta/${META_KEY}.json" << JSON
|
||||||
|
{"hash":"${SOURCE_HASH}","date":"${SOURCE_DATE}"}
|
||||||
|
JSON
|
||||||
|
echo "Stored source metadata for $DEPLOY_PATH → $SOURCE_HASH @ $SOURCE_DATE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Helper: get source commit hash + date for a path ──────────
|
||||||
|
get_commit_info() {
|
||||||
|
local path="$1"
|
||||||
|
|
||||||
|
# If this is the path we just deployed, use the injected source commit
|
||||||
|
if [ "$path" = "$DEPLOY_PATH" ] && [ -n "$SOURCE_HASH" ]; then
|
||||||
|
echo "${SOURCE_HASH} ${SOURCE_DATE}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try reading from stored metadata file (set by previous deploys)
|
||||||
|
local meta=".doc-meta/${path//\//_}.json"
|
||||||
|
if [ -f "$meta" ]; then
|
||||||
|
local hash date
|
||||||
|
hash=$(python3 -c "import json,sys; d=json.load(open('$meta')); print(d.get('hash',''))" 2>/dev/null || grep -o '"hash":"[^"]*"' "$meta" | cut -d'"' -f4)
|
||||||
|
date=$(python3 -c "import json,sys; d=json.load(open('$meta')); print(d.get('date',''))" 2>/dev/null || grep -o '"date":"[^"]*"' "$meta" | cut -d'"' -f4)
|
||||||
|
echo "${hash:-} ${date:-}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Last resort: gh-pages git log (hash will be wrong but better than empty)
|
||||||
|
local hash date
|
||||||
|
hash=$(git log --oneline -1 -- "$path" 2>/dev/null | awk '{print $1}')
|
||||||
|
date=$(git log --format="%cI" -1 -- "$path" 2>/dev/null)
|
||||||
|
echo "${hash:-} ${date:-}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ── Build releases JSON ────────────────────────────────────────
|
||||||
|
RELEASES_JSON="["
|
||||||
|
|
||||||
|
for i in "${!RELEASES[@]}"; do
|
||||||
|
version="${RELEASES[$i]}"
|
||||||
|
read -r HASH DATE <<< "$(get_commit_info "releases/$version")"
|
||||||
|
if [ "$i" -eq 0 ]; then
|
||||||
|
IS_LATEST="true"
|
||||||
|
else
|
||||||
|
IS_LATEST="false"
|
||||||
|
fi
|
||||||
|
RELEASES_JSON+="{\"id\":\"${version}\",\"version\":\"${version}\",\"path\":\"releases/${version}\",\"date\":\"${DATE}\",\"isLatest\":${IS_LATEST}},"
|
||||||
|
done
|
||||||
|
|
||||||
|
RELEASES_JSON="${RELEASES_JSON%,}]"
|
||||||
|
|
||||||
|
# ── Build experimental JSON ────────────────────────────────────
|
||||||
|
EXPERIMENTAL_JSON="["
|
||||||
|
|
||||||
|
for branch in "${EXPERIMENTAL[@]}"; do
|
||||||
|
read -r HASH DATE <<< "$(get_commit_info "experimental/$branch")"
|
||||||
|
EXPERIMENTAL_JSON+="{\"id\":\"${branch}\",\"branch\":\"${branch}\",\"path\":\"experimental/${branch}\",\"hash\":\"${HASH}\",\"date\":\"${DATE}\"},"
|
||||||
|
done
|
||||||
|
|
||||||
|
EXPERIMENTAL_JSON="${EXPERIMENTAL_JSON%,}]"
|
||||||
|
|
||||||
|
# ── Write manifest.json ────────────────────────────────────────
|
||||||
|
cat > manifest.json << JSON
|
||||||
|
{
|
||||||
|
"releases": ${RELEASES_JSON},
|
||||||
|
"experimental": ${EXPERIMENTAL_JSON},
|
||||||
|
"generated": "$(date -u '+%Y-%m-%dT%H:%M:%SZ')",
|
||||||
|
"source": "manifest"
|
||||||
|
}
|
||||||
|
JSON
|
||||||
|
|
||||||
|
echo "manifest.json generated:"
|
||||||
|
cat manifest.json
|
||||||
|
echo ""
|
||||||
|
echo "Done."
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/doc-config.sh"
|
||||||
|
|
||||||
|
BRANCH="${GITHUB_REF#refs/heads/}"
|
||||||
|
SAFE_BRANCH="${BRANCH//\//-}"
|
||||||
|
|
||||||
|
if [ "$BRANCH" = "$MAIN_BRANCH_NAME" ]; then
|
||||||
|
# Version resolution order:
|
||||||
|
# -> check if gradle.properties has a `modVersion` tag. If it does, just grab it.
|
||||||
|
# -> check if it has the `version` tag. Grab it if it does
|
||||||
|
# -> check build.gradle for the version tag.
|
||||||
|
if [ -f "gradle.properties" ] && grep -q "^modVersion=" gradle.properties; then
|
||||||
|
VERSION=$(grep "^modVersion=" gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
|
||||||
|
elif [ -f "gradle.properties" ] && grep -q "^version=" gradle.properties; then
|
||||||
|
VERSION=$(grep "^version=" gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
|
||||||
|
elif [ -f "build.gradle" ]; then
|
||||||
|
VERSION=$(grep "^version" build.gradle | head -1 | sed "s/version\s*=\s*['\"]//;s/['\"].*//;s/\s//g")
|
||||||
|
elif [ -f "build.gradle.kts" ]; then
|
||||||
|
VERSION=$(grep "^version" build.gradle.kts | head -1 | sed "s/version\s*=\s*\"//;s/\".*//;s/\s//g")
|
||||||
|
else
|
||||||
|
echo "Could not find version. Defaulting to 'unknown'."
|
||||||
|
VERSION="unknown"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Resolved version: $VERSION"
|
||||||
|
|
||||||
|
# Only deploy to releases/<version> — isLatest is handled by generate-index.sh
|
||||||
|
echo "path=releases/$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "extra_path=" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
else
|
||||||
|
MATCHED=false
|
||||||
|
for ALLOWED in "${EXPERIMENTAL_WHITELIST[@]}"; do
|
||||||
|
if [ "$BRANCH" = "$ALLOWED" ]; then
|
||||||
|
MATCHED=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$MATCHED" = true ]; then
|
||||||
|
echo "path=experimental/$SAFE_BRANCH" >> $GITHUB_OUTPUT
|
||||||
|
echo "extra_path=" >> $GITHUB_OUTPUT
|
||||||
|
echo "Branch '$BRANCH' is whitelisted, deploying to experimental/$SAFE_BRANCH"
|
||||||
|
else
|
||||||
|
echo "path=" >> $GITHUB_OUTPUT
|
||||||
|
echo "extra_path=" >> $GITHUB_OUTPUT
|
||||||
|
echo "Branch '$BRANCH' is not whitelisted. Skipping deploy."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
name: Build and test
|
name: Build and test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -9,5 +8,139 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
runs-on: ubuntu-24.04
|
||||||
secrets: inherit
|
env:
|
||||||
|
WORKSPACE_TASK: ${{ vars.WORKSPACE_TASK || 'setupCIWorkspace' }}
|
||||||
|
RUN_SERVER_TIMEOUT: ${{ vars.RUN_SERVER_TIMEOUT || 90 }}
|
||||||
|
RUN_SERVER_ENABLED: ${{ vars.RUN_SERVER_ENABLED || 'true' }}
|
||||||
|
steps:
|
||||||
|
- name: Install Ubuntu dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y mesa-utils xvfb x11-xserver-utils
|
||||||
|
|
||||||
|
- name: Checkout mod repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Initialize submodules
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
|
||||||
|
- name: Checkout workflows repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: GTNewHorizons/GTNH-Actions-Workflows
|
||||||
|
path: .gtnh-workflows
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up JDK versions
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: |
|
||||||
|
8
|
||||||
|
17
|
||||||
|
21
|
||||||
|
distribution: 'zulu'
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
with:
|
||||||
|
build-scan-publish: true
|
||||||
|
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
|
||||||
|
build-scan-terms-of-use-agree: "yes"
|
||||||
|
validate-wrappers: true
|
||||||
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: Setup the workspace
|
||||||
|
run: ./gradlew --build-cache --info --stacktrace "${WORKSPACE_TASK}"
|
||||||
|
|
||||||
|
- name: Compile the mod
|
||||||
|
run: ./gradlew --build-cache --info --stacktrace assemble
|
||||||
|
|
||||||
|
- name: Attach compilation artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ github.repository_id }}-build-libs
|
||||||
|
path: build/libs/
|
||||||
|
retention-days: 90
|
||||||
|
|
||||||
|
- name: Run post-build checks
|
||||||
|
id: build_mod
|
||||||
|
run: xvfb-run --server-args="-screen 0 1366x768x24" ./gradlew --build-cache --info --stacktrace build
|
||||||
|
|
||||||
|
- name: Attach gradle reports
|
||||||
|
if: failure() && steps.build_mod.conclusion == 'failure'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
name: ${{ github.repository_id }}-reports
|
||||||
|
path: build/reports/
|
||||||
|
retention-days: 31
|
||||||
|
|
||||||
|
- name: Attempt to make a PR fixing spotless errors
|
||||||
|
if: >-
|
||||||
|
${{ failure() && steps.build_mod.conclusion == 'failure'
|
||||||
|
&& github.event_name == 'pull_request'
|
||||||
|
&& !github.event.pull_request.draft
|
||||||
|
&& github.event.pull_request.head.repo.full_name == github.repository }}
|
||||||
|
run: |
|
||||||
|
git reset --hard
|
||||||
|
git checkout "${PR_BRANCH}"
|
||||||
|
./gradlew --build-cache --info --stacktrace spotlessApply || exit 1
|
||||||
|
git diff --exit-code && exit 1
|
||||||
|
git config user.name "GitHub GTNH Actions"
|
||||||
|
git config user.email "<>"
|
||||||
|
git switch -c "${FIXED_BRANCH}"
|
||||||
|
git commit -am "spotlessApply"
|
||||||
|
git push --force-with-lease origin "${FIXED_BRANCH}"
|
||||||
|
gh pr create \
|
||||||
|
--head "${FIXED_BRANCH}" \
|
||||||
|
--base "${PR_BRANCH}" \
|
||||||
|
--title "Spotless apply for branch ${PR_BRANCH} for #${{ github.event.pull_request.number }}" \
|
||||||
|
--body "Automatic spotless apply to fix formatting errors, applies to PR #${{ github.event.pull_request.number }}" \
|
||||||
|
2>&1 | tee pr-message.log || true
|
||||||
|
gh pr comment "${PR_BRANCH}" -F pr-message.log || true
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_BRANCH: ${{ github.head_ref }}
|
||||||
|
FIXED_BRANCH: ${{ github.head_ref }}-spotless-fixes
|
||||||
|
|
||||||
|
- name: Run server for up to ${{ env.RUN_SERVER_TIMEOUT }} seconds
|
||||||
|
if: ${{ env.RUN_SERVER_ENABLED == 'true' }}
|
||||||
|
run: |
|
||||||
|
mkdir -p run
|
||||||
|
echo "eula=true" > run/eula.txt
|
||||||
|
echo "level-seed=-6202107849386030209\nonline-mode=true\n" > run/server.properties
|
||||||
|
echo "stop" > run/stop.txt
|
||||||
|
timeout "${RUN_SERVER_TIMEOUT}" ./gradlew --build-cache --info --stacktrace runServer 2>&1 < run/stop.txt | tee -a server.log || true
|
||||||
|
|
||||||
|
- name: Test no errors reported during server run
|
||||||
|
if: ${{ env.RUN_SERVER_ENABLED == 'true' }}
|
||||||
|
run: |
|
||||||
|
chmod +x .gtnh-workflows/scripts/test_no_error_reports
|
||||||
|
.gtnh-workflows/scripts/test_no_error_reports
|
||||||
|
|
||||||
|
- name: Test no prerelease dependencies used
|
||||||
|
run: |
|
||||||
|
! grep -P -- "-pre(?!shadow)" dependencies.gradle*
|
||||||
|
|
||||||
|
- name: Make sure asset files are not overoptimized
|
||||||
|
run: |
|
||||||
|
echo "Checking for grayscale asset files which are not supported by the java8 image loader"
|
||||||
|
fail=0
|
||||||
|
set -o pipefail
|
||||||
|
while IFS= read -r -d $'\n' file; do
|
||||||
|
if $(file --brief -- "$file" | grep -q grayscale); then
|
||||||
|
printf "found grayscale image '%s'\n" "$file"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
done < <(gh pr diff --name-only "${PR_NUMBER}" | grep 'src/main/resources/.*\\.png$')
|
||||||
|
|
||||||
|
exit $fail
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ github.event.number }}
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
name: Generate and Deploy Javadoc
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '**'
|
||||||
|
delete:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
force_deploy:
|
||||||
|
description: 'Force redeploy Javadocs without a new commit'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sanity-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
should_deploy: ${{ steps.deploy_check.outputs.should_deploy }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Check for deploy tag
|
||||||
|
id: deploy_check
|
||||||
|
run: |
|
||||||
|
source .github/scripts/doc-config.sh
|
||||||
|
|
||||||
|
BRANCH="${GITHUB_REF#refs/heads/}"
|
||||||
|
|
||||||
|
# Always deploy on manual trigger
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
echo "should_deploy=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Reason: workflow_dispatch"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Main branch: only deploy if commit message contains [deploy-docs]
|
||||||
|
if [ "$BRANCH" = "$MAIN_BRANCH_NAME" ]; then
|
||||||
|
if echo "${{ github.event.head_commit.message }}" | grep -q "\[deploy-docs\]"; then
|
||||||
|
echo "should_deploy=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Reason: master branch with [deploy-docs] tag"
|
||||||
|
else
|
||||||
|
echo "should_deploy=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Reason: master branch without [deploy-docs] tag, skipping"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Experimental branches: only deploy if whitelisted
|
||||||
|
for ALLOWED in "${EXPERIMENTAL_WHITELIST[@]}"; do
|
||||||
|
if [ "$BRANCH" = "$ALLOWED" ]; then
|
||||||
|
echo "should_deploy=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Reason: branch '$BRANCH' is whitelisted"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "should_deploy=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Reason: branch '$BRANCH' is not whitelisted, skipping"
|
||||||
|
|
||||||
|
build-and-deploy-javadoc:
|
||||||
|
needs: sanity-check
|
||||||
|
if: needs.sanity-check.outputs.should_deploy == 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Initialize submodules
|
||||||
|
run: git submodule update --init --recursive
|
||||||
|
|
||||||
|
- name: Setup JDK 8 (compile)
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '8'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Set up JDK 8 (Zulu)
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '8'
|
||||||
|
distribution: 'zulu'
|
||||||
|
- name: Setup JDK 11 (javadoc)
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|
||||||
|
- name: Extract convention plugin version
|
||||||
|
id: convention
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep "id 'com.gtnewhorizons.gtnhsettingsconvention'" settings.gradle settings.gradle.kts 2>/dev/null | grep -o "version '[0-9]\+\.[0-9]\+\.[0-9]\+'" | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Detected convention version: $VERSION"
|
||||||
|
|
||||||
|
- name: Get source commit info
|
||||||
|
id: source_commit
|
||||||
|
run: |
|
||||||
|
echo "hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
echo "date=$(git log -1 --format='%cI')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache Gradle wrapper
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.gradle/wrapper
|
||||||
|
key: gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
|
||||||
|
|
||||||
|
- name: Cache Gradle dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/caches/modules-*
|
||||||
|
~/.gradle/caches/jars-*
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gradle-
|
||||||
|
|
||||||
|
- name: Cache RFG
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
build/rfg
|
||||||
|
build/tmp/.cache/expanded
|
||||||
|
build/tmp/deobfuscateMergedJarToSrg
|
||||||
|
key: ${{ runner.os }}-rfg-convention${{ steps.convention.outputs.version }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-rfg-
|
||||||
|
|
||||||
|
- name: Cache Node modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: .github/pages/node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('.github/pages/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Generate Javadoc
|
||||||
|
run: ./gradlew javadoc
|
||||||
|
|
||||||
|
- name: Get deploy path
|
||||||
|
id: deploy_path
|
||||||
|
run: bash .github/scripts/resolve-doc-path.sh
|
||||||
|
|
||||||
|
- name: Deploy to gh-pages
|
||||||
|
if: steps.deploy_path.outputs.path != ''
|
||||||
|
uses: peaceiris/actions-gh-pages@v4
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./build/docs/javadoc
|
||||||
|
destination_dir: ${{ steps.deploy_path.outputs.path }}
|
||||||
|
keep_files: true
|
||||||
|
|
||||||
|
# Give GitHub a moment to settle after the peaceiris push
|
||||||
|
- name: Wait for gh-pages to settle
|
||||||
|
run: sleep 10
|
||||||
|
|
||||||
|
- name: Checkout gh-pages
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: gh-pages
|
||||||
|
path: gh-pages-index
|
||||||
|
|
||||||
|
- name: Generate manifest
|
||||||
|
run: |
|
||||||
|
cd gh-pages-index
|
||||||
|
SOURCE_HASH="${{ steps.source_commit.outputs.hash }}" \
|
||||||
|
SOURCE_DATE="${{ steps.source_commit.outputs.date }}" \
|
||||||
|
DEPLOY_PATH="${{ steps.deploy_path.outputs.path }}" \
|
||||||
|
bash ../.github/scripts/generate-index.sh
|
||||||
|
|
||||||
|
- name: Install page dependencies
|
||||||
|
run: npm ci --prefix .github/pages
|
||||||
|
|
||||||
|
- name: Build index page
|
||||||
|
run: |
|
||||||
|
mkdir -p .github/pages/public
|
||||||
|
cp gh-pages-index/manifest.json .github/pages/public/manifest.json
|
||||||
|
npm run build --prefix .github/pages
|
||||||
|
|
||||||
|
- name: Deploy index to gh-pages
|
||||||
|
run: |
|
||||||
|
cp -r .github/pages-dist/* gh-pages-index/
|
||||||
|
cd gh-pages-index
|
||||||
|
git config user.name "github-actions"
|
||||||
|
git config user.email "[email protected]"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Regenerate index and manifest [skip ci]" || echo "Unchanged"
|
||||||
|
git push
|
||||||
|
|
||||||
|
cleanup-on-delete:
|
||||||
|
if: github.event_name == 'delete' && github.event.ref_type == 'branch'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout gh-pages
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: 'gh-pages'
|
||||||
|
|
||||||
|
- name: Remove deleted branch docs
|
||||||
|
run: |
|
||||||
|
BRANCH="${{ github.event.ref }}"
|
||||||
|
SAFE="experimental/${BRANCH//\//-}"
|
||||||
|
if [ -d "./$SAFE" ]; then
|
||||||
|
rm -rf "./$SAFE"
|
||||||
|
META_KEY="${SAFE//\//_}"
|
||||||
|
rm -f ".doc-meta/${META_KEY}.json"
|
||||||
|
git config user.name "github-actions"
|
||||||
|
git config user.email "[email protected]"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Remove docs for deleted branch: $BRANCH"
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "No docs found for $SAFE, skipping."
|
||||||
|
fi
|
||||||
+36
@@ -10,6 +10,8 @@
|
|||||||
.project
|
.project
|
||||||
/bin/
|
/bin/
|
||||||
/config/
|
/config/
|
||||||
|
/copilot/
|
||||||
|
/buildSrc/build/
|
||||||
/crash-reports/
|
/crash-reports/
|
||||||
/logs/
|
/logs/
|
||||||
options.txt
|
options.txt
|
||||||
@@ -39,3 +41,37 @@ addon.late.local.gradle.kts
|
|||||||
layout.json
|
layout.json
|
||||||
out
|
out
|
||||||
run
|
run
|
||||||
|
src/main/resources/assets/customnpcs/api
|
||||||
|
df/
|
||||||
|
tmp/
|
||||||
|
src/test
|
||||||
|
node_modules
|
||||||
|
.github/pages-dist
|
||||||
|
/core/build/
|
||||||
|
/platform-api/build/
|
||||||
|
|
||||||
|
# core
|
||||||
|
core/build/
|
||||||
|
core/run/
|
||||||
|
core/bin/
|
||||||
|
|
||||||
|
# platform-api
|
||||||
|
platform-api/build/
|
||||||
|
platform-api/run/
|
||||||
|
platform-api/bin/
|
||||||
|
|
||||||
|
# mc1710
|
||||||
|
mc1710/src/main/resources/mixins.*([!.]).json
|
||||||
|
mc1710/src/main/resources/assets/customnpcs/api
|
||||||
|
mc1710/build/
|
||||||
|
mc1710/run/
|
||||||
|
mc1710/bin/
|
||||||
|
|
||||||
|
# mc1122
|
||||||
|
mc1122/src/main/resources/mixins.*([!.]).json
|
||||||
|
mc1122/src/main/resources/assets/customnpcs/api
|
||||||
|
mc1122/build/
|
||||||
|
mc1122/run/
|
||||||
|
mc1122/bin/
|
||||||
|
|
||||||
|
|
||||||
+5
-2
@@ -1,4 +1,7 @@
|
|||||||
[submodule "src/api"]
|
[submodule "gradle-plugins"]
|
||||||
path = src/api
|
path = gradle-plugins
|
||||||
|
url = https://github.com/bigguy345/dts-gradle-plugin
|
||||||
|
[submodule "mc1710/src/api"]
|
||||||
|
path = mc1710/src/api
|
||||||
url = https://github.com/KAMKEEL/CustomNPC-Plus-API.git
|
url = https://github.com/KAMKEEL/CustomNPC-Plus-API.git
|
||||||
branch = dev
|
branch = dev
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
# AGENTS.md — CustomNPC-Plus
|
||||||
|
|
||||||
|
## ⚠️ AGENT CONTEXT — Read First
|
||||||
|
**All documents below this line are created BY and FOR agents operating on this codebase.**
|
||||||
|
This is the master architecture reference. Before any work:
|
||||||
|
1. Read `.AGENTS/SESSION_MEMORY.md` — strategic vision, roadmap, critical decisions
|
||||||
|
2. Skim `.AGENTS/FORBIDDEN_PRACTICES.md` — architectural guardrails (NEVER violate these)
|
||||||
|
3. Reference `.AGENTS/MC_COUPLING_ANALYSIS.md` — what's MC-dependent, migration priority
|
||||||
|
**If working on multi-version porting**, also read:
|
||||||
|
- `.AGENTS/MULTI_VERSION_RESEARCH.md` — real-world strategies, tools, pitfalls
|
||||||
|
- `.AGENTS/BUILD_SYSTEM.md` — Gradle architecture, version-specific build requirements
|
||||||
|
- `.AGENTS/MIGRATION_ROADMAP.md` — phased migration plan with milestones
|
||||||
|
|
||||||
|
-**IMPORTANT** ALWAYS CHECK OUT `.AGENTS/SESSION_MEMORY.md` WHEN WORKING ON MIGRATING/UPPORTING THIS PROJECT TO LATER MINECRAFT VERSIONS.
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## What This Is
|
||||||
|
Minecraft 1.7.10 Forge mod. NPC customization, AI, quests, abilities, scripting (JS/Java), economy.
|
||||||
|
~2,170 source files. Entry: `CustomNpcs.java` (`@Mod`). Packages: `noppes.npcs.*`, `kamkeel.npcs.*`.
|
||||||
|
|
||||||
|
## Module Structure
|
||||||
|
|
||||||
|
| Module | Path | Purpose | MC Dependencies |
|
||||||
|
|---|---|---|---|
|
||||||
|
| **platform-api** | `platform-api/` | Interfaces only (`PlatformService`, `NBTFactory`, `INBTCompound`) | None |
|
||||||
|
| **core** | `core/` | MC-free game logic: controllers, data classes, enums, utils | None (depends on platform-api) |
|
||||||
|
| **mc1710** (root) | `src/main/java/` | MC 1.7.10 implementations: entities, GUI, packets, wrappers | Full Forge/MC |
|
||||||
|
| **gradle-plugins** | `gradle-plugins/` | TypeScript `.d.ts` generator from Java API sources | Gradle only |
|
||||||
|
| **API** (submodule) | `src/api/java/` | Scripting API interfaces (`IPlayer`, `ICustomNpc`, `IWorld`, etc.) | Git submodule — run `./gradlew updateAPI` |
|
||||||
|
|
||||||
|
**Dependency flow:** `platform-api` ← `core` ← `mc1710 (root src)`
|
||||||
|
|
||||||
|
## Architecture Pattern
|
||||||
|
- **Split-package shadow**: Core class in `core/` + mc1710 version in `src/main/java/` same package. mc1710 shadows core at compile time (adds `implements IFaction`, SyncController calls, MC-specific methods).
|
||||||
|
- **Platform abstraction**: `PlatformServiceHolder.get()` → `PlatformService` impl registered at mod init.
|
||||||
|
- **NBT wrapping**: `NBTTagCompound` → `INBTCompound`, `new NBTTagCompound()` → `NBT.compound()`.
|
||||||
|
- **Entity wrapping**: `EntityPlayer` → `IPlayer` (platform-api), mc1710 provides `PlayerWrapper`.
|
||||||
|
|
||||||
|
## Subsystem Location Map
|
||||||
|
|
||||||
|
| Subsystem | Primary Path(s) | Key Files |
|
||||||
|
|---|---|---|
|
||||||
|
| **NPC Entities** | `src/.../noppes/npcs/entity/` | `EntityNPCInterface.java`, `EntityCustomNpc.java` |
|
||||||
|
| **NPC Data** | `src/.../noppes/npcs/Data*.java` | `DataAI`, `DataDisplay`, `DataStats`, `DataAbilities`, `DataAdvanced` |
|
||||||
|
| **AI System** | `src/.../noppes/npcs/ai/` | 28 AI tasks (`EntityAI*.java`), `CombatHandler`, `pathfinder/`, `selector/`, `target/` |
|
||||||
|
| **Quest System** | `src/.../noppes/npcs/quests/` | `QuestItem`, `QuestKill`, `QuestLocation`, `QuestDialog`, `QuestManual` |
|
||||||
|
| **Quest Controller** | `src/.../noppes/npcs/controllers/` | `QuestController.java`, `PlayerQuestController.java` |
|
||||||
|
| **Dialog System** | `src/.../noppes/npcs/controllers/` | `DialogController.java` + data in `controllers/data/` |
|
||||||
|
| **Faction System** | `core/.../noppes/npcs/controllers/` | `FactionController.java`, `Faction.java` (migrated to core) |
|
||||||
|
| **Ability System** | `src/.../kamkeel/npcs/controllers/` | `AbilityController.java`, `EnergyController.java`, `TelegraphController.java` |
|
||||||
|
| **Ability Entities** | `src/.../kamkeel/npcs/entity/` | `EntityAbility*.java`, `EntityEnergy*.java` (13 entity types) |
|
||||||
|
| **Scripting Engine** | `src/.../noppes/npcs/controllers/` | `ScriptController.java`, `ScriptContainer.java`, `ScriptHookController.java` |
|
||||||
|
| **Scripting Wrappers** | `src/.../noppes/npcs/scripted/` | `ScriptWorld`, `ScriptBlock`, `NpcAPI`, `event/`, `entity/`, `item/`, `gui/` |
|
||||||
|
| **Economy/Auction** | `src/.../noppes/npcs/controllers/` | `AuctionController.java`, `MarketRegistry.java` |
|
||||||
|
| **Roles & Jobs** | `src/.../noppes/npcs/roles/` | `RoleTrader`, `RoleBank`, `RoleFollower`, `JobGuard`, `JobBard`, etc. |
|
||||||
|
| **Profile System** | `src/.../kamkeel/npcs/controllers/` | `ProfileController.java` |
|
||||||
|
| **Animation** | `src/.../noppes/npcs/controllers/` | `AnimationController.java` |
|
||||||
|
| **Commands** | `src/.../kamkeel/npcs/command/` | Hierarchical `/kam` system. `CommandKamkeel.java` is root. |
|
||||||
|
| **Config** | `src/.../noppes/npcs/config/` | `ConfigMain`, `ConfigClient`, `ConfigScript`, `ConfigMarket`, `ConfigEnergy`, etc. |
|
||||||
|
| **Blocks** | `src/.../noppes/npcs/blocks/` | 34 block types + `tiles/` |
|
||||||
|
| **Items** | `src/.../noppes/npcs/items/` | Weapons, linked items, scripted items |
|
||||||
|
| **Networking** | `src/.../kamkeel/npcs/network/` | `PacketHandler.java` + `SyncController.java` |
|
||||||
|
| **Mixins** | `src/.../noppes/npcs/mixin/` | Forge/MC mixins |
|
||||||
|
| **Client** | `src/.../noppes/npcs/client/` + `src/.../kamkeel/npcs/client/` | GUI, rendering, overlays |
|
||||||
|
| **Compat** | `src/.../noppes/npcs/compat/` | Cross-mod compatibility |
|
||||||
|
| **TypeScript Gen** | `gradle-plugins/src/` | Gradle plugin: Java API → `.d.ts` definitions |
|
||||||
|
|
||||||
|
## Core Migration Status
|
||||||
|
- **188 files** abstracted to `core/` + `platform-api/` out of ~1,810 total
|
||||||
|
- Migrated: Faction, Magic, Transport, Tag, GlobalData controllers + 60+ data classes
|
||||||
|
- See `SESSION_MEMORY.md` for migration roadmap and current strategy
|
||||||
|
|
||||||
|
## NEVER / DO NOT Rules
|
||||||
|
|
||||||
|
1. **NEVER touch script system for migration** — `ScriptHandler`, `ScriptContainer`, all `I*Script*` interfaces, Action framework. Deeply coupled, not yet planned.
|
||||||
|
2. **NEVER touch Ability.java or ability type classes for migration** — 30+ MC imports, deeply coupled to Entity/World/DamageSource.
|
||||||
|
3. **NEVER touch entity classes for migration** — extend MC Entity directly, must stay platform-side.
|
||||||
|
4. **NEVER touch recipe system for migration** — `RecipeCarpentry` extends `ShapedRecipes`, `RecipeController` uses `CraftingManager`.
|
||||||
|
5. **NEVER import MC classes in `core/` or `platform-api/`** — use platform interfaces only.
|
||||||
|
6. **NEVER import wrapper classes in `core/`** — only interfaces from `platform-api/`.
|
||||||
|
7. **Platform interface naming**: Use the existing scripting API names as-is (`IPlayer`, `IEntity`, `IItemStack`, `IWorld`). Do NOT create semantically duplicate interfaces.
|
||||||
|
8. **MC1710 wrapper naming**: `[Thing]Wrapper` — no `MC1710` prefix.
|
||||||
|
9. **Scripting API** (`IPlayer`, `IEntity`, `ICustomNpc`) is being **merged into platform-api** — same package (`noppes.npcs.api.*`), stripped of MC type parameters. The MC-free versions live in `platform-api/`, version-specific extensions live in each version leaf's shadow. See `SESSION_MEMORY.md` Phase 0B/0C for the migration plan.
|
||||||
|
10. **Split-package rule**: When a class exists in both `core/` and `src/main/java/` with same package, mc1710 version shadows core. Never break this contract.
|
||||||
|
|
||||||
|
## Build & Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# First-time setup (pulls API submodule)
|
||||||
|
./gradlew updateAPI
|
||||||
|
|
||||||
|
# Build (includes TypeScript .d.ts generation)
|
||||||
|
./gradlew build
|
||||||
|
|
||||||
|
# Build without mixin embedding
|
||||||
|
./gradlew buildNoMixin
|
||||||
|
|
||||||
|
# Run game
|
||||||
|
./gradlew runClient
|
||||||
|
./gradlew runServer
|
||||||
|
|
||||||
|
# Run without Nashorn scripting engine
|
||||||
|
./gradlew runClientNoNashorn
|
||||||
|
./gradlew runServerNoNashorn
|
||||||
|
|
||||||
|
# Generate TypeScript definitions only
|
||||||
|
./gradlew generateTypeScriptDefinitions
|
||||||
|
|
||||||
|
# IDE setup (IntelliJ)
|
||||||
|
./gradlew genIntellijRuns
|
||||||
|
# Then add args: --tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json
|
||||||
|
```
|
||||||
|
|
||||||
|
**Build system**: GTNH Convention plugin + RetroFuturaGradle. Java 8 target (core/platform-api), Java 8 compile with JDK 8 (mc1710).
|
||||||
|
|
||||||
|
## Convention Summary
|
||||||
|
- Two root packages: `noppes.npcs.*` (original), `kamkeel.npcs.*` (additions)
|
||||||
|
- Controllers are singletons in `controllers/` packages — instantiated at server start
|
||||||
|
- Data classes use NBT serialization (`readNBT`/`writeNBT` pattern with `INBTCompound`)
|
||||||
|
- Commands: hierarchical under `/kam` — each subcommand is a `CommandKamkeelBase` subclass
|
||||||
|
- Script hooks: 154+ events across NPC, Player, Block, Item, Quest, Dialog, Ability, Auction, Animation
|
||||||
|
- Config: separate config classes per domain (`ConfigMain`, `ConfigScript`, `ConfigMarket`, etc.)
|
||||||
|
- Async saves: `CustomNPCsThreader` thread pool for controller persistence
|
||||||
|
- API submodule: `src/api/java/` — must `git submodule update --init --recursive` before build
|
||||||
|
|
||||||
|
## Key Reference Files
|
||||||
|
- `SESSION_MEMORY.md` — **Multi-version porting strategy**, owner's vision, corrected architecture, research synthesis
|
||||||
|
- `MULTI_VERSION_RESEARCH.md` — External research: real multi-version mod repos, build tools, preprocessor details
|
||||||
|
- `MC_COUPLING_ANALYSIS.md` — Quantified MC-dependency breakdown by subsystem (1,424 files analyzed)
|
||||||
|
- `FORBIDDEN_PRACTICES.md` — Anti-patterns, deprecated components, architectural guardrails
|
||||||
|
- `MIGRATION_ROADMAP.md` — Phased migration plan with milestones
|
||||||
|
- `BUILD_SYSTEM.md` — Gradle architecture, version-specific build requirements
|
||||||
|
- `CHANGELOG.md` — Version history
|
||||||
|
- `todo.txt` — Pending tasks
|
||||||
|
- `dts-patches/` — Manual patches applied to generated TypeScript definitions
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
# CustomNPC+ 1.11 Changelog
|
||||||
|
|
||||||
|
## Ability System
|
||||||
|
- Phase-based abilities (Wind-up, Active, Dazed) with configurable cooldowns, targeting, range, interrupts, invulnerability, and magic damage
|
||||||
|
- **Melee:** Slam, Heavy Hit, Cutter
|
||||||
|
- **Energy Projectiles:** Orb, Disc, Beam, Laser Shot with variant system, homing, hit types (Single/Pierce/Multi), size interpolation, explosions
|
||||||
|
- **Barriers:** Dome, Wall, Shield with HP, reflection, damage absorption
|
||||||
|
- **Defensive:** Guard, Counter, Dodge
|
||||||
|
- **Movement:** Charge, Dash, Teleport
|
||||||
|
- **AOE:** Shockwave, Sweeper, Vortex
|
||||||
|
- **Hazards & Traps:** Persistent zones and proximity triggers with visual presets
|
||||||
|
- **Effect:** Healing, buffs, debuffs with target filtering (Allies/Enemies/All)
|
||||||
|
- **Custom Ability:** Blank-slate type with full script hooks and toggle modes
|
||||||
|
- Burst system, chained ability combos with concurrency, telegraph system (6 shapes)
|
||||||
|
- Per-phase animations and sound events
|
||||||
|
- Ability conditions: HP Threshold, Hit Count, Has Item, Quest Completed, Has Effect
|
||||||
|
- 12-slot player ability hotbar with HUD editor
|
||||||
|
- Full scripting API for ability and energy projectile lifecycle events
|
||||||
|
- Ability Extender system for custom hooks
|
||||||
|
- Live preview in editor
|
||||||
|
- Commands: `/kam ability list|types|prebuilts|info|delete|reload|give|remove|giveChain|removeChain|player`
|
||||||
|
|
||||||
|
## Auction House
|
||||||
|
- Global marketplace with bidding, buyout, and snipe protection
|
||||||
|
- Built-in currency system (configurable, profile-persistent, Vault support)
|
||||||
|
- Listing fees, sales tax, minimum prices
|
||||||
|
- My Trades panel with claim management (20-day expiry)
|
||||||
|
- Search/sort, notifications (online + offline summary)
|
||||||
|
- Trade slots (default 8, expandable via permissions)
|
||||||
|
- Item blacklist (by item, wildcard, mod, NBT; soulbound always blocked)
|
||||||
|
- Auctioneer NPC role
|
||||||
|
- Admin GUI and logging
|
||||||
|
- Cancelable scripting events: Create, Bid, Buyout, Cancel, Claim
|
||||||
|
|
||||||
|
## Script Editor
|
||||||
|
- Full code editor with syntax highlighting, autocomplete, error detection, and hover tooltips
|
||||||
|
- Go to Line, Search/Replace, Go to Definition, Fullscreen
|
||||||
|
- Undo/Redo, Duplicate Line, Comment Toggle, Rename, Move Lines
|
||||||
|
- Line numbers, smooth scrolling, indent guides, brace matching, smart brackets
|
||||||
|
|
||||||
|
## Java Scripting
|
||||||
|
- Write scripts in Java via Janino compiler with automatic hook resolution
|
||||||
|
- Per-tab language selector (mix Java and JavaScript)
|
||||||
|
- External `.java` file support
|
||||||
|
|
||||||
|
## Client-Side Scripting
|
||||||
|
- Server-controlled client script execution with auto-sync (off by default)
|
||||||
|
|
||||||
|
## Addon API Support
|
||||||
|
- Ship `.d.ts` type definitions for automatic script editor autocomplete
|
||||||
|
- Patch support for extending CNPC+ types, hot reload
|
||||||
|
|
||||||
|
## Traders
|
||||||
|
- Stock system: Global or Per-Player modes with configurable restock timers
|
||||||
|
- Currency trades (items + coins)
|
||||||
|
- Client-side balance preview
|
||||||
|
|
||||||
|
## Cloner
|
||||||
|
- Folder and subfolder organization for all categories
|
||||||
|
- Full-width directory browser, improved tabs, tag-based filtering
|
||||||
|
|
||||||
|
## Animations
|
||||||
|
- Data store for passing data across events/frames
|
||||||
|
- Consumer-based task system
|
||||||
|
- Expanded scripting API
|
||||||
|
|
||||||
|
## Animated Textures
|
||||||
|
- Frame-based animation for items, effect icons, ability hotbar, scripted GUIs
|
||||||
|
|
||||||
|
## NPC API
|
||||||
|
- `IHitboxData` (width/height scaling), `ITintData` (hurt tint, persistent tints)
|
||||||
|
- Scriptable behavior: sprint, swim, doors, fire reactions, tactical chance, walking range
|
||||||
|
- `ISound` (volume, pitch, repeat, position)
|
||||||
|
- Skin overlay `getColor()`/`setColor()`, knockback API
|
||||||
|
- Six overlays in singleplayer, script error reporting to console
|
||||||
|
|
||||||
|
## NPC Combat & Behavior
|
||||||
|
- Attack speed enforcement, passive faction protection
|
||||||
|
- Improved track speed, invalid texture fallback
|
||||||
|
|
||||||
|
## Other Changes
|
||||||
|
- Player Dialog Events match NPC Dialog Events
|
||||||
|
- Linked Item attack speed and scripting API
|
||||||
|
- Right-click cycling on multi-option buttons
|
||||||
|
- Legacy quest import (1.6.4), fullscreen/pannable GUIs, unified menu background
|
||||||
|
- Textfield CTRL shortcuts, `java.lang.reflect` banned in scripts
|
||||||
|
- Entity packet loss fix (invisible NPCs)
|
||||||
|
- Natural spawn GUI, runtime control, and despawn improvements
|
||||||
|
|
||||||
|
## Bug Fixes
|
||||||
|
- Script config sync, Bukkit integration
|
||||||
|
- Quest cooldown for MC/RL Custom timers, quest/dialog saving and categories
|
||||||
|
- Bard music restart on dialog open
|
||||||
|
- Spawner yaw, biome spawn persistence, NPC invisibility
|
||||||
|
- Track speed, set speed edge cases, spawn data, block waypoints, job spawner
|
||||||
|
- Hitbox scaling and collision
|
||||||
|
- Animation offsets, lookup failures, syncing, resync on teleport, registration names, double loading
|
||||||
|
- Mount movement jitter, dismount edge cases
|
||||||
Binary file not shown.
@@ -1,86 +1,432 @@
|
|||||||
|

|
||||||
|
|
||||||
## 👋 Welcome to the CustomNPC+ Repository.
|
# CustomNPC+
|
||||||

|
|
||||||
|
|
||||||
> CustomNPC+ is a [Minecraft](https://minecraft.net/) mod that allows you to add custom NPCs to your world. It is developed for creative and storytelling players who want to make their Minecraft worlds more in-depth and unique. CustomNPC+ is only a branch version of the **1.7.10** Forge version of the original (down below) and has no plans to add or update any other version. This is not an official version of CustomNPC.
|
**CustomNPC+** is a Minecraft 1.7.10 Forge mod that lets you create fully customizable NPCs with advanced AI, combat abilities, quests, dialogs, scripting, an economy system, and much more. Built for creative and storytelling players who want to transform their worlds into living RPG experiences.
|
||||||
|
|
||||||
----------------
|
> CustomNPC+ is a branch version of the original [CustomNPC](https://www.curseforge.com/minecraft/mc-mods/custom-npcs) by [Noppes](https://github.com/Noppes), developed with permission. This is not an official version of CustomNPC.
|
||||||
|
|
||||||
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="https://img.shields.io/badge/KAMKEEL_Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white" width="400" height="60"> </a>
|
---
|
||||||
<a href="https://ko-fi.com/kamkeel"> <img src="https://img.shields.io/badge/Support_Me_|_Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white" alt="Support Me" width="400" height="60"> </a>
|
|
||||||
|
<a href="https://discord.gg/pQqRTvFeJ5"> <img src="images/Discord.png" width="400" height="60"> </a>
|
||||||
|
|
||||||
[](https://modrinth.com/mod/customnpc-plus)
|
[](https://modrinth.com/mod/customnpc-plus)
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
||||||
[](https://github.com/KAMKEEL/Plugin-Mod)
|
[](https://github.com/KAMKEEL/Plugin-Mod)
|
||||||
|
|
||||||
----------------
|
---
|
||||||
|
|
||||||
### ❗ Notice
|
## Installation
|
||||||
I am not the original creator of CustomNPC. The original creator is @[Noppes](https://github.com/Noppes). I have been permitted to update and develop my own branch version for 1.7.10. The original mod that is updated to the latest versions of Minecraft can be found on these links: [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs), [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs)
|
|
||||||
|
|
||||||
### ⬇️ Downloads
|
CustomNPC+ is a **replacement** for the original CustomNPC — not an add-on. Do not install both together. Simply drop CustomNPC+ into your client or server mods folder. All original CustomNPC features are preserved and expanded upon.
|
||||||
|
|
||||||
|
> Please **backup your world** before installing. Report any bugs on the [issue tracker](https://github.com/KAMKEEL/CustomNPC-Plus/issues).
|
||||||
|
|
||||||
|
### Downloads
|
||||||
|
|
||||||
- **Modrinth**: [Download](https://modrinth.com/mod/customnpc-plus)
|
- **Modrinth**: [Download](https://modrinth.com/mod/customnpc-plus)
|
||||||
- **CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
- **CurseForge**: [Download](https://www.curseforge.com/minecraft/mc-mods/customnpc-plus)
|
||||||
|
|
||||||
### 🔹 Installation
|
---
|
||||||
This mod is an ***update*** to CustomNPC and not an add-on. Do not install CustomNPC with CustomNPC-Plus. CustomNPC-Plus does not remove any functional features from the original mod. It expands upon CustomNPC with original features and backported features from newer versions. Simply drag CustomNPC-Plus into any client/server mods folder to utilize. Please **backup** before using as this could still have unforeseen errors. Report any bugs if found, thank you and enjoy.
|
|
||||||
|
|
||||||
### ❓ Features:
|
<a href="https://ko-fi.com/kamkeel"> <img src="images/Kofi.png" width="400" height="60"> </a>
|
||||||
- Flying NPC (Smart Pathfinding)
|
|
||||||
- 1.8 Skin Support (64x64) (Alex/Steve64)
|
|
||||||
- Full URL64 Selector (Downloads FULL Size Images for Custom Mob Skins)
|
|
||||||
- Additional Parts: [Wings, Fins, Capes, Horns, Tail]
|
|
||||||
- Hide Body Parts [Arms, Legs, Head, Body]
|
|
||||||
- Custom Overlays
|
|
||||||
- Animation Maker
|
|
||||||
- Enhanced Cloner GUI (More Tabs, Filters, Tags)
|
|
||||||
- Markov Name Generator
|
|
||||||
- Dark Mode GUI (Link Below)
|
|
||||||
- 1.12 Scripting Features (Details below)
|
|
||||||
|
|
||||||
#### Scripting:
|
> More betas with new features will continue to be released to supporters for **Early Access** to new content!
|
||||||
- CustomNPC+ Api: [API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
|
|
||||||
- Java Doc: [kamkeel.github.io/CustomNPC-Plus](https://kamkeel.github.io/CustomNPC-Plus/)
|
|
||||||
- Scripted Items
|
|
||||||
- Player Overlays
|
|
||||||
- Script Timers
|
|
||||||
- Global Scripts
|
|
||||||
- Script Logging
|
|
||||||
- GUI Overlays
|
|
||||||
- Event Scripting
|
|
||||||
(We never remove script functionality, only add on existing functions)
|
|
||||||
|
|
||||||
## 🔰 Skin Model Feature:
|
---
|
||||||
###### **Majority of these cape designs are taken from the internet with fair-usage.*
|
|
||||||
##### ❔ Please note all *local* skins in this version of CustomNPC, must match the model selected.
|
## Feature Overview
|
||||||
<img src="images/skinAnimation.gif" width="474" height="260"/>
|
|
||||||
|
### NPC Creation & Customization
|
||||||
|
|
||||||
|
Create NPCs with deep visual customization and lifelike behavior.
|
||||||
|
|
||||||
|
<img src="images/NPCEditor.gif" width="474" height="260"/>
|
||||||
|
|
||||||
|
- **Skin System** - 1.8 skin support (64x64), Alex & Steve64 models, full URL64 selector that downloads full-size images for custom skins
|
||||||
|
- **Body Parts** - Wings, fins, capes, horns, tails. Hide individual body parts (arms, legs, head, body)
|
||||||
|
- **Skin Overlays** - Layer additional textures on top of the base skin with color tinting and alpha control
|
||||||
|
- **Custom Models** - Support for custom model formats, plus Gecko and DBC addon model integration
|
||||||
|
- **Hitbox Scaling** - Independently scale NPC hitbox width and height
|
||||||
|
- **Tint System** - Control hurt flash color and apply persistent color tints
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### NPC AI & Behavior
|
||||||
|
|
||||||
|
NPCs have a full AI system for combat, pathing, and interaction.
|
||||||
|
|
||||||
|
- **Flying NPCs** - Smart pathfinding in 3D space for flying entities
|
||||||
|
- **Combat AI** - Multiple tactical behaviors: attack, ranged attack, ambush, pounce, dodge-shoot, zigzag, stalk, orbit, sprint-to-target, and leap attacks
|
||||||
|
- **Movement Types** - Standing, wandering, and moving path modes
|
||||||
|
- **Pathfinding** - Ground, flying, and water navigation
|
||||||
|
- **Door Interaction** - NPCs can break, open, or ignore doors
|
||||||
|
- **Behavior Controls** - Configurable sprinting, swimming, fire reactions, tactical chance, and walking range
|
||||||
|
- **Attack Speed** - NPCs respect attack speed timing when dealing damage
|
||||||
|
- **Faction Awareness** - NPCs respond to faction standings. Passive faction NPCs are protected from damage
|
||||||
|
|
||||||
#### Flying NPCs:
|
|
||||||
<img src="images/FlyingNPC.gif" width="474" height="260"/>
|
<img src="images/FlyingNPC.gif" width="474" height="260"/>
|
||||||
|
|
||||||
#### Url64:
|
---
|
||||||
<img src="images/Url64Example.gif" width="474" height="260"/>
|
|
||||||
|
|
||||||
#### DarkMode + Cloner GUI:
|
### NPC Roles & Jobs
|
||||||
<img src="images/ClonerGUI-DarkMode.png" width="474" height="260"/>
|
|
||||||
|
|
||||||
## 🔗 Want to check out my other projects?
|
**Roles** give NPCs interactive functions — Trader, Follower, Bank, Transporter, Postman, Companion, Mount, and Auctioneer. **Jobs** give NPCs background tasks — Bard, Healer, Guard, Item Giver, Follower, Spawner, Conversation, and Chunk Loader.
|
||||||
[Plugin Mod](https://github.com/KAMKEEL/Plugin-Mod) is a mod designed to add more aesthetic items for RPG and storytelling. It is compatible with CustomNPC+ and has many items intended to be used and wielded by created NPCs.
|
|
||||||
|
|
||||||
[RPG Messenger](https://github.com/KAMKEEL/RPGMessenger) is a bukkit plugin designed to allow operators to create messagable NPCs for RPG Servers. Allows a 'RPG Controller' to reply quickly as NPCs, form groupchats, and messagable parties.
|
---
|
||||||
|
|
||||||
[CustomNPC+ Dark Mode](https://github.com/KAMKEEL/CustomNPC-Plus-Dark-Mode) is a resource pack for CustomNPC+ that alters all GUIs within the mod to a dark variant that is both clean and pleasing to look at.
|
### Dialog System
|
||||||
|
|
||||||
## Cloning / Compiling / Building
|
Create branching dialog trees for storytelling and player interaction.
|
||||||
|
|
||||||
git clone call `git submodule update --init --recursive`
|
<img src="images/Dialog.png" width="474" height="260"/>
|
||||||
|
|
||||||
Using IntelliJ, take the following steps:
|
- **Dialog Trees** - Multi-level branching conversations with unlimited depth
|
||||||
1. Run `setupDecompWorkspace` under the `forgegradle` tab.
|
- **Dialog Options** - Player choices that affect outcomes, trigger quests, or change faction standings
|
||||||
2. Refresh Gradle.
|
- **Dialog Images** - Display images alongside dialog text
|
||||||
3. Run `genIntellijRuns` under the `other` tab to set up your Minecraft runs.
|
- **Dialog Colors** - Customizable text and background colors
|
||||||
|
- **Categories** - Organize dialogs into categories for large projects
|
||||||
|
- **Availability Conditions** - Show or hide dialogs based on quests, factions, items, or custom conditions
|
||||||
|
- **Script Hooks** - Full scripting support for dialog open, close, and option events
|
||||||
|
|
||||||
or for Eclipse, run `gradlew setupDecompWorkspace eclipse` then import the project.
|
---
|
||||||
|
|
||||||
Mixin code will not work if you do not add `--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json` to your program arguments.
|
### Quest System
|
||||||
|
|
||||||
|
A complete quest framework for RPG progression.
|
||||||
|
|
||||||
|
<img src="images/QuestMarks.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
- **Quest Types** - Item collection, dialog completion, kill targets, reach locations, area kills, and fully manual (script-driven) quests
|
||||||
|
- **Quest Tracking** - On-screen HUD overlay showing active quest objectives
|
||||||
|
- **Categories** - Organize quests into categories
|
||||||
|
- **Rewards** - Configure item, XP, and currency rewards
|
||||||
|
- **Cooldowns** - Repeatable quests with MC time, real-time, or custom cooldown intervals
|
||||||
|
- **Party Quests** - Share quest objectives across party members with configurable sharing modes
|
||||||
|
- **Availability** - Control quest visibility based on completed quests, faction standing, dialogs, and more
|
||||||
|
- **Script Hooks** - Events for quest start, completion, turn-in, and custom quest objectives
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Ability System
|
||||||
|
|
||||||
|
A full combat ability system for both NPCs and players.
|
||||||
|
|
||||||
|
<img src="images/NPCAbilities.gif" width="474" height="260"/>
|
||||||
|
<img src="images/PlayerAbilities.gif" width="474" height="260"/>
|
||||||
|
|
||||||
|
**Melee Abilities** - Slam, Heavy Hit, Cutter
|
||||||
|
**Energy Projectiles** - Orbs, Discs, Beams, Laser Shots with full visual customization, homing, and hit types
|
||||||
|
**Energy Barriers** - Domes, Walls, Shields with HP, reflection, and damage absorption
|
||||||
|
**Defensive** - Guard, Counter, Dodge with configurable damage reduction and counter-attacks
|
||||||
|
**Movement** - Charge, Dash, Teleport
|
||||||
|
**AOE** - Shockwave, Sweeper, Vortex
|
||||||
|
**Hazards & Traps** - Persistent damage zones and proximity-triggered traps with visual presets
|
||||||
|
**Support** - Ability Effect for healing, buffs, and debuffs
|
||||||
|
|
||||||
|
**Key Features:**
|
||||||
|
- Phase-based execution (Wind-up, Active, Dazed) with visual telegraphs
|
||||||
|
- Burst system for rapid multi-fire
|
||||||
|
- Chained abilities for sequential combos
|
||||||
|
- Player ability hotbar (12 slots) with unlock system
|
||||||
|
- Full scripting API for every lifecycle event
|
||||||
|
- Live preview in the ability editor
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Auction House & Economy
|
||||||
|
|
||||||
|
A complete marketplace and economy system.
|
||||||
|
|
||||||
|
<img src="images/Auction.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
- **Built-in Currency** - Configurable currency with starting balance, max cap, and Vault plugin integration
|
||||||
|
- **Auction House** - Global player marketplace with bidding, buyout, snipe protection, and notifications
|
||||||
|
- **Trade Slots** - Configurable per-player slot limits via permissions
|
||||||
|
- **Item Blacklist** - Block items by name, wildcard, mod, or NBT tag from being listed
|
||||||
|
- **Admin Tools** - Dedicated admin GUI for managing listings and creating server auctions
|
||||||
|
- **Scripting API** - Cancelable events for creates, bids, buyouts, cancels, and claims
|
||||||
|
|
||||||
|
**Trader Enhancements:**
|
||||||
|
- Limited stock with automatic restocking (MC time, real-time, or custom intervals)
|
||||||
|
- Global or per-player stock modes
|
||||||
|
- Currency costs on top of item trades
|
||||||
|
- Client-side balance preview
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Script Editor
|
||||||
|
|
||||||
|
A full-featured code editor built right into Minecraft.
|
||||||
|
|
||||||
|
<img src="images/ScriptEditor.gif" width="474" height="260"/>
|
||||||
|
|
||||||
|
- **Syntax Highlighting** - Color-coded keywords, types, variables, methods, strings, and comments
|
||||||
|
- **Autocomplete** - Smart suggestions with type awareness, static vs instance context, and auto-imports
|
||||||
|
- **Error Detection** - Real-time underlining of wrong argument types, missing methods, type mismatches, and unused imports
|
||||||
|
- **Hover Info** - Full type information, documentation, and JSDoc rendering on hover
|
||||||
|
- **Navigation** - Go to line, search & replace, go to definition, and fullscreen mode
|
||||||
|
- **Editing** - Smart undo/redo, duplicate lines, comment toggle, rename refactoring, smart bracket pairing
|
||||||
|
- **Visual** - Line numbers, smooth scrolling, indent guides, brace matching, resizable panels
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Scripting
|
||||||
|
|
||||||
|
Write scripts in **JavaScript** or **Java** to control every aspect of the mod.
|
||||||
|
|
||||||
|
- **Java Scripting** - Write real Java code compiled by the Janino engine. Full support for classes, generics, lambdas, and method references
|
||||||
|
- **JavaScript** - Full Nashorn-based JavaScript with ECMAScript 5.1 globals (Math, JSON, Date, Number)
|
||||||
|
- **Client-Side Scripting** - Run scripts on the client for responsive visual experiences (server-controlled)
|
||||||
|
- **154+ Script Hooks** - Events for NPCs, players, blocks, items, quests, dialogs, factions, abilities, auction, animations, and more
|
||||||
|
- **Script Types** - NPC, Player, Global, Block, Item, Linked Item, Effect, Ability, Recipe, and Forge Event scripts
|
||||||
|
- **Scripted Blocks** - Blocks with full script hooks for click, redstone, neighbor changes, and more
|
||||||
|
- **Scripted Items** - Items with use, attack, toss, pickup, and durability hooks
|
||||||
|
- **Custom GUIs** - Build custom interfaces with buttons, text fields, scroll panels, and slots via scripting
|
||||||
|
- **GUI Overlays** - Persistent on-screen overlays with labels, lines, and textured rectangles
|
||||||
|
- **Addon API** - Mods can ship `.d.ts` type definitions for full autocomplete in the editor
|
||||||
|
|
||||||
|
**Resources:**
|
||||||
|
- API Repository: [CustomNPC+ API](https://github.com/KAMKEEL/CustomNPC-Plus-API)
|
||||||
|
- Java Docs: [kamkeel.github.io/CustomNPC-Plus](https://kamkeel.github.io/CustomNPC-Plus/)
|
||||||
|
|
||||||
|
<img src="images/ScriptedBlock.png" width="474" height="260"/>
|
||||||
|
<img src="images/ScriptedParticle.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Animation System
|
||||||
|
|
||||||
|
Create custom animations for NPCs directly in-game.
|
||||||
|
|
||||||
|
- **Animation Maker** - Visual editor for creating frame-based animations
|
||||||
|
- **Animation Parts** - Animate individual body parts with rotation, position, and scaling
|
||||||
|
- **Frame Events** - Script hooks for animation start, end, frame enter, and frame exit
|
||||||
|
- **Data Store** - Animations can store and pass data across events and frames
|
||||||
|
- **Task System** - Consumer-based callbacks for animation lifecycle
|
||||||
|
- **Built-in Animations** - Pre-made animations for abilities that work automatically
|
||||||
|
- **Multiple Registrations** - Register multiple animations under one common name
|
||||||
|
- **Animated Textures** - Frame-based animated textures for items, effects, and ability icons
|
||||||
|
|
||||||
|
<img src="images/AnimationMaker.gif" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Custom Effects
|
||||||
|
|
||||||
|
Create custom status effects beyond vanilla potions.
|
||||||
|
|
||||||
|
- **Custom Icons** - Each effect gets its own texture, with support for animated icons
|
||||||
|
- **Script Hooks** - Events for effect apply, tick, and removal
|
||||||
|
- **Ability Integration** - Abilities can apply custom effects to targets
|
||||||
|
- **Condition System** - Check if entities have specific effects for ability or availability conditions
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Profile System
|
||||||
|
|
||||||
|
Multiple character slots on a single account.
|
||||||
|
|
||||||
|
- **Profile Slots** - Each slot stores separate quest progress, dialogs, factions, currency, abilities, and effects
|
||||||
|
- **Region Locking** - Lock profiles to specific areas
|
||||||
|
- **Soulbound Items** - Bind items to a specific player by UUID
|
||||||
|
- **Profile-Slotbound Items** - Bind items to a specific profile slot
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Party System
|
||||||
|
|
||||||
|
Group up with other players for cooperative gameplay.
|
||||||
|
|
||||||
|
- **Party Management** - Invite, kick, leave, disband, and transfer leadership
|
||||||
|
- **Quest Sharing** - Share quest objectives across party members
|
||||||
|
- **Ability Integration** - Party members are treated as allies for AOE ability targeting
|
||||||
|
- **Script Hooks** - Events for invites, kicks, leaves, disbands, and quest completion
|
||||||
|
|
||||||
|
<img src="images/PartySystem.png" width="474" height="260"/>
|
||||||
|
<img src="images/QuestParty.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Faction System
|
||||||
|
|
||||||
|
Create factions to control NPC relationships and player reputation.
|
||||||
|
|
||||||
|
- **Faction Points** - Players earn or lose standing with factions through quests, combat, and scripting
|
||||||
|
- **Availability Conditions** - Gate dialogs, quests, and content behind faction thresholds
|
||||||
|
- **NPC Behavior** - NPCs react to players based on faction standing (friendly, neutral, hostile)
|
||||||
|
- **Passive Factions** - Passive faction NPCs are protected from damage
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### HUD System
|
||||||
|
|
||||||
|
Customizable on-screen elements.
|
||||||
|
|
||||||
|
- **HUD Editor** - Drag and position HUD components to fit your screen
|
||||||
|
- **Ability Hotbar** - 12-slot bar with horizontal/vertical layout and configurable visible slots
|
||||||
|
- **Quest Tracking** - On-screen quest objective tracker
|
||||||
|
- **Compass** - Directional compass with quest and waypoint markers
|
||||||
|
- **Effect Bar** - Display active custom effects
|
||||||
|
|
||||||
|
<img src="images/HudSystem.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Cloner & Organization
|
||||||
|
|
||||||
|
Save, organize, and reuse NPCs and content.
|
||||||
|
|
||||||
|
- **Cloner Tabs** - Save and load NPCs, items, and other content
|
||||||
|
- **Folder System** - Organize with folders and subfolders for animations, abilities, forms, auras, outlines, effects, and linked items
|
||||||
|
- **Quick Tags** - Tag-based filtering for fast searching
|
||||||
|
- **Full Screen Browser** - Wide directory view for large collections
|
||||||
|
|
||||||
|
<img src="images/ClonerTabs.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Items & Blocks
|
||||||
|
|
||||||
|
A large library of custom items and decorative blocks.
|
||||||
|
|
||||||
|
**Weapons:** Battle Axe, Broadsword, Claw, Crossbow, Dagger, Staff, Glaive, Gun, Kunai, Scythe, Spear, Wand, Warhammer, Musket, and more
|
||||||
|
|
||||||
|
**Linked Items:** Create custom items with configurable attack speed, scripted behavior, animated textures, and item versioning
|
||||||
|
|
||||||
|
**Blocks:** Banners, barrels, beams, signs, campfires, candles, chairs, couches, crates, crystals, lanterns, mailboxes, pedestals, redstone blocks, and scripted blocks
|
||||||
|
|
||||||
|
**Crafting:** Carpentry Bench and Anvil with custom recipe support
|
||||||
|
|
||||||
|
<img src="images/VariousWeapons.png" width="474" height="260"/>
|
||||||
|
<img src="images/JappaTextures.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Custom Models
|
||||||
|
|
||||||
|
Support for custom NPC models beyond the default humanoid. Import Blockbench models using the **Gecko Addon** (GeckoLib integration) or use **Armorer's Workshop** skins with the AW Addon.
|
||||||
|
|
||||||
|
<img src="images/GeckoAddon1.png" width="474" height="260"/>
|
||||||
|
<img src="images/GeckoAddon2.png" width="474" height="260"/>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Addon Compatibility
|
||||||
|
|
||||||
|
CustomNPC+ has official addons that extend its functionality with other mods. Vault and Pixelmon are also supported natively for economy and scripting integration.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Official CNPC+ Addons
|
||||||
|
|
||||||
|
### DBC Addon
|
||||||
|
|
||||||
|
Adds full compatibility between [Dragon Block C](https://www.curseforge.com/minecraft/mc-mods/dragon-block-c) and CustomNPC+. Extends abilities with ki-based attacks, adds DBC stat integration to conditions, and enables DBC model/animation support on NPCs.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/cnpc-dbc-addon)
|
||||||
|
[](https://modrinth.com/mod/customnpc-plus-dbc-addon)
|
||||||
|
[](https://github.com/KAMKEEL/CustomNPC-DBC-Addon)
|
||||||
|
|
||||||
|
### Gecko Addon
|
||||||
|
|
||||||
|
Adds [GeckoLib](https://www.curseforge.com/minecraft/mc-mods/geckolib) support to CustomNPC+. Import Blockbench models directly into the mod and use them as custom NPC models with full animation support.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/cnpc-custom-model-addon)
|
||||||
|
[](https://modrinth.com/mod/customnpc-plus-gecko-addon)
|
||||||
|
[](https://github.com/KAMKEEL/CustomNPC-Gecko-Addon)
|
||||||
|
|
||||||
|
### Armorer's Workshop Addon
|
||||||
|
|
||||||
|
Adds compatibility between [Armorer's Workshop](https://www.curseforge.com/minecraft/mc-mods/armorers-workshop) and CustomNPC+. Use Armorer's Workshop skins and equipment on NPCs with custom rotation, scaling, and animation support. Requires UniMixins.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/cnpc-armorers-workshop-addon)
|
||||||
|
[](https://modrinth.com/mod/customnpc-plus-aw-addon)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Other Projects
|
||||||
|
|
||||||
|
### MorePlayerModels+
|
||||||
|
|
||||||
|
An updated continuation of MorePlayerModels for 1.7.10 with backported GUIs, original parts and customizations, and permission support. Works alongside CustomNPC+. This is a replacement — do not install alongside the original MorePlayerModels.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/moreplayermodels-plus)
|
||||||
|
[](https://modrinth.com/mod/moreplayermodels+)
|
||||||
|
[](https://github.com/KAMKEEL/MorePlayerModels-Plus)
|
||||||
|
|
||||||
|
### The Plugin Mod
|
||||||
|
|
||||||
|
Adds aesthetic weapons, artifacts, blocks, and apples for RPG and storytelling servers. Designed to pair with CustomNPC+ — use the included swords, spears, axes, medpacks, and decorative blocks to make your NPCs and worlds more diverse.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/the-plugin-mod)
|
||||||
|
[](https://modrinth.com/mod/the-plugin-mod)
|
||||||
|
[](https://github.com/KAMKEEL/Plugin-Mod)
|
||||||
|
|
||||||
|
### HexText
|
||||||
|
|
||||||
|
Upgrades Minecraft's font renderer with full RGB hex color support, nested color spans, and animated text effects (glow, shake, wave). Works in signs, anvils, and chat. Requires UniMixins.
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/hex-text)
|
||||||
|
[](https://modrinth.com/mod/hex-text)
|
||||||
|
[](https://github.com/KAMKEEL/HexText)
|
||||||
|
|
||||||
|
### RPG Messenger
|
||||||
|
|
||||||
|
A Bukkit plugin for messageable NPCs, group chats, and RPG controller tools. Allows operators to create NPCs that players can message, and lets RPG controllers reply as NPCs in real-time.
|
||||||
|
|
||||||
|
[](https://github.com/KAMKEEL/RPGMessenger)
|
||||||
|
|
||||||
|
### CustomNPC+ Dark Mode
|
||||||
|
|
||||||
|
A resource pack that applies a clean dark theme to all CustomNPC+ GUIs.
|
||||||
|
|
||||||
|
[](https://github.com/KAMKEEL/CustomNPC-Plus-Dark-Mode)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
CustomNPC+ has a modular configuration system:
|
||||||
|
|
||||||
|
| Config | Purpose |
|
||||||
|
|--------|---------|
|
||||||
|
| **Main** | Core mod settings |
|
||||||
|
| **Client** | Client-side display and UI preferences |
|
||||||
|
| **Script** | Scripting engine settings and client script toggle |
|
||||||
|
| **Market** | Currency, auction house, trader, and economy settings |
|
||||||
|
| **Energy** | Energy projectile settings (explosion block damage, dome item blacklist) |
|
||||||
|
| **Item** | Item and gun configuration |
|
||||||
|
| **Debug** | Debug logging and diagnostics |
|
||||||
|
| **Experimental** | Experimental features toggle |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Building from Source
|
||||||
|
|
||||||
|
This project uses the [GTNH Gradle Convention](https://github.com/GTNewHorizons/ExampleMod1.7.10) build system with [RetroFuturaGradle](https://github.com/GTNewHorizons/RetroFuturaGradle).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <repo-url>
|
||||||
|
git submodule update --init --recursive
|
||||||
|
./gradlew build
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it. Submodules pull in the API sources, and `build` handles decompilation, compilation, and mixin embedding automatically.
|
||||||
|
|
||||||
|
**Run the game:**
|
||||||
|
```bash
|
||||||
|
./gradlew runClient # Launch client
|
||||||
|
./gradlew runServer # Launch server
|
||||||
|
```
|
||||||
|
|
||||||
|
**IDE Setup (IntelliJ):**
|
||||||
|
1. Import the project as a Gradle project
|
||||||
|
2. Run `./gradlew genIntellijRuns`
|
||||||
|
3. Add program arguments: `--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Notice
|
||||||
|
|
||||||
|
I am not the original creator of CustomNPC. The original creator is [Noppes](https://github.com/Noppes). I have been permitted to update and develop my own branch version for 1.7.10. The original mod updated to the latest Minecraft versions can be found on [CurseForge](https://www.curseforge.com/minecraft/mc-mods/custom-npcs) and [kodevelopment](http://www.kodevelopment.nl/minecraft/customnpcs).
|
||||||
+12
-37
@@ -1,40 +1,15 @@
|
|||||||
//version: 1707058017
|
// CustomNPC-Plus — Root Project (Multi-Version Aggregator)
|
||||||
|
// Plain Gradle project that aggregates submodules.
|
||||||
|
// Each submodule (mc1710, mc1122, etc.) handles its own configuration.
|
||||||
|
|
||||||
plugins {
|
// IntelliJ IDEA triggers 'processIdeaSettings' on the root project during Gradle sync.
|
||||||
id 'com.gtnewhorizons.gtnhconvention'
|
// The GTNH convention plugin only registers this task on subprojects that apply it,
|
||||||
id 'idea'
|
// so we register a no-op task here to prevent "task not found" errors.
|
||||||
|
tasks.register('processIdeaSettings') {
|
||||||
|
group = 'ide'
|
||||||
|
description = 'No-op task for IntelliJ IDEA Gradle sync compatibility'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "1.10.1"
|
// IDEA plugin at root level is required for GTNH convention's IdeIntegrationModule
|
||||||
group= "kamkeel.customnpc-plus"
|
// which references rootProject.idea extension from subprojects.
|
||||||
archivesBaseName = "CustomNPC-Plus"
|
apply plugin: 'idea'
|
||||||
|
|
||||||
def embedMixin = !project.hasProperty("nomixin");
|
|
||||||
if(!embedMixin){
|
|
||||||
version += "-nomixin"
|
|
||||||
}
|
|
||||||
|
|
||||||
// API Task
|
|
||||||
tasks.create('updateAPI', Exec) {
|
|
||||||
description 'Updates (and Inits) git submodules'
|
|
||||||
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
|
||||||
group 'CustomNPC+'
|
|
||||||
}
|
|
||||||
|
|
||||||
// No Mixin Build Task
|
|
||||||
tasks.create('buildNoMixin', Exec) {
|
|
||||||
description 'Builds mod without embed'
|
|
||||||
group 'CustomNPC+'
|
|
||||||
commandLine 'build', '-Pnomixin'
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
named("main").configure {
|
|
||||||
java {
|
|
||||||
srcDirs += ['src/api/java']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modify the existing 'build' task to depend on 'updateAPI'
|
|
||||||
//tasks.apiClasses.dependsOn 'updateAPI'
|
|
||||||
-214
@@ -1,214 +0,0 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven {
|
|
||||||
name = "forge"
|
|
||||||
url = "https://maven.minecraftforge.net/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "jitpack"
|
|
||||||
url = "https://jitpack.io"
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "gt"
|
|
||||||
url = "https://gregtech.mechaenetia.com/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task submodulesUpdate(type:Exec) {
|
|
||||||
description 'Updates (and inits) git submodules'
|
|
||||||
commandLine 'git', 'submodule', 'update', '--init', '--recursive'
|
|
||||||
group 'Build Setup'
|
|
||||||
}
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
embed
|
|
||||||
compile.extendsFrom(embed)
|
|
||||||
shade
|
|
||||||
compile.extendsFrom(shade)
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'forge'
|
|
||||||
|
|
||||||
version = "1.9-beta6"
|
|
||||||
group= "com.kamkeel.customnpc-plus" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
|
||||||
archivesBaseName = "CustomNPC-Plus"
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
version = "1.7.10-10.13.4.1614-1.7.10"
|
|
||||||
runDir = "eclipse"
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
api {
|
|
||||||
java {
|
|
||||||
srcDir 'src/api/java'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
// you may put jars on which you depend on in ./libs
|
|
||||||
// or you may define them like so..
|
|
||||||
//compile "some.group:artifact:version:classifier"
|
|
||||||
//compile "some.group:artifact:version"
|
|
||||||
|
|
||||||
// real examples
|
|
||||||
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
|
||||||
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
|
||||||
|
|
||||||
// for more info...
|
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources
|
|
||||||
{
|
|
||||||
// this will ensure that this task is redone when the versions change.
|
|
||||||
inputs.property "version", project.version
|
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
// replace stuff in mcmod.info, nothing else
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
|
|
||||||
// replace version and mcversion
|
|
||||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from sourceSets.api.output
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(
|
|
||||||
'FMLAT': "customnpcs_at.cfg",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//##########################################################################################################
|
|
||||||
//######################################## Mixin Part ################################################
|
|
||||||
//##########################################################################################################
|
|
||||||
//Add
|
|
||||||
//--tweakClass org.spongepowered.asm.launch.MixinTweaker --mixin customnpcs.mixins.json
|
|
||||||
//to your client and server program arguments if working in a dev environment.
|
|
||||||
def embedMixin = !project.hasProperty("nomixin");
|
|
||||||
def yourMixinConfig = 'customnpcs.mixins.json'
|
|
||||||
def refMapForYourConfig = 'customnpcs.refmap.json'
|
|
||||||
def relativePathToMixinAP = 'tools/mixin-0.8-SNAPSHOT.jar'
|
|
||||||
|
|
||||||
if(!embedMixin){
|
|
||||||
version += "-nomixin"
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "sponge"
|
|
||||||
url = "https://repo.spongepowered.org/maven/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
if(embedMixin){
|
|
||||||
embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
|
|
||||||
// Mixin includes a lot of dependencies that are too up-to-date
|
|
||||||
exclude module: 'launchwrapper'
|
|
||||||
exclude module: 'guava'
|
|
||||||
exclude module: 'gson'
|
|
||||||
exclude module: 'commons-io'
|
|
||||||
exclude module: 'log4j-core'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT') {
|
|
||||||
// Mixin includes a lot of dependencies that are too up-to-date
|
|
||||||
exclude module: 'launchwrapper'
|
|
||||||
exclude module: 'guava'
|
|
||||||
exclude module: 'gson'
|
|
||||||
exclude module: 'commons-io'
|
|
||||||
exclude module: 'log4j-core'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + refMapForYourConfig
|
|
||||||
|
|
||||||
def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg"
|
|
||||||
|
|
||||||
jar {
|
|
||||||
configurations.shade.each { dep ->
|
|
||||||
from(project.zipTree(dep)){
|
|
||||||
exclude 'META-INF', 'META-INF/**'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
from refMap
|
|
||||||
manifest {
|
|
||||||
attributes.put("TweakClass", "org.spongepowered.asm.launch.MixinTweaker")
|
|
||||||
attributes.put("FMLCorePluginContainsFMLMod", true)
|
|
||||||
attributes.put("ForceLoadAsMod", true)
|
|
||||||
attributes.put("MixinConfigs", yourMixinConfig)
|
|
||||||
}
|
|
||||||
|
|
||||||
// embed libraries in jar
|
|
||||||
from configurations.embed.collect {
|
|
||||||
exclude '**/LICENSE.txt'
|
|
||||||
it.isDirectory() ? it : zipTree(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reobf {
|
|
||||||
addExtraSrgFile mixinSrg
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
def fixedRelPathToAP = relativePathToMixinAP
|
|
||||||
if(fixedRelPathToAP.startsWith('./') || fixedRelPathToAP.startsWith('.\\')){
|
|
||||||
fixedRelPathToAP = fixedRelPathToAP.substring(2)
|
|
||||||
} else if(fixedRelPathToAP.startsWith('/') || fixedRelPathToAP.startsWith('\\')){
|
|
||||||
fixedRelPathToAP = fixedRelPathToAP.substring(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.compileJava {
|
|
||||||
println "Path: " + projectDir.absolutePath
|
|
||||||
options.compilerArgs += [
|
|
||||||
// There's a bug in the AnnotationProcessor for 0.7.11 that will generate the annotations pointing to the parent class instead of subclass
|
|
||||||
// resulting in the mixin not being applied. This is fixed in 0.8, however 0.8 needs guava > 21.0, and minecraft ships with 17.0.
|
|
||||||
// So as a hacky workaround... ship with 0.7.11, but use the AP from 0.8 for compiling
|
|
||||||
"-processorpath", projectDir.absolutePath + '/' + fixedRelPathToAP,
|
|
||||||
"-processor", "org.spongepowered.tools.obfuscation.MixinObfuscationProcessorInjection,org.spongepowered.tools.obfuscation.MixinObfuscationProcessorTargets",
|
|
||||||
"-Xlint:-sunapi", "-XDenableSunApiLintControl", "-XDignore.symbol.file",
|
|
||||||
"-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${mixinSrg}", "-AoutRefMapFile=${refMap}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
|
||||||
classifier = 'dev'
|
|
||||||
from sourceSets.main.output
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
main {
|
|
||||||
ext.refMap = refMapForYourConfig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable Temporarily if Assets not loading
|
|
||||||
sourceSets {main { output.resourcesDir = output.classesDir }}
|
|
||||||
@@ -0,0 +1,330 @@
|
|||||||
|
package com.gtnewhorizons.gtnhgradle.modules;
|
||||||
|
|
||||||
|
import com.gtnewhorizons.retrofuturagradle.shadow.com.google.common.collect.ImmutableList;
|
||||||
|
import com.gtnewhorizons.retrofuturagradle.shadow.com.google.common.collect.ImmutableMap;
|
||||||
|
import com.gtnewhorizons.gtnhgradle.GTNHGradlePlugin;
|
||||||
|
import com.gtnewhorizons.gtnhgradle.GTNHModule;
|
||||||
|
import com.gtnewhorizons.gtnhgradle.PropertiesConfiguration;
|
||||||
|
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask;
|
||||||
|
import org.gradle.api.GradleException;
|
||||||
|
import org.gradle.api.JavaVersion;
|
||||||
|
import org.gradle.api.Project;
|
||||||
|
import org.gradle.api.plugins.ExtensionAware;
|
||||||
|
import org.gradle.api.tasks.TaskContainer;
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile;
|
||||||
|
import org.gradle.plugins.ide.eclipse.EclipsePlugin;
|
||||||
|
import org.gradle.plugins.ide.eclipse.model.EclipseJdt;
|
||||||
|
import org.gradle.plugins.ide.eclipse.model.EclipseModel;
|
||||||
|
import org.gradle.plugins.ide.idea.model.IdeaModel;
|
||||||
|
import org.gradle.plugins.ide.idea.model.IdeaProject;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.gradle.ext.ActionDelegationConfig;
|
||||||
|
import org.jetbrains.gradle.ext.Application;
|
||||||
|
import org.jetbrains.gradle.ext.Gradle;
|
||||||
|
import org.jetbrains.gradle.ext.IdeaCompilerConfiguration;
|
||||||
|
import org.jetbrains.gradle.ext.IdeaExtPlugin;
|
||||||
|
import org.jetbrains.gradle.ext.ProjectSettings;
|
||||||
|
import org.jetbrains.gradle.ext.RunConfigurationContainer;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/** Provides better integration for IntelliJ and Eclipse */
|
||||||
|
public class IdeIntegrationModule implements GTNHModule {
|
||||||
|
|
||||||
|
/** The default misc.xml for IntelliJ */
|
||||||
|
private final @NotNull String MISC_XML_DEFAULT = """
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
""";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(@NotNull PropertiesConfiguration configuration) {
|
||||||
|
return configuration.moduleIdeIntegration;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply(GTNHGradlePlugin.@NotNull GTNHExtension gtnh, @NotNull Project project) throws Throwable {
|
||||||
|
|
||||||
|
project.getPluginManager()
|
||||||
|
.apply(IdeaExtPlugin.class);
|
||||||
|
project.getPluginManager()
|
||||||
|
.apply(EclipsePlugin.class);
|
||||||
|
|
||||||
|
final TaskContainer tasks = project.getTasks();
|
||||||
|
final EclipseModel eclipse = project.getExtensions()
|
||||||
|
.getByType(EclipseModel.class);
|
||||||
|
eclipse.getClasspath()
|
||||||
|
.setDownloadSources(true);
|
||||||
|
eclipse.getClasspath()
|
||||||
|
.setDownloadJavadoc(true);
|
||||||
|
final EclipseJdt ejdt = eclipse.getJdt();
|
||||||
|
ejdt.setTargetCompatibility(JavaVersion.VERSION_1_8);
|
||||||
|
ejdt.setJavaRuntimeName("JavaSE-1.8");
|
||||||
|
if (gtnh.configuration.enableModernJavaSyntax) {
|
||||||
|
ejdt.setSourceCompatibility(JavaVersion.VERSION_17);
|
||||||
|
} else {
|
||||||
|
ejdt.setSourceCompatibility(JavaVersion.VERSION_1_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
final IdeaModel idea = project.getExtensions()
|
||||||
|
.getByType(IdeaModel.class);
|
||||||
|
idea.getModule()
|
||||||
|
.setDownloadSources(true);
|
||||||
|
idea.getModule()
|
||||||
|
.setDownloadJavadoc(true);
|
||||||
|
idea.getModule()
|
||||||
|
.setInheritOutputDirs(true);
|
||||||
|
final IdeaProject ideaProject = idea.getProject();
|
||||||
|
final ProjectSettings ideaExt = getExt(ideaProject, ProjectSettings.class);
|
||||||
|
final ActionDelegationConfig delegationConfig = getExt(ideaExt, ActionDelegationConfig.class);
|
||||||
|
final IdeaCompilerConfiguration compiler = getExt(ideaExt, IdeaCompilerConfiguration.class);
|
||||||
|
final RunConfigurationContainer runs = getExt(ideaExt, RunConfigurationContainer.class);
|
||||||
|
|
||||||
|
if (!gtnh.configuration.ideaOverrideBuildType.isEmpty()) {
|
||||||
|
switch (gtnh.configuration.ideaOverrideBuildType.toLowerCase(Locale.ROOT)) {
|
||||||
|
case "gradle":
|
||||||
|
delegationConfig.setDelegateBuildRunToGradle(true);
|
||||||
|
delegationConfig.setTestRunner(ActionDelegationConfig.TestRunner.GRADLE);
|
||||||
|
break;
|
||||||
|
case "idea":
|
||||||
|
delegationConfig.setDelegateBuildRunToGradle(false);
|
||||||
|
delegationConfig.setTestRunner(ActionDelegationConfig.TestRunner.PLATFORM);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new GradleException("Accepted value for ideaOverrideBuildType is one of gradle or idea.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compiler.getJavac()
|
||||||
|
.setJavacAdditionalOptions("-encoding utf8");
|
||||||
|
compiler.getJavac()
|
||||||
|
.setModuleJavacAdditionalOptions(
|
||||||
|
ImmutableMap.of(
|
||||||
|
project.getName() + ".main",
|
||||||
|
quotedJoin(
|
||||||
|
tasks.named("compileJava", JavaCompile.class)
|
||||||
|
.get()
|
||||||
|
.getOptions()
|
||||||
|
.getAllCompilerArgs())));
|
||||||
|
|
||||||
|
runs.register("0. Build and Test", Gradle.class, run -> { run.setTaskNames(ImmutableList.of("build")); });
|
||||||
|
runs.register("1. Run Client", Gradle.class, run -> { run.setTaskNames(ImmutableList.of("runClient")); });
|
||||||
|
runs.register("2. Run Server", Gradle.class, run -> { run.setTaskNames(ImmutableList.of("runServer")); });
|
||||||
|
if (gtnh.configuration.moduleModernJava) {
|
||||||
|
char suffix = 'a';
|
||||||
|
for (final int javaVer : ImmutableList.of(17, 21)) {
|
||||||
|
final char mySuffix = suffix;
|
||||||
|
final char myHsSuffix = (char) (suffix + 1);
|
||||||
|
suffix += 2;
|
||||||
|
runs.register(
|
||||||
|
"1" + mySuffix + ". Run Client (Java " + javaVer + ")",
|
||||||
|
Gradle.class,
|
||||||
|
run -> { run.setTaskNames(ImmutableList.of("runClient" + javaVer)); });
|
||||||
|
runs.register(
|
||||||
|
"2" + mySuffix + ". Run Server (Java " + javaVer + ")",
|
||||||
|
Gradle.class,
|
||||||
|
run -> { run.setTaskNames(ImmutableList.of("runServer" + javaVer)); });
|
||||||
|
runs.register("1" + myHsSuffix + ". Run Client (Java " + javaVer + ", Hotswap)", Gradle.class, run -> {
|
||||||
|
run.setTaskNames(ImmutableList.of("runClient" + javaVer));
|
||||||
|
run.setEnvs(ImmutableMap.of("HOTSWAP", "true"));
|
||||||
|
});
|
||||||
|
runs.register("2" + myHsSuffix + ". Run Server (Java " + javaVer + ", Hotswap)", Gradle.class, run -> {
|
||||||
|
run.setTaskNames(ImmutableList.of("runServer" + javaVer));
|
||||||
|
run.setEnvs(ImmutableMap.of("HOTSWAP", "true"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runs.register(
|
||||||
|
"3. Run Obfuscated Client",
|
||||||
|
Gradle.class,
|
||||||
|
run -> { run.setTaskNames(ImmutableList.of("runObfClient")); });
|
||||||
|
runs.register(
|
||||||
|
"4. Run Obfuscated Server",
|
||||||
|
Gradle.class,
|
||||||
|
run -> { run.setTaskNames(ImmutableList.of("runObfServer")); });
|
||||||
|
if (!gtnh.configuration.disableSpotless) {
|
||||||
|
runs.register(
|
||||||
|
"5. Apply spotless",
|
||||||
|
Gradle.class,
|
||||||
|
run -> { run.setTaskNames(ImmutableList.of("spotlessApply")); });
|
||||||
|
}
|
||||||
|
|
||||||
|
final var ijClientRun = runs.register("Run Client (IJ Native)", Application.class, run -> {
|
||||||
|
run.setMainClass("GradleStart");
|
||||||
|
run.setModuleName(project.getName() + ".ideVirtualMain");
|
||||||
|
});
|
||||||
|
project.afterEvaluate(_p -> {
|
||||||
|
final RunMinecraftTask runClient = tasks.named("runClient", RunMinecraftTask.class)
|
||||||
|
.get();
|
||||||
|
final var run = ijClientRun.get();
|
||||||
|
run.setWorkingDirectory(
|
||||||
|
runClient.getWorkingDir()
|
||||||
|
.getAbsolutePath());
|
||||||
|
run.setProgramParameters(quotedJoin(runClient.calculateArgs()));
|
||||||
|
run.setJvmArgs(
|
||||||
|
quotedJoin(runClient.calculateJvmArgs()) + ' ' + quotedPropJoin(runClient.getSystemProperties()));
|
||||||
|
});
|
||||||
|
final var ijServerRun = runs.register("Run Server (IJ Native)", Application.class, run -> {
|
||||||
|
run.setMainClass("GradleStartServer");
|
||||||
|
run.setModuleName(project.getName() + ".ideVirtualMain");
|
||||||
|
});
|
||||||
|
project.afterEvaluate(_p -> {
|
||||||
|
final RunMinecraftTask runServer = tasks.named("runServer", RunMinecraftTask.class)
|
||||||
|
.get();
|
||||||
|
final var run = ijServerRun.get();
|
||||||
|
run.setWorkingDirectory(
|
||||||
|
runServer.getWorkingDir()
|
||||||
|
.getAbsolutePath());
|
||||||
|
run.setProgramParameters(quotedJoin(runServer.calculateArgs()));
|
||||||
|
run.setJvmArgs(
|
||||||
|
quotedJoin(runServer.calculateJvmArgs()) + ' ' + quotedPropJoin(runServer.getSystemProperties()));
|
||||||
|
});
|
||||||
|
|
||||||
|
ideaExt.withIDEADir(ideaDir -> {
|
||||||
|
try {
|
||||||
|
if (!ideaDir.getPath()
|
||||||
|
.contains(".idea")) {
|
||||||
|
// If an .ipr file exists, the project root directory is passed here instead of the .idea
|
||||||
|
// subdirectory
|
||||||
|
ideaDir = new File(ideaDir, ".idea");
|
||||||
|
}
|
||||||
|
if (ideaDir.isDirectory()) {
|
||||||
|
final File miscFile = new File(ideaDir, "misc.xml");
|
||||||
|
if (miscFile.isFile()) {
|
||||||
|
boolean dirty = false;
|
||||||
|
final DocumentBuilder builder = DocumentBuilderFactory.newInstance()
|
||||||
|
.newDocumentBuilder();
|
||||||
|
final Document doc = builder.parse(miscFile);
|
||||||
|
Element docRoot = doc.getDocumentElement();
|
||||||
|
if (docRoot == null) {
|
||||||
|
docRoot = doc.createElement("project");
|
||||||
|
docRoot.setAttribute("version", "4");
|
||||||
|
docRoot.appendChild(docRoot);
|
||||||
|
}
|
||||||
|
final NodeList components = docRoot.getElementsByTagName("component");
|
||||||
|
Element foundComponent = null;
|
||||||
|
if (components != null) {
|
||||||
|
for (int i = 0; i < components.getLength(); i++) {
|
||||||
|
final Node node = components.item(i);
|
||||||
|
if (!(node instanceof Element)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!node.hasAttributes()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final Node name = node.getAttributes()
|
||||||
|
.getNamedItem("name");
|
||||||
|
if ("ProjectRootManager".equals(name.getNodeValue())) {
|
||||||
|
foundComponent = (Element) node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (foundComponent == null) {
|
||||||
|
dirty = true;
|
||||||
|
Element e = doc.createElement("component");
|
||||||
|
e.setAttribute("name", "ProjectRootManager");
|
||||||
|
e.setAttribute("version", "2");
|
||||||
|
docRoot.appendChild(e);
|
||||||
|
foundComponent = e;
|
||||||
|
}
|
||||||
|
final NodeList outputs = foundComponent.getElementsByTagName("output");
|
||||||
|
Element foundOutput = null;
|
||||||
|
for (int i = 0; i < outputs.getLength(); i++) {
|
||||||
|
final Node node = outputs.item(i);
|
||||||
|
if (!(node instanceof Element)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!node.hasAttributes()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
foundOutput = (Element) node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (foundOutput == null) {
|
||||||
|
dirty = true;
|
||||||
|
Element e = doc.createElement("output");
|
||||||
|
foundComponent.appendChild(e);
|
||||||
|
foundOutput = e;
|
||||||
|
}
|
||||||
|
if (foundOutput.getAttribute("url")
|
||||||
|
.isEmpty()) {
|
||||||
|
// Only modify the output url if it doesn't yet have one, or if the existing one is blank
|
||||||
|
// somehow.
|
||||||
|
// This is a sensible default for most setups
|
||||||
|
dirty = true;
|
||||||
|
foundOutput.setAttribute("url", "file://$PROJECT_DIR$/build/ideaBuild");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dirty) {
|
||||||
|
final DOMSource domSrc = new DOMSource(doc);
|
||||||
|
final Transformer xform = TransformerFactory.newInstance()
|
||||||
|
.newTransformer();
|
||||||
|
final StreamResult result = new StreamResult(miscFile);
|
||||||
|
xform.transform(domSrc, result);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Files.write(miscFile.toPath(), MISC_XML_DEFAULT.getBytes(StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (e instanceof RuntimeException ex) {
|
||||||
|
throw ex;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tasks.named("processIdeaSettings")
|
||||||
|
.configure(t -> { t.dependsOn("injectTags", "setupDecompWorkspace"); });
|
||||||
|
|
||||||
|
tasks.named("ideVirtualMainClasses")
|
||||||
|
.configure(t -> {
|
||||||
|
// Make IntelliJ "Build project" build the mod jars
|
||||||
|
t.dependsOn("jar", "reobfJar");
|
||||||
|
if (gtnh.configuration.moduleCodeStyle && !gtnh.configuration.disableSpotless
|
||||||
|
&& gtnh.configuration.ideaCheckSpotlessOnBuild) {
|
||||||
|
t.dependsOn("spotlessCheck");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String quotedJoin(Collection<String> collection) {
|
||||||
|
return collection.stream()
|
||||||
|
.map(a -> '"' + a + '"')
|
||||||
|
.collect(Collectors.joining(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String quotedPropJoin(Map<String, ?> collection) {
|
||||||
|
return collection.entrySet()
|
||||||
|
.stream()
|
||||||
|
.map(a -> "\"-D" + a.getKey() + '=' + a.getValue() + '"')
|
||||||
|
.collect(Collectors.joining(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> T getExt(Object o, Class<T> type) {
|
||||||
|
return ((ExtensionAware) o).getExtensions()
|
||||||
|
.getByType(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# core/ — MC-Free Game Logic
|
||||||
|
|
||||||
|
Core contains version-independent game logic: controllers, data classes, constants, utilities.
|
||||||
|
It depends only on `platform-api/` interfaces — **never** on MC classes, wrappers, or Forge.
|
||||||
|
|
||||||
|
## Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
noppes/npcs/controllers/ → FactionController, MagicController, TransportController, etc.
|
||||||
|
noppes/npcs/controllers/data/ → Faction, Magic, Tag, TransportLocation, Frame, Lines, etc.
|
||||||
|
noppes/npcs/constants/ → 40+ enums (EnumRoleType, EnumQuestType, EnumAnimation, etc.)
|
||||||
|
noppes/npcs/core/ → NBT factory, CoreConfig
|
||||||
|
noppes/npcs/util/ → ValueUtil, LRUHashMap, CacheHashMap, MillisTimer
|
||||||
|
noppes/npcs/ → NBTTags.java
|
||||||
|
kamkeel/npcs/ → Additional controllers, network enums, utilities, developer registry
|
||||||
|
```
|
||||||
|
|
||||||
|
## Forbidden Imports
|
||||||
|
|
||||||
|
Core code must **never** import:
|
||||||
|
- `net.minecraft.*`, `cpw.mods.*`, `net.minecraftforge.*`, `org.spongepowered.*`
|
||||||
|
- Wrapper classes from `src/main/java/` (mc1710 module)
|
||||||
|
- Only allowed: `java.*`, `javax.*`, `noppes.npcs.*`, `kamkeel.npcs.*` (from core + platform-api)
|
||||||
|
|
||||||
|
## Key Patterns
|
||||||
|
|
||||||
|
| MC Concept | Core Replacement |
|
||||||
|
|---|---|
|
||||||
|
| `new NBTTagCompound()` | `NBT.compound()` |
|
||||||
|
| `CompressedStreamTools` | `PlatformServiceHolder.get().readCompressedNBT()` |
|
||||||
|
| `LogWriter` | `PlatformServiceHolder.get().logError()` |
|
||||||
|
| `CustomNpcs.getWorldSaveDirectory()` | `PlatformServiceHolder.get().getWorldSaveDirectory()` |
|
||||||
|
| `EntityPlayer` param | `IPlayer` (via platform-api — `noppes.npcs.api.entity.IPlayer`) |
|
||||||
|
| `ItemStack` param | `IItemStack` (via platform-api — `noppes.npcs.api.item.IItemStack`) |
|
||||||
|
| `World` param | `IWorld` (via platform-api — `noppes.npcs.api.IWorld`) |
|
||||||
|
|
||||||
|
## Split-Package Shadows
|
||||||
|
|
||||||
|
Core classes share packages with mc1710 classes. The mc1710 version can:
|
||||||
|
- Add `implements IFaction`, `implements IFactionHandler` (scripting API)
|
||||||
|
- Re-add `SyncController` calls for network sync
|
||||||
|
- Override methods that need `ItemStack`, `EntityPlayer`, etc.
|
||||||
|
|
||||||
|
## Adding New Core Code
|
||||||
|
|
||||||
|
1. Ensure zero MC imports — use platform-api interfaces
|
||||||
|
2. NBT via `NBT.compound()` / `NBT.list()`, file I/O via `PlatformServiceHolder`
|
||||||
|
3. Stub out methods needing MC types — mc1710 shadow adds them
|
||||||
|
4. Follow existing package structure (controllers → `controllers/`, data → `controllers/data/`)
|
||||||
|
5. **NEVER create duplicate interface names** — use `IPlayer`, `IItemStack`, `IWorld`, `IEntity` etc. from platform-api as-is
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'noppes.npcs'
|
||||||
|
version = '1.0'
|
||||||
|
|
||||||
|
// Target Java 8 for compatibility with all MC versions (1.7.10 through 1.20.1)
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api project(':platform-api')
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.9'
|
||||||
|
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
||||||
|
implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8'
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# AGENTS.md — core/ (Platform-Abstracted Game Logic)
|
||||||
|
|
||||||
|
## What This Is
|
||||||
|
MC-free module containing game logic, enums, data classes, and controllers that compile without
|
||||||
|
Minecraft imports. Uses `platform-api/` interfaces for MC operations. 188 files migrated so far.
|
||||||
|
Dependency: `platform-api` ← `core` ← `mc1710 (root src)`.
|
||||||
|
|
||||||
|
## Split-Package Shadow Pattern
|
||||||
|
Core classes and mc1710 classes share the **same package**. At compile time, mc1710 versions shadow
|
||||||
|
core by adding MC-specific functionality:
|
||||||
|
|
||||||
|
```
|
||||||
|
core/ Faction.java → Pure data + INbt serialization
|
||||||
|
src/ Faction.java → adds `implements IFaction`, SyncController calls, EntityPlayer methods
|
||||||
|
```
|
||||||
|
|
||||||
|
**Rule**: Core class must compile independently. mc1710 version extends/overrides to add MC logic.
|
||||||
|
|
||||||
|
## Module Structure
|
||||||
|
|
||||||
|
### constants/ (42 files)
|
||||||
|
All game enums. No MC imports. Domains:
|
||||||
|
- **AI**: `AiMutex`, `EnumAnimation`, `EnumCombatPolicy`, `EnumMovingType`, `EnumNavType`, `EnumStandingType`
|
||||||
|
- **Quest**: `EnumQuestType`, `EnumQuestRepeat`, `EnumQuestCompletion`
|
||||||
|
- **Dialog**: `EnumAvailabilityDialog`, `EnumAvailabilityFaction`, `EnumAvailabilityFactionType`, `EnumAvailabilityQuest`, `EnumOptionType`
|
||||||
|
- **NPC**: `EnumJobType`, `EnumRoleType`, `EnumCompanionJobs`, `EnumCompanionStage`
|
||||||
|
- **Display**: `EnumTextureType`, `EnumBannerVariant`, `EnumDiagramLayout`, `EnumScrollData`
|
||||||
|
- **Economy**: `EnumAuctionPage`, `EnumAuctionSort`, `EnumStockReset`, `EnumTradeSlotType`
|
||||||
|
- **Party**: `EnumPartyExchange`, `EnumPartyObjectives`, `EnumPartyRequirements`
|
||||||
|
- **System**: `EnumGuiType`, `EnumPlayerData`, `EnumPlayerPacket`, `EnumScriptType`, `EnumProfileSync`, `EnumCategoryType`
|
||||||
|
- **Misc**: `EnumBardInstrument`, `EnumDayTime`, `EnumParticleType`, `MarkType`, `NBTTypes`, `EnumNpcToolMaterial`
|
||||||
|
|
||||||
|
### controllers/ (8 files)
|
||||||
|
Migrated controller singletons using `INbt` instead of `NBTTagCompound`:
|
||||||
|
|
||||||
|
| Controller | Status |
|
||||||
|
|---|---|
|
||||||
|
| `FactionController` | Fully migrated. Load/save via `PlatformServiceHolder.get()` |
|
||||||
|
| `MagicController` | Migrated with TODO stubs for ItemStack methods |
|
||||||
|
| `TransportController` | Fully migrated |
|
||||||
|
| `GlobalDataController` | Migrated. Async save via `CustomNPCsThreader` |
|
||||||
|
| `TagController` | Fully migrated |
|
||||||
|
| `ServerTagMapController` | Migrated (clone folder management) |
|
||||||
|
| `CategoryManager` | Utility — filesystem category operations |
|
||||||
|
| `APIRegistry` | Simple name→URL map, no MC deps |
|
||||||
|
|
||||||
|
### controllers/data/ (33 files)
|
||||||
|
Migrated data classes. Key groups:
|
||||||
|
- **Faction**: `Faction`, `Category` (base category class)
|
||||||
|
- **Magic**: `Magic`, `MagicCycle`, `MagicEntry`, `MagicAssociation`, `MagicData`
|
||||||
|
- **Transport**: `TransportCategory`, `TransportLocation`
|
||||||
|
- **Tags**: `Tag`, `TagMap`
|
||||||
|
- **Profile**: `ProfileOptions`, `ProfileInfoEntry`
|
||||||
|
- **Animation**: `Frame`, `FramePart`, `HitboxData`, `TintData`, `ItemDisplayData`
|
||||||
|
- **Dialog**: `DialogColorData`, `DialogImage`, `Line`, `Lines`
|
||||||
|
- **Player data fragments**: `PlayerDialogData`, `PlayerTransportData`, `PlayerEffectData`, `PlayerEffect`, `AbilityHotbarData`, `EffectKey`
|
||||||
|
- **Economy**: `AuctionFilter`, `TraderStock`, `SkinOverlay`, `InnDoorData`
|
||||||
|
- **Misc**: `CloneFolder`, `PartyOptions`
|
||||||
|
|
||||||
|
### util/ (6 files)
|
||||||
|
- `CustomNPCsThreader` — Thread pool for async controller saves
|
||||||
|
- `CacheHashMap` — TTL-based cache (used by PlayerDataController)
|
||||||
|
- `LRUHashMap` — Least-recently-used eviction map
|
||||||
|
- `ValueUtil` — Numeric clamping utilities
|
||||||
|
- `MillisTimer` — Simple timing
|
||||||
|
- `SizeOfObjectUtil` — Object size estimation
|
||||||
|
|
||||||
|
### kamkeel/ additions in core
|
||||||
|
- `controllers/data/ability/` — Ability enums (`AbilityPhase`, `HitType`, `TargetFilter`, `TargetingMode`, etc.) + data classes (`ProjectileData`, `EnergyBarrierData`, `EnergyHomingData`, etc.)
|
||||||
|
- `controllers/data/attribute/` — `AttributeDefinition`, `PlayerAttribute`, `PlayerAttributeMap`, `AttributeValueType`
|
||||||
|
- `controllers/data/profile/` — `Slot`, `ProfileOperation`, `EnumProfileOperation`, `ProfileInfoEntry`
|
||||||
|
- `controllers/data/telegraph/` — `Telegraph`, `TelegraphType`
|
||||||
|
- `network/enums/` — 9 network enum types (`EnumSyncType`, `EnumSyncAction`, `EnumDataPacket`, etc.)
|
||||||
|
- `util/` — `CNPCDebug`, `FileNameHelper`, `TextSplitter`
|
||||||
|
- `developer/` — `Developer` registry
|
||||||
|
|
||||||
|
## Platform Abstraction
|
||||||
|
Core uses `platform-api/` interfaces (the real ones from `noppes.npcs.api.*`):
|
||||||
|
- `INbt` / `INbtList` instead of `NBTTagCompound` / `NBTTagList`
|
||||||
|
- `NBT.compound()` / `NBT.list()` factory methods instead of `new NBTTagCompound()`
|
||||||
|
- `PlatformServiceHolder.get()` for file I/O, logging, world save directory access
|
||||||
|
- `IPlayer` for player references, `IItemStack` for items, `IWorld` for worlds
|
||||||
|
|
||||||
|
## Migration Status
|
||||||
|
188/~1810 files migrated. See `.AGENTS/SESSION_MEMORY.md` for the full migration roadmap.
|
||||||
|
|
||||||
|
## Forbidden
|
||||||
|
- **NEVER import net.minecraft.* in core/** — use platform-api interfaces only
|
||||||
|
- **NEVER import wrapper classes in core/** — only interfaces from platform-api/
|
||||||
|
- **NEVER break split-package shadow** — core class must compile alone, mc1710 adds MC logic
|
||||||
|
- **NEVER create duplicate interface names** — use the existing `IPlayer`, `IItemStack`, `IWorld`, `IEntity` etc. from platform-api
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package io.netty.buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEMPORARY STUB -- auto-generated for compilation.
|
||||||
|
* Netty ByteBuf stub for core compilation.
|
||||||
|
*/
|
||||||
|
public abstract class ByteBuf {
|
||||||
|
public abstract ByteBuf writeInt(int value);
|
||||||
|
public abstract int readInt();
|
||||||
|
public abstract ByteBuf writeByte(int value);
|
||||||
|
public abstract byte readByte();
|
||||||
|
public abstract ByteBuf writeShort(int value);
|
||||||
|
public abstract short readShort();
|
||||||
|
public abstract ByteBuf writeLong(long value);
|
||||||
|
public abstract long readLong();
|
||||||
|
public abstract ByteBuf writeFloat(float value);
|
||||||
|
public abstract float readFloat();
|
||||||
|
public abstract ByteBuf writeDouble(double value);
|
||||||
|
public abstract double readDouble();
|
||||||
|
public abstract ByteBuf writeBoolean(boolean value);
|
||||||
|
public abstract boolean readBoolean();
|
||||||
|
public abstract ByteBuf writeBytes(byte[] src);
|
||||||
|
public abstract ByteBuf readBytes(byte[] dst);
|
||||||
|
public abstract int readableBytes();
|
||||||
|
public abstract boolean isReadable();
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package kamkeel.npcs;
|
||||||
|
|
||||||
|
import kamkeel.npcs.controllers.AttributeController;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.AttributeDefinition;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.AttributeValueType;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.requirement.RequirementCheckerRegistry;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.requirement.types.ProfileSlotRequirement;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.requirement.types.QuestActiveRequirement;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.requirement.types.QuestCompletedRequirement;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.requirement.types.SoulbindRequirement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ModAttributes registers the core attributes (both non-magic and magic-based).
|
||||||
|
*/
|
||||||
|
public class CustomAttributes {
|
||||||
|
public static final String HEALTH_KEY = "health";
|
||||||
|
public static final String HEALTH_BOOST_KEY = "health_boost";
|
||||||
|
public static final String MAIN_ATTACK_KEY = "main_attack";
|
||||||
|
public static final String MAIN_ATTACK_BOOST_KEY = "main_attack_boost";
|
||||||
|
public static final String NEUTRAL_KEY = "neutral";
|
||||||
|
public static final String NEUTRAL_BOOST_KEY = "neutral_boost";
|
||||||
|
public static final String CRITICAL_DAMAGE_KEY = "critical_damage";
|
||||||
|
public static final String CRITICAL_CHANCE_KEY = "critical_chance";
|
||||||
|
public static final String MAGIC_DAMAGE_KEY = "magic_damage";
|
||||||
|
public static final String MAGIC_BOOST_KEY = "magic_boost";
|
||||||
|
public static final String MAGIC_DEFENSE_KEY = "magic_defense";
|
||||||
|
public static final String MAGIC_RESISTANCE_KEY = "magic_resistance";
|
||||||
|
public static final String MOVEMENT_SPEED_KEY = "movement_speed";
|
||||||
|
public static final String KNOCKBACK_RES_KEY = "knockback_res";
|
||||||
|
|
||||||
|
public static AttributeDefinition HEALTH;
|
||||||
|
public static AttributeDefinition HEALTH_BOOST;
|
||||||
|
public static AttributeDefinition MAIN_ATTACK;
|
||||||
|
public static AttributeDefinition MAIN_BOOST;
|
||||||
|
public static AttributeDefinition NEUTRAL_ATTACK;
|
||||||
|
public static AttributeDefinition NEUTRAL_BOOST;
|
||||||
|
public static AttributeDefinition CRITICAL_CHANCE;
|
||||||
|
public static AttributeDefinition CRITICAL_DAMAGE;
|
||||||
|
public static AttributeDefinition MAGIC_DAMAGE;
|
||||||
|
public static AttributeDefinition MAGIC_BOOST;
|
||||||
|
public static AttributeDefinition MAGIC_DEFENSE;
|
||||||
|
public static AttributeDefinition MAGIC_RESISTANCE;
|
||||||
|
public static AttributeDefinition MOVEMENT_SPEED;
|
||||||
|
public static AttributeDefinition KNOCKBACK_RES;
|
||||||
|
|
||||||
|
public CustomAttributes() {
|
||||||
|
HEALTH = AttributeController.registerAttribute(HEALTH_KEY, "Health", 'c', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.BASE);
|
||||||
|
HEALTH_BOOST = AttributeController.registerAttribute(HEALTH_BOOST_KEY, "Health Boost", 'c', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
HEALTH_BOOST.setTranslationKey("attribute.name.generic.maxHealth");
|
||||||
|
|
||||||
|
MAIN_ATTACK = AttributeController.registerAttribute(MAIN_ATTACK_KEY, "Main Attack Damage", '4', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.BASE);
|
||||||
|
MAIN_BOOST = AttributeController.registerAttribute(MAIN_ATTACK_BOOST_KEY, "Main Attack Damage", '4', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
|
||||||
|
NEUTRAL_ATTACK = AttributeController.registerAttribute(NEUTRAL_KEY, "Neutral Damage", '6', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.BASE);
|
||||||
|
NEUTRAL_BOOST = AttributeController.registerAttribute(NEUTRAL_BOOST_KEY, "Neutral Damage", '6', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
|
||||||
|
CRITICAL_CHANCE = AttributeController.registerAttribute(CRITICAL_CHANCE_KEY, "Critical Chance", '6', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.INFO);
|
||||||
|
CRITICAL_DAMAGE = AttributeController.registerAttribute(CRITICAL_DAMAGE_KEY, "Critical Damage", '6', AttributeValueType.FLAT, AttributeDefinition.AttributeSection.INFO);
|
||||||
|
|
||||||
|
MAGIC_DAMAGE = AttributeController.registerAttribute(MAGIC_DAMAGE_KEY, "Magic Damage", '3', AttributeValueType.MAGIC, AttributeDefinition.AttributeSection.BASE);
|
||||||
|
MAGIC_BOOST = AttributeController.registerAttribute(MAGIC_BOOST_KEY, "Magic Damage", '3', AttributeValueType.MAGIC, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
|
||||||
|
MAGIC_DEFENSE = AttributeController.registerAttribute(MAGIC_DEFENSE_KEY, "Magic Defense", 'b', AttributeValueType.MAGIC, AttributeDefinition.AttributeSection.BASE);
|
||||||
|
MAGIC_RESISTANCE = AttributeController.registerAttribute(MAGIC_RESISTANCE_KEY, "Magic Resistance", 'b', AttributeValueType.MAGIC, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
|
||||||
|
MOVEMENT_SPEED = AttributeController.registerAttribute(MOVEMENT_SPEED_KEY, "Movement Speed", 'a', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
MOVEMENT_SPEED.setTranslationKey("attribute.name.generic.movementSpeed");
|
||||||
|
|
||||||
|
KNOCKBACK_RES = AttributeController.registerAttribute(KNOCKBACK_RES_KEY, "Knockback Resistance", 'b', AttributeValueType.PERCENT, AttributeDefinition.AttributeSection.MODIFIER);
|
||||||
|
KNOCKBACK_RES.setTranslationKey("attribute.name.generic.knockbackResistance");
|
||||||
|
|
||||||
|
RequirementCheckerRegistry.registerChecker(new QuestCompletedRequirement());
|
||||||
|
RequirementCheckerRegistry.registerChecker(new QuestActiveRequirement());
|
||||||
|
RequirementCheckerRegistry.registerChecker(new ProfileSlotRequirement());
|
||||||
|
RequirementCheckerRegistry.registerChecker(new SoulbindRequirement());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package kamkeel.npcs.addon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEMPORARY STUB -- auto-generated for compilation.
|
||||||
|
* Will be replaced when this class is properly migrated.
|
||||||
|
* DO NOT add logic here.
|
||||||
|
*
|
||||||
|
* Addon hook interface.
|
||||||
|
*/
|
||||||
|
public class AddonHooks {
|
||||||
|
public static void onAbilityCounter(Object ability, Object attacker, Object target) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package kamkeel.npcs.addon;
|
||||||
|
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
/**
|
||||||
|
* TEMPORARY STUB -- auto-generated for compilation.
|
||||||
|
* Will be replaced when this class is properly migrated.
|
||||||
|
* DO NOT add logic here.
|
||||||
|
*/
|
||||||
|
public class DBCAddon {
|
||||||
|
public static boolean isLoaded() { return false; }
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,104 @@
|
|||||||
|
package kamkeel.npcs.controllers;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.AttributeDefinition;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.AttributeValueType;
|
||||||
|
import kamkeel.npcs.controllers.data.attribute.tracker.PlayerAttributeTracker;
|
||||||
|
import kamkeel.npcs.CustomAttributes;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.handler.data.IAttributeDefinition;
|
||||||
|
import noppes.npcs.api.handler.data.IPlayerAttributes;
|
||||||
|
import noppes.npcs.api.handler.IAttributeHandler;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AttributeController is the central registry for attribute definitions.
|
||||||
|
* It ensures that keys are unique.
|
||||||
|
*/
|
||||||
|
public class AttributeController implements IAttributeHandler {
|
||||||
|
|
||||||
|
public static AttributeController Instance;
|
||||||
|
public CustomAttributes attributes;
|
||||||
|
|
||||||
|
// Tracking Player Attributes
|
||||||
|
private static final Map<UUID, PlayerAttributeTracker> trackers = new HashMap<>();
|
||||||
|
private static final Map<String, AttributeDefinition> definitions = new HashMap<>();
|
||||||
|
|
||||||
|
public AttributeController() {
|
||||||
|
Instance = this;
|
||||||
|
definitions.clear();
|
||||||
|
trackers.clear();
|
||||||
|
attributes = new CustomAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AttributeDefinition registerAttribute(String key, String displayName, char colorCode, AttributeValueType valueType, AttributeDefinition.AttributeSection section) {
|
||||||
|
if (definitions.containsKey(key)) {
|
||||||
|
throw new IllegalArgumentException("Attribute already registered with key: " + key);
|
||||||
|
}
|
||||||
|
AttributeDefinition def = new AttributeDefinition(key, displayName, colorCode, valueType, section);
|
||||||
|
definitions.put(key, def);
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AttributeDefinition registerAttribute(AttributeDefinition definition) {
|
||||||
|
if (definitions.containsKey(definition.getKey())) {
|
||||||
|
throw new IllegalArgumentException("Attribute already registered with key: " + definition.getKey());
|
||||||
|
} else {
|
||||||
|
definitions.put(definition.getKey(), definition);
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AttributeDefinition getAttribute(String key) {
|
||||||
|
return definitions.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<AttributeDefinition> getAllAttributes() {
|
||||||
|
return definitions.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PlayerAttributeTracker getTracker(IPlayer player) {
|
||||||
|
return trackers.computeIfAbsent(player.getUniqueID(), id -> new PlayerAttributeTracker(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void removeTracker(UUID playerId) {
|
||||||
|
trackers.remove(playerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update all trackers (e.g. called every 10 ticks for all online players).
|
||||||
|
*/
|
||||||
|
public static void updateAllTrackers(Iterable<IPlayer> players) {
|
||||||
|
for (IPlayer player : players) {
|
||||||
|
PlayerAttributeTracker tracker = getTracker(player);
|
||||||
|
tracker.updateIfChanged(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IPlayerAttributes getPlayerAttributes(IPlayer player) {
|
||||||
|
if (player == null || player.getMCEntity() == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IPlayer IPlayer = (IPlayer) player.getMCEntity();
|
||||||
|
return trackers.computeIfAbsent(IPlayer.getUniqueID(), id -> new PlayerAttributeTracker(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAttributeDefinition getAttributeDefinition(String key) {
|
||||||
|
return definitions.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAttributeDefinition[] getAllAttributesArray() {
|
||||||
|
return definitions.values().toArray(new AttributeDefinition[definitions.size()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
package kamkeel.npcs.controllers;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityZone;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergySweeper;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyExplosion;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.energy.IEnergyExtender;
|
||||||
|
import noppes.npcs.api.IEnergyHandler;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.*;
|
||||||
|
import noppes.npcs.api.entity.IEnergyExplosion;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Central controller for script-created energy entities and handler registration.
|
||||||
|
* Provides factory methods for creating all energy IEntity types and routes
|
||||||
|
* damage through registered handlers when entities have customDamageData
|
||||||
|
* but no sourceAbility.
|
||||||
|
*/
|
||||||
|
public class EnergyController implements IEnergyHandler {
|
||||||
|
|
||||||
|
public static EnergyController Instance = new EnergyController();
|
||||||
|
|
||||||
|
private final List<IEnergyExtender> extenders = new ArrayList<>();
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// HANDLER REGISTRATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public void registerExtender(IEnergyExtender handler) {
|
||||||
|
extenders.add(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IEnergyExtender> getExtenders() {
|
||||||
|
return extenders;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// DAMAGE ROUTING
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire onEnergyDamage on all handlers. Chain of responsibility — first true wins.
|
||||||
|
*/
|
||||||
|
public boolean fireOnEnergyDamage(IEntity energyEntity, IEntityLivingBase owner,
|
||||||
|
IEntityLivingBase target, float damage,
|
||||||
|
float knockback, float knockbackUp,
|
||||||
|
double kbDirX, double kbDirZ,
|
||||||
|
float damageMultiplier,
|
||||||
|
INbt damageData) {
|
||||||
|
for (IEnergyExtender handler : extenders) {
|
||||||
|
if (handler.onEnergyDamage(energyEntity, owner, target, damage,
|
||||||
|
knockback, knockbackUp, kbDirX, kbDirZ, damageMultiplier, damageData)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fire modifyEnergyDamage on all handlers. Cumulative — each handler's output feeds the next.
|
||||||
|
*/
|
||||||
|
public float fireModifyEnergyDamage(IEntity energyEntity, IEntityLivingBase owner,
|
||||||
|
float baseDamage, INbt damageData) {
|
||||||
|
float damage = baseDamage;
|
||||||
|
for (IEnergyExtender handler : extenders) {
|
||||||
|
damage = handler.modifyEnergyDamage(energyEntity, owner, damage, damageData);
|
||||||
|
}
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// INTERNAL FACTORY METHODS (MC types)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public EntityAbilityOrb createOrbInternal(IWorld IWorld, IEntity owner, double x, double y, double z, float size) {
|
||||||
|
EntityAbilityOrb IEntity = new EntityAbilityOrb(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setStartPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
IEntity.setProjectileSize(size);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAbilityBeam createBeamInternal(IWorld IWorld, IEntity owner, double x, double y, double z,
|
||||||
|
float beamWidth, float headSize) {
|
||||||
|
EntityAbilityBeam IEntity = new EntityAbilityBeam(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setStartPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
IEntity.setBeamWidth(beamWidth);
|
||||||
|
IEntity.setHeadSize(headSize);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAbilityDisc createDiscInternal(IWorld IWorld, IEntity owner, double x, double y, double z,
|
||||||
|
float radius, float thickness) {
|
||||||
|
EntityAbilityDisc IEntity = new EntityAbilityDisc(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setStartPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
IEntity.setDiscRadius(radius);
|
||||||
|
IEntity.setDiscThickness(thickness);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAbilityLaser createLaserInternal(IWorld IWorld, IEntity owner, double x, double y, double z,
|
||||||
|
float laserWidth) {
|
||||||
|
EntityAbilityLaser IEntity = new EntityAbilityLaser(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setStartPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
IEntity.setLaserWidth(laserWidth);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAbilityZone createHazardInternal(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityAbilityZone IEntity = new EntityAbilityZone(IWorld);
|
||||||
|
IEntity.initAsHazard(owner, x, y, z);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityAbilityZone createTrapInternal(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityAbilityZone IEntity = new EntityAbilityZone(IWorld);
|
||||||
|
IEntity.initAsTrap(owner, x, y, z);
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityEnergySweeper createSweeperInternal(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityEnergySweeper IEntity = new EntityEnergySweeper(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityEnergyPanel createPanelInternal(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityEnergyPanel IEntity = new EntityEnergyPanel(IWorld);
|
||||||
|
IEntity.setPosition(x, y, z);
|
||||||
|
IEntity.setOwnerEntityId(owner.getEntityId());
|
||||||
|
return IEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityEnergyExplosion createExplosionInternal(IWorld IWorld, IEntity owner, double x, double y, double z, float radius) {
|
||||||
|
return new EntityEnergyExplosion(IWorld, owner, x, y, z, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// IEnergyHandler (Script API methods)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyOrb createOrb(IWorld IWorld, IEntity owner, double x, double y, double z, float size) {
|
||||||
|
EntityAbilityOrb IEntity = createOrbInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z, size);
|
||||||
|
return (IEnergyOrb) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyBeam createBeam(IWorld IWorld, IEntity owner, double x, double y, double z, float beamWidth, float headSize) {
|
||||||
|
EntityAbilityBeam IEntity = createBeamInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z, beamWidth, headSize);
|
||||||
|
return (IEnergyBeam) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyDisc createDisc(IWorld IWorld, IEntity owner, double x, double y, double z, float radius, float thickness) {
|
||||||
|
EntityAbilityDisc IEntity = createDiscInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z, radius, thickness);
|
||||||
|
return (IEnergyDisc) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyLaser createLaser(IWorld IWorld, IEntity owner, double x, double y, double z, float laserWidth) {
|
||||||
|
EntityAbilityLaser IEntity = createLaserInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z, laserWidth);
|
||||||
|
return (IEnergyLaser) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyZone createHazard(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityAbilityZone IEntity = createHazardInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z);
|
||||||
|
return (IEnergyZone) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyZone createTrap(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityAbilityZone IEntity = createTrapInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z);
|
||||||
|
return (IEnergyZone) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergySweeper createSweeper(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityEnergySweeper IEntity = createSweeperInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z);
|
||||||
|
return (IEnergySweeper) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyPanel createPanel(IWorld IWorld, IEntity owner, double x, double y, double z) {
|
||||||
|
EntityEnergyPanel IEntity = createPanelInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z);
|
||||||
|
return (IEnergyPanel) NpcAPI.Instance().getIEntity(IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IEnergyExplosion createExplosion(IWorld IWorld, IEntity owner, double x, double y, double z, float radius) {
|
||||||
|
EntityEnergyExplosion IEntity = createExplosionInternal((IWorld) IWorld.getMCWorld(), owner.getMCEntity(), x, y, z, radius);
|
||||||
|
return new ScriptEnergyExplosion<>(IEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,854 @@
|
|||||||
|
package kamkeel.npcs.controllers;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.CNPCData;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.EnumProfileOperation;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.IProfileData;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.Profile;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.ProfileInfoEntry;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.ProfileOperation;
|
||||||
|
import kamkeel.npcs.controllers.data.profile.Slot;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.handler.data.IProfile;
|
||||||
|
import noppes.npcs.api.handler.data.ISlot;
|
||||||
|
import noppes.npcs.api.handler.IPlayerData;
|
||||||
|
import noppes.npcs.api.handler.IProfileHandler;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.config.ConfigMain;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||||
|
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||||
|
import noppes.npcs.controllers.QuestController;
|
||||||
|
import noppes.npcs.controllers.ScriptController;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
|
import noppes.npcs.CustomNpcsPermissions;
|
||||||
|
import noppes.npcs.EventHooks;
|
||||||
|
import noppes.npcs.LogWriter;
|
||||||
|
import noppes.npcs.NoppesUtilServer;
|
||||||
|
import noppes.npcs.util.CustomNPCsThreader;
|
||||||
|
import noppes.npcs.util.NBTJsonUtil;
|
||||||
|
|
||||||
|
public class ProfileController implements IProfileHandler {
|
||||||
|
|
||||||
|
// Message constants
|
||||||
|
private static final String MSG_PLAYER_NOT_FOUND = "Player not found.";
|
||||||
|
private static final String MSG_PROFILE_LOCKED_CLONE = "Profile is locked; cannot clone slot.";
|
||||||
|
private static final String MSG_SOURCE_SLOT_NOT_EXIST = "Source slot does not exist.";
|
||||||
|
private static final String MSG_CANNOT_CLONE_CURRENT = "Cannot clone to the current active slot.";
|
||||||
|
private static final String MSG_INVALID_DEST_SLOT = "Invalid destination slot id.";
|
||||||
|
private static final String MSG_CLONE_SUCCESS = "Slot cloned successfully.";
|
||||||
|
private static final String MSG_PROFILE_LOCKED_REMOVE = "Profile is locked; cannot remove slot.";
|
||||||
|
private static final String MSG_CANNOT_REMOVE_ACTIVE = "Cannot remove the currently active slot.";
|
||||||
|
private static final String MSG_SLOT_NOT_EXIST = "Slot does not exist.";
|
||||||
|
private static final String MSG_REMOVE_SUCCESS = "Slot removed successfully.";
|
||||||
|
private static final String MSG_PROFILE_LOCKED_CREATE = "Profile is locked; cannot create slot.";
|
||||||
|
private static final String MSG_MAX_SLOTS_REACHED = "Maximum allowed slots reached.";
|
||||||
|
private static final String MSG_NEW_SLOT_CREATED = "New slot created successfully.";
|
||||||
|
private static final String MSG_PROFILE_LOCKED_CHANGE = "Profile is locked; cannot change slot.";
|
||||||
|
private static final String MSG_SLOT_ALREADY_ACTIVE = "Slot is already active.";
|
||||||
|
private static final String MSG_REGION_NOT_ALLOWED = "Profile switching not allowed from your current location.";
|
||||||
|
private static final String MSG_CHANGE_SUCCESS = "Slot changed successfully.";
|
||||||
|
private static final String MSG_CANCELLED = "Operation cancelled.";
|
||||||
|
|
||||||
|
public static Map<String, IProfileData> profileTypes = new HashMap<>();
|
||||||
|
public static Map<UUID, Profile> activeProfiles = new HashMap<>();
|
||||||
|
public static String profile_directory = "profiles";
|
||||||
|
|
||||||
|
public static ProfileController Instance;
|
||||||
|
|
||||||
|
public ProfileController() {
|
||||||
|
Instance = this;
|
||||||
|
profileTypes = new HashMap<>();
|
||||||
|
activeProfiles = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean registerProfileType(IProfileData type) {
|
||||||
|
if (profileTypes.containsKey(type.getTagName()))
|
||||||
|
return false;
|
||||||
|
profileTypes.put(type.getTagName(), type);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File getProfileDir() {
|
||||||
|
try {
|
||||||
|
File file = new File(CustomNpcs.getWorldSaveDirectory(), profile_directory);
|
||||||
|
if (!file.exists())
|
||||||
|
file.mkdir();
|
||||||
|
return file;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File getBackupDir() {
|
||||||
|
File base = getProfileDir();
|
||||||
|
File backup = new File(base, "backup");
|
||||||
|
if (!backup.exists()) {
|
||||||
|
backup.mkdir();
|
||||||
|
}
|
||||||
|
return backup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void login(IPlayer player) {
|
||||||
|
if (!ConfigMain.ProfilesEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (player == null)
|
||||||
|
return;
|
||||||
|
Profile profile;
|
||||||
|
if (activeProfiles.containsKey(player.getUniqueID())) {
|
||||||
|
profile = activeProfiles.get(player.getUniqueID());
|
||||||
|
profile.player = player;
|
||||||
|
} else {
|
||||||
|
INbt compound = load(player);
|
||||||
|
profile = new Profile(player, compound);
|
||||||
|
if (profile.getSlots().isEmpty()) {
|
||||||
|
Slot defaultSlot = new Slot(0, "Default Slot");
|
||||||
|
defaultSlot.setLastLoaded(System.currentTimeMillis());
|
||||||
|
profile.getSlots().put(0, defaultSlot);
|
||||||
|
profile.currentSlotId = 0;
|
||||||
|
saveSlotData(player);
|
||||||
|
}
|
||||||
|
if (!profile.getSlots().containsKey(profile.currentSlotId)) {
|
||||||
|
profile.currentSlotId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.player = player;
|
||||||
|
activeProfiles.put(player.getUniqueID(), profile);
|
||||||
|
|
||||||
|
PlayerData pdata = PlayerData.get(player);
|
||||||
|
if (profile.getSlots().containsKey(pdata.profileSlot)) {
|
||||||
|
profile.currentSlotId = pdata.profileSlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSlotData(player);
|
||||||
|
verifySlotQuests(profile.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized INbt load(IPlayer player) {
|
||||||
|
File saveDir = getProfileDir();
|
||||||
|
String filename = player.getUniqueID().toString() + ".dat";
|
||||||
|
try {
|
||||||
|
File file = new File(saveDir, filename);
|
||||||
|
if (file.exists()) {
|
||||||
|
return NBTJsonUtil.loadNBTData(file);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.error("Error loading profile file: " + filename, e);
|
||||||
|
}
|
||||||
|
return new INbt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized INbt load(UUID uuid) {
|
||||||
|
File saveDir = getProfileDir();
|
||||||
|
String filename = uuid.toString() + ".dat";
|
||||||
|
try {
|
||||||
|
File file = new File(saveDir, filename);
|
||||||
|
if (file.exists()) {
|
||||||
|
return NBTJsonUtil.loadNBTData(file);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.error("Error loading profile file: " + filename, e);
|
||||||
|
}
|
||||||
|
return new INbt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void saveOffline(Profile profile, UUID uuid) {
|
||||||
|
profile.setLocked(true);
|
||||||
|
final INbt compound = profile.writeToNBT();
|
||||||
|
final String filename = uuid.toString() + ".dat";
|
||||||
|
CustomNPCsThreader.customNPCThread.execute(() -> {
|
||||||
|
try {
|
||||||
|
File saveDir = getProfileDir();
|
||||||
|
File fileNew = new File(saveDir, filename + "_new");
|
||||||
|
File fileOld = new File(saveDir, filename);
|
||||||
|
NBTIO.writeCompressed(compound, new FileOutputStream(fileNew));
|
||||||
|
if (fileOld.exists()) {
|
||||||
|
fileOld.delete();
|
||||||
|
}
|
||||||
|
fileNew.renameTo(fileOld);
|
||||||
|
backupProfile(uuid, compound);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.except(e);
|
||||||
|
} finally {
|
||||||
|
profile.setLocked(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void save(IPlayer player, Profile profile) {
|
||||||
|
profile.setLocked(true);
|
||||||
|
final INbt compound = profile.writeToNBT();
|
||||||
|
final String filename = player.getUniqueID() + ".dat";
|
||||||
|
CustomNPCsThreader.customNPCThread.execute(() -> {
|
||||||
|
try {
|
||||||
|
File saveDir = getProfileDir();
|
||||||
|
File fileNew = new File(saveDir, filename + "_new");
|
||||||
|
File fileOld = new File(saveDir, filename);
|
||||||
|
NBTIO.writeCompressed(compound, new FileOutputStream(fileNew));
|
||||||
|
if (fileOld.exists()) {
|
||||||
|
fileOld.delete();
|
||||||
|
}
|
||||||
|
fileNew.renameTo(fileOld);
|
||||||
|
if (ConfigMain.AllowProfileBackups) {
|
||||||
|
backupProfile(player.getUniqueID(), compound);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.except(e);
|
||||||
|
} finally {
|
||||||
|
profile.setLocked(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void backupProfile(UUID uuid, INbt compound) {
|
||||||
|
try {
|
||||||
|
File backupDir = new File(getBackupDir(), uuid.toString());
|
||||||
|
if (!backupDir.exists()) {
|
||||||
|
backupDir.mkdirs();
|
||||||
|
}
|
||||||
|
String dateStr = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
||||||
|
File backupFile = new File(backupDir, dateStr + ".dat");
|
||||||
|
NBTIO.writeCompressed(compound, new FileOutputStream(backupFile));
|
||||||
|
File[] backups = backupDir.listFiles((dir, name) -> name.endsWith(".dat"));
|
||||||
|
if (backups != null && backups.length > ConfigMain.ProfileBackupAmount) {
|
||||||
|
Arrays.sort(backups, Comparator.comparingLong(File::lastModified));
|
||||||
|
for (int i = 0; i < backups.length - ConfigMain.ProfileBackupAmount; i++) {
|
||||||
|
backups[i].delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.except(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean rollbackProfile(String username, File backupFile) {
|
||||||
|
UUID uuid = getUUIDFromUsername(username);
|
||||||
|
if (uuid == null)
|
||||||
|
return false;
|
||||||
|
try (FileInputStream fis = new FileInputStream(backupFile)) {
|
||||||
|
INbt compound = NBTIO.readCompressed(fis);
|
||||||
|
File saveDir = getProfileDir();
|
||||||
|
File mainFile = new File(saveDir, uuid.toString() + ".dat");
|
||||||
|
File fileNew = new File(saveDir, uuid.toString() + "_new");
|
||||||
|
NBTIO.writeCompressed(compound, new FileOutputStream(fileNew));
|
||||||
|
if (mainFile.exists()) {
|
||||||
|
mainFile.delete();
|
||||||
|
}
|
||||||
|
fileNew.renameTo(mainFile);
|
||||||
|
IPlayer player = NoppesUtilServer.getPlayerByName(username);
|
||||||
|
Profile newProfile;
|
||||||
|
if (player != null) {
|
||||||
|
newProfile = new Profile(player, compound);
|
||||||
|
activeProfiles.put(uuid, newProfile);
|
||||||
|
loadSlotData(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.except(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void logout(IPlayer player) {
|
||||||
|
if (player != null && activeProfiles.containsKey(player.getUniqueID())) {
|
||||||
|
saveSlotData(player);
|
||||||
|
Profile profile = activeProfiles.get(player.getUniqueID());
|
||||||
|
save(player, profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profile getProfile(IPlayer player) {
|
||||||
|
if (player == null)
|
||||||
|
return null;
|
||||||
|
if (!activeProfiles.containsKey(player.getUniqueID()))
|
||||||
|
login(player);
|
||||||
|
return activeProfiles.get(player.getUniqueID());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profile getProfile(UUID uuid) {
|
||||||
|
if (activeProfiles.containsKey(uuid))
|
||||||
|
return activeProfiles.get(uuid);
|
||||||
|
INbt compound = load(uuid);
|
||||||
|
return new Profile(null, compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profile getProfile(String username) {
|
||||||
|
IPlayer player = NoppesUtilServer.getPlayerByName(username);
|
||||||
|
if (player != null) {
|
||||||
|
return getProfile(player);
|
||||||
|
} else {
|
||||||
|
UUID uuid = getUUIDFromUsername(username);
|
||||||
|
if (uuid == null)
|
||||||
|
return null;
|
||||||
|
return getProfile(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UUID getUUIDFromUsername(String username) {
|
||||||
|
try {
|
||||||
|
URL url = new URL("https://api.mojang.com/users/profiles/minecraft/" + username);
|
||||||
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
|
con.setRequestMethod("GET");
|
||||||
|
con.setConnectTimeout(5000);
|
||||||
|
con.setReadTimeout(5000);
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
|
StringBuilder temp = new StringBuilder();
|
||||||
|
String line;
|
||||||
|
while ((line = in.readLine()) != null) {
|
||||||
|
temp.append(line);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
con.disconnect();
|
||||||
|
String response = temp.toString();
|
||||||
|
if (response.contains("\"id\"")) {
|
||||||
|
int idIndex = response.indexOf("\"id\"");
|
||||||
|
int colonIndex = response.indexOf(":", idIndex);
|
||||||
|
int quoteStart = response.indexOf("\"", colonIndex);
|
||||||
|
int quoteEnd = response.indexOf("\"", quoteStart + 1);
|
||||||
|
String idString = response.substring(quoteStart + 1, quoteEnd);
|
||||||
|
idString = idString.replaceFirst(
|
||||||
|
"(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)",
|
||||||
|
"$1-$2-$3-$4-$5"
|
||||||
|
);
|
||||||
|
return UUID.fromString(idString);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogWriter.error("Error retrieving UUID for " + username, e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getNextAvailableTempSlot(Profile profile) {
|
||||||
|
int id = -1;
|
||||||
|
while (profile.getSlots().containsKey(id)) {
|
||||||
|
id--;
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProfileOperation cloneSlotInternal(Profile profile, int sourceSlotId, int destinationSlotId, boolean temporary) {
|
||||||
|
if (profile.isLocked()) {
|
||||||
|
return ProfileOperation.locked(MSG_PROFILE_LOCKED_CLONE);
|
||||||
|
}
|
||||||
|
if (profile.player != null) {
|
||||||
|
List<IProfileData> dataList = new ArrayList<>(profileTypes.values());
|
||||||
|
dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority));
|
||||||
|
for (IProfileData pd : dataList) {
|
||||||
|
if (pd.verifySwitch(profile.player).getResult() != EnumProfileOperation.SUCCESS) {
|
||||||
|
return pd.verifySwitch(profile.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!profile.getSlots().containsKey(sourceSlotId)) {
|
||||||
|
return ProfileOperation.error(MSG_SOURCE_SLOT_NOT_EXIST);
|
||||||
|
}
|
||||||
|
if (destinationSlotId == profile.getCurrentSlotId()) {
|
||||||
|
return ProfileOperation.error(MSG_CANNOT_CLONE_CURRENT);
|
||||||
|
}
|
||||||
|
if (temporary) {
|
||||||
|
destinationSlotId = getNextAvailableTempSlot(profile);
|
||||||
|
} else {
|
||||||
|
if (destinationSlotId <= 0) {
|
||||||
|
return ProfileOperation.error(MSG_INVALID_DEST_SLOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ISlot sourceSlot = profile.getSlots().get(sourceSlotId);
|
||||||
|
Map<String, INbt> newComponents = new HashMap<>();
|
||||||
|
for (String key : sourceSlot.getComponents().keySet()) {
|
||||||
|
newComponents.put(key, (INbt) sourceSlot.getComponentData(key).copy());
|
||||||
|
}
|
||||||
|
Slot clonedSlot = new Slot(destinationSlotId, "Cloned Slot " + destinationSlotId, System.currentTimeMillis(), temporary, newComponents);
|
||||||
|
profile.getSlots().put(destinationSlotId, clonedSlot);
|
||||||
|
return ProfileOperation.success(MSG_CLONE_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProfileOperation removeSlotInternal(Profile profile, int slotId) {
|
||||||
|
if (profile.isLocked()) {
|
||||||
|
return ProfileOperation.locked(MSG_PROFILE_LOCKED_REMOVE);
|
||||||
|
}
|
||||||
|
if (slotId == profile.getCurrentSlotId()) {
|
||||||
|
return ProfileOperation.error(MSG_CANNOT_REMOVE_ACTIVE);
|
||||||
|
}
|
||||||
|
if (!profile.getSlots().containsKey(slotId)) {
|
||||||
|
return ProfileOperation.error(MSG_SLOT_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile.player != null) {
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(profile.player);
|
||||||
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(profile.player);
|
||||||
|
if (EventHooks.onProfileRemove(handler, scriptPlayer, profile, slotId, false))
|
||||||
|
return ProfileOperation.error(MSG_CANCELLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
profile.getSlots().remove(slotId);
|
||||||
|
|
||||||
|
if (profile.player != null) {
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(profile.player);
|
||||||
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(profile.player);
|
||||||
|
EventHooks.onProfileRemove(handler, scriptPlayer, profile, slotId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ProfileOperation.success(MSG_REMOVE_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation createSlotInternal(Profile profile) {
|
||||||
|
if (profile.isLocked()) {
|
||||||
|
return ProfileOperation.locked(MSG_PROFILE_LOCKED_CREATE);
|
||||||
|
}
|
||||||
|
int newSlotId = 0;
|
||||||
|
while (profile.getSlots().containsKey(newSlotId)) {
|
||||||
|
newSlotId++;
|
||||||
|
}
|
||||||
|
if (!allowSlotPermission(profile.player)) {
|
||||||
|
return ProfileOperation.error(MSG_MAX_SLOTS_REACHED);
|
||||||
|
}
|
||||||
|
if (profile.player != null) {
|
||||||
|
List<IProfileData> dataList = new ArrayList<>(profileTypes.values());
|
||||||
|
dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority));
|
||||||
|
for (IProfileData pd : dataList) {
|
||||||
|
if (pd.verifySwitch(profile.player).getResult() != EnumProfileOperation.SUCCESS) {
|
||||||
|
return pd.verifySwitch(profile.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile.player != null) {
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(profile.player);
|
||||||
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(profile.player);
|
||||||
|
if (EventHooks.onProfileCreate(handler, scriptPlayer, profile, newSlotId, false))
|
||||||
|
return ProfileOperation.error(MSG_CANCELLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
Slot newSlot = new Slot(newSlotId, "Slot " + newSlotId);
|
||||||
|
newSlot.setLastLoaded(System.currentTimeMillis());
|
||||||
|
profile.getSlots().put(newSlotId, newSlot);
|
||||||
|
if (profile.player != null) {
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(profile.player);
|
||||||
|
verifySlotQuests(profile.player);
|
||||||
|
save(profile.player, profile);
|
||||||
|
if (profile.player instanceof IPlayer) {
|
||||||
|
ProfileSharedQuestPacket.sendToPlayer((IPlayer) profile.player);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(profile.player);
|
||||||
|
EventHooks.onProfileCreate(handler, scriptPlayer, profile, newSlotId, true);
|
||||||
|
}
|
||||||
|
return ProfileOperation.success(MSG_NEW_SLOT_CREATED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ProfileOperation changeSlotInternal(Profile profile, int newSlotId) {
|
||||||
|
if (profile.isLocked()) {
|
||||||
|
return ProfileOperation.locked(MSG_PROFILE_LOCKED_CHANGE);
|
||||||
|
}
|
||||||
|
if (profile.getCurrentSlotId() == newSlotId) {
|
||||||
|
return ProfileOperation.error(MSG_SLOT_ALREADY_ACTIVE);
|
||||||
|
}
|
||||||
|
if (!profile.getSlots().containsKey(newSlotId)) {
|
||||||
|
return ProfileOperation.error(MSG_SLOT_NOT_EXIST);
|
||||||
|
}
|
||||||
|
if (profile.player != null) {
|
||||||
|
if (ConfigMain.RegionProfileSwitching) {
|
||||||
|
boolean allowed = hasCustomPermission(profile.player, PROFILE_REGION_BYPASS.name);
|
||||||
|
if (!allowed) {
|
||||||
|
int playerDim = profile.player.dimension;
|
||||||
|
int playerX = (int) profile.player.posX;
|
||||||
|
int playerY = (int) profile.player.posY;
|
||||||
|
int playerZ = (int) profile.player.posZ;
|
||||||
|
for (List<Integer> region : ConfigMain.RestrictedProfileRegions) {
|
||||||
|
if (region.size() == 7) {
|
||||||
|
int dim = region.get(0);
|
||||||
|
int x1 = Math.min(region.get(1), region.get(4));
|
||||||
|
int y1 = Math.min(region.get(2), region.get(5));
|
||||||
|
int z1 = Math.min(region.get(3), region.get(6));
|
||||||
|
int x2 = Math.max(region.get(1), region.get(4));
|
||||||
|
int y2 = Math.max(region.get(2), region.get(5));
|
||||||
|
int z2 = Math.max(region.get(3), region.get(6));
|
||||||
|
if (playerDim == dim &&
|
||||||
|
playerX >= x1 && playerX <= x2 &&
|
||||||
|
playerY >= y1 && playerY <= y2 &&
|
||||||
|
playerZ >= z1 && playerZ <= z2) {
|
||||||
|
allowed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!allowed) {
|
||||||
|
return ProfileOperation.error(MSG_REGION_NOT_ALLOWED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<IProfileData> dataList = new ArrayList<>(profileTypes.values());
|
||||||
|
dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority));
|
||||||
|
for (IProfileData pd : dataList) {
|
||||||
|
if (pd.verifySwitch(profile.player).getResult() != EnumProfileOperation.SUCCESS) {
|
||||||
|
return pd.verifySwitch(profile.player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int prevSlot = profile.getCurrentSlotId();
|
||||||
|
|
||||||
|
PlayerDataScript handler = ScriptController.Instance.getPlayerScripts(profile.player);
|
||||||
|
IPlayer scriptPlayer = (IPlayer) NpcAPI.Instance().getIEntity(profile.player);
|
||||||
|
if (EventHooks.onProfileChange(handler, scriptPlayer, profile, newSlotId, prevSlot, false))
|
||||||
|
return ProfileOperation.error(MSG_CANCELLED);
|
||||||
|
|
||||||
|
// Persist the outgoing slot using its original id. Previously we relied on
|
||||||
|
// profile.currentSlotId inside saveSlotData, but scripts firing during the
|
||||||
|
// transition could change the active slot before the save completed and
|
||||||
|
// overwrite the destination slot with stale data.
|
||||||
|
saveSlotData(profile.player, profile, prevSlot);
|
||||||
|
loadSlotData(profile.player, profile, newSlotId);
|
||||||
|
syncSharedQuestsToPlayer(profile.player);
|
||||||
|
if (profile.player instanceof IPlayer) {
|
||||||
|
ProfileSharedQuestPacket.sendToPlayer((IPlayer) profile.player);
|
||||||
|
}
|
||||||
|
|
||||||
|
EventHooks.onProfileChange(handler, scriptPlayer, profile, newSlotId, prevSlot, true);
|
||||||
|
} else {
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
return ProfileOperation.success(MSG_CHANGE_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation cloneSlot(IPlayer player, int sourceSlotId, int destinationSlotId, boolean temporary) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = cloneSlotInternal(profile, sourceSlotId, destinationSlotId, temporary);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS && player != null) {
|
||||||
|
save(player, profile);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation cloneSlot(UUID uuid, int sourceSlotId, int destinationSlotId, boolean temporary) {
|
||||||
|
Profile profile = getProfile(uuid);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = cloneSlotInternal(profile, sourceSlotId, destinationSlotId, temporary);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS) {
|
||||||
|
if (profile.player != null)
|
||||||
|
save(profile.player, profile);
|
||||||
|
else
|
||||||
|
saveOffline(profile, uuid);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation cloneSlot(String username, int sourceSlotId, int destinationSlotId, boolean temporary) {
|
||||||
|
Profile profile = getProfile(username);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = cloneSlotInternal(profile, sourceSlotId, destinationSlotId, temporary);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS) {
|
||||||
|
if (profile.player != null)
|
||||||
|
save(profile.player, profile);
|
||||||
|
else {
|
||||||
|
UUID uuid = getUUIDFromUsername(username);
|
||||||
|
if (uuid != null)
|
||||||
|
saveOffline(profile, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation removeSlot(IPlayer player, int slotId) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = removeSlotInternal(profile, slotId);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS && player != null) {
|
||||||
|
save(player, profile);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation removeSlot(String username, int slotId) {
|
||||||
|
Profile profile = getProfile(username);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = removeSlotInternal(profile, slotId);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS) {
|
||||||
|
if (profile.player != null)
|
||||||
|
save(profile.player, profile);
|
||||||
|
else {
|
||||||
|
UUID uuid = getUUIDFromUsername(username);
|
||||||
|
if (uuid != null)
|
||||||
|
saveOffline(profile, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation changeSlot(IPlayer player, int newSlotId) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = changeSlotInternal(profile, newSlotId);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS && player != null)
|
||||||
|
save(player, profile);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProfileOperation changeSlot(String username, int newSlotId) {
|
||||||
|
Profile profile = getProfile(username);
|
||||||
|
if (profile == null)
|
||||||
|
return ProfileOperation.error(MSG_PLAYER_NOT_FOUND);
|
||||||
|
ProfileOperation result = changeSlotInternal(profile, newSlotId);
|
||||||
|
if (result.getResult() == EnumProfileOperation.SUCCESS) {
|
||||||
|
if (profile.player != null)
|
||||||
|
save(profile.player, profile);
|
||||||
|
else {
|
||||||
|
UUID uuid = getUUIDFromUsername(username);
|
||||||
|
if (uuid != null)
|
||||||
|
saveOffline(profile, uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveSlotData(IPlayer player, Profile profile, int slotId) {
|
||||||
|
if (player == null || profile == null)
|
||||||
|
return;
|
||||||
|
if (profile.isLocked()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ISlot slot = profile.getSlots().get(slotId);
|
||||||
|
if (slot == null) {
|
||||||
|
slot = new Slot(slotId, "Slot " + slotId);
|
||||||
|
profile.getSlots().put(slotId, slot);
|
||||||
|
}
|
||||||
|
for (IProfileData profileData : profileTypes.values()) {
|
||||||
|
INbt cloned = (INbt) profileData.getCurrentNBT(player).copy();
|
||||||
|
slot.setComponentData(profileData.getTagName(), cloned);
|
||||||
|
}
|
||||||
|
slot.setLastLoaded(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveSlotData(IPlayer player) {
|
||||||
|
if (player == null || !activeProfiles.containsKey(player.getUniqueID()))
|
||||||
|
return;
|
||||||
|
Profile profile = activeProfiles.get(player.getUniqueID());
|
||||||
|
saveSlotData(player, profile, profile.getCurrentSlotId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadSlotData(IPlayer player, Profile profile, int slotId) {
|
||||||
|
if (player == null || profile == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ISlot slot = profile.getSlots().get(slotId);
|
||||||
|
if (slot == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (IProfileData profileData : profileTypes.values()) {
|
||||||
|
INbt data;
|
||||||
|
if (slot.getComponents().containsKey(profileData.getTagName()))
|
||||||
|
data = (INbt) slot.getComponentData(profileData.getTagName()).copy();
|
||||||
|
else
|
||||||
|
data = new INbt();
|
||||||
|
profileData.setNBT(player, data);
|
||||||
|
}
|
||||||
|
for (IProfileData profileData : profileTypes.values()) {
|
||||||
|
profileData.save(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only flip the active slot after the player's live data matches the
|
||||||
|
// requested slot. This way, any additional saveSlotData() calls triggered by
|
||||||
|
// scripts during the load can't persist stale information to the new slot.
|
||||||
|
profile.currentSlotId = slotId;
|
||||||
|
|
||||||
|
PlayerData pdata = PlayerData.get(player);
|
||||||
|
pdata.profileSlot = slotId;
|
||||||
|
pdata.save();
|
||||||
|
|
||||||
|
if (ConfigMain.AttributesEnabled)
|
||||||
|
AttributeController.getTracker(player).recalcAttributes(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadSlotData(IPlayer player) {
|
||||||
|
if (player == null || !activeProfiles.containsKey(player.getUniqueID()))
|
||||||
|
return;
|
||||||
|
Profile profile = activeProfiles.get(player.getUniqueID());
|
||||||
|
// Delay flipping profile.currentSlotId until after the data for the target slot
|
||||||
|
// has been restored to the player so other saves observe consistent state.
|
||||||
|
loadSlotData(player, profile, profile.getCurrentSlotId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProfileInfoEntry> getProfileInfo(IPlayer player, int slotId) {
|
||||||
|
List<ProfileInfoEntry> infoList = new ArrayList<>();
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null)
|
||||||
|
return infoList;
|
||||||
|
|
||||||
|
List<IProfileData> dataList = new ArrayList<>(profileTypes.values());
|
||||||
|
dataList.sort(Comparator.comparingInt(IProfileData::getSwitchPriority));
|
||||||
|
if (slotId == profile.getCurrentSlotId()) {
|
||||||
|
for (IProfileData pd : dataList) {
|
||||||
|
INbt currentNBT = pd.getCurrentNBT(player);
|
||||||
|
List<ProfileInfoEntry> subInfo = pd.getInfo(player, currentNBT);
|
||||||
|
infoList.addAll(subInfo);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!profile.getSlots().containsKey(slotId))
|
||||||
|
return infoList;
|
||||||
|
ISlot slot = profile.getSlots().get(slotId);
|
||||||
|
for (IProfileData pd : dataList) {
|
||||||
|
if (slot.getComponents().containsKey(pd.getTagName())) {
|
||||||
|
INbt sub = (INbt) slot.getComponentData(pd.getTagName()).copy();
|
||||||
|
List<ProfileInfoEntry> subInfo = pd.getInfo(player, sub);
|
||||||
|
infoList.addAll(subInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return infoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean allowSlotPermission(IPlayer player) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
int currentSlots = profile.getSlots().size();
|
||||||
|
if (CustomNpcsPermissions.hasCustomPermission(player, PROFILE_MAX.name)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int highestAllowed = 0;
|
||||||
|
for (int i = 1; i <= 50; i++) {
|
||||||
|
String perm = "customnpcs.profile.max." + i;
|
||||||
|
if (CustomNpcsPermissions.hasCustomPermission(player, perm)) {
|
||||||
|
highestAllowed = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (highestAllowed == 0 || highestAllowed < ConfigMain.DefaultProfileSlots) {
|
||||||
|
highestAllowed = ConfigMain.DefaultProfileSlots;
|
||||||
|
}
|
||||||
|
return currentSlots < highestAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IPlayerData getSlotPlayerData(IPlayer player, int slotID) {
|
||||||
|
PlayerData playerData;
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (profile.currentSlotId == slotID) {
|
||||||
|
playerData = PlayerData.get(player);
|
||||||
|
} else {
|
||||||
|
Slot slot = (Slot) profile.getSlots().get(slotID);
|
||||||
|
playerData = getSlotPlayerData(player, slot);
|
||||||
|
}
|
||||||
|
return playerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerData getSlotPlayerData(IPlayer player, Slot slot) {
|
||||||
|
if (slot == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
PlayerData playerData = new PlayerData();
|
||||||
|
playerData.player = player;
|
||||||
|
|
||||||
|
INbt compound = slot.getComponentData(new CNPCData().getTagName());
|
||||||
|
if (compound == null)
|
||||||
|
compound = new INbt();
|
||||||
|
else
|
||||||
|
compound = (INbt) compound.copy();
|
||||||
|
playerData.setNBT(compound);
|
||||||
|
return playerData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void verifySlotQuests(IPlayer player) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Integer, Long> universalFinished = new HashMap<>();
|
||||||
|
for (Integer questId : QuestController.Instance.sharedQuests.keySet()) {
|
||||||
|
long maxTime = 0;
|
||||||
|
for (ISlot slot : profile.getSlots().values()) {
|
||||||
|
IPlayerData data = getSlotPlayerData(player, slot.getId());
|
||||||
|
if (data == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
PlayerQuestData questData = (PlayerQuestData) data.getQuestData();
|
||||||
|
Long t = questData.finishedQuests.get(questId);
|
||||||
|
if (t != null && t > maxTime) {
|
||||||
|
maxTime = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxTime > 0) {
|
||||||
|
universalFinished.put(questId, maxTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the profile cache
|
||||||
|
profile.sharedQuestTimestamps = universalFinished;
|
||||||
|
|
||||||
|
// Push the universal shared completion times into every slot.
|
||||||
|
for (ISlot slot : profile.getSlots().values()) {
|
||||||
|
IPlayerData data = getSlotPlayerData(player, slot.getId());
|
||||||
|
if (data != null) {
|
||||||
|
PlayerData playerData = (PlayerData) data;
|
||||||
|
PlayerQuestData questData = (PlayerQuestData) data.getQuestData();
|
||||||
|
questData.finishedQuests.putAll(universalFinished);
|
||||||
|
slot.setComponentData(new CNPCData().getTagName(), playerData.getNBT());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncSharedQuestsToPlayer(IPlayer player) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null || profile.sharedQuestTimestamps.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlayerQuestData questData = PlayerData.get(player).questData;
|
||||||
|
for (Map.Entry<Integer, Long> entry : profile.sharedQuestTimestamps.entrySet()) {
|
||||||
|
Long existing = questData.finishedQuests.get(entry.getKey());
|
||||||
|
if (existing == null || entry.getValue() > existing) {
|
||||||
|
questData.finishedQuests.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shareQuestCompletion(IPlayer player, int questId, long completeTime) {
|
||||||
|
Profile profile = getProfile(player);
|
||||||
|
if (profile == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long existing = profile.sharedQuestTimestamps.get(questId);
|
||||||
|
if (existing == null || completeTime > existing) {
|
||||||
|
profile.sharedQuestTimestamps.put(questId, completeTime);
|
||||||
|
}
|
||||||
|
save(player, profile);
|
||||||
|
if (player instanceof IPlayer) {
|
||||||
|
ProfileSharedQuestPacket.sendToPlayer((IPlayer) player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,400 @@
|
|||||||
|
package kamkeel.npcs.controllers;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.handler.ITelegraphHandler;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.ITelegraph;
|
||||||
|
import noppes.npcs.api.ITelegraphInstance;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.CustomNpcs;
|
||||||
|
import noppes.npcs.LogWriter;
|
||||||
|
import noppes.npcs.util.NBTJsonUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server-side controller for managing telegraphs.
|
||||||
|
* Provides factory methods for creating telegraphs and spawn methods for sending to clients.
|
||||||
|
* Also manages saved telegraph presets.
|
||||||
|
*/
|
||||||
|
public class TelegraphController implements ITelegraphHandler {
|
||||||
|
|
||||||
|
public static TelegraphController Instance;
|
||||||
|
|
||||||
|
// Saved telegraph presets (name -> Telegraph)
|
||||||
|
private HashMap<String, Telegraph> savedTelegraphs = new HashMap<>();
|
||||||
|
|
||||||
|
// Active server-side telegraph instances (for removal tracking)
|
||||||
|
private ConcurrentHashMap<String, TelegraphInstance> activeInstances = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public TelegraphController() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
Instance = new TelegraphController();
|
||||||
|
Instance.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// INTERNAL SPAWN METHODS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph at a fixed position.
|
||||||
|
*
|
||||||
|
* @param telegraph The telegraph IConfiguration
|
||||||
|
* @param IWorld The IWorld
|
||||||
|
* @param x X position
|
||||||
|
* @param y Y position
|
||||||
|
* @param z Z position
|
||||||
|
* @param yaw Rotation yaw (for directional telegraphs like LINE/CONE)
|
||||||
|
* @return The spawned telegraph instance
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawn(Telegraph telegraph, IWorld IWorld, double x, double y, double z, float yaw) {
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, x, y, z, yaw);
|
||||||
|
instance.setWorld(IWorld);
|
||||||
|
activeInstances.put(instance.getInstanceId(), instance);
|
||||||
|
TelegraphSpawnPacket.sendToDimension(instance, IWorld.provider.dimensionId);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph at a position with default yaw.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawn(Telegraph telegraph, IWorld IWorld, double x, double y, double z) {
|
||||||
|
return spawn(telegraph, IWorld, x, y, z, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph that follows an IEntity.
|
||||||
|
*
|
||||||
|
* @param telegraph The telegraph IConfiguration
|
||||||
|
* @param IEntity The IEntity to follow
|
||||||
|
* @return The spawned telegraph instance
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawn(Telegraph telegraph, IEntity IEntity) {
|
||||||
|
return spawn(telegraph, IEntity, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph that follows an IEntity with yaw.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawn(Telegraph telegraph, IEntity IEntity, float yaw) {
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, IEntity.posX, IEntity.posY, IEntity.posZ, yaw);
|
||||||
|
instance.setWorld(IEntity.worldObj);
|
||||||
|
instance.setEntityIdToFollow(IEntity.getEntityId());
|
||||||
|
activeInstances.put(instance.getInstanceId(), instance);
|
||||||
|
TelegraphSpawnPacket.sendToTracking(instance, IEntity);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph to a specific player only.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawnToPlayer(Telegraph telegraph, IPlayer player, double x, double y, double z, float yaw) {
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, x, y, z, yaw);
|
||||||
|
instance.setWorld(player.worldObj);
|
||||||
|
activeInstances.put(instance.getInstanceId(), instance);
|
||||||
|
TelegraphSpawnPacket.send(instance, player);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph to all players on the server.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawnToAll(Telegraph telegraph, IWorld IWorld, double x, double y, double z, float yaw) {
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, x, y, z, yaw);
|
||||||
|
instance.setWorld(IWorld);
|
||||||
|
activeInstances.put(instance.getInstanceId(), instance);
|
||||||
|
TelegraphSpawnPacket.sendToAll(instance);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a telegraph to all players tracking an IEntity.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance spawnToTracking(Telegraph telegraph, IEntity IEntity, double x, double y, double z, float yaw) {
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, x, y, z, yaw);
|
||||||
|
instance.setWorld(IEntity.worldObj);
|
||||||
|
activeInstances.put(instance.getInstanceId(), instance);
|
||||||
|
TelegraphSpawnPacket.sendToTracking(instance, IEntity);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// REMOVAL METHODS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a telegraph by instance ID.
|
||||||
|
*/
|
||||||
|
public void remove(String instanceId) {
|
||||||
|
TelegraphInstance instance = activeInstances.remove(instanceId);
|
||||||
|
if (instance != null && instance.getWorld() != null) {
|
||||||
|
TelegraphRemovePacket.sendToDimension(instanceId, instance.getDimensionId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a telegraph instance.
|
||||||
|
*/
|
||||||
|
public void remove(TelegraphInstance instance) {
|
||||||
|
if (instance != null) {
|
||||||
|
remove(instance.getInstanceId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a telegraph for a specific player only.
|
||||||
|
*/
|
||||||
|
public void removeFromPlayer(String instanceId, IPlayer player) {
|
||||||
|
activeInstances.remove(instanceId);
|
||||||
|
TelegraphRemovePacket.send(instanceId, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an active telegraph instance by ID.
|
||||||
|
*/
|
||||||
|
public TelegraphInstance getActiveInstance(String instanceId) {
|
||||||
|
return activeInstances.get(instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// PRESET MANAGEMENT
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save a telegraph preset (internal use).
|
||||||
|
*
|
||||||
|
* @param name The name for the preset
|
||||||
|
* @param telegraph The telegraph IConfiguration to save
|
||||||
|
*/
|
||||||
|
public void saveInternal(String name, Telegraph telegraph) {
|
||||||
|
if (name == null || name.isEmpty() || telegraph == null) return;
|
||||||
|
|
||||||
|
telegraph.setId(name);
|
||||||
|
savedTelegraphs.put(name, telegraph);
|
||||||
|
saveTelegraphFile(name, telegraph);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a saved telegraph preset by name (internal use).
|
||||||
|
*
|
||||||
|
* @param name The preset name
|
||||||
|
* @return The telegraph IConfiguration, or null if not found
|
||||||
|
*/
|
||||||
|
public Telegraph getInternal(String name) {
|
||||||
|
return savedTelegraphs.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a saved telegraph preset.
|
||||||
|
*
|
||||||
|
* @param name The preset name
|
||||||
|
*/
|
||||||
|
public void delete(String name) {
|
||||||
|
Telegraph removed = savedTelegraphs.remove(name);
|
||||||
|
if (removed != null) {
|
||||||
|
File file = new File(getDir(), name + ".json");
|
||||||
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a preset exists.
|
||||||
|
*/
|
||||||
|
public boolean has(String name) {
|
||||||
|
return savedTelegraphs.containsKey(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all saved preset names.
|
||||||
|
*/
|
||||||
|
public String[] getSavedNames() {
|
||||||
|
return savedTelegraphs.keySet().toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// PERSISTENCE
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
private File getDir() {
|
||||||
|
return new File(CustomNpcs.getWorldSaveDirectory(), "telegraphs");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
savedTelegraphs.clear();
|
||||||
|
LogWriter.info("Loading telegraph presets...");
|
||||||
|
|
||||||
|
File dir = getDir();
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
if (files == null) return;
|
||||||
|
|
||||||
|
for (File file : files) {
|
||||||
|
if (!file.isFile() || !file.getName().endsWith(".json")) continue;
|
||||||
|
try {
|
||||||
|
Telegraph telegraph = new Telegraph();
|
||||||
|
telegraph.readNBT(new NBTWrapper(NBTJsonUtil.LoadFile(file)));
|
||||||
|
String name = file.getName().substring(0, file.getName().length() - 5);
|
||||||
|
telegraph.setId(name);
|
||||||
|
savedTelegraphs.put(name, telegraph);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.error("Error loading telegraph preset: " + file.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogWriter.info("Loaded " + savedTelegraphs.size() + " telegraph presets.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveTelegraphFile(String name, Telegraph telegraph) {
|
||||||
|
try {
|
||||||
|
File dir = getDir();
|
||||||
|
if (!dir.exists()) {
|
||||||
|
dir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
File file = new File(dir, name + ".json_new");
|
||||||
|
File file2 = new File(dir, name + ".json");
|
||||||
|
|
||||||
|
NBTJsonUtil.SaveFile(file, ((NBTWrapper) telegraph.writeNBT()).getMCTag());
|
||||||
|
if (file2.exists()) {
|
||||||
|
file2.delete();
|
||||||
|
}
|
||||||
|
file.renameTo(file2);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogWriter.error("Error saving telegraph preset: " + name, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
// ITelegraphHandler INTERFACE IMPLEMENTATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createCircle(float radius) {
|
||||||
|
return new ScriptTelegraph(Telegraph.circle(radius));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createRing(float outerRadius, float innerRadius) {
|
||||||
|
return new ScriptTelegraph(Telegraph.ring(outerRadius, innerRadius));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createLine(float length, float width) {
|
||||||
|
return new ScriptTelegraph(Telegraph.line(length, width));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createCone(float length, float angle) {
|
||||||
|
return new ScriptTelegraph(Telegraph.cone(length, angle));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createSquare(float radius) {
|
||||||
|
return new ScriptTelegraph(Telegraph.square(radius));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph createPoint() {
|
||||||
|
return new ScriptTelegraph(Telegraph.point());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph create(String type) {
|
||||||
|
if (type == null) return null;
|
||||||
|
try {
|
||||||
|
TelegraphType telegraphType = TelegraphType.valueOf(type.toUpperCase());
|
||||||
|
Telegraph telegraph;
|
||||||
|
switch (telegraphType) {
|
||||||
|
case CIRCLE:
|
||||||
|
telegraph = Telegraph.circle(3.0f);
|
||||||
|
break;
|
||||||
|
case RING:
|
||||||
|
telegraph = Telegraph.ring(5.0f, 2.0f);
|
||||||
|
break;
|
||||||
|
case LINE:
|
||||||
|
telegraph = Telegraph.line(5.0f, 2.0f);
|
||||||
|
break;
|
||||||
|
case CONE:
|
||||||
|
telegraph = Telegraph.cone(5.0f, 45.0f);
|
||||||
|
break;
|
||||||
|
case SQUARE:
|
||||||
|
telegraph = Telegraph.square(3.0f);
|
||||||
|
break;
|
||||||
|
case POINT:
|
||||||
|
telegraph = Telegraph.point();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
telegraph = Telegraph.circle(3.0f);
|
||||||
|
}
|
||||||
|
return new ScriptTelegraph(telegraph);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraphInstance spawn(ITelegraph telegraph, IWorld IWorld, double x, double y, double z) {
|
||||||
|
return spawn(telegraph, IWorld, x, y, z, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraphInstance spawn(ITelegraph telegraph, IWorld IWorld, double x, double y, double z, float yaw) {
|
||||||
|
if (telegraph == null || IWorld == null) return null;
|
||||||
|
Telegraph internal = ((ScriptTelegraph) telegraph).getMCTelegraph();
|
||||||
|
TelegraphInstance instance = spawn(internal, (IWorld) IWorld.getMCWorld(), x, y, z, yaw);
|
||||||
|
return new ScriptTelegraphInstance(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraphInstance spawn(ITelegraph telegraph, IEntity IEntity) {
|
||||||
|
return spawn(telegraph, IEntity, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraphInstance spawn(ITelegraph telegraph, IEntity IEntity, float yaw) {
|
||||||
|
if (telegraph == null || IEntity == null) return null;
|
||||||
|
Telegraph internal = ((ScriptTelegraph) telegraph).getMCTelegraph();
|
||||||
|
TelegraphInstance instance = spawn(internal, (IEntity) IEntity.getMCEntity(), yaw);
|
||||||
|
return new ScriptTelegraphInstance(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITelegraph get(String name) {
|
||||||
|
Telegraph telegraph = savedTelegraphs.get(name);
|
||||||
|
return telegraph != null ? new ScriptTelegraph(new Telegraph(telegraph)) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(String name, ITelegraph telegraph) {
|
||||||
|
if (name == null || name.isEmpty() || telegraph == null) return;
|
||||||
|
Telegraph internal = ((ScriptTelegraph) telegraph).getMCTelegraph();
|
||||||
|
saveInternal(name, internal);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(ITelegraphInstance instance) {
|
||||||
|
if (instance != null) {
|
||||||
|
remove(instance.getInstanceId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,330 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.AbilityController;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.ChainedAbility;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.IAbilityAction;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unified slot for storing any combat action: inline ability, ability reference, or chain reference.
|
||||||
|
* Support for all {@link IAbilityAction} types.
|
||||||
|
* <p>
|
||||||
|
* References are lazy-resolved via their respective controllers and cached until
|
||||||
|
* the controller revision changes.
|
||||||
|
*/
|
||||||
|
public class AbilityAction {
|
||||||
|
|
||||||
|
public enum SlotType {
|
||||||
|
INLINE_ABILITY,
|
||||||
|
ABILITY_REFERENCE,
|
||||||
|
CHAIN_REFERENCE,
|
||||||
|
INLINE_CHAIN
|
||||||
|
}
|
||||||
|
|
||||||
|
private SlotType slotType;
|
||||||
|
private Ability inlineAbility;
|
||||||
|
private ChainedAbility inlineChain;
|
||||||
|
private String referenceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Per-slot enabled override for reference slots (null = use master's default).
|
||||||
|
*/
|
||||||
|
private Boolean enabledOverride;
|
||||||
|
|
||||||
|
// Cache
|
||||||
|
private transient IAbilityAction cachedAction;
|
||||||
|
private transient int cachedRevision = -1;
|
||||||
|
|
||||||
|
private AbilityAction() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// FACTORY METHODS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public static AbilityAction inline(Ability ability) {
|
||||||
|
AbilityAction slot = new AbilityAction();
|
||||||
|
slot.slotType = SlotType.INLINE_ABILITY;
|
||||||
|
slot.inlineAbility = ability;
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityAction abilityReference(String referenceId) {
|
||||||
|
AbilityAction slot = new AbilityAction();
|
||||||
|
slot.slotType = SlotType.ABILITY_REFERENCE;
|
||||||
|
slot.referenceId = referenceId;
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityAction chainReference(String referenceId) {
|
||||||
|
AbilityAction slot = new AbilityAction();
|
||||||
|
slot.slotType = SlotType.CHAIN_REFERENCE;
|
||||||
|
slot.referenceId = referenceId;
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityAction inlineChain(ChainedAbility chain) {
|
||||||
|
AbilityAction slot = new AbilityAction();
|
||||||
|
slot.slotType = SlotType.INLINE_CHAIN;
|
||||||
|
slot.inlineChain = chain;
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// QUERIES
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public SlotType getSlotType() {
|
||||||
|
return slotType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReference() {
|
||||||
|
return slotType == SlotType.ABILITY_REFERENCE || slotType == SlotType.CHAIN_REFERENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChainReference() {
|
||||||
|
return slotType == SlotType.CHAIN_REFERENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInlineChain() {
|
||||||
|
return slotType == SlotType.INLINE_CHAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChain() {
|
||||||
|
return slotType == SlotType.CHAIN_REFERENCE || slotType == SlotType.INLINE_CHAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAbilityReference() {
|
||||||
|
return slotType == SlotType.ABILITY_REFERENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReferenceId() {
|
||||||
|
return referenceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// RESOLUTION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve the action. Inline returns directly; references resolve
|
||||||
|
* from the appropriate controller with version-based caching.
|
||||||
|
*/
|
||||||
|
public IAbilityAction getAction() {
|
||||||
|
switch (slotType) {
|
||||||
|
case INLINE_ABILITY:
|
||||||
|
return inlineAbility;
|
||||||
|
|
||||||
|
case INLINE_CHAIN:
|
||||||
|
return inlineChain;
|
||||||
|
|
||||||
|
case ABILITY_REFERENCE: {
|
||||||
|
AbilityController ctrl = AbilityController.Instance;
|
||||||
|
if (ctrl == null) return null;
|
||||||
|
int rev = ctrl.getCustomAbilityRevision();
|
||||||
|
if (cachedAction != null && cachedRevision == rev) {
|
||||||
|
return cachedAction;
|
||||||
|
}
|
||||||
|
Ability resolved = ctrl.resolveAbility(referenceId);
|
||||||
|
cachedAction = resolved;
|
||||||
|
cachedRevision = rev;
|
||||||
|
return cachedAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CHAIN_REFERENCE: {
|
||||||
|
AbilityController ctrl = AbilityController.Instance;
|
||||||
|
if (ctrl == null) return null;
|
||||||
|
int rev = ctrl.getChainedAbilityRevision();
|
||||||
|
if (cachedAction != null && cachedRevision == rev) {
|
||||||
|
return cachedAction;
|
||||||
|
}
|
||||||
|
ChainedAbility resolved = ctrl.resolveChainedAbility(referenceId);
|
||||||
|
cachedAction = resolved;
|
||||||
|
cachedRevision = rev;
|
||||||
|
return cachedAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get as Ability (returns null if this is a chain slot or resolution fails).
|
||||||
|
*/
|
||||||
|
public Ability getAbility() {
|
||||||
|
IAbilityAction action = getAction();
|
||||||
|
return (action instanceof Ability) ? (Ability) action : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get as ChainedAbility (returns null if this is an ability slot or resolution fails).
|
||||||
|
*/
|
||||||
|
public ChainedAbility getChainedAbility() {
|
||||||
|
IAbilityAction action = getAction();
|
||||||
|
return (action instanceof ChainedAbility) ? (ChainedAbility) action : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// ENABLED OVERRIDE
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
if (slotType == SlotType.INLINE_ABILITY) {
|
||||||
|
if (inlineAbility != null) {
|
||||||
|
inlineAbility.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
} else if (slotType == SlotType.INLINE_CHAIN) {
|
||||||
|
if (inlineChain != null) {
|
||||||
|
inlineChain.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.enabledOverride = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this slot is enabled. For inline slots, delegates to the action directly.
|
||||||
|
* For reference slots, uses enabledOverride if set, otherwise the resolved action's own state.
|
||||||
|
* This avoids mutating the shared controller instance.
|
||||||
|
*/
|
||||||
|
public boolean isSlotEnabled() {
|
||||||
|
if (enabledOverride != null) {
|
||||||
|
return enabledOverride;
|
||||||
|
}
|
||||||
|
IAbilityAction action = getAction();
|
||||||
|
return action != null && action.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// INLINE CONVERSION (ability references only)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public Ability getInlineAbility() {
|
||||||
|
return inlineAbility;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChainedAbility getInlineChain() {
|
||||||
|
return inlineChain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert this reference slot to an inline slot by copying the resolved data.
|
||||||
|
* Works for ability references (→ INLINE_ABILITY) and chain references (→ INLINE_CHAIN).
|
||||||
|
* Chain entries are kept as-is (not auto-converted to inline).
|
||||||
|
*/
|
||||||
|
public boolean convertToInline() {
|
||||||
|
if (slotType == SlotType.ABILITY_REFERENCE) {
|
||||||
|
Ability resolved = getAbility();
|
||||||
|
if (resolved == null) return false;
|
||||||
|
|
||||||
|
INbt nbt = resolved.writeNBT(true);
|
||||||
|
nbt.setString("id", UUID.randomUUID().toString());
|
||||||
|
inlineAbility = AbilityController.Instance.fromNBT(nbt);
|
||||||
|
slotType = SlotType.INLINE_ABILITY;
|
||||||
|
referenceId = null;
|
||||||
|
cachedAction = null;
|
||||||
|
cachedRevision = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slotType == SlotType.CHAIN_REFERENCE) {
|
||||||
|
ChainedAbility resolved = getChainedAbility();
|
||||||
|
if (resolved == null) return false;
|
||||||
|
|
||||||
|
inlineChain = new ChainedAbility();
|
||||||
|
INbt chainNbt = resolved.writeNBT(true);
|
||||||
|
chainNbt.setString("Id", UUID.randomUUID().toString());
|
||||||
|
inlineChain.readNBT(chainNbt);
|
||||||
|
slotType = SlotType.INLINE_CHAIN;
|
||||||
|
referenceId = null;
|
||||||
|
cachedAction = null;
|
||||||
|
cachedRevision = -1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// NBT
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public INbt writeNBT(boolean saveScripts) {
|
||||||
|
switch (slotType) {
|
||||||
|
case INLINE_CHAIN: {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
if (inlineChain != null) {
|
||||||
|
nbt.setTag("InlineChain", inlineChain.writeNBT(saveScripts));
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CHAIN_REFERENCE: {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setString("ChainReference", referenceId);
|
||||||
|
if (enabledOverride != null) {
|
||||||
|
nbt.setBoolean("RefEnabled", enabledOverride);
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
case ABILITY_REFERENCE: {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setString("Reference", referenceId);
|
||||||
|
if (enabledOverride != null) {
|
||||||
|
nbt.setBoolean("RefEnabled", enabledOverride);
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
case INLINE_ABILITY:
|
||||||
|
default:
|
||||||
|
return inlineAbility != null ? inlineAbility.writeNBT(saveScripts) : new INbt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityAction fromNBT(INbt nbt) {
|
||||||
|
if (nbt == null) return null;
|
||||||
|
|
||||||
|
// Inline chain (new format)
|
||||||
|
if (nbt.hasKey("InlineChain")) {
|
||||||
|
ChainedAbility chain = new ChainedAbility();
|
||||||
|
chain.readNBT(nbt.getCompoundTag("InlineChain"));
|
||||||
|
return inlineChain(chain);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chain reference
|
||||||
|
if (nbt.hasKey("ChainReference")) {
|
||||||
|
AbilityAction slot = chainReference(nbt.getString("ChainReference"));
|
||||||
|
if (nbt.hasKey("RefEnabled")) {
|
||||||
|
slot.enabledOverride = nbt.getBoolean("RefEnabled");
|
||||||
|
}
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ability reference
|
||||||
|
if (nbt.hasKey("Reference")) {
|
||||||
|
AbilityAction slot = abilityReference(nbt.getString("Reference"));
|
||||||
|
if (nbt.hasKey("RefEnabled")) {
|
||||||
|
slot.enabledOverride = nbt.getBoolean("RefEnabled");
|
||||||
|
}
|
||||||
|
return slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inline ability
|
||||||
|
if (AbilityController.Instance == null) return null;
|
||||||
|
Ability ability = AbilityController.Instance.fromNBT(nbt);
|
||||||
|
if (ability == null) return null;
|
||||||
|
return inline(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a variant/template for an ability type.
|
||||||
|
* When a user creates an ability that has registered variants,
|
||||||
|
* they are presented with a selection dialog before the ability is created.
|
||||||
|
* <p>
|
||||||
|
* Each variant has a display name (lang key) and a configurator that
|
||||||
|
* applies preset values to the newly created ability.
|
||||||
|
*/
|
||||||
|
public class AbilityVariant {
|
||||||
|
|
||||||
|
private final String displayKey;
|
||||||
|
private final String group;
|
||||||
|
private final Consumer<Ability> configurator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayKey Lang key for the variant display name (e.g., "ability.variant.dual")
|
||||||
|
* @param configurator Lambda that configures the ability with preset values
|
||||||
|
*/
|
||||||
|
public AbilityVariant(String displayKey, Consumer<Ability> configurator) {
|
||||||
|
this(displayKey, null, configurator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayKey Lang key for the variant display name
|
||||||
|
* @param group Optional group header shown in the variant selection GUI (e.g., "DBC Addon")
|
||||||
|
* @param configurator Lambda that configures the ability with preset values
|
||||||
|
*/
|
||||||
|
public AbilityVariant(String displayKey, String group, Consumer<Ability> configurator) {
|
||||||
|
this.displayKey = displayKey;
|
||||||
|
this.group = group;
|
||||||
|
this.configurator = configurator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayKey() {
|
||||||
|
return displayKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroup() {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply this variant's preset IConfiguration to the given ability.
|
||||||
|
*/
|
||||||
|
public void apply(Ability ability) {
|
||||||
|
if (configurator != null) {
|
||||||
|
configurator.accept(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.AbilityPhase;
|
||||||
|
/**
|
||||||
|
* Wraps a concurrent ability execution with its own independent lifecycle.
|
||||||
|
* Concurrent abilities skip animations, sounds, and movement/rotation locks.
|
||||||
|
* They run their execute/tick logic in parallel with the primary ability.
|
||||||
|
* <p>
|
||||||
|
* Used by the chain system when an entry is concurrent-capable and concurrent-enabled.
|
||||||
|
*/
|
||||||
|
public class ConcurrentSlot {
|
||||||
|
|
||||||
|
private final Ability ability;
|
||||||
|
private boolean started = false;
|
||||||
|
private boolean completed = false;
|
||||||
|
|
||||||
|
public ConcurrentSlot(Ability ability) {
|
||||||
|
this.ability = ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ability getAbility() {
|
||||||
|
return ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCompleted() {
|
||||||
|
return completed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the concurrent ability. Skips windup — goes straight to ACTIVE.
|
||||||
|
* Called once when the slot is activated.
|
||||||
|
*/
|
||||||
|
public void start(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
// Skip windup for concurrent execution — fire immediately
|
||||||
|
ability.setWindUpTicks(0);
|
||||||
|
ability.start(target);
|
||||||
|
started = true;
|
||||||
|
|
||||||
|
// Ability should now be in ACTIVE phase (0 windup → immediate)
|
||||||
|
if (ability.getPhase() == AbilityPhase.ACTIVE) {
|
||||||
|
ability.onExecute(caster, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if ability completed during onExecute (instant abilities like signalCompletion)
|
||||||
|
if (ability.getPhase() == AbilityPhase.IDLE) {
|
||||||
|
completed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tick the concurrent ability. Called every game tick from AbstractDataAbilities.
|
||||||
|
* Handles phase transitions including burst delay → re-execute cycles.
|
||||||
|
*/
|
||||||
|
public void tick(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
if (completed || !started) return;
|
||||||
|
|
||||||
|
AbilityPhase oldPhase = ability.getPhase();
|
||||||
|
boolean phaseChanged = ability.tick();
|
||||||
|
AbilityPhase newPhase = ability.getPhase();
|
||||||
|
|
||||||
|
switch (newPhase) {
|
||||||
|
case ACTIVE:
|
||||||
|
if (phaseChanged && oldPhase == AbilityPhase.BURST_DELAY) {
|
||||||
|
// Re-entering ACTIVE after burst delay → re-execute (burst re-fire)
|
||||||
|
ability.onExecute(caster, target);
|
||||||
|
if (ability.getPhase() == AbilityPhase.IDLE) {
|
||||||
|
completed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Normal active tick
|
||||||
|
ability.onActiveTick(caster, target, ability.getCurrentTick());
|
||||||
|
if (ability.getPhase() == AbilityPhase.IDLE) {
|
||||||
|
completed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BURST_DELAY:
|
||||||
|
// Waiting between bursts — nothing to do, tick() handles countdown
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINDUP:
|
||||||
|
// Burst replay with windup — for concurrent, skip it by advancing
|
||||||
|
// (windUpTicks was set to 0 at start, but burst replay may re-enter WINDUP)
|
||||||
|
// The next tick() call will transition to ACTIVE
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDLE:
|
||||||
|
completed = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DAZED:
|
||||||
|
// Concurrent abilities don't get dazed — treat as completed
|
||||||
|
completed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force cleanup on interrupt. Called when the NPC is interrupted or combat ends.
|
||||||
|
*/
|
||||||
|
public void interrupt() {
|
||||||
|
if (!completed) {
|
||||||
|
ability.interrupt();
|
||||||
|
completed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,507 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.LockMode;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.TargetingMode;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||||
|
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||||
|
import noppes.npcs.api.ability.ICustomAbility;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A blank-slate ability that does nothing by itself.
|
||||||
|
* All behavior is driven by script event hooks (abilityStart, abilityTick, abilityComplete,
|
||||||
|
* abilityToggle, abilityToggleTick).
|
||||||
|
* <p>
|
||||||
|
* Supports two modes based on toggle IConfiguration:
|
||||||
|
* <ul>
|
||||||
|
* <li><b>Instant mode</b> (toggleStates = 0): Uses standard execution lifecycle with
|
||||||
|
* configurable duration. Script hooks: abilityStart, abilityTick, abilityComplete.</li>
|
||||||
|
* <li><b>Toggle mode</b> (toggleStates >= 1): Uses toggle lifecycle.
|
||||||
|
* Script hooks: abilityToggle, abilityToggleTick.</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public class CustomAbility extends Ability implements ICustomAbility {
|
||||||
|
|
||||||
|
private int durationTicks = 20;
|
||||||
|
|
||||||
|
// Telegraph dimension fields
|
||||||
|
private float tRadius = 5.0f;
|
||||||
|
private float tInnerRadius = 0.0f;
|
||||||
|
private float tLength = 5.0f;
|
||||||
|
private float tWidth = 2.0f;
|
||||||
|
private float tAngle = 45.0f;
|
||||||
|
|
||||||
|
// Telegraph timing
|
||||||
|
private int telegraphActiveTicks = 0;
|
||||||
|
private boolean syncTelegraphWithDuration = true;
|
||||||
|
|
||||||
|
public CustomAbility() {
|
||||||
|
this.typeId = "ability.cnpc.custom";
|
||||||
|
this.name = "Custom";
|
||||||
|
this.targetingMode = TargetingMode.SELF;
|
||||||
|
this.lockMovement = LockMode.NO;
|
||||||
|
this.cooldownTicks = 0;
|
||||||
|
this.windUpTicks = 0;
|
||||||
|
this.telegraphType = TelegraphType.NONE;
|
||||||
|
this.showTelegraph = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== EXECUTION ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExecute(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
if (durationTicks <= 0) {
|
||||||
|
signalCompletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActiveTick(IEntityLivingBase caster, IEntityLivingBase target, int tick) {
|
||||||
|
if (durationTicks > 0 && tick >= durationTicks) {
|
||||||
|
signalCompletion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== PROPERTIES ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasDamage() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConcurrentCapable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTargetingModeLocked() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean allowFreeOnCast() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasOwnTelegraphControls() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== TELEGRAPH OVERRIDES ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keepTelegraphDuringActive() {
|
||||||
|
return getResolvedTelegraphActiveTicks() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the effective telegraph active ticks: synced from duration or manual value.
|
||||||
|
*/
|
||||||
|
public int getResolvedTelegraphActiveTicks() {
|
||||||
|
if (syncTelegraphWithDuration) {
|
||||||
|
return durationTicks;
|
||||||
|
}
|
||||||
|
return telegraphActiveTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TelegraphInstance createTelegraph(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
if (!isShowTelegraph() || getTelegraphType() == TelegraphType.NONE) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Telegraph telegraph;
|
||||||
|
double x, y, z;
|
||||||
|
float yaw = caster.rotationYaw;
|
||||||
|
TelegraphType tType = getTelegraphType();
|
||||||
|
|
||||||
|
boolean positionAtCaster = targetingMode == TargetingMode.AOE_SELF ||
|
||||||
|
targetingMode == TargetingMode.SELF ||
|
||||||
|
tType == TelegraphType.LINE ||
|
||||||
|
tType == TelegraphType.CONE;
|
||||||
|
|
||||||
|
if (positionAtCaster) {
|
||||||
|
x = caster.posX;
|
||||||
|
y = findGroundLevel(caster.worldObj, caster.posX, caster.posY, caster.posZ);
|
||||||
|
z = caster.posZ;
|
||||||
|
} else if (target != null) {
|
||||||
|
x = target.posX;
|
||||||
|
y = findGroundLevel(caster.worldObj, target.posX, target.posY, target.posZ);
|
||||||
|
z = target.posZ;
|
||||||
|
} else {
|
||||||
|
x = caster.posX;
|
||||||
|
y = findGroundLevel(caster.worldObj, caster.posX, caster.posY, caster.posZ);
|
||||||
|
z = caster.posZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tType) {
|
||||||
|
case CIRCLE:
|
||||||
|
telegraph = Telegraph.circle(tRadius);
|
||||||
|
break;
|
||||||
|
case RING:
|
||||||
|
telegraph = Telegraph.ring(tRadius, tInnerRadius);
|
||||||
|
break;
|
||||||
|
case LINE:
|
||||||
|
telegraph = Telegraph.line(tLength, tWidth);
|
||||||
|
break;
|
||||||
|
case CONE:
|
||||||
|
telegraph = Telegraph.cone(tLength, tAngle, tInnerRadius);
|
||||||
|
break;
|
||||||
|
case POINT:
|
||||||
|
telegraph = new Telegraph("", TelegraphType.POINT);
|
||||||
|
break;
|
||||||
|
case SQUARE:
|
||||||
|
telegraph = Telegraph.square(tRadius);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int activeTicks = getResolvedTelegraphActiveTicks();
|
||||||
|
int totalDuration = windUpTicks + activeTicks;
|
||||||
|
telegraph.setDurationTicks(Math.max(1, totalDuration));
|
||||||
|
telegraph.setColor(windUpColor);
|
||||||
|
telegraph.setWarningColor(activeColor);
|
||||||
|
if (windUpTicks > 0) {
|
||||||
|
telegraph.setWarningStartTick(windUpTicks);
|
||||||
|
} else {
|
||||||
|
telegraph.setWarningStartTick(0);
|
||||||
|
}
|
||||||
|
telegraph.setHeightOffset(telegraphHeightOffset);
|
||||||
|
|
||||||
|
TelegraphInstance instance = new TelegraphInstance(telegraph, x, y, z, yaw);
|
||||||
|
instance.setCasterEntityId(caster.getEntityId());
|
||||||
|
|
||||||
|
if (positionAtCaster) {
|
||||||
|
instance.setEntityIdToFollow(caster.getEntityId());
|
||||||
|
if (tType == TelegraphType.LINE || tType == TelegraphType.CONE) {
|
||||||
|
if (!isRotationLockedDuringWindup()) {
|
||||||
|
if (target != null) {
|
||||||
|
instance.setTargetEntityId(target.getEntityId());
|
||||||
|
} else {
|
||||||
|
instance.setTrackFollowedEntityYaw(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (target != null) {
|
||||||
|
instance.setEntityIdToFollow(target.getEntityId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTelegraphRadius() {
|
||||||
|
return tRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTelegraphInnerRadius() {
|
||||||
|
return tInnerRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTelegraphLength() {
|
||||||
|
return tLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTelegraphWidth() {
|
||||||
|
return tWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getTelegraphAngle() {
|
||||||
|
return tAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== FIELDS ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDurationTicks() {
|
||||||
|
return durationTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDurationTicks(int ticks) {
|
||||||
|
this.durationTicks = Math.max(0, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTRadius() {
|
||||||
|
return tRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTRadius(float radius) {
|
||||||
|
this.tRadius = Math.max(0, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTInnerRadius() {
|
||||||
|
return tInnerRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTInnerRadius(float innerRadius) {
|
||||||
|
this.tInnerRadius = Math.max(0, innerRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTLength() {
|
||||||
|
return tLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTLength(float length) {
|
||||||
|
this.tLength = Math.max(0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTWidth() {
|
||||||
|
return tWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTWidth(float width) {
|
||||||
|
this.tWidth = Math.max(0, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getTAngle() {
|
||||||
|
return tAngle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTAngle(float angle) {
|
||||||
|
this.tAngle = Math.max(0, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTelegraphActiveTicks() {
|
||||||
|
return telegraphActiveTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTelegraphActiveTicks(int ticks) {
|
||||||
|
this.telegraphActiveTicks = Math.max(0, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSyncTelegraphWithDuration() {
|
||||||
|
return syncTelegraphWithDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSyncTelegraphWithDuration(boolean sync) {
|
||||||
|
this.syncTelegraphWithDuration = sync;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== ICustomAbility ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTelegraphShapeType() {
|
||||||
|
return getTelegraphType().ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphShapeType(int type) {
|
||||||
|
TelegraphType[] values = TelegraphType.values();
|
||||||
|
if (type >= 0 && type < values.length) {
|
||||||
|
setTelegraphType(values[type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphRadius(float radius) {
|
||||||
|
this.tRadius = Math.max(0, radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphInnerRadius(float innerRadius) {
|
||||||
|
this.tInnerRadius = Math.max(0, innerRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphLength(float length) {
|
||||||
|
this.tLength = Math.max(0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphWidth(float width) {
|
||||||
|
this.tWidth = Math.max(0, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTelegraphAngle(float angle) {
|
||||||
|
this.tAngle = Math.max(0, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTargetingModeType() {
|
||||||
|
return getTargetingMode().ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTargetingModeType(int type) {
|
||||||
|
TargetingMode[] values = TargetingMode.values();
|
||||||
|
if (type >= 0 && type < values.length) {
|
||||||
|
setTargetingMode(values[type]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== NBT ====================
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("durationTicks", durationTicks);
|
||||||
|
nbt.setFloat("tRadius", tRadius);
|
||||||
|
nbt.setFloat("tInnerRadius", tInnerRadius);
|
||||||
|
nbt.setFloat("tLength", tLength);
|
||||||
|
nbt.setFloat("tWidth", tWidth);
|
||||||
|
nbt.setFloat("tAngle", tAngle);
|
||||||
|
nbt.setInteger("telegraphActiveTicks", telegraphActiveTicks);
|
||||||
|
nbt.setBoolean("syncTelegraphWithDuration", syncTelegraphWithDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
this.durationTicks = Math.max(0, nbt.getInteger("durationTicks"));
|
||||||
|
this.tRadius = nbt.hasKey("tRadius") ? nbt.getFloat("tRadius") : 5.0f;
|
||||||
|
this.tInnerRadius = nbt.hasKey("tInnerRadius") ? nbt.getFloat("tInnerRadius") : 0.0f;
|
||||||
|
this.tLength = nbt.hasKey("tLength") ? nbt.getFloat("tLength") : 5.0f;
|
||||||
|
this.tWidth = nbt.hasKey("tWidth") ? nbt.getFloat("tWidth") : 2.0f;
|
||||||
|
this.tAngle = nbt.hasKey("tAngle") ? nbt.getFloat("tAngle") : 45.0f;
|
||||||
|
this.telegraphActiveTicks = nbt.hasKey("telegraphActiveTicks") ? nbt.getInteger("telegraphActiveTicks") : 0;
|
||||||
|
this.syncTelegraphWithDuration = nbt.hasKey("syncTelegraphWithDuration") ? nbt.getBoolean("syncTelegraphWithDuration") : true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== GUI ====================
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getAbilityDefinitions(List<FieldDef> defs) {
|
||||||
|
// User Type (NPC / Player / Both)
|
||||||
|
defs.add(FieldDef.enumField("ability.allowedBy", UserType.class,
|
||||||
|
this::getAllowedBy, this::setAllowedBy));
|
||||||
|
|
||||||
|
// Targeting Mode
|
||||||
|
defs.add(FieldDef.enumField("ability.targetingMode", TargetingMode.class,
|
||||||
|
this::getTargetingMode, this::setTargetingMode));
|
||||||
|
|
||||||
|
// Toggle section
|
||||||
|
defs.add(FieldDef.section("ability.section.toggle"));
|
||||||
|
defs.add(FieldDef.boolField("ability.toggleEnabled",
|
||||||
|
this::isToggleable, enabled -> setToggleStates(enabled ? Math.max(1, getToggleStates()) : 0)));
|
||||||
|
defs.add(FieldDef.intField("ability.toggleStates", this::getToggleStates, this::setToggleStates)
|
||||||
|
.range(1, 10)
|
||||||
|
.visibleWhen(this::isToggleable));
|
||||||
|
defs.add(FieldDef.boolField("ability.hasActiveToggle", this::hasActiveToggle, this::setHasActiveToggle)
|
||||||
|
.visibleWhen(this::isToggleable));
|
||||||
|
|
||||||
|
// Duration (instant mode only)
|
||||||
|
defs.add(FieldDef.section("ability.section.execution")
|
||||||
|
.visibleWhen(() -> !this.isToggleable()));
|
||||||
|
defs.add(FieldDef.intField("ability.duration", this::getDurationTicks, this::setDurationTicks)
|
||||||
|
.range(0, 6000)
|
||||||
|
.visibleWhen(() -> !this.isToggleable()));
|
||||||
|
|
||||||
|
// ── Telegraph Controls (Effects tab) ─────────────────────────
|
||||||
|
defs.add(FieldDef.section("ability.section.telegraph").tab("Effects"));
|
||||||
|
defs.add(FieldDef.enumField("ability.telegraphShape", TelegraphType.class,
|
||||||
|
this::getTelegraphType, this::setTelegraphType).tab("Effects")
|
||||||
|
.hover("ability.hover.telegraphShape"));
|
||||||
|
defs.add(FieldDef.boolField("ability.showTelegraph", this::isShowTelegraph, this::setShowTelegraph)
|
||||||
|
.tab("Effects").visibleWhen(this::hasTelegraphShape)
|
||||||
|
.hover("ability.hover.showTelegraph"));
|
||||||
|
defs.add(FieldDef.colorSubGui("ability.windUpColor", this::getWindUpColor, this::setWindUpColor)
|
||||||
|
.tab("Effects").visibleWhen(this::isTelegraphVisible)
|
||||||
|
.hover("ability.hover.windUpColor"));
|
||||||
|
defs.add(FieldDef.colorSubGui("ability.activeColor", this::getActiveColor, this::setActiveColor)
|
||||||
|
.tab("Effects").visibleWhen(this::isTelegraphVisible)
|
||||||
|
.hover("ability.hover.activeColor"));
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphHeight", this::getTelegraphHeightOffset, this::setTelegraphHeightOffset)
|
||||||
|
.tab("Effects").visibleWhen(this::isTelegraphVisible)
|
||||||
|
.hover("ability.hover.telegraphHeight"));
|
||||||
|
|
||||||
|
// Telegraph active duration with sync toggle (mirrors windup sync pattern)
|
||||||
|
defs.add(FieldDef.row(
|
||||||
|
FieldDef.intField("ability.telegraphActiveTicks", this::getTelegraphActiveTicks, this::setTelegraphActiveTicks).range(0, 6000)
|
||||||
|
.hover("ability.hover.telegraphActiveTicks"),
|
||||||
|
FieldDef.boolField("ability.syncTelegraph", this::isSyncTelegraphWithDuration, this::setSyncTelegraphWithDuration)
|
||||||
|
.hover("ability.hover.syncTelegraph")
|
||||||
|
).tab("Effects").visibleWhen(() -> isTelegraphVisible() && !isSyncTelegraphWithDuration()));
|
||||||
|
defs.add(FieldDef.row(
|
||||||
|
FieldDef.labelField("ability.telegraphActiveTicks", () -> getResolvedTelegraphActiveTicks() + "t"),
|
||||||
|
FieldDef.boolField("ability.syncTelegraph", this::isSyncTelegraphWithDuration, this::setSyncTelegraphWithDuration)
|
||||||
|
.hover("ability.hover.syncTelegraph")
|
||||||
|
).tab("Effects").visibleWhen(() -> isTelegraphVisible() && isSyncTelegraphWithDuration()));
|
||||||
|
|
||||||
|
// Shape-specific dimension fields
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphRadius", this::getTRadius, this::setTRadius)
|
||||||
|
.tab("Effects").visibleWhen(() -> isTelegraphVisible() && needsRadius())
|
||||||
|
.hover("ability.hover.telegraphRadius"));
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphInnerRadius", this::getTInnerRadius, this::setTInnerRadius)
|
||||||
|
.tab("Effects").visibleWhen(() -> isTelegraphVisible() && needsInnerRadius())
|
||||||
|
.hover("ability.hover.telegraphInnerRadius"));
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphLength", this::getTLength, this::setTLength)
|
||||||
|
.tab("Effects").visibleWhen(() -> isTelegraphVisible() && needsLength())
|
||||||
|
.hover("ability.hover.telegraphLength"));
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphWidth", this::getTWidth, this::setTWidth)
|
||||||
|
.tab("Effects").visibleWhen(() -> isTelegraphVisible() && needsWidth())
|
||||||
|
.hover("ability.hover.telegraphWidth"));
|
||||||
|
defs.add(FieldDef.floatField("ability.telegraphAngle", this::getTAngle, this::setTAngle)
|
||||||
|
.tab("Effects").visibleWhen(() -> isTelegraphVisible() && needsAngle())
|
||||||
|
.hover("ability.hover.telegraphAngle"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== TELEGRAPH VISIBILITY HELPERS ====================
|
||||||
|
|
||||||
|
private boolean hasTelegraphShape() {
|
||||||
|
return getTelegraphType() != TelegraphType.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTelegraphVisible() {
|
||||||
|
return hasTelegraphShape() && isShowTelegraph();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean needsRadius() {
|
||||||
|
TelegraphType t = getTelegraphType();
|
||||||
|
return t == TelegraphType.CIRCLE || t == TelegraphType.RING || t == TelegraphType.SQUARE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean needsInnerRadius() {
|
||||||
|
TelegraphType t = getTelegraphType();
|
||||||
|
return t == TelegraphType.RING || t == TelegraphType.CONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean needsLength() {
|
||||||
|
TelegraphType t = getTelegraphType();
|
||||||
|
return t == TelegraphType.LINE || t == TelegraphType.CONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean needsWidth() {
|
||||||
|
return getTelegraphType() == TelegraphType.LINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean needsAngle() {
|
||||||
|
return getTelegraphType() == TelegraphType.CONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
+147
@@ -0,0 +1,147 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.AbilityController;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import noppes.npcs.LogWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public abstract class AbilityCondition {
|
||||||
|
public static final int MAX_CONDITIONS = 5;
|
||||||
|
|
||||||
|
protected String typeId = "";
|
||||||
|
protected String name = "";
|
||||||
|
protected UserType userType = UserType.BOTH;
|
||||||
|
protected ConditionFilter conditionFilter = ConditionFilter.CASTER;
|
||||||
|
|
||||||
|
public boolean check(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
switch (getFilter()) {
|
||||||
|
case CASTER:
|
||||||
|
return checkEntity(caster);
|
||||||
|
case TARGET:
|
||||||
|
return target != null && checkEntity(target);
|
||||||
|
case BOTH:
|
||||||
|
return checkEntity(caster) && (target != null && checkEntity(target));
|
||||||
|
default:
|
||||||
|
return checkEntity(caster);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean checkEntity(IEntityLivingBase IEntity);
|
||||||
|
|
||||||
|
public boolean requiresTarget() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if all required fields are filled in.
|
||||||
|
* Used to disable the Done button in SubGuiConditionEdit when incomplete.
|
||||||
|
*/
|
||||||
|
public boolean isConfigured() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserType getUserType() {
|
||||||
|
return userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeId() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConditionFilter getFilter() {
|
||||||
|
return conditionFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilter(ConditionFilter filter) {
|
||||||
|
this.conditionFilter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
public abstract void getConditionDefinitions(List<FieldDef> defs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a human-readable summary of this condition's IConfiguration.
|
||||||
|
* Used for tooltips when hovering over condition buttons.
|
||||||
|
*/
|
||||||
|
@ClientOnly
|
||||||
|
public abstract String getConditionSummary();
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
public final List<FieldDef> getAllDefinitions() {
|
||||||
|
List<FieldDef> defs = new ArrayList<>();
|
||||||
|
|
||||||
|
defs.add(FieldDef.labelField("ability.validFor", () ->
|
||||||
|
"\u00A7e" + PlatformServiceHolder.get().translateToLocal("ability.userType." + getUserType().name())));
|
||||||
|
defs.add(FieldDef.enumField("condition.filter", ConditionFilter.class, this::getFilter, this::setFilter));
|
||||||
|
getConditionDefinitions(defs);
|
||||||
|
return defs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final INbt writeNBT() {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setString("typeId", getTypeId());
|
||||||
|
nbt.setString("name", getName());
|
||||||
|
nbt.setInteger("userType", getUserType().ordinal());
|
||||||
|
nbt.setInteger("filter", getFilter().ordinal());
|
||||||
|
writeTypeNBT(nbt);
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void writeTypeNBT(INbt nbt);
|
||||||
|
|
||||||
|
public abstract void readTypeNBT(INbt nbt);
|
||||||
|
|
||||||
|
public final void readNBT(INbt nbt) {
|
||||||
|
typeId = nbt.getString("typeId");
|
||||||
|
name = nbt.getString("name");
|
||||||
|
userType = UserType.fromOrdinal(nbt.getInteger("userType"));
|
||||||
|
conditionFilter = ConditionFilter.fromOrdinal(nbt.getInteger("filter"));
|
||||||
|
readTypeNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityCondition fromNBT(INbt nbt) {
|
||||||
|
String typeId = nbt.getString("typeId");
|
||||||
|
Supplier<AbilityCondition> factory = AbilityController.Instance.getConditionType(typeId);
|
||||||
|
if (factory == null) {
|
||||||
|
LogWriter.info("AbilityController: Unknown condition type: " + typeId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
AbilityCondition condition = factory.get();
|
||||||
|
condition.readNBT(nbt);
|
||||||
|
|
||||||
|
return condition;
|
||||||
|
}
|
||||||
|
}
|
||||||
+138
@@ -0,0 +1,138 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base for float comparison-based conditions.
|
||||||
|
* Provides shared CompareType enum, NBT serialization, and FieldDef generation.
|
||||||
|
*/
|
||||||
|
public abstract class ConditionCompare extends AbilityCondition {
|
||||||
|
|
||||||
|
public enum CompareType {
|
||||||
|
ABOVE {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return value >= threshold;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
BELOW {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return value <= threshold;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
EQUAL {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return value == threshold;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract boolean test(float value, float threshold);
|
||||||
|
|
||||||
|
public static CompareType fromOrdinal(int ordinal) {
|
||||||
|
CompareType[] values = values();
|
||||||
|
return (ordinal >= 0 && ordinal < values.length) ? values[ordinal] : ABOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "condition." + name().toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompareType compareType = CompareType.ABOVE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value to be compared for this IEntity (e.g. level, skill level).
|
||||||
|
* Return -1 to indicate the condition should fail immediately.
|
||||||
|
*/
|
||||||
|
protected abstract float getEntityValue(IEntityLivingBase IEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the threshold that getEntityValue() is compared against.
|
||||||
|
*/
|
||||||
|
protected abstract float getThreshold();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends subclass-specific FieldDefs (e.g. skill picker, level input).
|
||||||
|
* Called before the shared compareType field is added.
|
||||||
|
*/
|
||||||
|
@ClientOnly
|
||||||
|
protected abstract void getExtraDefinitions(List<FieldDef> defs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subclasses write their own NBT fields here.
|
||||||
|
*/
|
||||||
|
protected abstract void writeExtraNBT(INbt nbt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subclasses read their own NBT fields here.
|
||||||
|
*/
|
||||||
|
protected abstract void readExtraNBT(INbt nbt);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
float value = getEntityValue(IEntity);
|
||||||
|
if (value < 0) return false;
|
||||||
|
return compareType.test(value, getThreshold());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.enumField("condition.compare_type", CompareType.class, this::getCompareType, this::setCompareType));
|
||||||
|
getExtraDefinitions(defs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("compareType", compareType.ordinal());
|
||||||
|
writeExtraNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
compareType = CompareType.fromOrdinal(nbt.getInteger("compareType"));
|
||||||
|
readExtraNBT(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// GETTERS / SETTERS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public CompareType getCompareType() {
|
||||||
|
return compareType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompareType(CompareType compareType) {
|
||||||
|
this.compareType = compareType;
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
public enum ConditionFilter {
|
||||||
|
CASTER,
|
||||||
|
TARGET,
|
||||||
|
BOTH;
|
||||||
|
|
||||||
|
public boolean checksCaster() {
|
||||||
|
return this == CASTER || this == BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checksTarget() {
|
||||||
|
return this == TARGET || this == BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ConditionFilter fromOrdinal(int ordinal) {
|
||||||
|
ConditionFilter[] values = values();
|
||||||
|
if (ordinal >= 0 && ordinal < values.length) {
|
||||||
|
return values[ordinal];
|
||||||
|
}
|
||||||
|
return BOTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
switch (this) {
|
||||||
|
case BOTH:
|
||||||
|
return "condition.filter.both";
|
||||||
|
case CASTER:
|
||||||
|
return "condition.filter.caster";
|
||||||
|
case TARGET:
|
||||||
|
return "condition.filter.target";
|
||||||
|
default:
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
public class ConditionHPThreshold extends ConditionThreshold {
|
||||||
|
|
||||||
|
public ConditionHPThreshold() {
|
||||||
|
this.typeId = "condition.cnpc.hp_threshold";
|
||||||
|
this.name = "condition.hp_threshold";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getEntityValue(IEntityLivingBase IEntity) {
|
||||||
|
return IEntity.getHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getEntityMaxValue(IEntityLivingBase IEntity) {
|
||||||
|
return IEntity.getMaxHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getStatName() {
|
||||||
|
return "HP";
|
||||||
|
}
|
||||||
|
}
|
||||||
+128
@@ -0,0 +1,128 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import noppes.npcs.controllers.CustomEffectController;
|
||||||
|
import noppes.npcs.controllers.data.CustomEffect;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConditionHasEffect extends AbilityCondition {
|
||||||
|
private int effectId = -1;
|
||||||
|
private int effectIndex = 0;
|
||||||
|
|
||||||
|
public ConditionHasEffect() {
|
||||||
|
this.typeId = "condition.cnpc.has_effect";
|
||||||
|
this.name = "condition.has_effect";
|
||||||
|
this.userType = UserType.PLAYER_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
if (!(IEntity instanceof IPlayer)) return false;
|
||||||
|
if (effectId < 0) return false;
|
||||||
|
|
||||||
|
IPlayer player = (IPlayer) IEntity;
|
||||||
|
return CustomEffectController.getInstance().hasEffect(player, effectId, effectIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.subGuiField("condition.select_effect",
|
||||||
|
() -> new SubGuiCustomEffectSelect(effectId, effectIndex),
|
||||||
|
gui -> {
|
||||||
|
SubGuiCustomEffectSelect sel = (SubGuiCustomEffectSelect) gui;
|
||||||
|
if (sel.getSelectedEffectId() >= 0) {
|
||||||
|
effectId = sel.getSelectedEffectId();
|
||||||
|
effectIndex = sel.getSelectedIndex();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.buttonLabel(() -> {
|
||||||
|
if (effectId < 0) return "None";
|
||||||
|
CustomEffect effect = getEffect();
|
||||||
|
return effect != null ? effect.getName() : "ID:" + effectId;
|
||||||
|
})
|
||||||
|
.clearable(() -> {
|
||||||
|
effectId = -1;
|
||||||
|
effectIndex = 0;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public String getConditionSummary() {
|
||||||
|
String filterLabel = PlatformServiceHolder.get().translateToLocal(getFilter().toString());
|
||||||
|
String effectName = "None";
|
||||||
|
if (effectId >= 0) {
|
||||||
|
CustomEffect effect = getEffect();
|
||||||
|
effectName = effect != null ? effect.getName() : "ID:" + effectId;
|
||||||
|
}
|
||||||
|
return "[" + filterLabel + "] Effect: " + effectName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConfigured() {
|
||||||
|
return effectId >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CustomEffect getEffect() {
|
||||||
|
HashMap<Integer, CustomEffect> map = CustomEffectController.getInstance().getEffectMap(effectIndex);
|
||||||
|
return map != null ? map.get(effectId) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("effectId", effectId);
|
||||||
|
nbt.setInteger("effectIndex", effectIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
effectId = nbt.getInteger("effectId");
|
||||||
|
effectIndex = nbt.getInteger("effectIndex");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEffectId() {
|
||||||
|
return effectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEffectId(int effectId) {
|
||||||
|
this.effectId = effectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEffectIndex() {
|
||||||
|
return effectIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEffectIndex(int effectIndex) {
|
||||||
|
this.effectIndex = effectIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConditionHitCount extends AbilityCondition {
|
||||||
|
private int requiredHits = 3;
|
||||||
|
private int withinTicks = 60;
|
||||||
|
|
||||||
|
public ConditionHitCount() {
|
||||||
|
this.typeId = "condition.cnpc.hit_count";
|
||||||
|
this.name = "condition.hit_count";
|
||||||
|
this.conditionFilter = ConditionFilter.CASTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
// Not used — this condition overrides check() directly
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
if (caster instanceof EntityNPCInterface) {
|
||||||
|
EntityNPCInterface npc = (EntityNPCInterface) caster;
|
||||||
|
if (npc.abilities != null) {
|
||||||
|
return npc.abilities.getRecentHitCount(withinTicks) >= requiredHits;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// For players, hit count tracking is not yet supported
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRequiredHits() {
|
||||||
|
return requiredHits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequiredHits(int requiredHits) {
|
||||||
|
this.requiredHits = Math.max(0, requiredHits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWithinTicks() {
|
||||||
|
return withinTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWithinTicks(int withinTicks) {
|
||||||
|
this.withinTicks = Math.max(0, withinTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.intField("condition.required_hits", this::getRequiredHits, this::setRequiredHits).min(1));
|
||||||
|
defs.add(FieldDef.intField("condition.within_ticks", this::getWithinTicks, this::setWithinTicks).min(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public String getConditionSummary() {
|
||||||
|
return "[Caster] Hit " + requiredHits + " times in " + withinTicks + " ticks";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("requiredHits", requiredHits);
|
||||||
|
nbt.setInteger("withinTicks", withinTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
requiredHits = Math.max(0, nbt.getInteger("requiredHits"));
|
||||||
|
withinTicks = Math.max(0, nbt.getInteger("withinTicks"));
|
||||||
|
}
|
||||||
|
}
|
||||||
+208
@@ -0,0 +1,208 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConditionItem extends AbilityCondition {
|
||||||
|
|
||||||
|
public enum UsageType {
|
||||||
|
ARMOR, HOLDING, COUNT, OFFHAND;
|
||||||
|
|
||||||
|
public static UsageType fromOrdinal(int ordinal) {
|
||||||
|
UsageType[] values = values();
|
||||||
|
return (ordinal >= 0 && ordinal < values.length) ? values[ordinal] : HOLDING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ArmorSlot {
|
||||||
|
BOOTS, LEGS, CHEST, HELMET;
|
||||||
|
|
||||||
|
public static ArmorSlot fromOrdinal(int ordinal) {
|
||||||
|
ArmorSlot[] values = values();
|
||||||
|
return (ordinal >= 0 && ordinal < values.length) ? values[ordinal] : BOOTS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shared
|
||||||
|
private UsageType usageType = UsageType.HOLDING;
|
||||||
|
private String itemName = "";
|
||||||
|
|
||||||
|
// ARMOR only
|
||||||
|
private ArmorSlot armorSlot = ArmorSlot.BOOTS;
|
||||||
|
private boolean fullArmorSet = false;
|
||||||
|
|
||||||
|
// COUNT + PLAYER only
|
||||||
|
private int requiredCount = 1;
|
||||||
|
|
||||||
|
public ConditionItem() {
|
||||||
|
this.typeId = "condition.cnpc.item";
|
||||||
|
this.name = "condition.item";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
switch (usageType) {
|
||||||
|
case HOLDING:
|
||||||
|
return checkHolding(IEntity);
|
||||||
|
case ARMOR:
|
||||||
|
return checkArmor(IEntity);
|
||||||
|
case COUNT:
|
||||||
|
return checkCount(IEntity);
|
||||||
|
case OFFHAND:
|
||||||
|
return checkOffhand(IEntity);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkHolding(IEntityLivingBase IEntity) {
|
||||||
|
IItemStack held = IEntity.getHeldItem();
|
||||||
|
return matchesItem(held);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkArmor(IEntityLivingBase IEntity) {
|
||||||
|
// MC getEquipmentInSlot: 1=boots, 2=legs, 3=chest, 4=helmet
|
||||||
|
int slot = armorSlot.ordinal() + 1; // BOOTS=0, LEGS=1, CHEST=2, HELMET=3
|
||||||
|
return matchesItem(IEntity.getEquipmentInSlot(slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkCount(IEntityLivingBase IEntity) {
|
||||||
|
if (IEntity instanceof IPlayer) {
|
||||||
|
return checkPlayerInventoryCount((IPlayer) IEntity);
|
||||||
|
}
|
||||||
|
if (IEntity instanceof EntityNPCInterface) {
|
||||||
|
return checkNPCProjectile((EntityNPCInterface) IEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkOffhand(IEntityLivingBase IEntity) {
|
||||||
|
// No offhand for players
|
||||||
|
if (IEntity instanceof IPlayer) return false;
|
||||||
|
if (!(IEntity instanceof EntityNPCInterface)) return false;
|
||||||
|
|
||||||
|
IItemStack item = ((EntityNPCInterface) IEntity).getOffHand();
|
||||||
|
return matchesItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkPlayerInventoryCount(IPlayer player) {
|
||||||
|
int count = 0;
|
||||||
|
for (IItemStack stack : player.inventory.mainInventory) {
|
||||||
|
if (matchesItem(stack)) {
|
||||||
|
count += stack.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count >= requiredCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean checkNPCProjectile(EntityNPCInterface npc) {
|
||||||
|
IItemStack projectile = npc.inventory.getProjectile();
|
||||||
|
return matchesItem(projectile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean matchesItem(IItemStack stack) {
|
||||||
|
if (stack == null || itemName == null || itemName.isEmpty()) return false;
|
||||||
|
String registryName = net.minecraft.item.Item.itemRegistry.getNameForObject(stack.getItem());
|
||||||
|
return itemName.equals(registryName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.enumField("condition.usage_type", UsageType.class,
|
||||||
|
this::getUsageType, this::setUsageType));
|
||||||
|
|
||||||
|
defs.add(FieldDef.stringField("condition.item_name",
|
||||||
|
this::getItemName, this::setItemName)
|
||||||
|
.hover("condition.hover.item_name"));
|
||||||
|
|
||||||
|
defs.add(FieldDef.enumField("condition.armor_slot", ArmorSlot.class,
|
||||||
|
this::getArmorSlot, this::setArmorSlot)
|
||||||
|
.visibleWhen(() -> usageType == UsageType.ARMOR)
|
||||||
|
.hover("condition.hover.armor_slots"));
|
||||||
|
|
||||||
|
defs.add(FieldDef.intField("condition.item_count",
|
||||||
|
this::getRequiredCount, this::setRequiredCount)
|
||||||
|
.range(1, 64)
|
||||||
|
.visibleWhen(() -> usageType == UsageType.COUNT && userType.allowsPlayer())
|
||||||
|
.hover("condition.hover.required_count"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public String getConditionSummary() {
|
||||||
|
String filterLabel = PlatformServiceHolder.get().translateToLocal(getFilter().toString());
|
||||||
|
String usage = usageType.name();
|
||||||
|
String item = itemName.isEmpty() ? "None" : itemName;
|
||||||
|
return "[" + filterLabel + "] " + usage + ": " + item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setString("itemName", itemName);
|
||||||
|
nbt.setInteger("usageType", usageType.ordinal());
|
||||||
|
nbt.setInteger("armorSlot", armorSlot.ordinal());
|
||||||
|
nbt.setInteger("requiredCount", requiredCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
itemName = nbt.getString("itemName");
|
||||||
|
usageType = UsageType.fromOrdinal(nbt.getInteger("usageType"));
|
||||||
|
armorSlot = ArmorSlot.fromOrdinal(nbt.getInteger("armorSlot"));
|
||||||
|
requiredCount = Math.max(1, nbt.getInteger("requiredCount"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConfigured() {
|
||||||
|
return itemName != null && !itemName.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UsageType getUsageType() { return usageType; }
|
||||||
|
public void setUsageType(UsageType usageType) { this.usageType = usageType; }
|
||||||
|
|
||||||
|
public String getItemName() { return itemName; }
|
||||||
|
public void setItemName(String itemName) { this.itemName = itemName; }
|
||||||
|
|
||||||
|
public ArmorSlot getArmorSlot() { return armorSlot; }
|
||||||
|
public void setArmorSlot(ArmorSlot armorSlot) { this.armorSlot = armorSlot; }
|
||||||
|
|
||||||
|
public boolean isFullArmorSet() {
|
||||||
|
return fullArmorSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFullArmorSet(boolean fullArmorSet) {
|
||||||
|
this.fullArmorSet = fullArmorSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRequiredCount() { return requiredCount; }
|
||||||
|
public void setRequiredCount(int requiredCount) { this.requiredCount = Math.max(1, requiredCount); }
|
||||||
|
}
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import noppes.npcs.controllers.QuestController;
|
||||||
|
import noppes.npcs.controllers.data.PlayerData;
|
||||||
|
import noppes.npcs.controllers.data.Quest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ConditionQuestCompleted extends AbilityCondition {
|
||||||
|
private int questId = -1;
|
||||||
|
|
||||||
|
public ConditionQuestCompleted() {
|
||||||
|
this.typeId = "condition.cnpc.quest_completed";
|
||||||
|
this.name = "condition.quest_completed";
|
||||||
|
this.userType = UserType.PLAYER_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
if (!(IEntity instanceof IPlayer)) return false;
|
||||||
|
if (questId < 0) return false;
|
||||||
|
|
||||||
|
IPlayer player = (IPlayer) IEntity;
|
||||||
|
PlayerData data = PlayerData.get(player);
|
||||||
|
if (data == null || data.questData == null) return false;
|
||||||
|
return data.questData.hasFinishedQuest(questId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.subGuiField("condition.select_quest",
|
||||||
|
() -> new GuiQuestSelection(questId),
|
||||||
|
gui -> {
|
||||||
|
GuiQuestSelection sel = (GuiQuestSelection) gui;
|
||||||
|
if (sel.selectedQuest != null) {
|
||||||
|
questId = sel.selectedQuest.id;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.buttonLabel(() -> {
|
||||||
|
if (questId < 0) return "None";
|
||||||
|
Quest q = QuestController.Instance.quests.get(questId);
|
||||||
|
return q != null ? q.title : "ID:" + questId;
|
||||||
|
})
|
||||||
|
.clearable(() -> questId = -1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public String getConditionSummary() {
|
||||||
|
String filterLabel = PlatformServiceHolder.get().translateToLocal(getFilter().toString());
|
||||||
|
String questName = "None";
|
||||||
|
if (questId >= 0) {
|
||||||
|
Quest q = QuestController.Instance.quests.get(questId);
|
||||||
|
questName = q != null ? q.title : "ID:" + questId;
|
||||||
|
}
|
||||||
|
return "[" + filterLabel + "] Quest: " + questName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("questId", questId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
questId = nbt.getInteger("questId");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isConfigured() {
|
||||||
|
return questId >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQuestId() {
|
||||||
|
return questId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuestId(int questId) {
|
||||||
|
this.questId = questId;
|
||||||
|
}
|
||||||
|
}
|
||||||
+195
@@ -0,0 +1,195 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.conditions;
|
||||||
|
|
||||||
|
import noppes.npcs.constants.ClientOnly;
|
||||||
|
import kamkeel.npcs.util.IVector3;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.preview.PreviewEntityHandler;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.SubGuiAbilityConfig;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityConfigCallback;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.FieldDef;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IChainedAbilityFieldProvider;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.gui.IAbilityFieldProvider;
|
||||||
|
import noppes.npcs.entity.EntityNPCInterface;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyDome;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyBarrier;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyPanel;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityOrb;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityLaser;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityDisc;
|
||||||
|
import kamkeel.npcs.entity.EntityAbilityBeam;
|
||||||
|
import kamkeel.npcs.entity.EntityEnergyProjectile;
|
||||||
|
import kamkeel.npcs.util.ByteBufUtils;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract base for threshold-based conditions (HP, Ki, etc.).
|
||||||
|
* Provides shared percent/flat toggle, ThresholdType enum, and FieldDef generation.
|
||||||
|
*/
|
||||||
|
public abstract class ConditionThreshold extends AbilityCondition {
|
||||||
|
|
||||||
|
public enum ThresholdType {
|
||||||
|
ABOVE {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return value >= threshold;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
BELOW {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return value <= threshold;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
EQUAL {
|
||||||
|
@Override
|
||||||
|
public boolean test(float value, float threshold) {
|
||||||
|
return Math.abs(value - threshold) < 0.001f;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract boolean test(float value, float threshold);
|
||||||
|
|
||||||
|
public static ThresholdType fromOrdinal(int ordinal) {
|
||||||
|
ThresholdType[] values = values();
|
||||||
|
if (ordinal >= 0 && ordinal < values.length) {
|
||||||
|
return values[ordinal];
|
||||||
|
}
|
||||||
|
return ABOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
switch (this) {
|
||||||
|
case ABOVE:
|
||||||
|
return "condition.above";
|
||||||
|
case BELOW:
|
||||||
|
return "condition.below";
|
||||||
|
case EQUAL:
|
||||||
|
return "condition.equal";
|
||||||
|
default:
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float thresholdFlat = 100f;
|
||||||
|
protected float thresholdPercent = 0.5f;
|
||||||
|
protected boolean percent = true;
|
||||||
|
protected ThresholdType thresholdType = ThresholdType.ABOVE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the raw stat value for the IEntity (e.g. current HP, current Ki).
|
||||||
|
*/
|
||||||
|
protected abstract float getEntityValue(IEntityLivingBase IEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the maximum stat value for the IEntity (e.g. max HP, max Ki).
|
||||||
|
* Used to compute the percentage ratio.
|
||||||
|
*/
|
||||||
|
protected abstract float getEntityMaxValue(IEntityLivingBase IEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the display name for the stat being checked (e.g. "HP", "Ki").
|
||||||
|
* Used in getConditionSummary().
|
||||||
|
*/
|
||||||
|
protected abstract String getStatName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean checkEntity(IEntityLivingBase IEntity) {
|
||||||
|
float value;
|
||||||
|
float threshold;
|
||||||
|
if (percent) {
|
||||||
|
float max = getEntityMaxValue(IEntity);
|
||||||
|
value = max > 0 ? getEntityValue(IEntity) / max : 0;
|
||||||
|
threshold = thresholdPercent;
|
||||||
|
} else {
|
||||||
|
value = getEntityValue(IEntity);
|
||||||
|
threshold = thresholdFlat;
|
||||||
|
}
|
||||||
|
return thresholdType.test(value, threshold);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public void getConditionDefinitions(List<FieldDef> defs) {
|
||||||
|
defs.add(FieldDef.floatField("condition.threshold_flat", this::getThresholdFlat, this::setThresholdFlat)
|
||||||
|
.min(0).visibleWhen(() -> !isPercent()));
|
||||||
|
defs.add(FieldDef.floatField("condition.threshold_percent", this::getThresholdPercent, this::setThresholdPercent)
|
||||||
|
.min(0).max(1).visibleWhen(this::isPercent));
|
||||||
|
defs.add(FieldDef.boolField("condition.percent", this::isPercent, this::setIsPercent));
|
||||||
|
defs.add(FieldDef.enumField("condition.threshold_type", ThresholdType.class,
|
||||||
|
this::getThresholdType, this::setThresholdType));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeTypeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("thresholdFlat", thresholdFlat);
|
||||||
|
nbt.setFloat("thresholdPercent", thresholdPercent);
|
||||||
|
nbt.setBoolean("percent", percent);
|
||||||
|
nbt.setInteger("thresholdType", thresholdType.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readTypeNBT(INbt nbt) {
|
||||||
|
thresholdFlat = nbt.getFloat("thresholdFlat");
|
||||||
|
thresholdPercent = nbt.getFloat("thresholdPercent");
|
||||||
|
percent = nbt.getBoolean("percent");
|
||||||
|
thresholdType = ThresholdType.fromOrdinal(nbt.getInteger("thresholdType"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ClientOnly
|
||||||
|
@Override
|
||||||
|
public String getConditionSummary() {
|
||||||
|
String filterLabel = PlatformServiceHolder.get().translateToLocal(getFilter().toString());
|
||||||
|
String typeName = getStatName();
|
||||||
|
String typeLabel = PlatformServiceHolder.get().translateToLocal(thresholdType.toString());
|
||||||
|
String value = percent
|
||||||
|
? String.format("%.0f%%", thresholdPercent * 100)
|
||||||
|
: String.format("%.0f", thresholdFlat);
|
||||||
|
return "[" + filterLabel + "] " + typeName + " " + typeLabel + " " + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// GETTERS / SETTERS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public float getThresholdFlat() {
|
||||||
|
return thresholdFlat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThresholdFlat(float value) {
|
||||||
|
this.thresholdFlat = Math.max(0, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getThresholdPercent() {
|
||||||
|
return thresholdPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThresholdPercent(float value) {
|
||||||
|
this.thresholdPercent = Math.max(0, Math.min(1, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPercent() {
|
||||||
|
return percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsPercent(boolean percent) {
|
||||||
|
this.percent = percent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThresholdType getThresholdType() {
|
||||||
|
return thresholdType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThresholdType(ThresholdType type) {
|
||||||
|
this.thresholdType = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,344 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||||
|
/**
|
||||||
|
* Icon data for abilities, stored in the ability's customData NBT under "AbilityIcon".
|
||||||
|
* Supports up to 3 layers, each with its own texture, UV coordinates, and tint color.
|
||||||
|
* Width, height, and scale are shared across all layers.
|
||||||
|
*/
|
||||||
|
public class AbilityIconData {
|
||||||
|
public static final String NBT_KEY = "AbilityIcon";
|
||||||
|
public static final int MAX_LAYERS = 3;
|
||||||
|
|
||||||
|
private final INbt customData;
|
||||||
|
|
||||||
|
// Shared across all layers
|
||||||
|
public int width = 32;
|
||||||
|
public int height = 32;
|
||||||
|
public float scale = 1.0f;
|
||||||
|
|
||||||
|
/** Whether a custom icon override is active. Default false = use type's default icon. */
|
||||||
|
private boolean enabled = false;
|
||||||
|
|
||||||
|
/** Number of active layers (1-3). */
|
||||||
|
private int layerCount = 1;
|
||||||
|
|
||||||
|
/** Layer data (always 3 slots allocated). */
|
||||||
|
private Layer[] layers = { new Layer(), new Layer(), new Layer() };
|
||||||
|
|
||||||
|
/** Per-state icon UV overrides for layer 0 (0-indexed, maps to toggle states 1, 2, ...). */
|
||||||
|
private int[][] stateIcons = null;
|
||||||
|
|
||||||
|
// Animation
|
||||||
|
private boolean animated = false;
|
||||||
|
private int frameCount = 1;
|
||||||
|
private int frametime = 2;
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// LAYER INNER CLASS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public static class Layer {
|
||||||
|
public String texture = "";
|
||||||
|
public int iconX = 0;
|
||||||
|
public int iconY = 0;
|
||||||
|
public int tintColor = 0xFFFFFF;
|
||||||
|
|
||||||
|
public Layer() {}
|
||||||
|
|
||||||
|
public boolean hasTexture() {
|
||||||
|
return texture != null && !texture.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToNBT(INbt nbt) {
|
||||||
|
nbt.setString("Texture", texture);
|
||||||
|
nbt.setInteger("IconX", iconX);
|
||||||
|
nbt.setInteger("IconY", iconY);
|
||||||
|
nbt.setInteger("TintColor", tintColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(INbt nbt) {
|
||||||
|
texture = nbt.getString("Texture");
|
||||||
|
iconX = nbt.getInteger("IconX");
|
||||||
|
iconY = nbt.getInteger("IconY");
|
||||||
|
tintColor = nbt.hasKey("TintColor") ? nbt.getInteger("TintColor") : 0xFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// CONSTRUCTION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
private AbilityIconData(INbt customData) {
|
||||||
|
this.customData = customData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an AbilityIconData instance from a raw customData compound.
|
||||||
|
* Reads existing values if present, otherwise uses defaults.
|
||||||
|
*/
|
||||||
|
public static AbilityIconData fromCustomData(INbt customData) {
|
||||||
|
AbilityIconData icon = new AbilityIconData(customData);
|
||||||
|
if (customData.hasKey(NBT_KEY)) {
|
||||||
|
icon.readFromNBT(customData.getCompoundTag(NBT_KEY));
|
||||||
|
}
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an AbilityIconData instance from an ability's customData.
|
||||||
|
*/
|
||||||
|
public static AbilityIconData fromAbility(Ability ability) {
|
||||||
|
return fromCustomData(ability.getCustomData());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an AbilityIconData instance from a chained ability's customData.
|
||||||
|
*/
|
||||||
|
public static AbilityIconData fromChainedAbility(ChainedAbility chain) {
|
||||||
|
return fromCustomData(chain.getCustomData());
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// NBT SERIALIZATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write current state back to the customData NBT.
|
||||||
|
*/
|
||||||
|
public void save() {
|
||||||
|
INbt tag = new INbt();
|
||||||
|
writeToNBT(tag);
|
||||||
|
customData.setTag(NBT_KEY, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToNBT(INbt nbt) {
|
||||||
|
nbt.setBoolean("Enabled", enabled);
|
||||||
|
nbt.setInteger("Width", width);
|
||||||
|
nbt.setInteger("Height", height);
|
||||||
|
nbt.setFloat("Scale", scale);
|
||||||
|
nbt.setInteger("LayerCount", layerCount);
|
||||||
|
|
||||||
|
INbtList layerList = new INbtList();
|
||||||
|
for (int i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
INbt layerNBT = new INbt();
|
||||||
|
layers[i].writeToNBT(layerNBT);
|
||||||
|
layerList.appendTag(layerNBT);
|
||||||
|
}
|
||||||
|
nbt.setTag("Layers", layerList);
|
||||||
|
|
||||||
|
nbt.setBoolean("Animated", animated);
|
||||||
|
nbt.setInteger("FrameCount", frameCount);
|
||||||
|
nbt.setInteger("FrameTime", frametime);
|
||||||
|
|
||||||
|
if (stateIcons != null && stateIcons.length > 0) {
|
||||||
|
INbtList list = new INbtList();
|
||||||
|
for (int[] pair : stateIcons) {
|
||||||
|
INbt comp = new INbt();
|
||||||
|
comp.setInteger("IconX", pair[0]);
|
||||||
|
comp.setInteger("IconY", pair[1]);
|
||||||
|
list.appendTag(comp);
|
||||||
|
}
|
||||||
|
nbt.setTag("StateIcons", list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(INbt nbt) {
|
||||||
|
enabled = nbt.getBoolean("Enabled");
|
||||||
|
width = nbt.getInteger("Width");
|
||||||
|
if (width <= 0) width = 32;
|
||||||
|
height = nbt.getInteger("Height");
|
||||||
|
if (height <= 0) height = 32;
|
||||||
|
scale = nbt.getFloat("Scale");
|
||||||
|
if (scale <= 0) scale = 1.0f;
|
||||||
|
|
||||||
|
layerCount = nbt.getInteger("LayerCount");
|
||||||
|
if (layerCount < 1) layerCount = 1;
|
||||||
|
if (layerCount > MAX_LAYERS) layerCount = MAX_LAYERS;
|
||||||
|
|
||||||
|
if (nbt.hasKey("Animated"))
|
||||||
|
animated = nbt.getBoolean("Animated");
|
||||||
|
if (nbt.hasKey("FrameCount"))
|
||||||
|
frameCount = Math.max(1, nbt.getInteger("FrameCount"));
|
||||||
|
if (nbt.hasKey("FrameTime"))
|
||||||
|
frametime = Math.max(1, nbt.getInteger("FrameTime"));
|
||||||
|
|
||||||
|
if (nbt.hasKey("Layers")) {
|
||||||
|
INbtList layerList = nbt.getTagList("Layers", 10);
|
||||||
|
for (int i = 0; i < MAX_LAYERS; i++) {
|
||||||
|
layers[i] = new Layer();
|
||||||
|
if (i < layerList.tagCount()) {
|
||||||
|
layers[i].readFromNBT(layerList.getCompoundTagAt(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbt.hasKey("StateIcons")) {
|
||||||
|
INbtList list = nbt.getTagList("StateIcons", 10);
|
||||||
|
stateIcons = new int[list.tagCount()][2];
|
||||||
|
for (int i = 0; i < list.tagCount(); i++) {
|
||||||
|
INbt comp = list.getCompoundTagAt(i);
|
||||||
|
stateIcons[i][0] = comp.getInteger("IconX");
|
||||||
|
stateIcons[i][1] = comp.getInteger("IconY");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// LAYER API
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public int getLayerCount() {
|
||||||
|
return layerCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerCount(int count) {
|
||||||
|
this.layerCount = Math.max(1, Math.min(MAX_LAYERS, count));
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Layer getLayer(int index) {
|
||||||
|
return (index >= 0 && index < MAX_LAYERS) ? layers[index] : layers[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerTexture(int index, String tex) {
|
||||||
|
if (index >= 0 && index < MAX_LAYERS) {
|
||||||
|
layers[index].texture = tex != null ? tex : "";
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerIconX(int index, int x) {
|
||||||
|
if (index >= 0 && index < MAX_LAYERS) {
|
||||||
|
layers[index].iconX = Math.max(0, x);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerIconY(int index, int y) {
|
||||||
|
if (index >= 0 && index < MAX_LAYERS) {
|
||||||
|
layers[index].iconY = Math.max(0, y);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerTintColor(int index, int color) {
|
||||||
|
if (index >= 0 && index < MAX_LAYERS) {
|
||||||
|
layers[index].tintColor = color & 0xFFFFFF;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// SHARED IConfigProperty GETTERS/SETTERS (with auto-save)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = Math.max(1, width);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = Math.max(1, height);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScale() {
|
||||||
|
return scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(float scale) {
|
||||||
|
this.scale = Math.max(0.1f, scale);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// ANIMATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public boolean isAnimated() {
|
||||||
|
return animated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnimated(boolean animated) {
|
||||||
|
this.animated = animated;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFrameCount() {
|
||||||
|
return frameCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrameCount(int frameCount) {
|
||||||
|
this.frameCount = Math.max(1, frameCount);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFrameTime() {
|
||||||
|
return frametime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFrameTime(int frametime) {
|
||||||
|
this.frametime = Math.max(1, frametime);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// PER-STATE ICON OVERRIDES (applies to layer 0)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public void setStateIcons(int[][] stateIcons) {
|
||||||
|
this.stateIcons = stateIcons;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get iconX for a specific toggle state (layer 0).
|
||||||
|
* Falls back to layer 0 iconX if no state override exists.
|
||||||
|
* @param state 1-indexed toggle state (0 = off/default)
|
||||||
|
*/
|
||||||
|
public int getIconXForState(int state) {
|
||||||
|
if (state > 0 && stateIcons != null && state - 1 < stateIcons.length) {
|
||||||
|
return stateIcons[state - 1][0];
|
||||||
|
}
|
||||||
|
return layers[0].iconX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get iconY for a specific toggle state (layer 0).
|
||||||
|
* Falls back to layer 0 iconY if no state override exists.
|
||||||
|
* @param state 1-indexed toggle state (0 = off/default)
|
||||||
|
*/
|
||||||
|
public int getIconYForState(int state) {
|
||||||
|
if (state > 0 && stateIcons != null && state - 1 < stateIcons.length) {
|
||||||
|
return stateIcons[state - 1][1];
|
||||||
|
}
|
||||||
|
return layers[0].iconY;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,567 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.AbilityController;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||||
|
import noppes.npcs.controllers.data.ChainedAbilityScript;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.entry.ChainedAbilityEntry;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.conditions.AbilityCondition;
|
||||||
|
import noppes.npcs.api.ability.IChainedAbility;
|
||||||
|
import noppes.npcs.controllers.data.IScriptUnit;
|
||||||
|
import kamkeel.npcs.util.FileNameHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A chained ability is an ordered sequence of ability references that execute
|
||||||
|
* one after another. It has its own conditions, cooldown, weight, and per-entry
|
||||||
|
* delay IConfiguration. Individual ability conditions are skipped during chain execution.
|
||||||
|
* <p>
|
||||||
|
* All entries must be ability references (by name/key). Inline abilities are not supported.
|
||||||
|
* When saving, all references are validated against {@link AbilityController}.
|
||||||
|
*/
|
||||||
|
public class ChainedAbility implements IChainedAbility, IAbilityAction {
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// IConfiguration (saved to NBT)
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
private String id = ""; // UUID (stable persistent reference)
|
||||||
|
private String name = ""; // Unique file key / identifier
|
||||||
|
private String displayName = ""; // Cosmetic name (falls back to name when empty)
|
||||||
|
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weight for NPC weighted random selection.
|
||||||
|
*/
|
||||||
|
private int weight = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether each ability in the chain uses its own windup phase.
|
||||||
|
*/
|
||||||
|
private boolean windUpAll = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chain-level cooldown in ticks (applied after entire chain completes).
|
||||||
|
*/
|
||||||
|
private int cooldownTicks = 100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, only this chain goes on cooldown (not the global cooldown).
|
||||||
|
*/
|
||||||
|
private boolean perAbilityCooldown = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, skip cooldown entirely after chain completes.
|
||||||
|
*/
|
||||||
|
private boolean ignoreCooldown = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum range for NPC eligibility check.
|
||||||
|
*/
|
||||||
|
private float minRange = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum range for NPC eligibility check.
|
||||||
|
*/
|
||||||
|
private float maxRange = 20;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chain-level conditions (individual ability conditions are ignored).
|
||||||
|
*/
|
||||||
|
private List<AbilityCondition> conditions = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ordered list of ability entries to execute.
|
||||||
|
*/
|
||||||
|
private List<ChainedAbilityEntry> entries = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extension data for external mods (e.g., icons, DBC stats).
|
||||||
|
*/
|
||||||
|
private INbt customData = new INbt();
|
||||||
|
|
||||||
|
// Per-instance script (isolated per execution, not saved to NBT)
|
||||||
|
private transient ChainedAbilityScript instanceScript;
|
||||||
|
|
||||||
|
public ChainedAbility() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChainedAbility(String name) {
|
||||||
|
setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// GETTERS / SETTERS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id != null ? id : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
String fallback = (this.name != null && !this.name.isEmpty()) ? this.name : "Chain";
|
||||||
|
this.name = FileNameHelper.sanitizeName(name, fallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the display name for this chained ability.
|
||||||
|
* Returns displayName if set, otherwise falls back to name.
|
||||||
|
* Converts & color codes to § for rendering.
|
||||||
|
*/
|
||||||
|
public String getDisplayName() {
|
||||||
|
String result = (displayName != null && !displayName.isEmpty())
|
||||||
|
? displayName
|
||||||
|
: FileNameHelper.toDisplayName(name);
|
||||||
|
return result != null ? result.replaceAll("&([0-9a-fk-or])", "\u00A7$1") : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRawDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(String displayName) {
|
||||||
|
this.displayName = displayName != null ? displayName : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(int weight) {
|
||||||
|
this.weight = Math.max(1, weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWindUpAll() {
|
||||||
|
return windUpAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWindUpAll(boolean windUpAll) {
|
||||||
|
this.windUpAll = windUpAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCooldownTicks() {
|
||||||
|
return cooldownTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCooldownTicks(int cooldownTicks) {
|
||||||
|
this.cooldownTicks = Math.max(0, cooldownTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPerAbilityCooldown() {
|
||||||
|
return perAbilityCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPerAbilityCooldown(boolean perAbilityCooldown) {
|
||||||
|
this.perAbilityCooldown = perAbilityCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIgnoreCooldown() {
|
||||||
|
return ignoreCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIgnoreCooldown(boolean ignoreCooldown) {
|
||||||
|
this.ignoreCooldown = ignoreCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getMinRange() {
|
||||||
|
return minRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMinRange(float minRange) {
|
||||||
|
this.minRange = Math.max(0, minRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getMaxRange() {
|
||||||
|
return maxRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxRange(float maxRange) {
|
||||||
|
this.maxRange = Math.max(0, maxRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the allowed user type from child abilities.
|
||||||
|
* A chain allows players if ALL resolved entries allow players.
|
||||||
|
* A chain allows NPCs if ALL resolved entries allow NPCs.
|
||||||
|
* Unresolvable entries are skipped (don't restrict).
|
||||||
|
*/
|
||||||
|
public UserType getAllowedBy() {
|
||||||
|
if (entries.isEmpty()) return UserType.BOTH;
|
||||||
|
boolean allAllowPlayer = true;
|
||||||
|
boolean allAllowNpc = true;
|
||||||
|
for (ChainedAbilityEntry entry : entries) {
|
||||||
|
Ability a = entry.resolve();
|
||||||
|
if (a == null) continue;
|
||||||
|
UserType ut = a.getAllowedBy();
|
||||||
|
if (!ut.allowsPlayer()) allAllowPlayer = false;
|
||||||
|
if (!ut.allowsNpc()) allAllowNpc = false;
|
||||||
|
}
|
||||||
|
if (allAllowPlayer && allAllowNpc) return UserType.BOTH;
|
||||||
|
if (allAllowPlayer) return UserType.PLAYER_ONLY;
|
||||||
|
if (allAllowNpc) return UserType.NPC_ONLY;
|
||||||
|
return UserType.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AbilityCondition> getConditions() {
|
||||||
|
return conditions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConditions(List<AbilityCondition> conditions) {
|
||||||
|
this.conditions = conditions != null ? conditions : new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ChainedAbilityEntry> getEntries() {
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntries(List<ChainedAbilityEntry> entries) {
|
||||||
|
this.entries = entries != null ? entries : new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public INbt getCustomData() {
|
||||||
|
return customData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// IChainedAbility INTERFACE
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEntryCount() {
|
||||||
|
return entries.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEntryReference(int index) {
|
||||||
|
if (index < 0 || index >= entries.size()) return null;
|
||||||
|
ChainedAbilityEntry entry = entries.get(index);
|
||||||
|
if (entry.isInline()) {
|
||||||
|
Ability a = entry.getInlineAbility();
|
||||||
|
return a != null ? a.getName() : "";
|
||||||
|
}
|
||||||
|
return entry.getAbilityReference();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEntryInline(int index) {
|
||||||
|
if (index < 0 || index >= entries.size()) return false;
|
||||||
|
return entries.get(index).isInline();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEntryDelay(int index) {
|
||||||
|
if (index < 0 || index >= entries.size()) return 0;
|
||||||
|
return entries.get(index).getDelayTicks();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// ENTRY MANAGEMENT
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public void addEntry(ChainedAbilityEntry entry) {
|
||||||
|
if (entry != null) {
|
||||||
|
entries.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addEntry(String abilityReference, int delayTicks) {
|
||||||
|
entries.add(new ChainedAbilityEntry(abilityReference, delayTicks));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeEntry(int index) {
|
||||||
|
if (index >= 0 && index < entries.size()) {
|
||||||
|
entries.remove(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveEntryUp(int index) {
|
||||||
|
if (index > 0 && index < entries.size()) {
|
||||||
|
ChainedAbilityEntry entry = entries.remove(index);
|
||||||
|
entries.add(index - 1, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveEntryDown(int index) {
|
||||||
|
if (index >= 0 && index < entries.size() - 1) {
|
||||||
|
ChainedAbilityEntry entry = entries.remove(index);
|
||||||
|
entries.add(index + 1, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// CONDITIONS
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check all chain-level conditions against the caster and target.
|
||||||
|
*/
|
||||||
|
public boolean checkConditions(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
for (AbilityCondition c : conditions) {
|
||||||
|
if (!c.getUserType().allowsNpc()) continue;
|
||||||
|
Boolean extendedCondition = AbilityController.Instance.fireCheckConditions(c, caster, target);
|
||||||
|
|
||||||
|
if (extendedCondition != null) {
|
||||||
|
if (!extendedCondition) return false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c.check(caster, target)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check conditions for player use (skip target-requiring conditions).
|
||||||
|
*/
|
||||||
|
public boolean checkConditionsForPlayer(IEntityLivingBase caster) {
|
||||||
|
for (AbilityCondition c : conditions) {
|
||||||
|
if (!c.getUserType().allowsPlayer()) continue;
|
||||||
|
if (c.requiresTarget()) continue;
|
||||||
|
Boolean extendedCondition = AbilityController.Instance.fireCheckConditionsForPlayer(c, caster);
|
||||||
|
|
||||||
|
if (extendedCondition != null) {
|
||||||
|
if (!extendedCondition) return false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!c.check(caster, null)) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// VALIDATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate this chained ability. Returns a list of error messages.
|
||||||
|
* An empty list means valid.
|
||||||
|
*/
|
||||||
|
public List<String> validate() {
|
||||||
|
List<String> errors = new ArrayList<>();
|
||||||
|
|
||||||
|
if (name == null || name.isEmpty()) {
|
||||||
|
errors.add("Name is required");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entries.isEmpty()) {
|
||||||
|
errors.add("At least one ability entry is required");
|
||||||
|
}
|
||||||
|
|
||||||
|
AbilityController controller = AbilityController.Instance;
|
||||||
|
if (controller != null) {
|
||||||
|
for (int i = 0; i < entries.size(); i++) {
|
||||||
|
ChainedAbilityEntry entry = entries.get(i);
|
||||||
|
if (entry.isInline()) {
|
||||||
|
if (entry.getInlineAbility() == null) {
|
||||||
|
errors.add("Entry " + (i + 1) + ": inline ability is null");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String ref = entry.getAbilityReference();
|
||||||
|
if (ref == null || ref.isEmpty()) {
|
||||||
|
errors.add("Entry " + (i + 1) + ": ability reference is empty");
|
||||||
|
} else if (!controller.canResolveAbility(ref)) {
|
||||||
|
errors.add("Entry " + (i + 1) + ": cannot resolve ability '" + ref + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// DEEP COPY
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a deep copy via NBT round-trip.
|
||||||
|
*/
|
||||||
|
public ChainedAbility deepCopy() {
|
||||||
|
ChainedAbility copy = new ChainedAbility();
|
||||||
|
copy.readNBT(this.writeNBT(false));
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isChain() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAbilityAction deepCopyAction() {
|
||||||
|
return deepCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// NBT SERIALIZATION
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public INbt writeNBT(boolean saveScripts) {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setString("Id", id);
|
||||||
|
nbt.setString("Name", name);
|
||||||
|
nbt.setString("DisplayName", displayName);
|
||||||
|
nbt.setBoolean("Enabled", enabled);
|
||||||
|
nbt.setInteger("Weight", weight);
|
||||||
|
nbt.setBoolean("WindUpAll", windUpAll);
|
||||||
|
nbt.setInteger("CooldownTicks", cooldownTicks);
|
||||||
|
nbt.setBoolean("PerAbilityCooldown", perAbilityCooldown);
|
||||||
|
nbt.setBoolean("IgnoreCooldown", ignoreCooldown);
|
||||||
|
nbt.setFloat("MinRange", minRange);
|
||||||
|
nbt.setFloat("MaxRange", maxRange);
|
||||||
|
|
||||||
|
// Conditions
|
||||||
|
INbtList condList = new INbtList();
|
||||||
|
for (AbilityCondition c : conditions) {
|
||||||
|
condList.appendTag(c.writeNBT());
|
||||||
|
}
|
||||||
|
nbt.setTag("Conditions", condList);
|
||||||
|
|
||||||
|
// Entries
|
||||||
|
INbtList entryList = new INbtList();
|
||||||
|
for (ChainedAbilityEntry entry : entries) {
|
||||||
|
entryList.appendTag(entry.writeNBT(saveScripts));
|
||||||
|
}
|
||||||
|
nbt.setTag("Entries", entryList);
|
||||||
|
|
||||||
|
// Custom data (for external mods)
|
||||||
|
nbt.setTag("customData", (INbt) customData.copy());
|
||||||
|
|
||||||
|
// Script handler data (matching CustomEffect.writeToNBT pattern)
|
||||||
|
if (saveScripts) {
|
||||||
|
ChainedAbilityScript handler = getScriptHandler();
|
||||||
|
if (handler != null) {
|
||||||
|
INbt scriptData = new INbt();
|
||||||
|
handler.writeToNBT(scriptData);
|
||||||
|
nbt.setTag("ScriptData", scriptData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
id = nbt.getString("Id");
|
||||||
|
setName(nbt.getString("Name"));
|
||||||
|
displayName = nbt.getString("DisplayName");
|
||||||
|
enabled = !nbt.hasKey("Enabled") || nbt.getBoolean("Enabled");
|
||||||
|
weight = nbt.hasKey("Weight") ? nbt.getInteger("Weight") : 10;
|
||||||
|
windUpAll = !nbt.hasKey("WindUpAll") || nbt.getBoolean("WindUpAll");
|
||||||
|
cooldownTicks = nbt.hasKey("CooldownTicks") ? nbt.getInteger("CooldownTicks") : 100;
|
||||||
|
perAbilityCooldown = nbt.getBoolean("PerAbilityCooldown");
|
||||||
|
ignoreCooldown = nbt.getBoolean("IgnoreCooldown");
|
||||||
|
minRange = nbt.getFloat("MinRange");
|
||||||
|
maxRange = nbt.hasKey("MaxRange") ? nbt.getFloat("MaxRange") : 20;
|
||||||
|
// AllowedBy is computed from child abilities
|
||||||
|
|
||||||
|
// Conditions
|
||||||
|
conditions.clear();
|
||||||
|
INbtList condList = nbt.getTagList("Conditions", 10);
|
||||||
|
for (int i = 0; i < condList.tagCount(); i++) {
|
||||||
|
AbilityCondition c = AbilityCondition.fromNBT(condList.getCompoundTagAt(i));
|
||||||
|
if (c != null) {
|
||||||
|
conditions.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entries
|
||||||
|
entries.clear();
|
||||||
|
INbtList entryList = nbt.getTagList("Entries", 10);
|
||||||
|
for (int i = 0; i < entryList.tagCount(); i++) {
|
||||||
|
ChainedAbilityEntry entry = ChainedAbilityEntry.fromNBT(entryList.getCompoundTagAt(i));
|
||||||
|
if (entry != null) {
|
||||||
|
entries.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Custom data (for external mods)
|
||||||
|
customData = (INbt) nbt.getCompoundTag("customData").copy();
|
||||||
|
|
||||||
|
// Script handler data (matching CustomEffect.readFromNBT pattern)
|
||||||
|
if (nbt.hasKey("ScriptData", 10)) {
|
||||||
|
if (getScriptHandler() == null) {
|
||||||
|
ChainedAbilityScript handler = new ChainedAbilityScript(this.id);
|
||||||
|
handler.readFromNBT(nbt.getCompoundTag("ScriptData"));
|
||||||
|
setScriptHandler(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
// SCRIPT HANDLER
|
||||||
|
// ═══════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
|
public ChainedAbilityScript getScriptHandler() {
|
||||||
|
return AbilityController.Instance.chainedAbilityScriptHandlers.get(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScriptHandler(ChainedAbilityScript handler) {
|
||||||
|
AbilityController.Instance.chainedAbilityScriptHandlers.put(this.id, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChainedAbilityScript getOrCreateScriptHandler() {
|
||||||
|
ChainedAbilityScript handler = getScriptHandler();
|
||||||
|
if (handler == null) {
|
||||||
|
handler = new ChainedAbilityScript(this.id);
|
||||||
|
AbilityController.Instance.chainedAbilityScriptHandlers.put(this.id, handler);
|
||||||
|
}
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or create a per-instance script handler for this chain execution.
|
||||||
|
* Shares the template's engine but creates isolated Bindings for variable state.
|
||||||
|
* Returns null if no script is configured on the template.
|
||||||
|
*/
|
||||||
|
public ChainedAbilityScript getOrCreateInstanceScript() {
|
||||||
|
if (instanceScript != null) return instanceScript;
|
||||||
|
|
||||||
|
ChainedAbilityScript template = getScriptHandler();
|
||||||
|
if (template == null || !template.getEnabled() || template.container == null) return null;
|
||||||
|
|
||||||
|
instanceScript = new ChainedAbilityScript(this.id);
|
||||||
|
instanceScript.setLanguage(template.getLanguage());
|
||||||
|
instanceScript.setEnabled(true);
|
||||||
|
|
||||||
|
IScriptUnit clone = template.container.createInstanceScope(instanceScript);
|
||||||
|
instanceScript.addScriptUnit(clone);
|
||||||
|
|
||||||
|
return instanceScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the per-instance script handler (call on chain completion/reset).
|
||||||
|
*/
|
||||||
|
public void clearInstanceScript() {
|
||||||
|
this.instanceScript = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.AbilityAction;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.conditions.AbilityCondition;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.UserType;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common interface for all combat actions that can be assigned to NPCs or players.
|
||||||
|
* Implemented by {@link Ability} (individual ability) and {@link ChainedAbility} (sequence).
|
||||||
|
* <p>
|
||||||
|
* This enables unified storage via {@link AbilityAction}, unified weighted random selection,
|
||||||
|
* and unified eligibility checking without instanceof or separate codepaths.
|
||||||
|
*/
|
||||||
|
public interface IAbilityAction {
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
boolean isEnabled();
|
||||||
|
|
||||||
|
void setEnabled(boolean enabled);
|
||||||
|
|
||||||
|
int getWeight();
|
||||||
|
|
||||||
|
int getCooldownTicks();
|
||||||
|
|
||||||
|
float getMinRange();
|
||||||
|
|
||||||
|
float getMaxRange();
|
||||||
|
|
||||||
|
UserType getAllowedBy();
|
||||||
|
|
||||||
|
List<AbilityCondition> getConditions();
|
||||||
|
|
||||||
|
boolean checkConditions(IEntityLivingBase caster, IEntityLivingBase target);
|
||||||
|
|
||||||
|
boolean checkConditionsForPlayer(IEntityLivingBase caster);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this action is available for the given player.
|
||||||
|
* Used for visibility filtering (HUD, selection) and activation gating.
|
||||||
|
* Returns true by default (no requirement).
|
||||||
|
*/
|
||||||
|
default boolean isAvailableFor(IPlayer player) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this action is a chained ability (sequence of abilities) vs an individual ability.
|
||||||
|
*/
|
||||||
|
boolean isChain();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a deep copy of this action.
|
||||||
|
*/
|
||||||
|
IAbilityAction deepCopyAction();
|
||||||
|
|
||||||
|
INbt writeNBT(boolean saveScripts);
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data;
|
||||||
|
|
||||||
|
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyAnchorData;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyDisplayData;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.AnchorPoint;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Per-projectile data: anchor point + optional color override.
|
||||||
|
* All projectiles share the primary EnergyDisplayData; this class
|
||||||
|
* allows individual projectiles to override just the inner/outer colors.
|
||||||
|
*/
|
||||||
|
public class ProjectileData {
|
||||||
|
public EnergyAnchorData anchor;
|
||||||
|
public boolean colorOverride = false;
|
||||||
|
public int innerColor = 0xFFFFFF;
|
||||||
|
public int outerColor = 0x8888FF;
|
||||||
|
|
||||||
|
public ProjectileData(AnchorPoint defaultAnchor) {
|
||||||
|
this.anchor = new EnergyAnchorData(defaultAnchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the display data to use for this projectile.
|
||||||
|
* If colorOverride is false, returns the primary display data directly.
|
||||||
|
* If colorOverride is true, returns a copy with overridden inner/outer colors.
|
||||||
|
*/
|
||||||
|
public EnergyDisplayData resolveDisplay(EnergyDisplayData primary) {
|
||||||
|
// Always return a copy so IEntity mutations never bleed back into the ability template.
|
||||||
|
EnergyDisplayData resolved = primary.copy();
|
||||||
|
if (colorOverride) {
|
||||||
|
resolved.innerColor = this.innerColor;
|
||||||
|
resolved.outerColor = this.outerColor;
|
||||||
|
}
|
||||||
|
return resolved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
// OLD: anchor.writeNBT(new NBTWrapper(nbt));
|
||||||
|
anchor.writeNBT(nbt);
|
||||||
|
nbt.setBoolean("colorOverride", colorOverride);
|
||||||
|
if (colorOverride) {
|
||||||
|
nbt.setInteger("overrideInnerColor", innerColor);
|
||||||
|
nbt.setInteger("overrideOuterColor", outerColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
// OLD: anchor.readNBT(new NBTWrapper(nbt));
|
||||||
|
anchor.readNBT(nbt);
|
||||||
|
colorOverride = nbt.getBoolean("colorOverride");
|
||||||
|
if (colorOverride) {
|
||||||
|
innerColor = nbt.getInteger("overrideInnerColor");
|
||||||
|
outerColor = nbt.getInteger("overrideOuterColor");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectileData copy() {
|
||||||
|
ProjectileData copy = new ProjectileData(anchor.anchorPoint);
|
||||||
|
copy.anchor = anchor.copy();
|
||||||
|
copy.colorOverride = colorOverride;
|
||||||
|
copy.innerColor = innerColor;
|
||||||
|
copy.outerColor = outerColor;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.effect;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.controllers.CustomEffectController;
|
||||||
|
import noppes.npcs.util.ValueUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a custom effect reference that can be applied by abilities.
|
||||||
|
* Wraps the CustomEffectController system (player-only effects with script callbacks).
|
||||||
|
*/
|
||||||
|
public class AbilityCustomEffect {
|
||||||
|
|
||||||
|
private int effectId = -1;
|
||||||
|
private int durationTicks = 60;
|
||||||
|
private byte level = 0;
|
||||||
|
private int index = 0;
|
||||||
|
|
||||||
|
public AbilityCustomEffect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityCustomEffect(int effectId, int durationTicks, byte level) {
|
||||||
|
this.effectId = effectId;
|
||||||
|
this.durationTicks = Math.max(1, durationTicks);
|
||||||
|
this.level = (byte) Math.max(0, Math.min(10, level));
|
||||||
|
this.index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityCustomEffect(int effectId, int durationTicks, byte level, int index) {
|
||||||
|
this(effectId, durationTicks, level);
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityCustomEffect copy() {
|
||||||
|
return new AbilityCustomEffect(effectId, durationTicks, level, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies this custom effect to the given IEntity.
|
||||||
|
* Only works on players (CustomEffectController is player-only).
|
||||||
|
*/
|
||||||
|
public void apply(IEntityLivingBase IEntity) {
|
||||||
|
if (IEntity == null || effectId <= 0) return;
|
||||||
|
if (IEntity instanceof IPlayer) {
|
||||||
|
CustomEffectController.getInstance().applyEffect(
|
||||||
|
(IPlayer) IEntity, effectId, durationTicks, level, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return effectId > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── NBT ──
|
||||||
|
|
||||||
|
public INbt writeNBT() {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setInteger("effectId", effectId);
|
||||||
|
nbt.setInteger("duration", durationTicks);
|
||||||
|
nbt.setByte("level", level);
|
||||||
|
nbt.setInteger("index", index);
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
this.effectId = nbt.getInteger("effectId");
|
||||||
|
this.durationTicks = nbt.getInteger("duration");
|
||||||
|
this.level = nbt.getByte("level");
|
||||||
|
this.index = nbt.getInteger("index");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityCustomEffect fromNBT(INbt nbt) {
|
||||||
|
AbilityCustomEffect e = new AbilityCustomEffect();
|
||||||
|
e.readNBT(nbt);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Getters/Setters ──
|
||||||
|
|
||||||
|
public int getEffectId() {
|
||||||
|
return effectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEffectId(int effectId) {
|
||||||
|
this.effectId = effectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDurationTicks() {
|
||||||
|
return durationTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDurationTicks(int durationTicks) {
|
||||||
|
this.durationTicks = Math.max(1, durationTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(byte level) {
|
||||||
|
this.level = (byte) ValueUtil.clamp(level, 0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndex(int index) {
|
||||||
|
this.index = Math.max(0, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
+138
@@ -0,0 +1,138 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.effect;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.constants.EnumPotionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a configurable IPotionType effect that can be applied by abilities.
|
||||||
|
* Uses the unified EnumPotionType enum shared across melee, ranged, and ability systems.
|
||||||
|
*/
|
||||||
|
public class AbilityPotionEffect {
|
||||||
|
|
||||||
|
private EnumPotionType type = EnumPotionType.None;
|
||||||
|
private int manualPotionId = 0;
|
||||||
|
private int durationTicks = 60;
|
||||||
|
private int amplifier = 0; // 0-255 (Manual), 0-10 (preset)
|
||||||
|
|
||||||
|
public AbilityPotionEffect() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityPotionEffect(EnumPotionType type, int durationTicks, int amplifier) {
|
||||||
|
this.type = type;
|
||||||
|
this.durationTicks = Math.max(1, durationTicks);
|
||||||
|
this.amplifier = Math.max(0, Math.min(255, amplifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a copy of this effect.
|
||||||
|
*/
|
||||||
|
public AbilityPotionEffect copy() {
|
||||||
|
AbilityPotionEffect copy = new AbilityPotionEffect(type, durationTicks, amplifier);
|
||||||
|
copy.manualPotionId = this.manualPotionId;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Applies this effect to the given IEntity.
|
||||||
|
* Does nothing if type is None. Validates IPotionType IDs before applying.
|
||||||
|
*/
|
||||||
|
public void apply(IEntityLivingBase IEntity) {
|
||||||
|
if (IEntity == null || type == EnumPotionType.None) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == EnumPotionType.Fire) {
|
||||||
|
IEntity.setFire(Math.max(1, durationTicks / 20));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int potionId = type.getResolvedPotionId(manualPotionId);
|
||||||
|
if (EnumPotionType.isValidPotionId(potionId)) {
|
||||||
|
IEntity.addPotionEffect(new IPotionEffect(potionId, durationTicks, amplifier));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes this effect to NBT.
|
||||||
|
*/
|
||||||
|
public INbt writeNBT() {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setInteger("potionType", type.ordinal());
|
||||||
|
nbt.setInteger("duration", durationTicks);
|
||||||
|
nbt.setInteger("amplifier", amplifier);
|
||||||
|
if (type == EnumPotionType.Manual) {
|
||||||
|
nbt.setInteger("manualPotionId", manualPotionId);
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads this effect from NBT.
|
||||||
|
*/
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
this.type = EnumPotionType.fromOrdinal(nbt.getInteger("potionType"));
|
||||||
|
this.durationTicks = nbt.getInteger("duration");
|
||||||
|
this.amplifier = nbt.getInteger("amplifier");
|
||||||
|
if (type == EnumPotionType.Manual) {
|
||||||
|
this.manualPotionId = nbt.getInteger("manualPotionId");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an AbilityPotionEffect from NBT.
|
||||||
|
*/
|
||||||
|
public static AbilityPotionEffect fromNBT(INbt nbt) {
|
||||||
|
AbilityPotionEffect effect = new AbilityPotionEffect();
|
||||||
|
effect.readNBT(nbt);
|
||||||
|
return effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters & Setters
|
||||||
|
|
||||||
|
public EnumPotionType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(EnumPotionType type) {
|
||||||
|
this.type = type != null ? type : EnumPotionType.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getManualPotionId() {
|
||||||
|
return manualPotionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManualPotionId(int manualPotionId) {
|
||||||
|
this.manualPotionId = Math.max(0, manualPotionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDurationTicks() {
|
||||||
|
return durationTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDurationTicks(int durationTicks) {
|
||||||
|
this.durationTicks = Math.max(1, durationTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAmplifier() {
|
||||||
|
return amplifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmplifier(int amplifier) {
|
||||||
|
this.amplifier = Math.max(0, Math.min(255, amplifier));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this effect is configured (not None).
|
||||||
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
return type != EnumPotionType.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.effect;
|
||||||
|
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for mod-registered effect actions that can be applied by AbilityEffect.
|
||||||
|
* <p>
|
||||||
|
* Mods register implementations via {@code Register.EffectActions} or
|
||||||
|
* {@code AbilityController.Instance.registerEffectAction()}.
|
||||||
|
* Each action has a unique ID, display name, and apply logic.
|
||||||
|
* Actions can optionally provide custom IConfiguration fields for the GUI.
|
||||||
|
*/
|
||||||
|
public interface IEffectAction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unique identifier, e.g. "dbc:kiRestore", "mymod:buffSpeed".
|
||||||
|
*/
|
||||||
|
String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localized display name shown in the GUI selector.
|
||||||
|
*/
|
||||||
|
String getDisplayName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply this action to a target IEntity.
|
||||||
|
* Called once per affected IEntity during ability execution.
|
||||||
|
*
|
||||||
|
* @param caster The IEntity that used the ability
|
||||||
|
* @param target The IEntity being affected
|
||||||
|
* @param config Action-specific IConfiguration NBT (from GUI)
|
||||||
|
*/
|
||||||
|
void apply(IEntityLivingBase caster, IEntityLivingBase target, INbt config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create default IConfiguration NBT for a new instance of this action.
|
||||||
|
*/
|
||||||
|
default INbt createDefaultConfig() {
|
||||||
|
return new INbt();
|
||||||
|
}
|
||||||
|
}
|
||||||
+118
@@ -0,0 +1,118 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.AnchorPoint;
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyAnchorData;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
|
||||||
|
public class EnergyAnchorData implements IEnergyAnchorData {
|
||||||
|
public AnchorPoint anchorPoint = AnchorPoint.FRONT;
|
||||||
|
public float anchorOffsetX = 0;
|
||||||
|
public float anchorOffsetY = 0;
|
||||||
|
public float anchorOffsetZ = 0;
|
||||||
|
public boolean launchFromAnchor = false;
|
||||||
|
|
||||||
|
public EnergyAnchorData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyAnchorData(AnchorPoint anchorPoint) {
|
||||||
|
this.anchorPoint = anchorPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyAnchorData(AnchorPoint anchorPoint, float anchorOffsetX, float anchorOffsetY, float anchorOffsetZ) {
|
||||||
|
this.anchorPoint = anchorPoint;
|
||||||
|
this.anchorOffsetX = anchorOffsetX;
|
||||||
|
this.anchorOffsetY = anchorOffsetY;
|
||||||
|
this.anchorOffsetZ = anchorOffsetZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyAnchorData(int anchorPoint) {
|
||||||
|
this.anchorPoint = AnchorPoint.fromOrdinal(anchorPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyAnchorData(int anchorPoint, float anchorOffsetX, float anchorOffsetY, float anchorOffsetZ) {
|
||||||
|
this.anchorPoint = AnchorPoint.fromOrdinal(anchorPoint);
|
||||||
|
this.anchorOffsetX = anchorOffsetX;
|
||||||
|
this.anchorOffsetY = anchorOffsetY;
|
||||||
|
this.anchorOffsetZ = anchorOffsetZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AnchorPoint getAnchorPoint() {
|
||||||
|
return anchorPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnchorPoint(AnchorPoint anchorPoint) {
|
||||||
|
this.anchorPoint = anchorPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAnchor() {
|
||||||
|
return anchorPoint.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchor(int anchor) {
|
||||||
|
this.anchorPoint = AnchorPoint.fromOrdinal(anchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAnchorOffsetX() {
|
||||||
|
return anchorOffsetX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchorOffsetX(float anchorOffsetX) {
|
||||||
|
this.anchorOffsetX = anchorOffsetX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAnchorOffsetY() {
|
||||||
|
return anchorOffsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchorOffsetY(float anchorOffsetY) {
|
||||||
|
this.anchorOffsetY = anchorOffsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getAnchorOffsetZ() {
|
||||||
|
return anchorOffsetZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAnchorOffsetZ(float anchorOffsetZ) {
|
||||||
|
this.anchorOffsetZ = anchorOffsetZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getLaunchFromAnchor() {
|
||||||
|
return launchFromAnchor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLaunchFromAnchor(boolean launchFromAnchor) {
|
||||||
|
this.launchFromAnchor = launchFromAnchor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("anchorPoint", anchorPoint.ordinal());
|
||||||
|
nbt.setFloat("anchorOffsetX", anchorOffsetX);
|
||||||
|
nbt.setFloat("anchorOffsetY", anchorOffsetY);
|
||||||
|
nbt.setFloat("anchorOffsetZ", anchorOffsetZ);
|
||||||
|
nbt.setBoolean("launchFromAnchor", launchFromAnchor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
this.anchorPoint = AnchorPoint.fromOrdinal(nbt.getInteger("anchorPoint"));
|
||||||
|
this.anchorOffsetX = nbt.getFloat("anchorOffsetX");
|
||||||
|
this.anchorOffsetY = nbt.getFloat("anchorOffsetY");
|
||||||
|
this.anchorOffsetZ = nbt.getFloat("anchorOffsetZ");
|
||||||
|
this.launchFromAnchor = nbt.getBoolean("launchFromAnchor");
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyAnchorData copy() {
|
||||||
|
EnergyAnchorData copy = new EnergyAnchorData(anchorPoint, anchorOffsetX, anchorOffsetY, anchorOffsetZ);
|
||||||
|
copy.launchFromAnchor = this.launchFromAnchor;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
+243
@@ -0,0 +1,243 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.core.NBT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups barrier properties shared by energy barrier abilities (Dome, Wall, Shield).
|
||||||
|
* Handles health/durability, duration, and per-projectile-type damage multipliers.
|
||||||
|
*
|
||||||
|
* Properties:
|
||||||
|
* - Solid: Hard wall - entities cannot pass through the barrier boundary (either direction)
|
||||||
|
* - Knockback: Repulsion field - entities near the surface get pushed away
|
||||||
|
* - Absorbing: Caster's incoming damage is redirected to the barrier
|
||||||
|
* - Allows Melee: Barrier can be hit by melee attacks (punching)
|
||||||
|
*/
|
||||||
|
public class EnergyBarrierData {
|
||||||
|
|
||||||
|
public float maxHealth = 100.0f;
|
||||||
|
public boolean useHealth = true;
|
||||||
|
public int durationTicks = 200;
|
||||||
|
public boolean useDuration = true;
|
||||||
|
public float defaultMultiplier = 1.0f;
|
||||||
|
|
||||||
|
// Solid: entities cannot pass through the barrier boundary
|
||||||
|
public boolean solid = false;
|
||||||
|
|
||||||
|
// Knockback: repulsion field pushing entities away from surface
|
||||||
|
public boolean knockbackEnabled = false;
|
||||||
|
public float knockbackStrength = 1.0f;
|
||||||
|
|
||||||
|
// Absorbing: caster's damage is redirected to the barrier
|
||||||
|
public boolean absorbing = false;
|
||||||
|
// Absorb radius: max distance from barrier's current position for absorption to work
|
||||||
|
// -1 = no radius limit (absorb regardless of distance)
|
||||||
|
// 0 = use barrier's own extent as the radius (dome radius, panel half-size, etc.)
|
||||||
|
// positive = owner must be within this many blocks of the barrier IEntity
|
||||||
|
public float absorbRadius = 0.0f;
|
||||||
|
|
||||||
|
// Melee: barrier can be hit by melee attacks
|
||||||
|
public boolean meleeEnabled = false;
|
||||||
|
public float meleeDamageMultiplier = 1.0f;
|
||||||
|
|
||||||
|
// Reflection: rebound projectiles that fail to break the barrier
|
||||||
|
public boolean reflect = false;
|
||||||
|
public float reflectStrengthPct = 25.0f;
|
||||||
|
public boolean targetOwner = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Per-projectile-type damage multipliers.
|
||||||
|
* Key is the ability typeId (e.g., "ability.cnpc.orb", "ability.cnpc.beam").
|
||||||
|
* Value is the multiplier applied to damage dealt to this barrier.
|
||||||
|
*/
|
||||||
|
private Map<String, Float> damageMultipliers = new HashMap<>();
|
||||||
|
|
||||||
|
public EnergyBarrierData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyBarrierData(float maxHealth, boolean useHealth, int durationTicks, boolean useDuration) {
|
||||||
|
this.maxHealth = maxHealth;
|
||||||
|
this.useHealth = useHealth;
|
||||||
|
this.durationTicks = durationTicks;
|
||||||
|
this.useDuration = useDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== MULTIPLIER METHODS ====================
|
||||||
|
|
||||||
|
public float getMultiplier(String abilityTypeId) {
|
||||||
|
Float mult = damageMultipliers.get(abilityTypeId);
|
||||||
|
return mult != null ? mult : defaultMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMultiplier(String abilityTypeId, float multiplier) {
|
||||||
|
damageMultipliers.put(abilityTypeId, multiplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeMultiplier(String abilityTypeId) {
|
||||||
|
damageMultipliers.remove(abilityTypeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Float> getDamageMultipliers() {
|
||||||
|
return damageMultipliers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDamageMultipliers(Map<String, Float> multipliers) {
|
||||||
|
this.damageMultipliers = multipliers != null ? multipliers : new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== GETTERS & SETTERS ====================
|
||||||
|
|
||||||
|
public float getMaxHealth() {
|
||||||
|
return maxHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxHealth(float maxHealth) {
|
||||||
|
this.maxHealth = Math.max(1.0f, maxHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUseHealth() {
|
||||||
|
return useHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseHealth(boolean useHealth) {
|
||||||
|
this.useHealth = useHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDurationTicks() {
|
||||||
|
return durationTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDurationTicks(int durationTicks) {
|
||||||
|
this.durationTicks = Math.max(1, durationTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUseDuration() {
|
||||||
|
return useDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseDuration(boolean useDuration) {
|
||||||
|
this.useDuration = useDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getDefaultMultiplier() {
|
||||||
|
return defaultMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultMultiplier(float defaultMultiplier) {
|
||||||
|
this.defaultMultiplier = defaultMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReflect() {
|
||||||
|
return reflect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReflect(boolean reflect) {
|
||||||
|
this.reflect = reflect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getReflectStrengthPct() {
|
||||||
|
return reflectStrengthPct;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReflectStrengthPct(float reflectStrengthPct) {
|
||||||
|
this.reflectStrengthPct = Math.max(0.0f, Math.min(100.0f, reflectStrengthPct));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTargetOwner() {
|
||||||
|
return targetOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetOwner(boolean targetOwner) {
|
||||||
|
this.targetOwner = targetOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAbsorbRadius() {
|
||||||
|
return absorbRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbsorbRadius(float absorbRadius) {
|
||||||
|
this.absorbRadius = absorbRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== NBT ====================
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("barrierMaxHealth", maxHealth);
|
||||||
|
nbt.setBoolean("barrierUseHealth", useHealth);
|
||||||
|
nbt.setInteger("barrierDuration", durationTicks);
|
||||||
|
nbt.setBoolean("barrierUseDuration", useDuration);
|
||||||
|
nbt.setFloat("barrierDefaultMult", defaultMultiplier);
|
||||||
|
nbt.setBoolean("barrierSolid", solid);
|
||||||
|
nbt.setBoolean("barrierKnockback", knockbackEnabled);
|
||||||
|
nbt.setFloat("barrierKnockbackStr", knockbackStrength);
|
||||||
|
nbt.setBoolean("barrierAbsorbing", absorbing);
|
||||||
|
nbt.setFloat("barrierAbsorbRadius", absorbRadius);
|
||||||
|
nbt.setBoolean("barrierMelee", meleeEnabled);
|
||||||
|
nbt.setFloat("barrierMeleeMult", meleeDamageMultiplier);
|
||||||
|
nbt.setBoolean("barrierReflect", reflect);
|
||||||
|
nbt.setFloat("barrierReflectStrPct", reflectStrengthPct);
|
||||||
|
nbt.setBoolean("barrierTargetOwner", targetOwner);
|
||||||
|
|
||||||
|
INbt multNbt = NBT.compound();
|
||||||
|
for (Map.Entry<String, Float> entry : damageMultipliers.entrySet()) {
|
||||||
|
multNbt.setFloat(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
nbt.setCompound("barrierMultipliers", multNbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
maxHealth = nbt.hasKey("barrierMaxHealth") ? nbt.getFloat("barrierMaxHealth") : 100.0f;
|
||||||
|
useHealth = !nbt.hasKey("barrierUseHealth") || nbt.getBoolean("barrierUseHealth");
|
||||||
|
durationTicks = nbt.hasKey("barrierDuration") ? nbt.getInteger("barrierDuration") : 200;
|
||||||
|
useDuration = !nbt.hasKey("barrierUseDuration") || nbt.getBoolean("barrierUseDuration");
|
||||||
|
defaultMultiplier = nbt.hasKey("barrierDefaultMult") ? nbt.getFloat("barrierDefaultMult") : 1.0f;
|
||||||
|
solid = nbt.hasKey("barrierSolid") && nbt.getBoolean("barrierSolid");
|
||||||
|
knockbackEnabled = nbt.hasKey("barrierKnockback") && nbt.getBoolean("barrierKnockback");
|
||||||
|
knockbackStrength = nbt.hasKey("barrierKnockbackStr") ? nbt.getFloat("barrierKnockbackStr") : 1.0f;
|
||||||
|
absorbing = nbt.hasKey("barrierAbsorbing") && nbt.getBoolean("barrierAbsorbing");
|
||||||
|
absorbRadius = nbt.hasKey("barrierAbsorbRadius") ? nbt.getFloat("barrierAbsorbRadius") : 0.0f;
|
||||||
|
meleeEnabled = nbt.hasKey("barrierMelee") && nbt.getBoolean("barrierMelee");
|
||||||
|
meleeDamageMultiplier = nbt.hasKey("barrierMeleeMult") ? nbt.getFloat("barrierMeleeMult") : 1.0f;
|
||||||
|
reflect = nbt.hasKey("barrierReflect") && nbt.getBoolean("barrierReflect");
|
||||||
|
setReflectStrengthPct(nbt.hasKey("barrierReflectStrPct") ? nbt.getFloat("barrierReflectStrPct") : 25.0f);
|
||||||
|
targetOwner = nbt.hasKey("barrierTargetOwner") && nbt.getBoolean("barrierTargetOwner");
|
||||||
|
|
||||||
|
damageMultipliers.clear();
|
||||||
|
if (nbt.hasKey("barrierMultipliers")) {
|
||||||
|
INbt multNbt = nbt.getCompound("barrierMultipliers");
|
||||||
|
Set<String> keys = multNbt.getKeySet();
|
||||||
|
for (String key : keys) {
|
||||||
|
damageMultipliers.put(key, multNbt.getFloat(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyBarrierData copy() {
|
||||||
|
EnergyBarrierData copy = new EnergyBarrierData(maxHealth, useHealth, durationTicks, useDuration);
|
||||||
|
copy.defaultMultiplier = defaultMultiplier;
|
||||||
|
copy.solid = solid;
|
||||||
|
copy.knockbackEnabled = knockbackEnabled;
|
||||||
|
copy.knockbackStrength = knockbackStrength;
|
||||||
|
copy.absorbing = absorbing;
|
||||||
|
copy.absorbRadius = absorbRadius;
|
||||||
|
copy.meleeEnabled = meleeEnabled;
|
||||||
|
copy.meleeDamageMultiplier = meleeDamageMultiplier;
|
||||||
|
copy.reflect = reflect;
|
||||||
|
copy.reflectStrengthPct = reflectStrengthPct;
|
||||||
|
copy.targetOwner = targetOwner;
|
||||||
|
copy.damageMultipliers = new HashMap<>(damageMultipliers);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
|
||||||
|
public class EnergyChargingData {
|
||||||
|
|
||||||
|
public int chargeDuration = 60;
|
||||||
|
public int chargeDelay = 0;
|
||||||
|
public int maxCharge = 100;
|
||||||
|
public boolean hasCharge = true;
|
||||||
|
public boolean chargeWindUpSync = true;
|
||||||
|
|
||||||
|
public EnergyChargingData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyChargingData(int chargeDuration, int chargeDelay, int maxCharge, boolean hasCharge, boolean chargeWindUpSync) {
|
||||||
|
this.chargeDuration = chargeDuration;
|
||||||
|
this.chargeDelay = chargeDelay;
|
||||||
|
this.maxCharge = maxCharge;
|
||||||
|
this.hasCharge = hasCharge;
|
||||||
|
this.chargeWindUpSync = chargeWindUpSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasCharge() {
|
||||||
|
return hasCharge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasCharge(boolean hasCharge) {
|
||||||
|
this.hasCharge = hasCharge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isChargeWindUpSync() {
|
||||||
|
return chargeWindUpSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeWindUpSync(boolean chargeWindUpSync) {
|
||||||
|
this.chargeWindUpSync = chargeWindUpSync;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getChargeDuration() {
|
||||||
|
return chargeDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeDuration(int chargeDuration) {
|
||||||
|
this.chargeDuration = chargeDuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getChargeDelay() {
|
||||||
|
return chargeDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeDelay(int chargeDelay) {
|
||||||
|
this.chargeDelay = chargeDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxCharge() {
|
||||||
|
return maxCharge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxCharge(int maxCharge) {
|
||||||
|
this.maxCharge = Math.max(0, maxCharge);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("chargeDuration", chargeDuration);
|
||||||
|
nbt.setInteger("chargeDelay", chargeDelay);
|
||||||
|
nbt.setInteger("maxCharge", maxCharge);
|
||||||
|
nbt.setBoolean("hasCharge", hasCharge);
|
||||||
|
nbt.setBoolean("chargeWindUpSync", chargeWindUpSync);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
chargeDuration = nbt.hasKey("chargeDuration") ? nbt.getInteger("chargeDuration") : 60;
|
||||||
|
chargeDelay = nbt.hasKey("chargeDelay") ? nbt.getInteger("chargeDelay") : 0;
|
||||||
|
maxCharge = nbt.hasKey("maxCharge") ? nbt.getInteger("maxCharge") : 100;
|
||||||
|
hasCharge = !nbt.hasKey("hasCharge") || nbt.getBoolean("hasCharge");
|
||||||
|
chargeWindUpSync = !nbt.hasKey("chargeWindUpSync") || nbt.getBoolean("chargeWindUpSync");
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyChargingData copy() {
|
||||||
|
return new EnergyChargingData(chargeDuration, chargeDelay, maxCharge, hasCharge, chargeWindUpSync);
|
||||||
|
}
|
||||||
|
}
|
||||||
+185
@@ -0,0 +1,185 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import kamkeel.npcs.controllers.data.ability.enums.HitType;
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyCombatData;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups combat properties shared by energy projectile abilities.
|
||||||
|
* Used as a parameter object for IEntity constructors and ability IConfiguration.
|
||||||
|
*/
|
||||||
|
public class EnergyCombatData implements IEnergyCombatData {
|
||||||
|
public static final float MAX_IExplosion_RADIUS = 15.0f;
|
||||||
|
public static final int DEFAULT_MAX_HITS = 5;
|
||||||
|
public static final int MAX_HITS = 200;
|
||||||
|
|
||||||
|
public float damage = 7.0f;
|
||||||
|
public float knockback = 1.0f;
|
||||||
|
public float knockbackUp = 0.1f;
|
||||||
|
public boolean explosive = false;
|
||||||
|
public float IExplosionRadius = 3.0f;
|
||||||
|
public float IExplosionDamageFalloff = 0.5f;
|
||||||
|
public HitType hitType = HitType.SINGLE;
|
||||||
|
public int multiHitDelayTicks = 5;
|
||||||
|
public int maxHits = DEFAULT_MAX_HITS;
|
||||||
|
|
||||||
|
public EnergyCombatData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||||
|
boolean explosive, float IExplosionRadius, float IExplosionDamageFalloff,
|
||||||
|
HitType hitType, int multiHitDelay) {
|
||||||
|
this(damage, knockback, knockbackUp, explosive, IExplosionRadius, IExplosionDamageFalloff, hitType, multiHitDelay, DEFAULT_MAX_HITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||||
|
boolean explosive, float IExplosionRadius, float IExplosionDamageFalloff,
|
||||||
|
HitType hitType, int multiHitDelay, int maxHits) {
|
||||||
|
this.damage = damage;
|
||||||
|
this.knockback = knockback;
|
||||||
|
this.knockbackUp = knockbackUp;
|
||||||
|
this.explosive = explosive;
|
||||||
|
this.IExplosionRadius = clampIExplosionRadius(IExplosionRadius);
|
||||||
|
this.IExplosionDamageFalloff = IExplosionDamageFalloff;
|
||||||
|
this.hitType = hitType;
|
||||||
|
this.multiHitDelayTicks = multiHitDelay;
|
||||||
|
this.maxHits = clampMaxHits(maxHits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyCombatData(float damage, float knockback, float knockbackUp,
|
||||||
|
boolean explosive, float IExplosionRadius, float IExplosionDamageFalloff) {
|
||||||
|
this.damage = damage;
|
||||||
|
this.knockback = knockback;
|
||||||
|
this.knockbackUp = knockbackUp;
|
||||||
|
this.explosive = explosive;
|
||||||
|
this.IExplosionRadius = clampIExplosionRadius(IExplosionRadius);
|
||||||
|
this.IExplosionDamageFalloff = IExplosionDamageFalloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getDamage() {
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setDamage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getKnockback() {
|
||||||
|
return knockback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKnockback(float knockback) {
|
||||||
|
this.knockback = knockback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getKnockbackUp() {
|
||||||
|
return knockbackUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setKnockbackUp(float knockbackUp) {
|
||||||
|
this.knockbackUp = knockbackUp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExplosive() {
|
||||||
|
return explosive;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setExplosive(boolean explosive) {
|
||||||
|
this.explosive = explosive;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getIExplosionRadius() {
|
||||||
|
return IExplosionRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIExplosionRadius(float IExplosionRadius) {
|
||||||
|
this.IExplosionRadius = clampIExplosionRadius(IExplosionRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getIExplosionDamageFalloff() {
|
||||||
|
return IExplosionDamageFalloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setIExplosionDamageFalloff(float IExplosionDamageFalloff) {
|
||||||
|
this.IExplosionDamageFalloff = IExplosionDamageFalloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxHits() {
|
||||||
|
return maxHits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxHits(int maxHits) {
|
||||||
|
this.maxHits = clampMaxHits(maxHits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("damage", damage);
|
||||||
|
nbt.setFloat("knockback", knockback);
|
||||||
|
nbt.setFloat("knockbackUp", knockbackUp);
|
||||||
|
nbt.setBoolean("explosive", explosive);
|
||||||
|
nbt.setFloat("IExplosionRadius", IExplosionRadius);
|
||||||
|
nbt.setFloat("IExplosionDamageFalloff", IExplosionDamageFalloff);
|
||||||
|
nbt.setInteger("hitType", hitType.ordinal());
|
||||||
|
nbt.setInteger("multiHitDelayTicks", multiHitDelayTicks);
|
||||||
|
nbt.setInteger("maxHits", maxHits);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
damage = nbt.hasKey("damage") ? nbt.getFloat("damage") : 7.0f;
|
||||||
|
knockback = nbt.hasKey("knockback") ? nbt.getFloat("knockback") : 1.0f;
|
||||||
|
knockbackUp = nbt.hasKey("knockbackUp") ? nbt.getFloat("knockbackUp") : 0.1f;
|
||||||
|
explosive = nbt.hasKey("explosive") && nbt.getBoolean("explosive");
|
||||||
|
IExplosionRadius = nbt.hasKey("IExplosionRadius") ? nbt.getFloat("IExplosionRadius") : 3.0f;
|
||||||
|
IExplosionDamageFalloff = nbt.hasKey("IExplosionDamageFalloff") ? nbt.getFloat("IExplosionDamageFalloff") : 0.5f;
|
||||||
|
hitType = HitType.fromOrdinal(nbt.hasKey("hitType") ? nbt.getInteger("hitType") : 0);
|
||||||
|
multiHitDelayTicks = nbt.hasKey("multiHitDelayTicks") ? nbt.getInteger("multiHitDelayTicks") : 5;
|
||||||
|
maxHits = nbt.hasKey("maxHits") ? nbt.getInteger("maxHits") : DEFAULT_MAX_HITS;
|
||||||
|
|
||||||
|
// Sanitize
|
||||||
|
if (Float.isNaN(damage) || Float.isInfinite(damage)) damage = 7.0f;
|
||||||
|
if (Float.isNaN(knockback) || Float.isInfinite(knockback) || knockback < 0) knockback = 1.0f;
|
||||||
|
if (Float.isNaN(IExplosionRadius) || Float.isInfinite(IExplosionRadius) || IExplosionRadius < 0) IExplosionRadius = 3.0f;
|
||||||
|
IExplosionRadius = clampIExplosionRadius(IExplosionRadius);
|
||||||
|
if (multiHitDelayTicks < 1) multiHitDelayTicks = 1;
|
||||||
|
maxHits = clampMaxHits(maxHits);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float clampIExplosionRadius(float IExplosionRadius) {
|
||||||
|
if (Float.isNaN(IExplosionRadius) || Float.isInfinite(IExplosionRadius)) return 0.0f;
|
||||||
|
return Math.max(0.0f, Math.min(MAX_IExplosion_RADIUS, IExplosionRadius));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int clampMaxHits(int maxHits) {
|
||||||
|
return Math.max(1, Math.min(MAX_HITS, maxHits));
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyCombatData copy() {
|
||||||
|
EnergyCombatData copy = new EnergyCombatData(damage, knockback, knockbackUp,
|
||||||
|
explosive, IExplosionRadius, IExplosionDamageFalloff);
|
||||||
|
copy.hitType = hitType;
|
||||||
|
copy.multiHitDelayTicks = multiHitDelayTicks;
|
||||||
|
copy.maxHits = maxHits;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
+146
@@ -0,0 +1,146 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyDisplayData;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups visual color properties shared by all energy abilities.
|
||||||
|
* Used as a parameter object for IEntity constructors and ability IConfiguration.
|
||||||
|
*/
|
||||||
|
public class EnergyDisplayData implements IEnergyDisplayData {
|
||||||
|
public int innerColor = 0xFFFFFF;
|
||||||
|
public int outerColor = 0x8888FF;
|
||||||
|
public boolean outerColorEnabled = true;
|
||||||
|
public float outerColorWidth = 0.4f;
|
||||||
|
public float outerColorAlpha = 0.5f;
|
||||||
|
public float innerAlpha = 1.0f;
|
||||||
|
public float rotationSpeed = 4.0f;
|
||||||
|
|
||||||
|
public EnergyDisplayData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyDisplayData(int innerColor, int outerColor) {
|
||||||
|
this.innerColor = innerColor;
|
||||||
|
this.outerColor = outerColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyDisplayData(int innerColor, int outerColor, boolean outerColorEnabled,
|
||||||
|
float outerColorWidth, float outerColorAlpha, float rotationSpeed) {
|
||||||
|
this.innerColor = innerColor;
|
||||||
|
this.outerColor = outerColor;
|
||||||
|
this.outerColorEnabled = outerColorEnabled;
|
||||||
|
this.outerColorWidth = outerColorWidth;
|
||||||
|
this.outerColorAlpha = outerColorAlpha;
|
||||||
|
this.rotationSpeed = rotationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyDisplayData(int innerColor, int outerColor, boolean outerColorEnabled,
|
||||||
|
float outerColorWidth, float outerColorAlpha, float innerAlpha, float rotationSpeed) {
|
||||||
|
this(innerColor, outerColor, outerColorEnabled, outerColorWidth, outerColorAlpha, rotationSpeed);
|
||||||
|
this.innerAlpha = innerAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getInnerColor() {
|
||||||
|
return innerColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInnerColor(int innerColor) {
|
||||||
|
this.innerColor = innerColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOuterColor() {
|
||||||
|
return outerColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOuterColor(int outerColor) {
|
||||||
|
this.outerColor = outerColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOuterColorEnabled() {
|
||||||
|
return outerColorEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOuterColorEnabled(boolean outerColorEnabled) {
|
||||||
|
this.outerColorEnabled = outerColorEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getOuterColorWidth() {
|
||||||
|
return outerColorWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOuterColorWidth(float outerColorWidth) {
|
||||||
|
this.outerColorWidth = outerColorWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getOuterColorAlpha() {
|
||||||
|
return outerColorAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOuterColorAlpha(float outerColorAlpha) {
|
||||||
|
this.outerColorAlpha = outerColorAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getInnerAlpha() {
|
||||||
|
return innerAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInnerAlpha(float innerAlpha) {
|
||||||
|
this.innerAlpha = innerAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getRotationSpeed() {
|
||||||
|
return rotationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRotationSpeed(float rotationSpeed) {
|
||||||
|
this.rotationSpeed = rotationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setInteger("innerColor", innerColor);
|
||||||
|
nbt.setInteger("outerColor", outerColor);
|
||||||
|
nbt.setBoolean("outerColorEnabled", outerColorEnabled);
|
||||||
|
nbt.setFloat("outerColorWidth", outerColorWidth);
|
||||||
|
nbt.setFloat("outerColorAlpha", outerColorAlpha);
|
||||||
|
nbt.setFloat("innerAlpha", innerAlpha);
|
||||||
|
nbt.setFloat("rotationSpeed", rotationSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
innerColor = nbt.hasKey("innerColor") ? nbt.getInteger("innerColor") : 0xFFFFFF;
|
||||||
|
outerColor = nbt.hasKey("outerColor") ? nbt.getInteger("outerColor") : 0x8888FF;
|
||||||
|
outerColorEnabled = !nbt.hasKey("outerColorEnabled") || nbt.getBoolean("outerColorEnabled");
|
||||||
|
outerColorWidth = nbt.hasKey("outerColorWidth") ? nbt.getFloat("outerColorWidth") : 0.4f;
|
||||||
|
outerColorAlpha = nbt.hasKey("outerColorAlpha") ? nbt.getFloat("outerColorAlpha") : 0.5f;
|
||||||
|
innerAlpha = nbt.hasKey("innerAlpha") ? nbt.getFloat("innerAlpha") : 1.0f;
|
||||||
|
rotationSpeed = nbt.hasKey("rotationSpeed") ? nbt.getFloat("rotationSpeed") : 4.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyDisplayData copy() {
|
||||||
|
EnergyDisplayData copy = new EnergyDisplayData(innerColor, outerColor, outerColorEnabled, outerColorWidth, outerColorAlpha, innerAlpha, rotationSpeed);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyHomingData;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups homing/movement properties for energy projectile abilities.
|
||||||
|
* Used by Orb, Disc, and Beam (not Laser or Sweeper).
|
||||||
|
*/
|
||||||
|
public class EnergyHomingData implements IEnergyHomingData {
|
||||||
|
public float speed = 0.5f;
|
||||||
|
public boolean homing = true;
|
||||||
|
public float homingStrength = 0.15f;
|
||||||
|
public float homingRange = 20.0f;
|
||||||
|
|
||||||
|
public EnergyHomingData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyHomingData(float speed, boolean homing, float homingStrength, float homingRange) {
|
||||||
|
this.speed = speed;
|
||||||
|
this.homing = homing;
|
||||||
|
this.homingStrength = homingStrength;
|
||||||
|
this.homingRange = homingRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSpeed() {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSpeed(float speed) {
|
||||||
|
this.speed = Math.max(0.01f, speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHoming() {
|
||||||
|
return homing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHoming(boolean homing) {
|
||||||
|
this.homing = homing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getHomingStrength() {
|
||||||
|
return homingStrength;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHomingStrength(float homingStrength) {
|
||||||
|
this.homingStrength = homingStrength;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getHomingRange() {
|
||||||
|
return homingRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setHomingRange(float homingRange) {
|
||||||
|
this.homingRange = homingRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("speed", speed);
|
||||||
|
nbt.setBoolean("homing", homing);
|
||||||
|
nbt.setFloat("homingStrength", homingStrength);
|
||||||
|
nbt.setFloat("homingRange", homingRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
speed = nbt.hasKey("speed") ? nbt.getFloat("speed") : 0.5f;
|
||||||
|
homing = !nbt.hasKey("homing") || nbt.getBoolean("homing");
|
||||||
|
homingStrength = nbt.hasKey("homingStrength") ? nbt.getFloat("homingStrength") : 0.15f;
|
||||||
|
homingRange = nbt.hasKey("homingRange") ? nbt.getFloat("homingRange") : 20.0f;
|
||||||
|
|
||||||
|
// Sanitize speed to prevent stuck projectiles
|
||||||
|
if (Float.isNaN(speed) || Float.isInfinite(speed) || speed <= 0) speed = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyHomingData copy() {
|
||||||
|
return new EnergyHomingData(speed, homing, homingStrength, homingRange);
|
||||||
|
}
|
||||||
|
}
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyLifespanData;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups lifespan/range properties for energy projectile abilities.
|
||||||
|
* Used as a parameter object for IEntity constructors and ability IConfiguration.
|
||||||
|
*/
|
||||||
|
public class EnergyLifespanData implements IEnergyLifespanData {
|
||||||
|
public float maxDistance = 150.0f;
|
||||||
|
public int maxLifetime = 200;
|
||||||
|
|
||||||
|
public EnergyLifespanData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyLifespanData(float maxDistance, int maxLifetime) {
|
||||||
|
this.maxDistance = maxDistance;
|
||||||
|
this.maxLifetime = maxLifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getMaxDistance() {
|
||||||
|
return maxDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMaxDistance(float maxDistance) {
|
||||||
|
this.maxDistance = Float.isNaN(maxDistance) || maxDistance <= 0 ? 150.0f : maxDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxLifetime() {
|
||||||
|
return maxLifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMaxLifetime(int maxLifetime) {
|
||||||
|
this.maxLifetime = maxLifetime <= 0 ? 200 : maxLifetime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("maxDistance", maxDistance);
|
||||||
|
nbt.setInteger("maxLifetime", maxLifetime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
maxDistance = nbt.getFloat("maxDistance");
|
||||||
|
maxLifetime = nbt.getInteger("maxLifetime");
|
||||||
|
|
||||||
|
// Sanitize: ensure minimum values so entities don't die instantly or live forever
|
||||||
|
if (Float.isNaN(maxDistance) || Float.isInfinite(maxDistance) || maxDistance <= 0) maxDistance = 150.0f;
|
||||||
|
if (maxLifetime <= 0) maxLifetime = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyLifespanData copy() {
|
||||||
|
return new EnergyLifespanData(maxDistance, maxLifetime);
|
||||||
|
}
|
||||||
|
}
|
||||||
+94
@@ -0,0 +1,94 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import noppes.npcs.api.ability.data.IEnergyLightningData;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups lightning visual effect properties for energy abilities.
|
||||||
|
* Used as a parameter object for IEntity constructors and ability IConfiguration.
|
||||||
|
*/
|
||||||
|
public class EnergyLightningData implements IEnergyLightningData {
|
||||||
|
public boolean lightningEffect = false;
|
||||||
|
public float lightningDensity = 0.15f;
|
||||||
|
public float lightningRadius = 0.5f;
|
||||||
|
public int lightningFadeTime = 6;
|
||||||
|
|
||||||
|
public EnergyLightningData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyLightningData(boolean lightningEffect, float lightningDensity,
|
||||||
|
float lightningRadius, int lightningFadeTime) {
|
||||||
|
this.lightningEffect = lightningEffect;
|
||||||
|
this.lightningDensity = lightningDensity;
|
||||||
|
this.lightningRadius = lightningRadius;
|
||||||
|
this.lightningFadeTime = lightningFadeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLightningEffect() {
|
||||||
|
return lightningEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLightningEffect(boolean lightningEffect) {
|
||||||
|
this.lightningEffect = lightningEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getLightningDensity() {
|
||||||
|
return lightningDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLightningDensity(float lightningDensity) {
|
||||||
|
this.lightningDensity = lightningDensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getLightningRadius() {
|
||||||
|
return lightningRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLightningRadius(float lightningRadius) {
|
||||||
|
this.lightningRadius = lightningRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLightningFadeTime() {
|
||||||
|
return lightningFadeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLightningFadeTime(int lightningFadeTime) {
|
||||||
|
this.lightningFadeTime = Math.max(1, lightningFadeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setBoolean("lightningEffect", lightningEffect);
|
||||||
|
nbt.setFloat("lightningDensity", lightningDensity);
|
||||||
|
nbt.setFloat("lightningRadius", lightningRadius);
|
||||||
|
nbt.setInteger("lightningFadeTime", lightningFadeTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
lightningEffect = nbt.hasKey("lightningEffect") && nbt.getBoolean("lightningEffect");
|
||||||
|
lightningDensity = nbt.hasKey("lightningDensity") ? nbt.getFloat("lightningDensity") : 0.15f;
|
||||||
|
lightningRadius = nbt.hasKey("lightningRadius") ? nbt.getFloat("lightningRadius") : 0.5f;
|
||||||
|
lightningFadeTime = nbt.hasKey("lightningFadeTime") ? nbt.getInteger("lightningFadeTime") : 6;
|
||||||
|
if (lightningFadeTime <= 0) lightningFadeTime = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyLightningData copy() {
|
||||||
|
return new EnergyLightningData(lightningEffect, lightningDensity, lightningRadius, lightningFadeTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
+125
@@ -0,0 +1,125 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Groups panel-specific properties for energy wall/shield abilities.
|
||||||
|
* Handles dimensions, positioning, and launch behavior.
|
||||||
|
*/
|
||||||
|
public class EnergyPanelData {
|
||||||
|
public float panelWidth = 3.0f;
|
||||||
|
public float panelHeight = 3.0f;
|
||||||
|
public float heightOffset = 0.0f;
|
||||||
|
public float offsetX = 0.0f;
|
||||||
|
public float offsetZ = 0.0f;
|
||||||
|
|
||||||
|
// Launch properties (Wall only)
|
||||||
|
public boolean launching = false;
|
||||||
|
public float launchSpeed = 0.5f;
|
||||||
|
public float launchDamage = 8.0f;
|
||||||
|
public float launchKnockback = 2.0f;
|
||||||
|
|
||||||
|
public EnergyPanelData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyPanelData(float panelWidth, float panelHeight, float heightOffset) {
|
||||||
|
this.panelWidth = panelWidth;
|
||||||
|
this.panelHeight = panelHeight;
|
||||||
|
this.heightOffset = heightOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== GETTERS & SETTERS ====================
|
||||||
|
|
||||||
|
public float getPanelWidth() {
|
||||||
|
return panelWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelWidth(float panelWidth) {
|
||||||
|
this.panelWidth = Math.max(0.5f, panelWidth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPanelHeight() {
|
||||||
|
return panelHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPanelHeight(float panelHeight) {
|
||||||
|
this.panelHeight = Math.max(0.5f, panelHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getHeightOffset() {
|
||||||
|
return heightOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeightOffset(float heightOffset) {
|
||||||
|
this.heightOffset = heightOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLaunching() {
|
||||||
|
return launching;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaunching(boolean launching) {
|
||||||
|
this.launching = launching;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLaunchSpeed() {
|
||||||
|
return launchSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaunchSpeed(float launchSpeed) {
|
||||||
|
this.launchSpeed = Math.max(0.1f, launchSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLaunchDamage() {
|
||||||
|
return launchDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaunchDamage(float launchDamage) {
|
||||||
|
this.launchDamage = Math.max(0, launchDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getLaunchKnockback() {
|
||||||
|
return launchKnockback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLaunchKnockback(float launchKnockback) {
|
||||||
|
this.launchKnockback = Math.max(0, launchKnockback);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== NBT ====================
|
||||||
|
|
||||||
|
public void writeNBT(INbt nbt) {
|
||||||
|
nbt.setFloat("panelWidth", panelWidth);
|
||||||
|
nbt.setFloat("panelHeight", panelHeight);
|
||||||
|
nbt.setFloat("panelHeightOffset", heightOffset);
|
||||||
|
nbt.setFloat("panelOffsetX", offsetX);
|
||||||
|
nbt.setFloat("panelOffsetZ", offsetZ);
|
||||||
|
nbt.setBoolean("panelLaunching", launching);
|
||||||
|
nbt.setFloat("panelLaunchSpeed", launchSpeed);
|
||||||
|
nbt.setFloat("panelLaunchDamage", launchDamage);
|
||||||
|
nbt.setFloat("panelLaunchKnockback", launchKnockback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
panelWidth = nbt.hasKey("panelWidth") ? nbt.getFloat("panelWidth") : 3.0f;
|
||||||
|
panelHeight = nbt.hasKey("panelHeight") ? nbt.getFloat("panelHeight") : 3.0f;
|
||||||
|
heightOffset = nbt.hasKey("panelHeightOffset") ? nbt.getFloat("panelHeightOffset") : 0.0f;
|
||||||
|
offsetX = nbt.hasKey("panelOffsetX") ? nbt.getFloat("panelOffsetX") : 0.0f;
|
||||||
|
offsetZ = nbt.hasKey("panelOffsetZ") ? nbt.getFloat("panelOffsetZ") : 0.0f;
|
||||||
|
launching = nbt.hasKey("panelLaunching") && nbt.getBoolean("panelLaunching");
|
||||||
|
launchSpeed = nbt.hasKey("panelLaunchSpeed") ? nbt.getFloat("panelLaunchSpeed") : 0.5f;
|
||||||
|
launchDamage = nbt.hasKey("panelLaunchDamage") ? nbt.getFloat("panelLaunchDamage") : 8.0f;
|
||||||
|
launchKnockback = nbt.hasKey("panelLaunchKnockback") ? nbt.getFloat("panelLaunchKnockback") : 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnergyPanelData copy() {
|
||||||
|
EnergyPanelData copy = new EnergyPanelData(panelWidth, panelHeight, heightOffset);
|
||||||
|
copy.offsetX = offsetX;
|
||||||
|
copy.offsetZ = offsetZ;
|
||||||
|
copy.launching = launching;
|
||||||
|
copy.launchSpeed = launchSpeed;
|
||||||
|
copy.launchDamage = launchDamage;
|
||||||
|
copy.launchKnockback = launchKnockback;
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.energy;
|
||||||
|
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TEMPORARY STUB -- auto-generated for compilation.
|
||||||
|
* Panel data for energy panel entities.
|
||||||
|
*/
|
||||||
|
public class PanelData {
|
||||||
|
public int panelCount = 1;
|
||||||
|
public float panelSize = 1.0f;
|
||||||
|
public float panelSpacing = 0.5f;
|
||||||
|
public void readNBT(INbt nbt) {}
|
||||||
|
public INbt writeNBT(INbt nbt) { return nbt; }
|
||||||
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
package kamkeel.npcs.controllers.data.ability.data.entry;
|
||||||
|
|
||||||
|
import noppes.npcs.api.entity.IEntityLiving;
|
||||||
|
import noppes.npcs.api.IDamageSource;
|
||||||
|
import noppes.npcs.api.IWorld;
|
||||||
|
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||||
|
import noppes.npcs.api.item.IItemStack;
|
||||||
|
import noppes.npcs.api.entity.IEntity;
|
||||||
|
import noppes.npcs.api.entity.IPlayer;
|
||||||
|
import noppes.npcs.api.INbtList;
|
||||||
|
import noppes.npcs.api.INbt;
|
||||||
|
import kamkeel.npcs.controllers.AbilityController;
|
||||||
|
import kamkeel.npcs.controllers.data.ability.data.effect.IEffectAction;
|
||||||
|
/**
|
||||||
|
* A configured instance of an {@link IEffectAction} stored on an ability.
|
||||||
|
* Holds the action ID and its IConfiguration NBT.
|
||||||
|
*/
|
||||||
|
public class AbilityEffectActionEntry {
|
||||||
|
|
||||||
|
private String actionId = "";
|
||||||
|
private INbt config = new INbt();
|
||||||
|
|
||||||
|
public AbilityEffectActionEntry() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityEffectActionEntry(String actionId) {
|
||||||
|
this.actionId = actionId != null ? actionId : "";
|
||||||
|
IEffectAction action = AbilityController.Instance.getEffectAction(this.actionId);
|
||||||
|
if (action != null) {
|
||||||
|
this.config = action.createDefaultConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbilityEffectActionEntry copy() {
|
||||||
|
AbilityEffectActionEntry copy = new AbilityEffectActionEntry();
|
||||||
|
copy.actionId = this.actionId;
|
||||||
|
copy.config = (INbt) this.config.copy();
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply this action to a target IEntity.
|
||||||
|
*/
|
||||||
|
public void apply(IEntityLivingBase caster, IEntityLivingBase target) {
|
||||||
|
if (actionId.isEmpty()) return;
|
||||||
|
IEffectAction action = AbilityController.Instance.getEffectAction(actionId);
|
||||||
|
if (action != null) {
|
||||||
|
action.apply(caster, target, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return !actionId.isEmpty() && AbilityController.Instance.getEffectAction(actionId) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── NBT ──
|
||||||
|
|
||||||
|
public INbt writeNBT() {
|
||||||
|
INbt nbt = new INbt();
|
||||||
|
nbt.setString("actionId", actionId);
|
||||||
|
nbt.setTag("config", config);
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readNBT(INbt nbt) {
|
||||||
|
this.actionId = nbt.getString("actionId");
|
||||||
|
this.config = nbt.hasKey("config") ? nbt.getCompoundTag("config") : new INbt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AbilityEffectActionEntry fromNBT(INbt nbt) {
|
||||||
|
AbilityEffectActionEntry entry = new AbilityEffectActionEntry();
|
||||||
|
entry.readNBT(nbt);
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Getters/Setters ──
|
||||||
|
|
||||||
|
public String getActionId() {
|
||||||
|
return actionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActionId(String actionId) {
|
||||||
|
this.actionId = actionId != null ? actionId : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public INbt getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfig(INbt config) {
|
||||||
|
this.config = config != null ? config : new INbt();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loaded 100 of 5458 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user