mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 11:29:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b852e30285 | ||
|
|
7ea571f593 | ||
|
|
7a4ceebf5e | ||
|
|
31efcfc3b2 | ||
|
|
49cb893d12 | ||
|
|
009d4dee23 | ||
|
|
3e278acb71 | ||
|
|
d0d31d9575 | ||
|
|
ef492407ef | ||
|
|
cd417c6786 | ||
|
|
89e4e483c2 | ||
|
|
fd36f50d82 | ||
|
|
1d71c017f4 | ||
|
|
99c681ad87 | ||
|
|
57f7f1d7ab | ||
|
|
b2550b8a69 | ||
|
|
a30f173627 | ||
|
|
2aaaeba15e | ||
|
|
9c96a0a10a | ||
|
|
f5c38e2359 | ||
|
|
e544adba5c | ||
|
|
58f7487cfa | ||
|
|
9f928963f2 | ||
|
|
38cec7a11f | ||
|
|
7ab3c3a37c | ||
|
|
53127eec30 | ||
|
|
30d532f4fc | ||
|
|
01fb451b69 | ||
|
|
3714426e19 | ||
|
|
c2b919d339 | ||
|
|
c4b8a393f9 | ||
|
|
30894f7afa | ||
|
|
e9a7660cb8 | ||
|
|
4d46abf761 | ||
|
|
23baf3a8ce | ||
|
|
c6a21d0d62 | ||
|
|
da72640c7e | ||
|
|
b7f34629c3 | ||
|
|
5500d69b77 | ||
|
|
6af42bc656 | ||
|
|
e19fcb8844 | ||
|
|
0a62333890 | ||
|
|
e7512f13e4 | ||
|
|
4708d77c98 | ||
|
|
9b1d2bdd13 | ||
|
|
a6dc03aa7e | ||
|
|
6cd8349542 | ||
|
|
976c589c78 | ||
|
|
24ec338a51 | ||
|
|
4f634855ac | ||
|
|
9f01e3407e | ||
|
|
adeaeb74aa | ||
|
|
e13c3966e0 | ||
|
|
02c3b4e74b | ||
|
|
89a07d3668 | ||
|
|
b52eb6d699 | ||
|
|
3281faf2be | ||
|
|
3d25b4e793 | ||
|
|
f4532410ec | ||
|
|
8f87021b0f | ||
|
|
bc57ff9e83 | ||
|
|
de8ab934d8 | ||
|
|
81fe1c9682 | ||
|
|
58a299aabc | ||
|
|
243a21a353 | ||
|
|
f0dc530b28 | ||
|
|
dac7f590ea | ||
|
|
bf54d4d667 | ||
|
|
da4337efbf | ||
|
|
f92962bbbb | ||
|
|
2714da1022 | ||
|
|
96be82343c | ||
|
|
58577775d2 | ||
|
|
fc3e7647d2 | ||
|
|
a381874bb9 | ||
|
|
55525f6d2e | ||
|
|
bc64ceabef | ||
|
|
63ba3aa009 | ||
|
|
5265e34a35 | ||
|
|
35ab9f52b0 | ||
|
|
9b55f1f48f | ||
|
|
e356f4d713 | ||
|
|
bfc25bc5da | ||
|
|
9f0f9e7288 | ||
|
|
ce6404fd5b | ||
|
|
8f18a3de9a | ||
|
|
9815d8c379 | ||
|
|
1d902df581 | ||
|
|
8e26c99de3 | ||
|
|
fc8c3bef03 | ||
|
|
a4de22c1ad | ||
|
|
70cffe6982 | ||
|
|
39620f1e41 | ||
|
|
0e80fcb8f7 | ||
|
|
4a94c2c71b | ||
|
|
79c39f8b7c | ||
|
|
f6190e8752 | ||
|
|
0950b9fc84 | ||
|
|
25981706ef | ||
|
|
82d896a35e | ||
|
|
e7dd728f95 | ||
|
|
8f2e675581 | ||
|
|
ff75416a32 | ||
|
|
95afc95b24 | ||
|
|
34493b0d99 | ||
|
|
e77d2547ad | ||
|
|
40a34af431 | ||
|
|
352117fd78 | ||
|
|
81328b6684 | ||
|
|
b5af446d71 | ||
|
|
d0c6e92900 | ||
|
|
2a9c485edc | ||
|
|
a13598b17e | ||
|
|
40b54013b4 | ||
|
|
1c9a853868 | ||
|
|
da70cdd35a | ||
|
|
b993cf4a98 | ||
|
|
ac065ff5f7 | ||
|
|
913f6f6d36 | ||
|
|
9468e41bbf | ||
|
|
ffdd056a18 | ||
|
|
f157e7a6ec | ||
|
|
4a9d0f9bd5 | ||
|
|
0398916666 | ||
|
|
dec9a3924d | ||
|
|
2470120680 | ||
|
|
ba90b61607 | ||
|
|
9a5e24e338 | ||
|
|
29ef3d5ab4 | ||
|
|
f46a538b41 | ||
|
|
182aa9c0cb | ||
|
|
1857064afa | ||
|
|
cb05c8c4aa | ||
|
|
f275a24b43 | ||
|
|
1d84e8063e | ||
|
|
57befa89bb | ||
|
|
10b16d32da | ||
|
|
3f21a2c1b4 | ||
|
|
b2958c9066 | ||
|
|
9520978b81 | ||
|
|
4981aa3421 | ||
|
|
c48b48ee15 | ||
|
|
9947ba8503 | ||
|
|
a3f48734ff | ||
|
|
0378355c37 | ||
|
|
c625ef3009 | ||
|
|
d4b30422b6 | ||
|
|
6de36d78f5 | ||
|
|
7348929819 | ||
|
|
b9f4b02cb0 | ||
|
|
20e93a412e | ||
|
|
e44e8b3112 | ||
|
|
bab4d87ce7 | ||
|
|
bc9d1fe657 | ||
|
|
d4d522c597 | ||
|
|
97269a5e3d | ||
|
|
c913258ca3 | ||
|
|
c7ab872c85 | ||
|
|
e91431fb70 | ||
|
|
dfa3a2665d | ||
|
|
4fa375683f | ||
|
|
0db4624b27 | ||
|
|
c997f2adbc | ||
|
|
26e5f4b4ff | ||
|
|
2336002f20 | ||
|
|
e88a0cd13f | ||
|
|
dbf5fe38ce | ||
|
|
c47d08c89d | ||
|
|
7af5c21d74 | ||
|
|
6f96d89e2b | ||
|
|
111b0216fd | ||
|
|
1d0384f8f6 | ||
|
|
adc8972277 | ||
|
|
5990e29af7 | ||
|
|
2676c8999c | ||
|
|
3a200e901e | ||
|
|
c97ac284a5 | ||
|
|
54e06e841d | ||
|
|
7ce84491d1 | ||
|
|
532bee7ce1 | ||
|
|
e24f949517 | ||
|
|
4545beb49d | ||
|
|
3f4bf61ae6 | ||
|
|
155e846818 | ||
|
|
ba3707af22 | ||
|
|
ad79b9ed86 | ||
|
|
5f7df5e742 | ||
|
|
7aa7221756 | ||
|
|
8844554da6 | ||
|
|
6f0eedc9a6 | ||
|
|
f21cd286ca | ||
|
|
f1b533ad87 | ||
|
|
5a97d183df | ||
|
|
fbd57b3264 | ||
|
|
efc369ee83 | ||
|
|
91ecf71109 | ||
|
|
9b6525e805 | ||
|
|
dc7d02ebf6 | ||
|
|
7037184a4e | ||
|
|
bf38d94756 | ||
|
|
3d17434510 | ||
|
|
29d6c875d0 | ||
|
|
902772ed0c | ||
|
|
1229c4c4ea | ||
|
|
7fecf2ad6b | ||
|
|
c418da353f | ||
|
|
110cf372eb | ||
|
|
7a004087f7 | ||
|
|
70cfe24e67 | ||
|
|
8960f6869f | ||
|
|
71a92de5d9 | ||
|
|
3f15cd54c2 | ||
|
|
12c928c538 | ||
|
|
7406b38d8a | ||
|
|
ef646d3146 | ||
|
|
18371bd8c9 | ||
|
|
e35e4b16ff | ||
|
|
3711da9c45 | ||
|
|
6a318ddb78 | ||
|
|
2766f9a293 | ||
|
|
2e3f2461fa | ||
|
|
95f7345ff7 | ||
|
|
bc02f3e67b | ||
|
|
8db42c44bf | ||
|
|
404e6f1cc0 | ||
|
|
5741f669d5 | ||
|
|
6a67149b16 | ||
|
|
c8d934bafd | ||
|
|
075e240303 | ||
|
|
d00665ee65 | ||
|
|
ebb74a5f30 | ||
|
|
5b0117ec76 | ||
|
|
e06d9d0fbc | ||
|
|
ab91647546 | ||
|
|
b236a4a4db | ||
|
|
a480a83a98 | ||
|
|
3a9f123a16 | ||
|
|
8d27fb0692 | ||
|
|
d369fe1c25 | ||
|
|
98b71f2dd4 | ||
|
|
fef0f6422d | ||
|
|
2eb81ac88b | ||
|
|
e02a91f008 | ||
|
|
ced1b95155 | ||
|
|
8f910dfa5d | ||
|
|
05a854cd2a | ||
|
|
22738de028 | ||
|
|
cd0466395a | ||
|
|
24c4056651 | ||
|
|
59fe905695 | ||
|
|
6f3da97365 | ||
|
|
edc1fb24e2 | ||
|
|
f1d68ed4c8 | ||
|
|
ac97370f94 | ||
|
|
82e9de8641 | ||
|
|
843a13c1ab | ||
|
|
3bf50c4bbe | ||
|
|
4922e90d81 | ||
|
|
a3a920437f | ||
|
|
787c0c4a6a | ||
|
|
8517a824e5 | ||
|
|
2cca7aa759 | ||
|
|
23b070c7d0 | ||
|
|
49111e9c5c | ||
|
|
c0cca7f41d | ||
|
|
99bb50d8f8 | ||
|
|
00f00b17bf | ||
|
|
62fdbad74c | ||
|
|
f0bba74a47 | ||
|
|
cf9b5b445b | ||
|
|
aa200923f0 | ||
|
|
ddadf93ca1 | ||
|
|
781c681216 | ||
|
|
cfda7fc738 | ||
|
|
58ba24add2 | ||
|
|
dcf069ca52 | ||
|
|
c3fda11d10 | ||
|
|
11ac46daeb | ||
|
|
2dcabe0123 | ||
|
|
42f1d87955 | ||
|
|
334a76de75 | ||
|
|
677a6e578e | ||
|
|
a3b5eaacfd | ||
|
|
b3d4ea05ec | ||
|
|
8f35adca7a | ||
|
|
394f424185 | ||
|
|
ada52078c7 | ||
|
|
0daf1a6df4 | ||
|
|
edffd04ed2 | ||
|
|
7aea09f4ca | ||
|
|
5673c1dd29 | ||
|
|
1774e2bf30 | ||
|
|
4836b3272a | ||
|
|
a31607ae7d | ||
|
|
57ad221cc6 | ||
|
|
00c7883088 | ||
|
|
1de89525cc | ||
|
|
704a70902f | ||
|
|
570faeb790 | ||
|
|
8b8837c9ff | ||
|
|
eff464cf0e | ||
|
|
26ccb9106e | ||
|
|
0d84487412 | ||
|
|
2bc6a0666f | ||
|
|
82bc9f1b35 | ||
|
|
d73ac867df | ||
|
|
ede93d438f | ||
|
|
5e1949eb0e | ||
|
|
2d368c4c2e | ||
|
|
d9db27275e | ||
|
|
591a25722b | ||
|
|
d1ff1967b5 | ||
|
|
012a755bb9 | ||
|
|
748eece456 | ||
|
|
f709ce7579 | ||
|
|
33efc35b60 | ||
|
|
687d3c059d | ||
|
|
aaf02ea2ac | ||
|
|
625da6492d | ||
|
|
a573faf92d | ||
|
|
9565529baf | ||
|
|
3c346247e1 | ||
|
|
ce949e6099 | ||
|
|
5e3af8ac0e | ||
|
|
5cc90f060c | ||
|
|
577b19c1cf | ||
|
|
8905237306 | ||
|
|
c5d5f4e516 | ||
|
|
24022ab6ba | ||
|
|
6370c242f0 | ||
|
|
4762d4d8ef | ||
|
|
8f2dbf7046 | ||
|
|
23ea835fa7 | ||
|
|
d88db6c0cf | ||
|
|
c6dab815f4 | ||
|
|
7b722bfcd6 | ||
|
|
a90504315e | ||
|
|
3765ceb02d | ||
|
|
dab22f5b74 | ||
|
|
b301e8e4c1 | ||
|
|
f647929993 | ||
|
|
984291cee9 | ||
|
|
ac16845fc4 | ||
|
|
29edd242cd | ||
|
|
ca2d8bd834 | ||
|
|
2a779ec328 | ||
|
|
591e65fa1a | ||
|
|
485db6be2e | ||
|
|
25f3fcad46 | ||
|
|
6bf7c9878c | ||
|
|
95d0ff18cd | ||
|
|
1642bad402 | ||
|
|
450dd8313c | ||
|
|
ebdb166ec8 | ||
|
|
1eba1dfdc0 | ||
|
|
368a2245ef | ||
|
|
58ee06ea8e | ||
|
|
62f5adf8e2 | ||
|
|
fe1623a36a | ||
|
|
889efc1c0a | ||
|
|
0419b9d975 | ||
|
|
f1c6bdd57d | ||
|
|
b3e854a15d | ||
|
|
80a40c03e6 | ||
|
|
5bfaf7c170 | ||
|
|
2d98835db8 | ||
|
|
81c6421f84 | ||
|
|
6eeae8c49f | ||
|
|
c42a210140 | ||
|
|
a723aa6860 | ||
|
|
e9ff699c2d | ||
|
|
abe4f73a9a | ||
|
|
74fffc6fdc | ||
|
|
debbdc00be | ||
|
|
aed2cc446a | ||
|
|
e74087ee43 | ||
|
|
f329084f1f | ||
|
|
33cd9ad0fe | ||
|
|
ce819ac143 | ||
|
|
f0495a8abc | ||
|
|
a696db5a21 | ||
|
|
fcdbb4f5b3 | ||
|
|
e105337ff4 | ||
|
|
f52e2112dd | ||
|
|
945d927fa0 | ||
|
|
2ee6946824 | ||
|
|
e08c43366a | ||
|
|
c508004429 | ||
|
|
21af85323a | ||
|
|
3410242f03 | ||
|
|
9b9c46d93b | ||
|
|
de8e76c7fd | ||
|
|
47b5e99b6f | ||
|
|
1a465b33f5 | ||
|
|
8e7956397d | ||
|
|
86a9c7d359 | ||
|
|
6a581803a9 | ||
|
|
b4e0c709c5 | ||
|
|
f3458456a2 | ||
|
|
dcb15a587c | ||
|
|
937e9a0169 | ||
|
|
decd230ac1 | ||
|
|
5347caa1c4 | ||
|
|
52f6a674ea | ||
|
|
a16c61f7ba | ||
|
|
67f12d6dec | ||
|
|
bad55cacfa | ||
|
|
a6e979b311 | ||
|
|
ce68456f97 | ||
|
|
29e59438c5 | ||
|
|
10d4acfad2 | ||
|
|
1c3dc132cb | ||
|
|
cd96718339 | ||
|
|
22dbe411d9 | ||
|
|
a99d110fff | ||
|
|
f21929b7d1 | ||
|
|
5d78b310da | ||
|
|
549b6fd535 | ||
|
|
9fafdc1695 | ||
|
|
f169f7c92f | ||
|
|
b9ccadb2f1 | ||
|
|
f00650481b | ||
|
|
5d4c2fed88 | ||
|
|
66a81e7dbe | ||
|
|
6b5a433f65 | ||
|
|
b5d5c95b33 | ||
|
|
3ac891fa5a | ||
|
|
2dc0189179 | ||
|
|
dd98784262 | ||
|
|
1c9a51098b | ||
|
|
d075daf00e | ||
|
|
1bd6847bc8 | ||
|
|
dd832f2a88 | ||
|
|
aebf6eb168 | ||
|
|
8921cfe061 | ||
|
|
cd67596d57 | ||
|
|
e1c6630569 | ||
|
|
5ce4e31855 | ||
|
|
a99c488d49 | ||
|
|
94282c5575 | ||
|
|
7ad8529390 | ||
|
|
15534edce4 | ||
|
|
aa822e32af | ||
|
|
a14ab913a9 | ||
|
|
0165742a30 | ||
|
|
26a5b316de | ||
|
|
2140cd8cb6 | ||
|
|
4a6245a215 | ||
|
|
48544db690 | ||
|
|
2c89b3def3 | ||
|
|
5689182088 | ||
|
|
4a1f4b90fd | ||
|
|
f2d42d1134 | ||
|
|
51e7606e74 | ||
|
|
723c2d98eb | ||
|
|
7dee072e1a | ||
|
|
3e18c4160f | ||
|
|
513ad19187 | ||
|
|
eabede2203 | ||
|
|
b22dbc12a2 | ||
|
|
708e86adfb | ||
|
|
6f1b762c9d | ||
|
|
d9bfb29d6c | ||
|
|
6fc7bc4941 | ||
|
|
fb701cdc5e | ||
|
|
f7cc50b521 | ||
|
|
1a232cf766 | ||
|
|
853f54bcc2 | ||
|
|
127be2237d | ||
|
|
7e6456d7cd | ||
|
|
664ebda599 | ||
|
|
9b4a225ad2 | ||
|
|
6c59fa2d2c | ||
|
|
5736d850f0 | ||
|
|
127d6ee8ac | ||
|
|
2055543042 | ||
|
|
40e57a26a9 | ||
|
|
d604e44195 | ||
|
|
8b7778ccb6 | ||
|
|
7e30814ecb | ||
|
|
e5b1dfb74c | ||
|
|
27bc77363e | ||
|
|
506b73d0a0 | ||
|
|
20337b6e8a | ||
|
|
33ff87d8d9 | ||
|
|
af06bbd373 | ||
|
|
92a47ace8b | ||
|
|
f285ac369a | ||
|
|
68e76c273a | ||
|
|
e98c311a2c | ||
|
|
293edb316e | ||
|
|
2d4465eaf7 | ||
|
|
9266ff394a | ||
|
|
bbfd85ed1e | ||
|
|
6ecc2303f4 | ||
|
|
d35cfda798 | ||
|
|
cffa2a92a6 | ||
|
|
179c504746 | ||
|
|
31695d5ec1 | ||
|
|
bfb3020505 | ||
|
|
22a88ea2e4 | ||
|
|
0423fa5885 | ||
|
|
d17fbb527f | ||
|
|
d40bb0fe32 | ||
|
|
a513060a81 | ||
|
|
8e594a347c | ||
|
|
9af365edcc | ||
|
|
70554d6a2b | ||
|
|
eb84f52493 | ||
|
|
d074830d95 | ||
|
|
f7fe9ebeb2 | ||
|
|
b2c8f37aec | ||
|
|
a5bcccab59 | ||
|
|
a11f368b62 | ||
|
|
59656b004b | ||
|
|
ff8cb67a99 | ||
|
|
fa5256c8a7 | ||
|
|
4b19987ee6 | ||
|
|
9f43303073 | ||
|
|
a20958fb56 | ||
|
|
8c71098081 | ||
|
|
a3a5b44acb | ||
|
|
0473273709 | ||
|
|
bf492f32f9 | ||
|
|
4744677646 | ||
|
|
f0af2e4ef5 | ||
|
|
c7f763d6f0 | ||
|
|
563b8d1215 | ||
|
|
221493453f | ||
|
|
86c928430a | ||
|
|
cd0a0e51d5 | ||
|
|
66ff95f9d7 | ||
|
|
8ad172295f | ||
|
|
26a2ef5995 | ||
|
|
b4e3490fa1 | ||
|
|
828341f987 | ||
|
|
bc03fbb3be | ||
|
|
7a8dae5e35 | ||
|
|
d3c0e1f589 | ||
|
|
9c77d3f25b | ||
|
|
6371e9b71e | ||
|
|
578ef5cfeb | ||
|
|
516954e6f9 | ||
|
|
1151d5c3e3 | ||
|
|
25f1ddac30 | ||
|
|
39a146f8e6 | ||
|
|
037dcaefea | ||
|
|
01d6da3a90 | ||
|
|
8b2665980d | ||
|
|
42b3e6ad56 | ||
|
|
e709ab8a70 | ||
|
|
501409d1fb | ||
|
|
0fb3a34235 | ||
|
|
e4ba1f863e | ||
|
|
1f5c58b723 | ||
|
|
61e4db2c3b | ||
|
|
5efc1eb34c | ||
|
|
96c6f91201 | ||
|
|
62e69a2804 | ||
|
|
e9352d2675 | ||
|
|
ee6abdf28d | ||
|
|
968ee7ab09 | ||
|
|
3b3600d44f | ||
|
|
edcc5ca554 | ||
|
|
ca79dfe298 | ||
|
|
5945279b8b | ||
|
|
57bf64318b | ||
|
|
d9d0a46809 | ||
|
|
2fac644914 | ||
|
|
570592b24b | ||
|
|
fde94144ec | ||
|
|
f348496c10 | ||
|
|
a5c31b5365 | ||
|
|
2dc3f0ddef | ||
|
|
fa567014a5 | ||
|
|
96935bb122 | ||
|
|
43d3042dff | ||
|
|
fec221f8a6 | ||
|
|
b0f0635eb3 | ||
|
|
23a25131b0 | ||
|
|
a6eaa2bebc | ||
|
|
c6a0741379 | ||
|
|
5a1930e2d6 | ||
|
|
418deba5bf | ||
|
|
4ff2cff3c0 | ||
|
|
bd2123cf9d | ||
|
|
c2a603c910 | ||
|
|
db12af48fa | ||
|
|
a0f574a0ac | ||
|
|
8356fe9a7b | ||
|
|
6edce8b5f4 | ||
|
|
ca2bbe0b5f | ||
|
|
c8941a7faa | ||
|
|
5e20c03736 | ||
|
|
b19e882aab | ||
|
|
9d7d32a1b5 | ||
|
|
d512539554 | ||
|
|
a3a93f3387 | ||
|
|
a7eb5dc773 | ||
|
|
b23081df78 | ||
|
|
66db4ec46e | ||
|
|
8bd98c3a2d | ||
|
|
34cc42d3cb | ||
|
|
09eade4623 | ||
|
|
9bfe7df373 | ||
|
|
8006b774bf | ||
|
|
7cc91cfb0c | ||
|
|
24d72852e7 | ||
|
|
cedf3d55d5 | ||
|
|
d915f39996 | ||
|
|
346691c298 |
No files matched your search
+9
-2
@@ -1,7 +1,14 @@
|
|||||||
* text eol=lf
|
* text eol=lf
|
||||||
*.bat text eol=crlf
|
*.bat text eol=crlf
|
||||||
*.patch text
|
*.patch text eol=lf
|
||||||
|
*.java text eol=lf
|
||||||
|
*.gradle text eol=crlf
|
||||||
*.png binary
|
*.png binary
|
||||||
*.exe binary
|
*.exe binary
|
||||||
*.dll binary
|
*.dll binary
|
||||||
*.zip binary
|
*.jar binary
|
||||||
|
*.lzma binary
|
||||||
|
*.zip binary
|
||||||
|
*.pyd binary
|
||||||
|
*.cfg text eol=lf
|
||||||
|
*.py text eol=lf
|
||||||
+20
-9
@@ -1,10 +1,21 @@
|
|||||||
|
#eclipse
|
||||||
/bin
|
/bin
|
||||||
/minecraft_server
|
/.settings
|
||||||
/mods
|
/.classpath
|
||||||
/fmlbuild.properties
|
|
||||||
/fmlversion.properties
|
#idea
|
||||||
/difflist.txt
|
/.idea
|
||||||
/target
|
*.iml
|
||||||
fmlbranding.properties
|
|
||||||
/fernflower.zip
|
#gradle
|
||||||
/commands.py.bck
|
/build
|
||||||
|
/buildSrc
|
||||||
|
/.gradle
|
||||||
|
|
||||||
|
#occupational hazards
|
||||||
|
/eclipse/
|
||||||
|
/repo/
|
||||||
|
|
||||||
|
|
||||||
|
#Patch reject
|
||||||
|
*.rej
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
This is Forge Mod Loader.
|
||||||
|
|
||||||
|
You can find the source code at all times at https://github.com/MinecraftForge/FML
|
||||||
|
|
||||||
|
This minecraft mod is a clean open source implementation of a mod loader for
|
||||||
|
minecraft servers, minecraft bukkit servers, and minecraft clients.
|
||||||
|
|
||||||
|
The code is authored by cpw.
|
||||||
|
|
||||||
|
It (partially) implements API defined by the client side ModLoader, authored by Risugami.
|
||||||
|
http://www.minecraftforum.net/topic/75440-
|
||||||
|
|
||||||
|
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
|
||||||
|
http://www.minecraftforge.net/
|
||||||
|
|
||||||
|
Additionally, it contains an implementation of topological sort based on that
|
||||||
|
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
|
||||||
|
|
||||||
|
It also contains code from the Maven project for performing versioned dependency
|
||||||
|
resolution. http://maven.apache.org/
|
||||||
|
|
||||||
|
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
|
||||||
|
with credit to it's authors.
|
||||||
|
|
||||||
|
Forge Mod Loader downloads components from the Minecraft Coder Pack
|
||||||
|
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
|
||||||
|
|
||||||
+27
-3
@@ -1,7 +1,7 @@
|
|||||||
This minecraft mod, Forge Mod Loader, including all parts herein, is licensed
|
This minecraft mod, Forge Mod Loader, including all parts herein except as noted below,
|
||||||
under the GNU LGPL v2.1 or later.
|
is licensed under the GNU LGPL v2.1 or later.
|
||||||
|
|
||||||
Homepage: https://github.com/cpw/FML
|
Homepage: https://github.com/MinecraftForge/FML
|
||||||
|
|
||||||
This software includes portions from the Apache Maven project at
|
This software includes portions from the Apache Maven project at
|
||||||
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
http://maven.apache.org/ specifically the ComparableVersion.java code. It is
|
||||||
@@ -9,6 +9,30 @@ included based on guidelines at
|
|||||||
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
|
||||||
with notices intact. The only change is a non-functional change of package name.
|
with notices intact. The only change is a non-functional change of package name.
|
||||||
|
|
||||||
|
This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating
|
||||||
|
binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/
|
||||||
|
authored by genman, heikok, pivot.
|
||||||
|
The only changes are to replace some Trove collection types with standard Java collections, and repackaged.
|
||||||
|
|
||||||
|
|
||||||
|
=== MCP Data ===
|
||||||
|
This software includes data from the Minecraft Coder Pack (MCP), with kind permission
|
||||||
|
from them. The license to MCP data is not transitive - distribution of this data by
|
||||||
|
third parties requires independent licensing from the MCP team. This data is not
|
||||||
|
redistributable without permission from the MCP team.
|
||||||
|
|
||||||
|
=== Sharing ===
|
||||||
|
I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of
|
||||||
|
the minecraft modding community. All contributions to these parts should be licensed under the same additional grant.
|
||||||
|
|
||||||
|
-- Runtime patcher --
|
||||||
|
License is granted to redistribute the runtime patcher code (common/cpw/mods/fml/patcher and subdirectories) under
|
||||||
|
any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||||
|
|
||||||
|
-- ASM transformers --
|
||||||
|
License is granted to redistribute the ASM transformer code (common/cpw/mods/fml/common/asm/ and subdirectories)
|
||||||
|
under any alternative open source license as classified by the OSI (http://opensource.org/licenses)
|
||||||
|
|
||||||
========
|
========
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
|||||||
Executable → Regular
+11
-14
@@ -1,6 +1,6 @@
|
|||||||
This is Forge Mod Loader, or FML for short, by cpw.
|
This is Forge Mod Loader, or FML for short, by cpw.
|
||||||
|
|
||||||
More information can be found at https://github.com/cpw/FML/wiki
|
More information can be found at https://github.com/MinecraftForge/FML/wiki
|
||||||
|
|
||||||
It is a clean reimplementation of a mod loading system for client, server and
|
It is a clean reimplementation of a mod loading system for client, server and
|
||||||
bukkit use, incorporating API implementations of client side ModLoader by
|
bukkit use, incorporating API implementations of client side ModLoader by
|
||||||
@@ -40,8 +40,8 @@ contributors through github.
|
|||||||
|
|
||||||
Notable integrations
|
Notable integrations
|
||||||
====================
|
====================
|
||||||
Optifine, with the Cx series have started performing the actions necessary for
|
Optifine has FML compatibility. It varies from Optifine release to release, however
|
||||||
FML compatibility. This means optifine will work well alongside an FML or
|
in general it will work well alongside an FML or
|
||||||
Minecraft Forge installation. FML will detect and ensure the good operation of
|
Minecraft Forge installation. FML will detect and ensure the good operation of
|
||||||
Optifine (you can see it in your client as an additional data line on the
|
Optifine (you can see it in your client as an additional data line on the
|
||||||
bottom left).
|
bottom left).
|
||||||
@@ -49,9 +49,8 @@ bottom left).
|
|||||||
Client notes
|
Client notes
|
||||||
============
|
============
|
||||||
FML does provide a standard pattern for mods to provide HD textures. This is why
|
FML does provide a standard pattern for mods to provide HD textures. This is why
|
||||||
optifine needed integration code. FML supports very very basic HD texture packs
|
optifine needed integration code. FML supports HD texture packs
|
||||||
up to 128x resolution (some 256x resolution packs work but not all). For full
|
up to 128x resolution.
|
||||||
featured HD optifine is recommended.
|
|
||||||
|
|
||||||
Mod information
|
Mod information
|
||||||
===============
|
===============
|
||||||
@@ -68,15 +67,13 @@ or server):
|
|||||||
|
|
||||||
Installation
|
Installation
|
||||||
============
|
============
|
||||||
To install this on it's own into a minecraft environment, simply copy the
|
To install on a server, simply execute the FML or Forge jar file, with a copy of
|
||||||
contents of the fml zip file into the minecraft jar file, using your preferred
|
minecraft_server.jar placed in the same directory. FML will launch it's patched
|
||||||
zip management tool (I recommend 7 zip on windows).
|
copy.
|
||||||
|
|
||||||
For servers: the minecraft jar file is minecraft_server.jar.
|
To install on a client, FIRST delete META-INF from the minecraft.jar file, then
|
||||||
For clients: the minecraft jar file is minecraft.jar. You will additionally need
|
copy the contents of the FML or Forge jar file into it. FML and Forge provide
|
||||||
to delete the "META-INF" folder in the minecraft.jar file.
|
their own META-INF data which should *not* be deleted.
|
||||||
For bukkit: the mcportcentral custom builds of craftbukkit contain all you need
|
|
||||||
already. Please refer to mcportcentral.co.za for more information.
|
|
||||||
|
|
||||||
Forge Installation
|
Forge Installation
|
||||||
==================
|
==================
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import os, sys
|
|
||||||
|
|
||||||
def main():
|
|
||||||
fml_dir = os.path.abspath(sys.argv[1])
|
|
||||||
work_dir = os.path.normpath(sys.argv[2])
|
|
||||||
mcp_dir = os.path.normpath(sys.argv[3])
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(fml_dir, 'install'))
|
|
||||||
from fml import apply_fml_patches
|
|
||||||
|
|
||||||
apply_fml_patches(fml_dir, mcp_dir, work_dir, False)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
maven {
|
||||||
|
name = "forge"
|
||||||
|
url = "http://files.minecraftforge.net/maven"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "sonatype"
|
||||||
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
import static net.minecraftforge.gradle.dev.FmlDevPlugin.*
|
||||||
|
|
||||||
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'fmldev'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
flatDir {
|
||||||
|
name "fileRepo"
|
||||||
|
dirs "repo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = '1.7.2'
|
||||||
|
mcpVersion = '9.01-pre'
|
||||||
|
fmlDir = projectDir.getAbsolutePath();
|
||||||
|
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
|
||||||
|
installerVersion = "1.4"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'cpw.mods'
|
||||||
|
version = getVersionFromGit(getProject())
|
||||||
|
|
||||||
|
jenkins {
|
||||||
|
job = 'fml'
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadArchives {
|
||||||
|
repositories {
|
||||||
|
if (project.hasProperty("filesmaven")) {
|
||||||
|
logger.info('Publishing to files server')
|
||||||
|
|
||||||
|
mavenDeployer {
|
||||||
|
configuration = configurations.deployerJars
|
||||||
|
|
||||||
|
repository(url: project.filesmaven.url) {
|
||||||
|
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
pom {
|
||||||
|
groupId = project.group
|
||||||
|
version = project.version
|
||||||
|
artifactId = project.archivesBaseName
|
||||||
|
project {
|
||||||
|
name project.archivesBaseName
|
||||||
|
packaging 'jar'
|
||||||
|
description 'ForgeModLoader'
|
||||||
|
url 'https://github.com/MinecraftForge/FML'
|
||||||
|
|
||||||
|
scm {
|
||||||
|
url 'https://github.com/MinecraftForge/FML'
|
||||||
|
connection 'scm:git:git://github.com/MinecraftForge/FML.git'
|
||||||
|
developerConnection 'scm:git:[email protected]:MinecraftForge/FML.git'
|
||||||
|
}
|
||||||
|
|
||||||
|
issueManagement {
|
||||||
|
system 'github'
|
||||||
|
url 'https://github.com/MinecraftForge/FML/issues'
|
||||||
|
}
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name 'GNU Lesser Public License (LGPL), Version 2.1'
|
||||||
|
url 'http://www.gnu.org/licenses/lgpl-2.1.txt'
|
||||||
|
distribution 'repo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id 'cpw'
|
||||||
|
name 'cpw'
|
||||||
|
roles { role 'developer' }
|
||||||
|
}
|
||||||
|
developer {
|
||||||
|
id 'LexManos'
|
||||||
|
name 'Lex Manos'
|
||||||
|
roles { role 'developer' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.info('Publishing to repo folder')
|
||||||
|
|
||||||
|
mavenDeployer {
|
||||||
|
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,367 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!-- ======================================================================
|
|
||||||
30 Mar 2012 13:35:40
|
|
||||||
|
|
||||||
FML
|
|
||||||
The Forge Mod Loader
|
|
||||||
|
|
||||||
cpw
|
|
||||||
====================================================================== -->
|
|
||||||
<project name="FML" default="jenkinsbuild">
|
|
||||||
<description>The Forge Mod Loader</description>
|
|
||||||
<macrodef name="side">
|
|
||||||
<attribute name="prop" />
|
|
||||||
<attribute name="src" />
|
|
||||||
<attribute name="side" />
|
|
||||||
<sequential>
|
|
||||||
<property name="@{prop}" value="${@{side}.@{src}}" />
|
|
||||||
<condition property="is.client">
|
|
||||||
<equals arg1="@{side}" arg2="client" />
|
|
||||||
</condition>
|
|
||||||
<condition property="is.server">
|
|
||||||
<equals arg1="@{side}" arg2="server" />
|
|
||||||
</condition>
|
|
||||||
</sequential>
|
|
||||||
</macrodef>
|
|
||||||
<target name="writeversion" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}" failonerror="true">
|
|
||||||
<arg value="${basedir}/getversion.py" />
|
|
||||||
<arg value="${mcp.home}" />
|
|
||||||
</exec>
|
|
||||||
<propertyfile file="fmlversion.properties">
|
|
||||||
<entry key="fmlbuild.build.number" type="int" value="${version.build}"/>
|
|
||||||
</propertyfile>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="buildenvsetup">
|
|
||||||
<tstamp>
|
|
||||||
<format pattern="yyMMddHHmmss" property="timestamp" />
|
|
||||||
</tstamp>
|
|
||||||
<property environment="env" />
|
|
||||||
<property file="fmlbuild.properties" />
|
|
||||||
<property name="modname" value="fml" />
|
|
||||||
<condition property="dev.home" value="${env.WORKSPACE}" else="${default.dev.home}">
|
|
||||||
<isset property="env.WORKSPACE" />
|
|
||||||
</condition>
|
|
||||||
<condition property="mcp.home" value="${env.WORKSPACE}/mcpworkspace" else="${default.mcp.home}">
|
|
||||||
<isset property="env.WORKSPACE" />
|
|
||||||
</condition>
|
|
||||||
<condition property="python.exe" value="${mcp.home}/runtime/bin/python/python_mcp" else="python">
|
|
||||||
<os family="Windows" />
|
|
||||||
</condition>
|
|
||||||
<property name="mcp.obfoutput" location="${mcp.home}/reobf" />
|
|
||||||
<property name="client.mcp.obfoutput" location="${mcp.obfoutput}/minecraft" />
|
|
||||||
<property name="mcp.srcdir" location="${mcp.home}/src" />
|
|
||||||
<property name="common.mcp.srcdir" location="${mcp.srcdir}/common" />
|
|
||||||
<property name="client.mcp.srcdir" location="${mcp.srcdir}/minecraft" />
|
|
||||||
<property name="clean.mcp.srcdir" location="${mcp.home}/src-base" />
|
|
||||||
<property name="patch.mcp.srcdir" location="${mcp.home}/src-work" />
|
|
||||||
<property name="tmp.mcp.srcdir" location="${mcp.home}/src-tmp" />
|
|
||||||
<property name="renamed.mcp.srcdir" location="${mcp.home}/src-renamed" />
|
|
||||||
<property name="common.src.dir" location="${basedir}/common" />
|
|
||||||
<property name="client.src.dir" location="${basedir}/client" />
|
|
||||||
<property name="patch.src.dir" location="${basedir}/patches" />
|
|
||||||
<property name="fml.conf.dir" location="${basedir}/conf" />
|
|
||||||
<condition property="version.build" value="${env.BUILD_NUMBER}" else="1">
|
|
||||||
<isset property="env.BUILD_NUMBER" />
|
|
||||||
</condition>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="makeversion" depends="buildenvsetup">
|
|
||||||
<antcall target="writeversion" />
|
|
||||||
<property file="fmlversion.properties" />
|
|
||||||
<property name="build.number" value="${fmlbuild.major.number}.${fmlbuild.minor.number}.${fmlbuild.revision.number}" />
|
|
||||||
<property name="version.major" value="${fmlbuild.major.number}" />
|
|
||||||
<property name="version.minor" value="${fmlbuild.minor.number}" />
|
|
||||||
<property name="version.rev" value="${fmlbuild.revision.number}" />
|
|
||||||
<property name="version" value="${version.major}.${version.minor}.${version.rev}.${version.build}" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/decompile.py" />
|
|
||||||
<arg value="-d" />
|
|
||||||
<arg value="-n" />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="reobfuscate" depends="buildenvsetup,recompile">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
|
||||||
<arg value="${mcp.home}/runtime/reobfuscate.py" />
|
|
||||||
</exec>
|
|
||||||
<fail message="Reobfuscation failed">
|
|
||||||
<condition>
|
|
||||||
<not>
|
|
||||||
<and>
|
|
||||||
<available file="${mcp.home}/temp/client.md5"/>
|
|
||||||
<available file="${mcp.home}/temp/client_reobf.md5"/>
|
|
||||||
</and>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
</fail>
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${basedir}/generatechangedfilelist.py"/>
|
|
||||||
<arg value="${mcp.home}"/>
|
|
||||||
<arg value="${basedir}/difflist.txt"/>
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="recompile" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}" failonerror="true">
|
|
||||||
<arg value="${mcp.home}/runtime/recompile.py" />
|
|
||||||
</exec>
|
|
||||||
<fail message="Compilation failed">
|
|
||||||
<condition>
|
|
||||||
<not>
|
|
||||||
<available file="${mcp.home}/bin/minecraft/net/minecraft/client/Minecraft.class"/>
|
|
||||||
</not>
|
|
||||||
</condition>
|
|
||||||
</fail>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="merge-client" depends="buildenvsetup">
|
|
||||||
<copy todir="${client.mcp.srcdir}" overwrite="true" verbose="true">
|
|
||||||
<fileset dir="${client.src.dir}" includes="**/*.java" />
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="merge-common">
|
|
||||||
<copy todir="${common.mcp.srcdir}" overwrite="true" verbose="true">
|
|
||||||
<fileset dir="${common.src.dir}" includes="**/*.java" />
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="merge-source" depends="buildenvsetup,merge-client,merge-common" />
|
|
||||||
|
|
||||||
<target name="build-client" depends="buildenvsetup,merge-client,merge-common,reobfuscate,makeversion"/>
|
|
||||||
|
|
||||||
<target name="extract-built-jar">
|
|
||||||
<side prop="output" src="mcp.obfoutput" side="${side}" />
|
|
||||||
<property name="jarname" value="${modname}-${side}-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
|
||||||
<zip destfile="${basedir}/target/${jarname}.zip">
|
|
||||||
<fileset dir="${output}" includes="**/*.class" />
|
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
|
||||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
|
||||||
<mappedresources>
|
|
||||||
<concat>
|
|
||||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
|
||||||
<filterchain>
|
|
||||||
<replacetokens>
|
|
||||||
<token key="MAJOR" value="${version.major}" />
|
|
||||||
<token key="MINOR" value="${version.minor}" />
|
|
||||||
<token key="REV" value="${version.rev}" />
|
|
||||||
<token key="BUILD" value="${version.build}" />
|
|
||||||
<token key="MCVERSION" value="${version.minecraft}" />
|
|
||||||
</replacetokens>
|
|
||||||
</filterchain>
|
|
||||||
</concat>
|
|
||||||
<mergemapper to="README-fml.txt" />
|
|
||||||
</mappedresources>
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-universal" depends="build-client">
|
|
||||||
<property name="universal.jarname" value="${modname}-universal-${version}" />
|
|
||||||
<mkdir dir="${basedir}/target" />
|
|
||||||
<jar destfile="${basedir}/target/${universal.jarname}.zip" duplicate="preserve">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="net.minecraft.server.MinecraftServer"/>
|
|
||||||
<attribute name="Class-Path" value="minecraft_server.jar"/>
|
|
||||||
</manifest>
|
|
||||||
<fileset dir="${client.mcp.obfoutput}" includes="**/*.class" />
|
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties"/>
|
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt" />
|
|
||||||
<zipfileset dir="${basedir}" includes="install/CREDITS-fml.txt" fullpath="CREDITS-fml.txt"/>
|
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" />
|
|
||||||
<mappedresources>
|
|
||||||
<concat>
|
|
||||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
|
||||||
<filterchain>
|
|
||||||
<replacetokens>
|
|
||||||
<token key="MAJOR" value="${version.major}" />
|
|
||||||
<token key="MINOR" value="${version.minor}" />
|
|
||||||
<token key="REV" value="${version.rev}" />
|
|
||||||
<token key="BUILD" value="${version.build}" />
|
|
||||||
<token key="MCVERSION" value="${version.minecraft}" />
|
|
||||||
</replacetokens>
|
|
||||||
</filterchain>
|
|
||||||
</concat>
|
|
||||||
<mergemapper to="README-fml.txt" />
|
|
||||||
</mappedresources>
|
|
||||||
</jar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build-source-pack" depends="makeversion">
|
|
||||||
<property name="srcpack.jarname" value="${modname}-src-${version}" />
|
|
||||||
<zip destfile="${basedir}/target/${srcpack.jarname}.zip">
|
|
||||||
<zipfileset dir="${basedir}" includes="LICENSE-fml.txt,difflist.txt,commands.patch,mcp_merge.cfg" prefix="fml" />
|
|
||||||
<zipfileset dir="${common.src.dir}" includes="**/*.java" prefix="fml/common" />
|
|
||||||
<zipfileset dir="${client.src.dir}" includes="**/*.java" prefix="fml/client" />
|
|
||||||
<zipfileset dir="${basedir}" includes="fmlversion.properties" prefix="fml/common" />
|
|
||||||
<zipfileset dir="${common.src.dir}" includes="*.cfg" prefix="fml/common" />
|
|
||||||
<zipfileset dir="${patch.src.dir}" includes="**/*.patch" prefix="fml/patches" />
|
|
||||||
<zipfileset dir="${fml.conf.dir}" prefix="fml/conf" />
|
|
||||||
<mappedresources>
|
|
||||||
<concat>
|
|
||||||
<fileset dir="${basedir}/install" includes="README.txt" />
|
|
||||||
<filterchain>
|
|
||||||
<replacetokens>
|
|
||||||
<token key="MAJOR" value="${version.major}" />
|
|
||||||
<token key="MINOR" value="${version.minor}" />
|
|
||||||
<token key="REV" value="${version.rev}" />
|
|
||||||
<token key="BUILD" value="${version.build}" />
|
|
||||||
<token key="MCVERSION" value="${version.minecraft}" />
|
|
||||||
</replacetokens>
|
|
||||||
</filterchain>
|
|
||||||
</concat>
|
|
||||||
<mergemapper to="fml/README-fml.txt" />
|
|
||||||
</mappedresources>
|
|
||||||
<zipfileset dir="${basedir}/install" excludes="README.txt,fml.pyc" prefix="fml" />
|
|
||||||
</zip>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="build" depends="buildenvsetup,merge-client,merge-common,build-client,build-universal,build-source-pack" />
|
|
||||||
|
|
||||||
<target name="jenkinsbuild" depends="buildenvsetup,jenkinsfmldecompile,patch,build"/>
|
|
||||||
|
|
||||||
<target name="patch" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
|
||||||
<arg value="${basedir}/applypatches.py" />
|
|
||||||
<arg value="${basedir}" />
|
|
||||||
<arg value="${mcp.srcdir}" />
|
|
||||||
<arg value="${mcp.home}" />
|
|
||||||
</exec>
|
|
||||||
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="setupenvironment" depends="buildenvsetup">
|
|
||||||
<input message="This will clean the mcp environment at ${mcp.home} and backup any src-work folder there (src-base will be erased). Continue?" validargs="y,n" addproperty="do.continue" />
|
|
||||||
<condition property="do.not.continue">
|
|
||||||
<equals arg1="n" arg2="${do.continue}" />
|
|
||||||
</condition>
|
|
||||||
<fail if="do.not.continue">You have decided not to continue. This script will stop now.</fail>
|
|
||||||
<echo>Preparing the MCP environment at ${mcp.home}</echo>
|
|
||||||
<antcall target="fmldecompile"/>
|
|
||||||
<echo>Moving old patched sources at ${patch.mcp.srcdir} out of the way</echo>
|
|
||||||
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
|
||||||
<fileset dir="${patch.mcp.srcdir}"/>
|
|
||||||
</move>
|
|
||||||
<echo>Deleting old patch references at ${clean.mcp.srcdir}</echo>
|
|
||||||
<delete dir="${clean.mcp.srcdir}" failonerror="false"/>
|
|
||||||
<echo>Creating new patch references at ${clean.mcp.srcdir}</echo>
|
|
||||||
<copy todir="${clean.mcp.srcdir}">
|
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
<antcall target="cleanargo"/>
|
|
||||||
<antcall target="patch"/>
|
|
||||||
<echo>Creating clean patched references at ${patch.mcp.srcdir}</echo>
|
|
||||||
<copy todir="${patch.mcp.srcdir}">
|
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
<antcall target="writeversion"/>
|
|
||||||
<echo>Setup complete! You should now be able to open ${basedir}/eclipse as a workspace in eclipse and import/refresh the FML-Server and FML-Client projects</echo>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="fmldecompile" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
|
||||||
<arg value="${basedir}/decompile.py" />
|
|
||||||
<arg value="${mcp.home}" />
|
|
||||||
<arg value="${basedir}" />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="jenkinsfmldecompile" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/cleanup.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
|
||||||
<arg value="${basedir}/decompile.py" />
|
|
||||||
<arg value="${mcp.home}" />
|
|
||||||
<arg value="${basedir}" />
|
|
||||||
<arg value="-no_gen_conf" />
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="repatch" depends="buildenvsetup,checkpatches">
|
|
||||||
<echo>Moving old patched sources at ${mcp.home}/src-work out of the way</echo>
|
|
||||||
<move todir="${mcp.home}/src-work${timestamp}" failonerror="false" verbose="true">
|
|
||||||
<fileset dir="${patch.mcp.srcdir}"/>
|
|
||||||
</move>
|
|
||||||
<delete dir="${mcp.srcdir}"/>
|
|
||||||
<copy todir="${mcp.srcdir}">
|
|
||||||
<fileset dir="${clean.mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<antcall target="cleanargo"/>
|
|
||||||
|
|
||||||
<antcall target="patch"/>
|
|
||||||
<copy todir="${patch.mcp.srcdir}">
|
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="repatchclean" depends="buildenvsetup">
|
|
||||||
<delete dir="${mcp.srcdir}"/>
|
|
||||||
<copy todir="${mcp.srcdir}">
|
|
||||||
<fileset dir="${clean.mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<antcall target="cleanargo"/>
|
|
||||||
|
|
||||||
<antcall target="patch"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="cleanargo" depends="buildenvsetup">
|
|
||||||
<delete dir="${client.mcp.srcdir}/argo"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="checkpatches" depends="buildenvsetup">
|
|
||||||
<uptodate property="checkUptodate.uptodate">
|
|
||||||
<srcfiles dir="${patch.mcp.srcdir}" includes="**/*.java">
|
|
||||||
<present targetdir="${patch.src.dir}">
|
|
||||||
<globmapper from="*.java" to="*.java.patch"/>
|
|
||||||
</present>
|
|
||||||
</srcfiles>
|
|
||||||
<globmapper from="*.java" to="${patch.src.dir}/*.java.patch"/>
|
|
||||||
</uptodate>
|
|
||||||
<fail unless="checkUptodate.uptodate">
|
|
||||||
A patch is out of date. Update your patches!
|
|
||||||
</fail>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="updatepatches" depends="buildenvsetup">
|
|
||||||
<exec executable="${python.exe}" dir="${basedir}">
|
|
||||||
<arg value="${basedir}/update_patches.py" />
|
|
||||||
<arg value="${mcp.home}"/>
|
|
||||||
<arg value="${basedir}"/>
|
|
||||||
</exec>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="makerenamedsource" depends="buildenvsetup,repatch,merge-client,merge-common,reobfuscate">
|
|
||||||
<copy todir="${tmp.mcp.srcdir}">
|
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
<exec executable="${python.exe}" dir="${mcp.home}">
|
|
||||||
<arg value="${mcp.home}/runtime/updatenames.py" />
|
|
||||||
<arg value="-f" />
|
|
||||||
</exec>
|
|
||||||
<copy todir="${renamed.mcp.srcdir}">
|
|
||||||
<fileset dir="${mcp.srcdir}"/>
|
|
||||||
</copy>
|
|
||||||
<move todir="${mcp.srcdir}">
|
|
||||||
<fileset dir="${tmp.mcp.srcdir}"/>
|
|
||||||
</move>
|
|
||||||
</target>
|
|
||||||
</project>
|
|
||||||
@@ -1,637 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.server;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import net.minecraft.server.Block;
|
|
||||||
import net.minecraft.server.Item;
|
|
||||||
import net.minecraft.server.LocaleLanguage;
|
|
||||||
import net.minecraft.server.MLProp;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.BaseMod;
|
|
||||||
import net.minecraft.server.BiomeBase;
|
|
||||||
import net.minecraft.server.EntityItem;
|
|
||||||
import net.minecraft.server.EntityHuman;
|
|
||||||
import net.minecraft.server.IChunkProvider;
|
|
||||||
import net.minecraft.server.ICommandListener;
|
|
||||||
import net.minecraft.server.IInventory;
|
|
||||||
import net.minecraft.server.ItemStack;
|
|
||||||
import net.minecraft.server.NetworkManager;
|
|
||||||
import net.minecraft.server.Packet1Login;
|
|
||||||
import net.minecraft.server.Packet250CustomPayload;
|
|
||||||
import net.minecraft.server.Packet3Chat;
|
|
||||||
import net.minecraft.server.BukkitRegistry;
|
|
||||||
import net.minecraft.server.SidedProxy;
|
|
||||||
import net.minecraft.server.World;
|
|
||||||
import net.minecraft.server.WorldType;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.IFMLSidedHandler;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
import cpw.mods.fml.common.ModMetadata;
|
|
||||||
import cpw.mods.fml.common.ProxyInjector;
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
|
||||||
import cpw.mods.fml.common.modloader.ModProperty;
|
|
||||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles primary communication from hooked code into the system
|
|
||||||
*
|
|
||||||
* The FML entry point is {@link #onPreLoad(MinecraftServer)} called from {@link MinecraftServer}
|
|
||||||
*
|
|
||||||
* Obfuscated code should focus on this class and other members of the "server" (or "client") code
|
|
||||||
*
|
|
||||||
* The actual mod loading is handled at arms length by {@link Loader}
|
|
||||||
*
|
|
||||||
* It is expected that a similar class will exist for each target environment: Bukkit and Client side.
|
|
||||||
*
|
|
||||||
* It should not be directly modified.
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class FMLBukkitHandler implements IFMLSidedHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The singleton
|
|
||||||
*/
|
|
||||||
private static final FMLBukkitHandler INSTANCE = new FMLBukkitHandler();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A reference to the server itself
|
|
||||||
*/
|
|
||||||
private MinecraftServer server;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A handy list of the default overworld biomes
|
|
||||||
*/
|
|
||||||
private BiomeBase[] defaultOverworldBiomes;
|
|
||||||
|
|
||||||
FMLBukkitProfiler profiler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to start the whole game off from {@link MinecraftServer#startServer}
|
|
||||||
* @param minecraftServer
|
|
||||||
*/
|
|
||||||
public void onPreLoad(MinecraftServer minecraftServer)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Class.forName("BaseModMp", false, getClass().getClassLoader());
|
|
||||||
MinecraftServer.log.severe(""
|
|
||||||
+ "Forge Mod Loader has detected that this server has an ModLoaderMP installed alongside Forge Mod Loader.\n"
|
|
||||||
+ "This will cause a serious problem with compatibility. To protect your worlds, this minecraft server will now shutdown.\n"
|
|
||||||
+ "You should follow the installation instructions of either Minecraft Forge of Forge Mod Loader and NOT install ModLoaderMP \n"
|
|
||||||
+ "into the minecraft_server.jar file "
|
|
||||||
+ "before this server will be allowed to start up.\n\nFailure to do so will simply result in more startup failures.\n\n"
|
|
||||||
+ "The authors of Minecraft Forge and Forge Mod Loader strongly suggest you talk to your mod's authors and get them to\nupdate their "
|
|
||||||
+ "requirements. ModLoaderMP is not compatible with Minecraft Forge on the server and they will need to update their mod\n"
|
|
||||||
+ "for Minecraft Forge and other server compatibility, unless they are Minecraft Forge mods, in which case they already\n"
|
|
||||||
+ "don't need ModLoaderMP and the mod author simply has failed to update his requirements and should be informed appropriately.\n\n"
|
|
||||||
+ "The authors of Forge Mod Loader would like to be compatible with ModLoaderMP but it is closed source and owned by SDK.\n"
|
|
||||||
+ "SDK, the author of ModLoaderMP, has a standing invitation to submit compatibility patches \n"
|
|
||||||
+ "to the open source community project that is Forge Mod Loader so that this incompatibility doesn't last. \n"
|
|
||||||
+ "Users who wish to enjoy mods of both types are "
|
|
||||||
+ "encouraged to request of SDK that he submit a\ncompatibility patch to the Forge Mod Loader project at \n"
|
|
||||||
+ "http://github.com/cpw/FML.\nPosting on the minecraft forums at\nhttp://www.minecraftforum.net/topic/86765- (the MLMP thread)\n"
|
|
||||||
+ "may encourage him in this effort. However, I ask that your requests be polite.\n"
|
|
||||||
+ "Now, the server has to shutdown so you can reinstall your minecraft_server.jar\nproperly, until such time as we can work together.");
|
|
||||||
throw new RuntimeException(
|
|
||||||
"This FML based server has detected an installation of ModLoaderMP alongside. This will cause serious compatibility issues, so the server will now shut down.");
|
|
||||||
}
|
|
||||||
catch (ClassNotFoundException e)
|
|
||||||
{
|
|
||||||
// We're safe. continue
|
|
||||||
}
|
|
||||||
server = minecraftServer;
|
|
||||||
FMLCommonHandler.instance().beginLoading(this);
|
|
||||||
FMLRegistry.registerRegistry(new BukkitRegistry());
|
|
||||||
Loader.instance().loadMods();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called a bit later on during server initialization to finish loading mods
|
|
||||||
*/
|
|
||||||
public void onLoadComplete()
|
|
||||||
{
|
|
||||||
Loader.instance().initializeMods();
|
|
||||||
for (Item i : Item.byId) {
|
|
||||||
if (i!=null && Material.getMaterial(i.id).name().startsWith("X")) {
|
|
||||||
Material.setMaterialName(i.id, i.l());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onWorldLoadTick()
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLDLOAD));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Every tick just before world and other ticks occur
|
|
||||||
*/
|
|
||||||
public void onPreWorldTick(World world)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.WORLD),world);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Every tick just after world and other ticks occur
|
|
||||||
*/
|
|
||||||
public void onPostWorldTick(World world)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.WORLD), world);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the server instance
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public MinecraftServer getServer()
|
|
||||||
{
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a handle to the server's logger instance
|
|
||||||
*/
|
|
||||||
public Logger getMinecraftLogger()
|
|
||||||
{
|
|
||||||
return MinecraftServer.log;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from ChunkProviderServer when a chunk needs to be populated
|
|
||||||
*
|
|
||||||
* To avoid polluting the worldgen seed, we generate a new random from the world seed and
|
|
||||||
* generate a seed from that
|
|
||||||
*
|
|
||||||
* @param chunkProvider
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
* @param world
|
|
||||||
* @param generator
|
|
||||||
*/
|
|
||||||
public void onChunkPopulate(IChunkProvider chunkProvider, int chunkX, int chunkZ, World world, IChunkProvider generator)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().handleWorldGeneration(chunkX, chunkZ, world.getSeed(), world, generator, chunkProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called from the furnace to lookup fuel values
|
|
||||||
*
|
|
||||||
* @param itemId
|
|
||||||
* @param itemDamage
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int fuelLookup(int itemId, int itemDamage)
|
|
||||||
{
|
|
||||||
int fv = 0;
|
|
||||||
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
fv = Math.max(fv, mod.lookupFuelValue(itemId, itemDamage));
|
|
||||||
}
|
|
||||||
|
|
||||||
return fv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the offered class and instance of BaseMod and therefore a ModLoader mod?
|
|
||||||
*/
|
|
||||||
public boolean isModLoaderMod(Class<?> clazz)
|
|
||||||
{
|
|
||||||
return BaseMod.class.isAssignableFrom(clazz);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the supplied mod class into a mod container
|
|
||||||
*/
|
|
||||||
public ModContainer loadBaseModMod(Class<?> clazz, File canonicalFile)
|
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Class <? extends BaseMod > bmClazz = (Class <? extends BaseMod >) clazz;
|
|
||||||
return new ModLoaderModContainer(bmClazz, canonicalFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to notify that an item was picked up from the world
|
|
||||||
*
|
|
||||||
* @param entityItem
|
|
||||||
* @param entityPlayer
|
|
||||||
*/
|
|
||||||
public void notifyItemPickup(EntityItem entityItem, EntityHuman entityPlayer)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsPickupNotification())
|
|
||||||
{
|
|
||||||
mod.getPickupNotifier().notifyPickup(entityItem, entityPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Raise an exception
|
|
||||||
*
|
|
||||||
* @param exception
|
|
||||||
* @param message
|
|
||||||
* @param stopGame
|
|
||||||
*/
|
|
||||||
public void raiseException(Throwable exception, String message, boolean stopGame)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception);
|
|
||||||
throw new RuntimeException(exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to dispense the item as an entity other than just as a the item itself
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVelocity
|
|
||||||
* @param zVelocity
|
|
||||||
* @param item
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean tryDispensingEntity(World world, double x, double y, double z, byte xVelocity, byte zVelocity, ItemStack item)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsToDispense() && mod.getDispenseHandler().dispense(x, y, z, xVelocity, zVelocity, world, item))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the instance
|
|
||||||
*/
|
|
||||||
public static FMLBukkitHandler instance()
|
|
||||||
{
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build a list of default overworld biomes
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public BiomeBase[] getDefaultOverworldBiomes()
|
|
||||||
{
|
|
||||||
if (defaultOverworldBiomes == null)
|
|
||||||
{
|
|
||||||
ArrayList<BiomeBase> biomes = new ArrayList<BiomeBase>(20);
|
|
||||||
|
|
||||||
for (int i = 0; i < 23; i++)
|
|
||||||
{
|
|
||||||
if ("Sky".equals(BiomeBase.biomes[i].y) || "Hell".equals(BiomeBase.biomes[i].y))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
biomes.add(BiomeBase.biomes[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultOverworldBiomes = new BiomeBase[biomes.size()];
|
|
||||||
biomes.toArray(defaultOverworldBiomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultOverworldBiomes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when an item is crafted
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param craftedItem
|
|
||||||
* @param craftingGrid
|
|
||||||
*/
|
|
||||||
public void onItemCrafted(EntityHuman player, ItemStack craftedItem, IInventory craftingGrid)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsCraftingNotification())
|
|
||||||
{
|
|
||||||
mod.getCraftingHandler().onCrafting(player, craftedItem, craftingGrid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when an item is smelted
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param smeltedItem
|
|
||||||
*/
|
|
||||||
public void onItemSmelted(EntityHuman player, ItemStack smeltedItem)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsCraftingNotification())
|
|
||||||
{
|
|
||||||
mod.getCraftingHandler().onSmelting(player, smeltedItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a chat packet is received
|
|
||||||
*
|
|
||||||
* @param chat
|
|
||||||
* @param player
|
|
||||||
* @return true if you want the packet to stop processing and not echo to the rest of the world
|
|
||||||
*/
|
|
||||||
public boolean handleChatPacket(Packet3Chat chat, EntityHuman player)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsNetworkPackets() && mod.getNetworkHandler().onChat(chat, player))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a packet 250 packet is received from the player
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public void handlePacket250(Packet250CustomPayload packet, EntityHuman player)
|
|
||||||
{
|
|
||||||
if ("REGISTER".equals(packet.tag) || "UNREGISTER".equals(packet.tag))
|
|
||||||
{
|
|
||||||
handleClientRegistration(packet, player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModContainer mod = FMLCommonHandler.instance().getModForChannel(packet.tag);
|
|
||||||
|
|
||||||
if (mod != null)
|
|
||||||
{
|
|
||||||
mod.getNetworkHandler().onPacket250Packet(packet, player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle register requests for packet 250 channels
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
private void handleClientRegistration(Packet250CustomPayload packet, EntityHuman player)
|
|
||||||
{
|
|
||||||
if (packet.data==null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (String channel : new String(packet.data, "UTF8").split("\0"))
|
|
||||||
{
|
|
||||||
// Skip it if we don't know it
|
|
||||||
if (FMLCommonHandler.instance().getModForChannel(channel) == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("REGISTER".equals(packet.tag))
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().activateChannel(player, channel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().deactivateChannel(player, channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (UnsupportedEncodingException e)
|
|
||||||
{
|
|
||||||
getMinecraftLogger().warning("Received invalid registration packet");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle a login
|
|
||||||
*
|
|
||||||
* @param loginPacket
|
|
||||||
* @param networkManager
|
|
||||||
*/
|
|
||||||
public void handleLogin(Packet1Login loginPacket, NetworkManager networkManager)
|
|
||||||
{
|
|
||||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
|
||||||
packet.tag = "REGISTER";
|
|
||||||
packet.data = FMLCommonHandler.instance().getPacketRegistry();
|
|
||||||
packet.length = packet.data.length;
|
|
||||||
if (packet.length>0) {
|
|
||||||
networkManager.queue(packet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void announceLogin(EntityHuman player) {
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsPlayerTracking())
|
|
||||||
{
|
|
||||||
mod.getPlayerTracker().onPlayerLogin(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getMinecraftRootDirectory()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
return server.a(".").getCanonicalFile();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
return new File(".");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param var2
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean handleServerCommand(String command, String player, ICommandListener listener)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList()) {
|
|
||||||
if (mod.wantsConsoleCommands() && mod.getConsoleHandler().handleCommand(command, player, listener)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public void announceLogout(EntityHuman player)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsPlayerTracking())
|
|
||||||
{
|
|
||||||
mod.getPlayerTracker().onPlayerLogout(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param p_28168_1_
|
|
||||||
*/
|
|
||||||
public void announceDimensionChange(EntityHuman player)
|
|
||||||
{
|
|
||||||
for (ModContainer mod : Loader.getModList())
|
|
||||||
{
|
|
||||||
if (mod.wantsPlayerTracking())
|
|
||||||
{
|
|
||||||
mod.getPlayerTracker().onPlayerChangedDimension(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param biome
|
|
||||||
*/
|
|
||||||
public void addBiomeToDefaultWorldGenerator(BiomeBase biome)
|
|
||||||
{
|
|
||||||
WorldType.NORMAL.addNewBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param biome
|
|
||||||
*/
|
|
||||||
public void removeBiomeFromDefaultWorldGenerator(BiomeBase biome)
|
|
||||||
{
|
|
||||||
WorldType.NORMAL.removeBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getMinecraftInstance() {
|
|
||||||
return server;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCurrentLanguage()
|
|
||||||
{
|
|
||||||
return LocaleLanguage.a().getCurrentLanguage();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Properties getCurrentLanguageTable()
|
|
||||||
{
|
|
||||||
return LocaleLanguage.a().getCurrentLanguageTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getObjectName(Object instance)
|
|
||||||
{
|
|
||||||
String objectName;
|
|
||||||
if (instance instanceof Item) {
|
|
||||||
objectName=((Item)instance).getName();
|
|
||||||
} else if (instance instanceof Block) {
|
|
||||||
objectName=((Block)instance).getName();
|
|
||||||
} else if (instance instanceof ItemStack) {
|
|
||||||
objectName=Item.byId[((ItemStack)instance).id].a((ItemStack)instance);
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException(String.format("Illegal object for naming %s",instance));
|
|
||||||
}
|
|
||||||
objectName+=".name";
|
|
||||||
return objectName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModMetadata readMetadataFrom(InputStream input, ModContainer mod) throws Exception {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void profileStart(String profileLabel) {
|
|
||||||
if (profiler!=null)
|
|
||||||
{
|
|
||||||
profiler.start(profileLabel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void profileEnd() {
|
|
||||||
if (profiler!=null)
|
|
||||||
{
|
|
||||||
profiler.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModProperty getModLoaderPropertyFor(Field f) {
|
|
||||||
if (f.isAnnotationPresent(MLProp.class)) {
|
|
||||||
MLProp prop = f.getAnnotation(MLProp.class);
|
|
||||||
return new ModProperty(prop.info(), prop.min(), prop.max(), prop.name());
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getAdditionalBrandingInformation() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Side getSide() {
|
|
||||||
return Side.BUKKIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ProxyInjector findSidedProxyOn(cpw.mods.fml.common.modloader.BaseMod mod) {
|
|
||||||
for (Field f : mod.getClass().getDeclaredFields())
|
|
||||||
{
|
|
||||||
if (f.isAnnotationPresent(SidedProxy.class))
|
|
||||||
{
|
|
||||||
SidedProxy sp = f.getAnnotation(SidedProxy.class);
|
|
||||||
return new ProxyInjector(sp.clientSide(), sp.serverSide(), sp.bukkitSide(), f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerPostTick() {
|
|
||||||
FMLCommonHandler.instance().tickEnd(EnumSet.of(TickType.GAME));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onServerPreTick() {
|
|
||||||
FMLCommonHandler.instance().tickStart(EnumSet.of(TickType.GAME));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
package cpw.mods.fml.server;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.ImmutableMultiset;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Multiset;
|
|
||||||
import com.google.common.collect.Multiset.Entry;
|
|
||||||
import com.google.common.collect.Multisets;
|
|
||||||
import com.google.common.collect.TreeMultiset;
|
|
||||||
import com.google.common.primitives.Ints;
|
|
||||||
|
|
||||||
public class FMLBukkitProfiler {
|
|
||||||
private static FMLBukkitProfiler lastInstance;
|
|
||||||
private static long endTime;
|
|
||||||
private LinkedList<String> profiles = new LinkedList<String>();
|
|
||||||
private TreeMultiset<String> hitCounter = TreeMultiset.create();
|
|
||||||
private TreeMultiset<String> timings = TreeMultiset.create();
|
|
||||||
private long timestamp;
|
|
||||||
|
|
||||||
public static long beginProfiling(int seconds)
|
|
||||||
{
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
if (lastInstance == null)
|
|
||||||
{
|
|
||||||
lastInstance = new FMLBukkitProfiler();
|
|
||||||
FMLBukkitHandler.instance().profiler = lastInstance;
|
|
||||||
endTime = now + seconds * 1000;
|
|
||||||
}
|
|
||||||
if (endTime > now)
|
|
||||||
{
|
|
||||||
return (endTime - now) / 1000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long endProfiling()
|
|
||||||
{
|
|
||||||
FMLBukkitHandler.instance().profiler = null;
|
|
||||||
return endTime - System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetProfiling()
|
|
||||||
{
|
|
||||||
endProfiling();
|
|
||||||
lastInstance = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start(String profileLabel)
|
|
||||||
{
|
|
||||||
profiles.push(profileLabel);
|
|
||||||
timestamp = System.nanoTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void end()
|
|
||||||
{
|
|
||||||
int timing = (int)((System.nanoTime() - timestamp)/1000L);
|
|
||||||
String label = Joiner.on('.').join(profiles);
|
|
||||||
profiles.pop();
|
|
||||||
hitCounter.add(label);
|
|
||||||
timings.add(label,timing);
|
|
||||||
if (System.currentTimeMillis()>endTime)
|
|
||||||
{
|
|
||||||
endProfiling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String[] dumpProfileData(int count)
|
|
||||||
{
|
|
||||||
if (lastInstance == null)
|
|
||||||
{
|
|
||||||
return new String[] { "No profile data available" };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endTime > System.currentTimeMillis())
|
|
||||||
{
|
|
||||||
return new String[] { String.format("Timing is being gathered for another %d seconds", endTime - System.currentTimeMillis()) };
|
|
||||||
}
|
|
||||||
return lastInstance.profileData(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String[] profileData(int count) {
|
|
||||||
List<Entry<String>> sortedTiming = getEntriesSortedByFrequency(timings, false);
|
|
||||||
ArrayList<String> timeLine = new ArrayList<String>();
|
|
||||||
|
|
||||||
double totalTime = timings.size();
|
|
||||||
|
|
||||||
for (Entry<String> hit : sortedTiming)
|
|
||||||
{
|
|
||||||
if (--count == 0)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
timeLine.add(String.format("%s : %d microseconds, %d invocations. %.2f %% of overall time",hit.getElement(), hit.getCount(), hitCounter.count(hit.getElement()), 100.0 * hit.getCount()/totalTime));
|
|
||||||
}
|
|
||||||
return timeLine.toArray(new String[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Code from http://stackoverflow.com/questions/4345633/simplest-way-to-iterate-through-a-multiset-in-the-order-of-element-frequency
|
|
||||||
*/
|
|
||||||
private enum EntryComp implements Comparator<Multiset.Entry<?>>{
|
|
||||||
DESCENDING{
|
|
||||||
@Override
|
|
||||||
public int compare(final Entry<?> a, final Entry<?> b){
|
|
||||||
return Ints.compare(b.getCount(), a.getCount());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ASCENDING{
|
|
||||||
@Override
|
|
||||||
public int compare(final Entry<?> a, final Entry<?> b){
|
|
||||||
return Ints.compare(a.getCount(), b.getCount());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <E> List<Entry<E>> getEntriesSortedByFrequency(final Multiset<E> ms, final boolean ascending) {
|
|
||||||
final List<Entry<E>> entryList = Lists.newArrayList(ms.entrySet());
|
|
||||||
Collections.sort(entryList, ascending ? EntryComp.ASCENDING : EntryComp.DESCENDING);
|
|
||||||
return entryList;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,409 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.generator.NetherChunkGenerator;
|
|
||||||
import org.bukkit.craftbukkit.generator.NormalChunkGenerator;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
|
|
||||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseMod
|
|
||||||
{
|
|
||||||
// CALLBACK MECHANISMS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param minecraftInstance
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object minecraftInstance, Object... data)
|
|
||||||
{
|
|
||||||
if (tick==TickType.GAME && tickEnd) {
|
|
||||||
return onTickInGame((MinecraftServer)minecraftInstance);
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onCrafting(Object... craftingParameters)
|
|
||||||
{
|
|
||||||
takenFromCrafting((EntityHuman)craftingParameters[0], (ItemStack)craftingParameters[1], (IInventory)craftingParameters[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onSmelting(Object... smeltingParameters)
|
|
||||||
{
|
|
||||||
takenFromFurnace((EntityHuman)smeltingParameters[0], (ItemStack)smeltingParameters[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean dispense(double x, double y, double z, byte xVelocity, byte zVelocity, Object... data)
|
|
||||||
{
|
|
||||||
return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean onChat(Object... data)
|
|
||||||
{
|
|
||||||
return onChatMessageReceived((EntityHuman)data[1], (Packet3Chat)data[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onServerLogin(Object handler) {
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void onServerLogout() {
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public final void onPlayerLogin(Object player)
|
|
||||||
{
|
|
||||||
onClientLogin((EntityHuman) player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayerLogout(Object player)
|
|
||||||
{
|
|
||||||
onClientLogout((EntityHuman)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayerChangedDimension(Object player)
|
|
||||||
{
|
|
||||||
onClientDimensionChanged((EntityHuman)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPacket250Packet(Object... data)
|
|
||||||
{
|
|
||||||
onPacket250Received((EntityHuman)data[1], (Packet250CustomPayload)data[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void notifyPickup(Object... pickupData)
|
|
||||||
{
|
|
||||||
EntityItem item = (EntityItem) pickupData[0];
|
|
||||||
EntityHuman player = (EntityHuman) pickupData[1];
|
|
||||||
onItemPickup(player, item.itemStack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void generate(Random random, int chunkX, int chunkZ, Object... additionalData)
|
|
||||||
{
|
|
||||||
World w = (World) additionalData[0];
|
|
||||||
IChunkProvider cp = (IChunkProvider) additionalData[1];
|
|
||||||
|
|
||||||
if (cp instanceof ChunkProviderHell || cp instanceof NetherChunkGenerator)
|
|
||||||
{
|
|
||||||
generateNether(w, random, chunkX << 4, chunkZ << 4);
|
|
||||||
}
|
|
||||||
else if (cp instanceof ChunkProviderGenerate || cp instanceof NormalChunkGenerator)
|
|
||||||
{
|
|
||||||
generateSurface(w, random, chunkX << 4, chunkZ << 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NO-OP on client side
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public final boolean handleCommand(String command, Object... data)
|
|
||||||
{
|
|
||||||
return onServerCommand(command, (String)data[0], (ICommandListener)data[1]);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onRegisterAnimations() {
|
|
||||||
// NOOP on servers
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRenderHarvest(@SuppressWarnings("rawtypes") Map renderers) {
|
|
||||||
// NOOP on servers
|
|
||||||
}
|
|
||||||
|
|
||||||
// BASEMOD API
|
|
||||||
/**
|
|
||||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param metadata
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public int addFuel(int id, int metadata)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRenderer(Map<Class<? extends Entity>, Object> renderers)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to perform some action other than just dispensing the item from the dispenser
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVel
|
|
||||||
* @param zVel
|
|
||||||
* @param item
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to generate Nether (Hell biome) blocks
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param random
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
*/
|
|
||||||
public void generateNether(World world, Random random, int chunkX, int chunkZ)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to generate Overworld (not hell or the end) blocks
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param random
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
*/
|
|
||||||
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name of your mod. Defaults to the class name
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get your mod priorities
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getPriorities()
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the version of your mod
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public abstract String getVersion();
|
|
||||||
|
|
||||||
public void keyboardEvent(Object event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load your mod
|
|
||||||
*/
|
|
||||||
public abstract void load();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finish loading your mod
|
|
||||||
*/
|
|
||||||
public void modsLoaded()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle item pickup
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
public void onItemPickup(EntityHuman player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
|
|
||||||
*
|
|
||||||
* @param minecraftServer the server
|
|
||||||
* @return true to continue receiving ticks
|
|
||||||
*/
|
|
||||||
public boolean onTickInGame(MinecraftServer minecraftServer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTickInGUI(float tick, Object game, Object gui)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only implemented on the client side
|
|
||||||
* {@link #onChatMessageReceived(EntityPlayer, Packet3Chat)}
|
|
||||||
*
|
|
||||||
* @param text
|
|
||||||
*/
|
|
||||||
public void receiveChatPacket(String text)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only called on the client side
|
|
||||||
* {@link #onPacket250Received(EntityPlayer, Packet250CustomPayload)}
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
public void receiveCustomPacket(Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerAnimation(Object game)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when someone crafts an item from a crafting table
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
* @param matrix
|
|
||||||
*/
|
|
||||||
public void takenFromCrafting(EntityHuman player, ItemStack item, IInventory matrix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when someone takes a smelted item from a furnace
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
public void takenFromFurnace(EntityHuman player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The identifier string for the mod- used in client<->server negotiation
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getName() + " " + getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a 250 packet is received on a channel registered to this mod
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* @param payload
|
|
||||||
*/
|
|
||||||
public void onPacket250Received(EntityHuman source, Packet250CustomPayload payload)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a chat message is received. Return true to stop further processing
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* @param chat
|
|
||||||
* @return true if you want to consume the message so it is not available for further processing
|
|
||||||
*/
|
|
||||||
public boolean onChatMessageReceived(EntityHuman source, Packet3Chat chat)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Called when a server command is received
|
|
||||||
* @param command
|
|
||||||
* @return true if you want to consume the message so it is not available for further processing
|
|
||||||
*/
|
|
||||||
public boolean onServerCommand(String command, String sender, ICommandListener listener)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a new client logs in.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public void onClientLogin(EntityHuman player)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a client logs out of the server.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public void onClientLogout(EntityHuman player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Called when a client changes dimensions on the server.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public void onClientDimensionChanged(EntityHuman player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Spare client junk
|
|
||||||
// -------
|
|
||||||
// void addRenderer(Map<Class<? extends Entity>, Render> renderers);
|
|
||||||
// void registerAnimation(Minecraft game);
|
|
||||||
// void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID);
|
|
||||||
// boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID);
|
|
||||||
// boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui);
|
|
||||||
// void keyboardEvent(KeyBinding event);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyBindingEvent(Object keybinding) {
|
|
||||||
// NOOP on server
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.src.BiomeGenBase;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.IMinecraftRegistry;
|
|
||||||
import cpw.mods.fml.server.FMLBukkitHandler;
|
|
||||||
|
|
||||||
public class BukkitRegistry implements IMinecraftRegistry
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addRecipe(net.minecraft.src.ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
CraftingManager.getInstance().registerShapedRecipe((ItemStack) output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addShapelessRecipe(net.minecraft.src.ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
CraftingManager.getInstance().registerShapelessRecipe((ItemStack) output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void addRecipe(net.minecraft.src.IRecipe recipe)
|
|
||||||
{
|
|
||||||
CraftingManager.getInstance().getRecipies().add(recipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addSmelting(int input, net.minecraft.src.ItemStack output)
|
|
||||||
{
|
|
||||||
FurnaceRecipes.getInstance().registerRecipe(input, (ItemStack) output);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlock(net.minecraft.src.Block block)
|
|
||||||
{
|
|
||||||
registerBlock(block, ItemBlock.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerBlock(net.minecraft.src.Block block, Class <? extends net.minecraft.src.ItemBlock > itemclass)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
assert block != null : "registerBlock: block cannot be null";
|
|
||||||
assert itemclass != null : "registerBlock: itemclass cannot be null";
|
|
||||||
int blockItemId = ((Block)block).id - 256;
|
|
||||||
itemclass.getConstructor(int.class).newInstance(blockItemId);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//HMMM
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id)
|
|
||||||
{
|
|
||||||
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void registerEntityID(Class <? extends net.minecraft.src.Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
|
|
||||||
{
|
|
||||||
EntityTypes.addNewEntityListMapping((Class<? extends Entity>) entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void registerTileEntity(Class <? extends net.minecraft.src.TileEntity > tileEntityClass, String id)
|
|
||||||
{
|
|
||||||
TileEntity.addNewTileEntityMapping((Class<? extends TileEntity>) tileEntityClass, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addBiome(BiomeGenBase biome)
|
|
||||||
{
|
|
||||||
FMLBukkitHandler.instance().addBiomeToDefaultWorldGenerator((BiomeBase) biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addSpawn(Class <? extends net.minecraft.src.EntityLiving > entityClass, int weightedProb, int min, int max, net.minecraft.src.EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
BiomeBase[] realBiomes=(BiomeBase[]) biomes;
|
|
||||||
for (BiomeBase biome : realBiomes)
|
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType)typeOfCreature);
|
|
||||||
|
|
||||||
for (BiomeMeta entry : spawns)
|
|
||||||
{
|
|
||||||
//Adjusting an existing spawn entry
|
|
||||||
if (entry.a == entityClass)
|
|
||||||
{
|
|
||||||
entry.d = weightedProb;
|
|
||||||
entry.b = min;
|
|
||||||
entry.c = max;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spawns.add(new BiomeMeta(entityClass, weightedProb, min, max));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void addSpawn(String entityName, int weightedProb, int min, int max, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
|
|
||||||
|
|
||||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
|
||||||
{
|
|
||||||
addSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, weightedProb, min, max, spawnList, biomes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeBiome(BiomeGenBase biome)
|
|
||||||
{
|
|
||||||
FMLBukkitHandler.instance().removeBiomeFromDefaultWorldGenerator((BiomeBase)biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeSpawn(Class <? extends net.minecraft.src.EntityLiving > entityClass, net.minecraft.src.EnumCreatureType typeOfCreature, BiomeGenBase... biomesO)
|
|
||||||
{
|
|
||||||
BiomeBase[] biomes=(BiomeBase[]) biomesO;
|
|
||||||
for (BiomeBase biome : biomes)
|
|
||||||
{
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
List<BiomeMeta> spawns = ((BiomeBase)biome).getMobs((EnumCreatureType) typeOfCreature);
|
|
||||||
|
|
||||||
Iterator<BiomeMeta> entries = spawns.iterator();
|
|
||||||
while (entries.hasNext())
|
|
||||||
{
|
|
||||||
BiomeMeta entry = entries.next();
|
|
||||||
if (entry.a == entityClass)
|
|
||||||
{
|
|
||||||
entries.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void removeSpawn(String entityName, net.minecraft.src.EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
Class <? extends Entity > entityClazz = EntityTypes.getEntityToClassMapping().get(entityName);
|
|
||||||
|
|
||||||
if (EntityLiving.class.isAssignableFrom(entityClazz))
|
|
||||||
{
|
|
||||||
removeSpawn((Class <? extends net.minecraft.src.EntityLiving >) entityClazz, spawnList, biomes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
import static java.lang.annotation.RetentionPolicy.*;
|
|
||||||
import static java.lang.annotation.ElementType.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(value = RUNTIME)
|
|
||||||
@Target(value = FIELD)
|
|
||||||
public @interface MLProp
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Adds additional help to top of configuration file.
|
|
||||||
*/
|
|
||||||
String info() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum value allowed if field is a number.
|
|
||||||
*/
|
|
||||||
double max() default Double.MAX_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum value allowed if field is a number.
|
|
||||||
*/
|
|
||||||
double min() default Double.MIN_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides the field name for property key.
|
|
||||||
*/
|
|
||||||
String name() default "";
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,780 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.ReflectionHelper;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
|
||||||
import cpw.mods.fml.common.registry.FMLRegistry;
|
|
||||||
import cpw.mods.fml.server.FMLBukkitHandler;
|
|
||||||
|
|
||||||
public class ModLoader
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Not used on the server.
|
|
||||||
*
|
|
||||||
* @param achievement
|
|
||||||
* @param name
|
|
||||||
* @param description
|
|
||||||
*/
|
|
||||||
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
|
||||||
{
|
|
||||||
String achName=achievement.getName();
|
|
||||||
addLocalization(achName, name);
|
|
||||||
addLocalization(achName+".desc", description);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
*
|
|
||||||
* {@link FMLCommonHandler#fuelLookup(int, int)}
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param metadata
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int addAllFuel(int id, int metadata)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addAllRenderers(Map<Class<? extends Entity>, Object> renderers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addAnimation(Object anim)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is unimplemented in server versions to date.
|
|
||||||
*
|
|
||||||
* @param armor
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int addArmor(String armor)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
|
||||||
*
|
|
||||||
* @param biome
|
|
||||||
*/
|
|
||||||
public static void addBiome(BiomeBase biome)
|
|
||||||
{
|
|
||||||
FMLRegistry.addBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add localization for the specified string
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static void addLocalization(String key, String value)
|
|
||||||
{
|
|
||||||
addLocalization(key, "en_US", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add localization for the specified string
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param lang
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static void addLocalization(String key, String lang, String value)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().addStringLocalization(key, lang, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name the specified minecraft object with the supplied name
|
|
||||||
*
|
|
||||||
* @param instance
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public static void addName(Object instance, String name)
|
|
||||||
{
|
|
||||||
addName(instance,"en_US",name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unimplemented on the server as it does not generate names
|
|
||||||
*
|
|
||||||
* @param instance
|
|
||||||
* @param lang
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public static void addName(Object instance, String lang, String name)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().addNameForObject(instance, lang, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unimplemented on the server as it does not render textures
|
|
||||||
*
|
|
||||||
* @param fileToOverride
|
|
||||||
* @param fileToAdd
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unimplemented on the server as it does not render textures
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @param overlayPath
|
|
||||||
* @param index
|
|
||||||
*/
|
|
||||||
public static void addOverride(String path, String overlayPath, int index)
|
|
||||||
{
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a Shaped Recipe
|
|
||||||
*
|
|
||||||
* @param output
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
public static void addRecipe(ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
FMLRegistry.addRecipe(output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a shapeless recipe
|
|
||||||
*
|
|
||||||
* @param output
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
FMLRegistry.addShapelessRecipe(output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new product to be smelted
|
|
||||||
*
|
|
||||||
* @param input
|
|
||||||
* @param output
|
|
||||||
*/
|
|
||||||
public static void addSmelting(int input, ItemStack output)
|
|
||||||
{
|
|
||||||
FMLRegistry.addSmelting(input, output);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
* @param entityClass
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeBase... biomes)
|
|
||||||
{
|
|
||||||
FMLRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
* @param entityName
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeBase... biomes)
|
|
||||||
{
|
|
||||||
FMLRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
* {@link FMLBukkitHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)}
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVel
|
|
||||||
* @param zVel
|
|
||||||
* @param item
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a container and drop all the items in it on the ground around
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
*/
|
|
||||||
public static void genericContainerRemoval(World world, int x, int y, int z)
|
|
||||||
{
|
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
if (!(te instanceof IInventory))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IInventory inv = (IInventory)te;
|
|
||||||
|
|
||||||
for (int l = 0; l < inv.getSize(); l++)
|
|
||||||
{
|
|
||||||
ItemStack itemstack = inv.getItem(l);
|
|
||||||
|
|
||||||
if (itemstack == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float f = world.random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float f1 = world.random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float f2 = world.random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
while (itemstack.count > 0)
|
|
||||||
{
|
|
||||||
int i1 = world.random.nextInt(21) + 10;
|
|
||||||
|
|
||||||
if (i1 > itemstack.count)
|
|
||||||
{
|
|
||||||
i1 = itemstack.count ;
|
|
||||||
}
|
|
||||||
|
|
||||||
itemstack.count -= i1;
|
|
||||||
EntityItem entityitem = new EntityItem(world, (float)te.x + f, (float)te.y + f1, (float)te.z + f2, new ItemStack(itemstack.id, i1, itemstack.getData()));
|
|
||||||
float f3 = 0.05F;
|
|
||||||
entityitem.motX = (float)world.random.nextGaussian() * f3;
|
|
||||||
entityitem.motY = (float)world.random.nextGaussian() * f3 + 0.2F;
|
|
||||||
entityitem.motZ = (float)world.random.nextGaussian() * f3;
|
|
||||||
|
|
||||||
if (itemstack.hasTag())
|
|
||||||
{
|
|
||||||
entityitem.itemStack.setTag((NBTTagCompound)itemstack.getTag().clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
world.addEntity(entityitem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of all BaseMod loaded into the system
|
|
||||||
* {@link ModLoaderModContainer#findAll}
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<BaseMod> getLoadedMods()
|
|
||||||
{
|
|
||||||
return ModLoaderModContainer.findAll(BaseMod.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Logger getLogger()
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().getFMLLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getMinecraftInstance()
|
|
||||||
{
|
|
||||||
return getMinecraftServerInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the minecraft server instance
|
|
||||||
* {@link FMLServerHandler#getServer()}
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static MinecraftServer getMinecraftServerInstance()
|
|
||||||
{
|
|
||||||
return FMLBukkitHandler.instance().getServer();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Get a value from a field using reflection
|
|
||||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, int)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param fieldindex
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, int fieldindex)
|
|
||||||
{
|
|
||||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a value from a field using reflection
|
|
||||||
* {@link ReflectionHelper#getPrivateValue(Class, Object, String)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param field
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static <T, E> T getPrivateValue(Class <? super E > instanceclass, E instance, String field)
|
|
||||||
{
|
|
||||||
return ReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stubbed method on the server to return a unique model id
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a new unique entity id
|
|
||||||
* {@link Entity#getNextId()}
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int getUniqueEntityId()
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().nextUniqueEntityListId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getUniqueSpriteIndex(String path)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To properly implement packet 250 protocol you should always check your
|
|
||||||
* channel is active prior to sending the packet
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param channel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isChannelActive(EntityPlayer player, String channel)
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().isChannelActive(channel, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isGUIOpen(Class<?> gui)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the named mod loaded?
|
|
||||||
* {@link Loader#isModLoaded(String)}
|
|
||||||
*
|
|
||||||
* @param modname
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isModLoaded(String modname)
|
|
||||||
{
|
|
||||||
return Loader.isModLoaded(modname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implemented elsewhere
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void loadConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object loadImage(Object renderEngine, String path) throws Exception
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call in from elsewhere. Unimplemented here.
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void onItemPickup(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Call in from elsewhere. Unimplemented here.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void onTick(float tick, Object game)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openGUI(EntityPlayer player, Object gui)
|
|
||||||
{
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
* {@link FMLBukkitHandler#handlePacket250(Packet250CustomPayload, EntityHuman)}
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void receivePacket(Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static Object[] registerAllKeys(Object[] keys)
|
|
||||||
{
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void registerAllTextureOverrides(Object cache)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new block
|
|
||||||
*
|
|
||||||
* @param block
|
|
||||||
*/
|
|
||||||
public static void registerBlock(Block block)
|
|
||||||
{
|
|
||||||
FMLRegistry.registerBlock(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new block
|
|
||||||
*
|
|
||||||
* @param block
|
|
||||||
* @param itemclass
|
|
||||||
*/
|
|
||||||
public static void registerBlock(Block block, Class <? extends ItemBlock > itemclass)
|
|
||||||
{
|
|
||||||
FMLRegistry.registerBlock(block, itemclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new entity ID
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param entityName
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id)
|
|
||||||
{
|
|
||||||
FMLRegistry.registerEntityID(entityClass, entityName, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new entity ID
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param entityName
|
|
||||||
* @param id
|
|
||||||
* @param background
|
|
||||||
* @param foreground
|
|
||||||
*/
|
|
||||||
public static void registerEntityID(Class <? extends Entity > entityClass, String entityName, int id, int background, int foreground)
|
|
||||||
{
|
|
||||||
FMLRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerKey(BaseMod mod, Object keyHandler, boolean allowRepeat)
|
|
||||||
{
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the mod for packets on this channel. This only registers the
|
|
||||||
* channel with Forge Mod Loader, not with clients connecting- use
|
|
||||||
* BaseMod.onClientLogin to tell them about your custom channel
|
|
||||||
* {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)}
|
|
||||||
*
|
|
||||||
* @param mod
|
|
||||||
* @param channel
|
|
||||||
*/
|
|
||||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new tile entity class
|
|
||||||
*
|
|
||||||
* @param tileEntityClass
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public static void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id)
|
|
||||||
{
|
|
||||||
FMLRegistry.registerTileEntity(tileEntityClass, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, Object renderer)
|
|
||||||
{
|
|
||||||
FMLRegistry.instance().registerTileEntity(tileEntityClass, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a biome from the list of generated biomes
|
|
||||||
*
|
|
||||||
* @param biome
|
|
||||||
*/
|
|
||||||
public static void removeBiome(BiomeBase biome)
|
|
||||||
{
|
|
||||||
FMLRegistry.removeBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
FMLRegistry.removeSpawn(entityClass, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType spawnList, BiomeBase... biomes)
|
|
||||||
{
|
|
||||||
FMLRegistry.removeSpawn(entityClass, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
FMLRegistry.removeSpawn(entityName, spawnList, FMLBukkitHandler.instance().getDefaultOverworldBiomes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeBase... biomes)
|
|
||||||
{
|
|
||||||
FMLRegistry.removeSpawn(entityName, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean renderBlockIsItemFull3D(int modelID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void renderInvBlock(Object renderer, Block block, int metadata, int modelID)
|
|
||||||
{
|
|
||||||
// NOOP
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static boolean renderWorldBlock(Object renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration is handled elsewhere
|
|
||||||
* {@link ModLoaderModContainer}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void saveConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a chat message to the server
|
|
||||||
* {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)}
|
|
||||||
*
|
|
||||||
* @param text
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void serverChat(String text)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void serverLogin(Object handler, Packet1Login loginPacket)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicate that you want to receive ticks
|
|
||||||
*
|
|
||||||
* @param mod receiving the events
|
|
||||||
* @param enable indicates whether you want to recieve them or not
|
|
||||||
* @param useClock Not used in server side: all ticks are sent on the server side (no render subticks)
|
|
||||||
*/
|
|
||||||
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a private field to a value using reflection
|
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param fieldindex
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, int fieldindex, E value)
|
|
||||||
{
|
|
||||||
ReflectionHelper.setPrivateValue(instanceclass, instance, fieldindex, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a private field to a value using reflection
|
|
||||||
* {@link ReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param field
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static <T, E> void setPrivateValue(Class <? super T > instanceclass, T instance, String field, E value)
|
|
||||||
{
|
|
||||||
ReflectionHelper.setPrivateValue(instanceclass, instance, field, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
* {@link FMLBukkitHandler#onItemCrafted(EntityHuman, ItemStack, IInventory)}
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
* @param matrix
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void takenFromCrafting(EntityHuman player, ItemStack item, IInventory matrix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
* {@link FMLBukkitHandler#onItemSmelted(EntityHuman, ItemStack)}
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void takenFromFurnace(EntityHuman player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throw the offered exception. Likely will stop the game.
|
|
||||||
* {@link FMLBukkitHandler#raiseException(Throwable, String, boolean)}
|
|
||||||
* @param message
|
|
||||||
* @param e
|
|
||||||
*/
|
|
||||||
public static void throwException(String message, Throwable e)
|
|
||||||
{
|
|
||||||
FMLBukkitHandler.instance().raiseException(e, message, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To properly implement packet 250 protocol you should always check your channel
|
|
||||||
* is active prior to sending the packet
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param channel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isChannelActive(EntityHuman player, String channel)
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().isChannelActive(channel, player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.server;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface SidedProxy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name of the client side class to load and populate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String clientSide() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the server side class to load and populate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String serverSide() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the a special bukkit plugin class to load and populate
|
|
||||||
*/
|
|
||||||
String bukkitSide() default "";
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface BiomeGenBase {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface Block {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface Entity {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface EntityLiving {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface EnumCreatureType {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface IRecipe {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface ItemBlock {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface ItemStack {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
public interface TileEntity {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os, os.path, shutil
|
|
||||||
import fnmatch
|
|
||||||
import re
|
|
||||||
|
|
||||||
def main():
|
|
||||||
sys.stdout.flush()
|
|
||||||
for x in range(1, len(sys.argv)):
|
|
||||||
cleanup_source(sys.argv[x])
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
def cleanup_source(path):
|
|
||||||
path = os.path.normpath(path)
|
|
||||||
regex_cases_before = re.compile(r'((case|default).+\r?\n)\r?\n', re.MULTILINE) #Fixes newline after case before case body
|
|
||||||
regex_cases_after = re.compile(r'\r?\n(\r?\n[ \t]+(case|default))', re.MULTILINE) #Fixes newline after case body before new case
|
|
||||||
|
|
||||||
def updatefile(src_file):
|
|
||||||
global count
|
|
||||||
tmp_file = src_file + '.tmp'
|
|
||||||
count = 0
|
|
||||||
with open(src_file, 'r') as fh:
|
|
||||||
buf = fh.read()
|
|
||||||
|
|
||||||
def fix_cases(match):
|
|
||||||
global count
|
|
||||||
count += 1
|
|
||||||
return match.group(1)
|
|
||||||
|
|
||||||
buf = regex_cases_before.sub(fix_cases, buf)
|
|
||||||
buf = regex_cases_after.sub(fix_cases, buf)
|
|
||||||
if count > 0:
|
|
||||||
with open(tmp_file, 'w') as fh:
|
|
||||||
fh.write(buf)
|
|
||||||
shutil.move(tmp_file, src_file)
|
|
||||||
|
|
||||||
for path, _, filelist in os.walk(path, followlinks=True):
|
|
||||||
sub_dir = os.path.relpath(path, path)
|
|
||||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
|
||||||
src_file = os.path.normpath(os.path.join(path, cur_file))
|
|
||||||
updatefile(src_file)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import net.minecraft.src.RenderEngine;
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
import net.minecraft.src.ITexturePack;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
public class FMLTextureFX extends TextureFX implements ITextureFX
|
|
||||||
{
|
|
||||||
public int tileSizeBase = 16;
|
|
||||||
public int tileSizeSquare = 256;
|
|
||||||
public int tileSizeMask = 15;
|
|
||||||
public int tileSizeSquareMask = 255;
|
|
||||||
public boolean errored = false;
|
|
||||||
protected Logger log = FMLLog.getLogger();
|
|
||||||
|
|
||||||
public FMLTextureFX(int icon)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void setErrored(boolean err){ errored = err; }
|
|
||||||
@Override public boolean getErrored(){ return errored; }
|
|
||||||
@Override
|
|
||||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions)
|
|
||||||
{
|
|
||||||
onTextureDimensionsUpdate(dimensions.width, dimensions.height);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onTextureDimensionsUpdate(int width, int height)
|
|
||||||
{
|
|
||||||
tileSizeBase = width >> 4;
|
|
||||||
tileSizeSquare = tileSizeBase * tileSizeBase;
|
|
||||||
tileSizeMask = tileSizeBase - 1;
|
|
||||||
tileSizeSquareMask = tileSizeSquare - 1;
|
|
||||||
setErrored(false);
|
|
||||||
setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setup()
|
|
||||||
{
|
|
||||||
field_76852_a = new byte[tileSizeSquare << 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean unregister(RenderEngine engine, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
effects.remove(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
|
|
||||||
public class GuiCustomModLoadingErrorScreen extends GuiErrorScreen
|
|
||||||
{
|
|
||||||
private CustomModLoadingErrorDisplayException customException;
|
|
||||||
public GuiCustomModLoadingErrorScreen(CustomModLoadingErrorDisplayException customException)
|
|
||||||
{
|
|
||||||
this.customException = customException;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73866_w_()
|
|
||||||
{
|
|
||||||
super.func_73866_w_();
|
|
||||||
this.customException.initGui(this, field_73886_k);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
|
||||||
{
|
|
||||||
this.func_73873_v_();
|
|
||||||
this.customException.drawScreen(this, field_73886_k, p_73863_1_, p_73863_2_, p_73863_3_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,182 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.src.FontRenderer;
|
|
||||||
import net.minecraft.src.GuiButton;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
import net.minecraft.src.GuiSmallButton;
|
|
||||||
import net.minecraft.src.StringTranslate;
|
|
||||||
import net.minecraft.src.Tessellator;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class GuiModList extends GuiScreen
|
|
||||||
{
|
|
||||||
private GuiScreen mainMenu;
|
|
||||||
private GuiSlotModList modList;
|
|
||||||
private int selected = -1;
|
|
||||||
private ModContainer selectedMod;
|
|
||||||
private int listWidth;
|
|
||||||
private ArrayList<ModContainer> mods;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mainMenu
|
|
||||||
*/
|
|
||||||
public GuiModList(GuiScreen mainMenu)
|
|
||||||
{
|
|
||||||
this.mainMenu=mainMenu;
|
|
||||||
this.mods=new ArrayList<ModContainer>();
|
|
||||||
FMLClientHandler.instance().addSpecialModEntries(mods);
|
|
||||||
for (ModContainer mod : Loader.instance().getModList()) {
|
|
||||||
if (mod.getMetadata()!=null && !Strings.isNullOrEmpty(mod.getMetadata().parent)) {
|
|
||||||
String parentMod = mod.getMetadata().parent;
|
|
||||||
ModContainer parentContainer = Loader.instance().getIndexedModList().get(parentMod);
|
|
||||||
if (parentContainer != null)
|
|
||||||
{
|
|
||||||
mod.getMetadata().parentMod = parentContainer;
|
|
||||||
parentContainer.getMetadata().childMods.add(mod);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mods.add(mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_73866_w_()
|
|
||||||
{
|
|
||||||
for (ModContainer mod : mods) {
|
|
||||||
listWidth=Math.max(listWidth,getFontRenderer().func_78256_a(mod.getName()) + 10);
|
|
||||||
listWidth=Math.max(listWidth,getFontRenderer().func_78256_a(mod.getVersion()) + 10);
|
|
||||||
}
|
|
||||||
listWidth=Math.min(listWidth, 150);
|
|
||||||
StringTranslate translations = StringTranslate.func_74808_a();
|
|
||||||
this.field_73887_h.add(new GuiSmallButton(6, this.field_73880_f / 2 - 75, this.field_73881_g - 38, translations.func_74805_b("gui.done")));
|
|
||||||
this.modList=new GuiSlotModList(this, mods, listWidth);
|
|
||||||
this.modList.registerScrollButtons(this.field_73887_h, 7, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void func_73875_a(GuiButton button) {
|
|
||||||
if (button.field_73742_g)
|
|
||||||
{
|
|
||||||
switch (button.field_73741_f)
|
|
||||||
{
|
|
||||||
case 6:
|
|
||||||
this.field_73882_e.func_71373_a(this.mainMenu);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.func_73875_a(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int drawLine(String line, int offset, int shifty)
|
|
||||||
{
|
|
||||||
this.field_73886_k.func_78276_b(line, offset, shifty, 0xd7edea);
|
|
||||||
return shifty + 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_73863_a(int p_571_1_, int p_571_2_, float p_571_3_)
|
|
||||||
{
|
|
||||||
this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_);
|
|
||||||
this.func_73732_a(this.field_73886_k, "Mod List", this.field_73880_f / 2, 16, 0xFFFFFF);
|
|
||||||
int offset = this.listWidth + 20;
|
|
||||||
if (selectedMod != null) {
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
|
||||||
if (!selectedMod.getMetadata().autogenerated) {
|
|
||||||
int shifty = 35;
|
|
||||||
if (!selectedMod.getMetadata().logoFile.isEmpty())
|
|
||||||
{
|
|
||||||
int texture = this.field_73882_e.field_71446_o.func_78341_b(selectedMod.getMetadata().logoFile);
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.field_73882_e.field_71446_o.func_78342_b(texture);
|
|
||||||
Dimension dim = TextureFXManager.instance().getTextureDimensions(texture);
|
|
||||||
int top = 32;
|
|
||||||
Tessellator tess = Tessellator.field_78398_a;
|
|
||||||
tess.func_78382_b();
|
|
||||||
tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1);
|
|
||||||
tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1);
|
|
||||||
tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0);
|
|
||||||
tess.func_78374_a(offset, top, field_73735_i, 0, 0);
|
|
||||||
tess.func_78381_a();
|
|
||||||
|
|
||||||
shifty += 65;
|
|
||||||
}
|
|
||||||
this.field_73886_k.func_78261_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
|
|
||||||
shifty += 12;
|
|
||||||
|
|
||||||
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);
|
|
||||||
shifty = drawLine(String.format("Mod State: %s", Loader.instance().getModState(selectedMod)), offset, shifty);
|
|
||||||
if (!selectedMod.getMetadata().credits.isEmpty()) {
|
|
||||||
shifty = drawLine(String.format("Credits: %s", selectedMod.getMetadata().credits), offset, shifty);
|
|
||||||
}
|
|
||||||
shifty = drawLine(String.format("Authors: %s", selectedMod.getMetadata().getAuthorList()), offset, shifty);
|
|
||||||
shifty = drawLine(String.format("URL: %s", selectedMod.getMetadata().url), offset, shifty);
|
|
||||||
shifty = drawLine(selectedMod.getMetadata().childMods.isEmpty() ? "No child mods for this mod" : String.format("Child mods: %s", selectedMod.getMetadata().getChildModList()), offset, shifty);
|
|
||||||
this.getFontRenderer().func_78279_b(selectedMod.getMetadata().description, offset, shifty + 10, this.field_73880_f - offset - 20, 0xDDDDDD);
|
|
||||||
} else {
|
|
||||||
offset = ( this.listWidth + this.field_73880_f ) / 2;
|
|
||||||
this.func_73732_a(this.field_73886_k, selectedMod.getName(), offset, 35, 0xFFFFFF);
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("Version: %s",selectedMod.getVersion()), offset, 45, 0xFFFFFF);
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("Mod State: %s",Loader.instance().getModState(selectedMod)), offset, 55, 0xFFFFFF);
|
|
||||||
this.func_73732_a(this.field_73886_k, "No mod information found", offset, 65, 0xDDDDDD);
|
|
||||||
this.func_73732_a(this.field_73886_k, "Ask your mod author to provide a mod mcmod.info file", offset, 75, 0xDDDDDD);
|
|
||||||
}
|
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
|
||||||
}
|
|
||||||
super.func_73863_a(p_571_1_, p_571_2_, p_571_3_);
|
|
||||||
}
|
|
||||||
|
|
||||||
Minecraft getMinecraftInstance() {
|
|
||||||
return field_73882_e;
|
|
||||||
}
|
|
||||||
|
|
||||||
FontRenderer getFontRenderer() {
|
|
||||||
return field_73886_k;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param var1
|
|
||||||
*/
|
|
||||||
public void selectModIndex(int var1)
|
|
||||||
{
|
|
||||||
this.selected=var1;
|
|
||||||
if (var1>=0 && var1<=mods.size()) {
|
|
||||||
this.selectedMod=mods.get(selected);
|
|
||||||
} else {
|
|
||||||
this.selectedMod=null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean modIndexSelected(int var1)
|
|
||||||
{
|
|
||||||
return var1==selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.MissingModsException;
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
|
|
||||||
public class GuiModsMissing extends GuiErrorScreen
|
|
||||||
{
|
|
||||||
|
|
||||||
private MissingModsException modsMissing;
|
|
||||||
|
|
||||||
public GuiModsMissing(MissingModsException modsMissing)
|
|
||||||
{
|
|
||||||
this.modsMissing = modsMissing;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_73866_w_()
|
|
||||||
{
|
|
||||||
super.func_73866_w_();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
|
||||||
{
|
|
||||||
this.func_73873_v_();
|
|
||||||
int offset = Math.max(85 - modsMissing.missingMods.size() * 10, 10);
|
|
||||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset+=10;
|
|
||||||
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset+=5;
|
|
||||||
for (ArtifactVersion v : modsMissing.missingMods)
|
|
||||||
{
|
|
||||||
offset+=10;
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
|
||||||
}
|
|
||||||
offset+=20;
|
|
||||||
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import net.minecraft.src.GuiButton;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
import net.minecraft.src.GuiSmallButton;
|
|
||||||
import net.minecraft.src.StringTranslate;
|
|
||||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
|
|
||||||
public class GuiModsMissingForServer extends GuiScreen
|
|
||||||
{
|
|
||||||
private ModMissingPacket modsMissing;
|
|
||||||
|
|
||||||
public GuiModsMissingForServer(ModMissingPacket modsMissing)
|
|
||||||
{
|
|
||||||
this.modsMissing = modsMissing;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_73866_w_()
|
|
||||||
{
|
|
||||||
StringTranslate translations = StringTranslate.func_74808_a();
|
|
||||||
this.field_73887_h.add(new GuiSmallButton(1, this.field_73880_f / 2 - 75, this.field_73881_g - 38, translations.func_74805_b("gui.done")));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void func_73875_a(GuiButton p_73875_1_)
|
|
||||||
{
|
|
||||||
if (p_73875_1_.field_73742_g && p_73875_1_.field_73741_f == 1)
|
|
||||||
{
|
|
||||||
FMLClientHandler.instance().getClient().func_71373_a(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
|
||||||
{
|
|
||||||
this.func_73873_v_();
|
|
||||||
int offset = Math.max(85 - modsMissing.getModList().size() * 10, 10);
|
|
||||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader could not connect to this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset += 10;
|
|
||||||
this.func_73732_a(this.field_73886_k, "The mods and versions listed below could not be found", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset += 10;
|
|
||||||
this.func_73732_a(this.field_73886_k, "They are required to play on this server", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset += 5;
|
|
||||||
for (ArtifactVersion v : modsMissing.getModList())
|
|
||||||
{
|
|
||||||
offset += 10;
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
|
||||||
}
|
|
||||||
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.WrongMinecraftVersionException;
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
import net.minecraft.src.GuiErrorScreen;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
|
|
||||||
public class GuiWrongMinecraft extends GuiErrorScreen
|
|
||||||
{
|
|
||||||
private WrongMinecraftVersionException wrongMC;
|
|
||||||
public GuiWrongMinecraft(WrongMinecraftVersionException wrongMC)
|
|
||||||
{
|
|
||||||
this.wrongMC = wrongMC;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73866_w_()
|
|
||||||
{
|
|
||||||
super.func_73866_w_();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
|
||||||
{
|
|
||||||
this.func_73873_v_();
|
|
||||||
int offset = 75;
|
|
||||||
this.func_73732_a(this.field_73886_k, "Forge Mod Loader has found a problem with your minecraft installation", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset+=10;
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("The mod listed below does not want to run in Minecraft version %s", Loader.instance().getMinecraftModContainer().getVersion()), this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
offset+=5;
|
|
||||||
offset+=10;
|
|
||||||
this.func_73732_a(this.field_73886_k, String.format("%s (%s) wants Minecraft %s", wrongMC.mod.getName(), wrongMC.mod.getModId(), wrongMC.mod.acceptableMinecraftVersionRange()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
|
||||||
offset+=20;
|
|
||||||
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
|
|
||||||
import net.minecraft.src.RenderEngine;
|
|
||||||
import net.minecraft.src.ITexturePack;
|
|
||||||
|
|
||||||
public interface ITextureFX
|
|
||||||
{
|
|
||||||
public void onTexturePackChanged(RenderEngine engine, ITexturePack texturepack, Dimension dimensions);
|
|
||||||
|
|
||||||
public void onTextureDimensionsUpdate(int width, int height);
|
|
||||||
|
|
||||||
public void setErrored(boolean errored);
|
|
||||||
|
|
||||||
public boolean getErrored();
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
|
|
||||||
class OverrideInfo
|
|
||||||
{
|
|
||||||
public String texture;
|
|
||||||
public String override;
|
|
||||||
public int index;
|
|
||||||
public int imageIndex;
|
|
||||||
public TextureFX textureFX;
|
|
||||||
public boolean added;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
OverrideInfo inf=(OverrideInfo) obj;
|
|
||||||
return index==inf.index && imageIndex==inf.imageIndex;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return index+imageIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SpriteHelper
|
|
||||||
{
|
|
||||||
private static HashMap<String, BitSet> spriteInfo = new HashMap<String, BitSet>();
|
|
||||||
|
|
||||||
private static void initMCSpriteMaps() {
|
|
||||||
BitSet slots =
|
|
||||||
SpriteHelper.toBitSet(
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000110000" +
|
|
||||||
"0000000000100000" +
|
|
||||||
"0000000001100000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000011111" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000001111100" +
|
|
||||||
"0000000001111000" +
|
|
||||||
"0000000000000000");
|
|
||||||
spriteInfo.put("/terrain.png", slots);
|
|
||||||
|
|
||||||
slots = SpriteHelper.toBitSet(
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0000000000000000" +
|
|
||||||
"0111100000000000" +
|
|
||||||
"1111100010000000" +
|
|
||||||
"0000101110000000" +
|
|
||||||
"0111000000000000" +
|
|
||||||
"1100001100001111" +
|
|
||||||
"0000000000001111" +
|
|
||||||
"0000000000000000");
|
|
||||||
spriteInfo.put("/gui/items.png", slots);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Register a sprite map for ModTextureStatic, to allow for other mods to override
|
|
||||||
* your sprite page.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void registerSpriteMapForFile(String file, String spriteMap) {
|
|
||||||
if (spriteInfo.size() == 0) {
|
|
||||||
initMCSpriteMaps();
|
|
||||||
}
|
|
||||||
if (spriteInfo.containsKey(file)) {
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Duplicate attempt to register a sprite file %s for overriding -- ignoring",file));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spriteInfo.put(file, toBitSet(spriteMap));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getUniqueSpriteIndex(String path)
|
|
||||||
{
|
|
||||||
if (!spriteInfo.containsKey("/terrain.png"))
|
|
||||||
{
|
|
||||||
initMCSpriteMaps();
|
|
||||||
}
|
|
||||||
|
|
||||||
BitSet slots = spriteInfo.get(path);
|
|
||||||
|
|
||||||
if (slots == null)
|
|
||||||
{
|
|
||||||
Exception ex = new Exception(String.format("Invalid getUniqueSpriteIndex call for texture: %s", path));
|
|
||||||
FMLLog.log(Level.SEVERE, ex, "A critical error has been detected with sprite overrides");
|
|
||||||
FMLCommonHandler.instance().raiseException(ex,"Invalid request to getUniqueSpriteIndex",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = getFreeSlot(slots);
|
|
||||||
|
|
||||||
if (ret == -1)
|
|
||||||
{
|
|
||||||
Exception ex = new Exception(String.format("No more sprite indicies left for: %s", path));
|
|
||||||
FMLLog.log(Level.SEVERE, ex, "There are no sprite indicies left for %s", path);
|
|
||||||
FMLCommonHandler.instance().raiseException(ex,"No more sprite indicies left", true);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BitSet toBitSet(String data)
|
|
||||||
{
|
|
||||||
BitSet ret = new BitSet(data.length());
|
|
||||||
for (int x = 0; x < data.length(); x++)
|
|
||||||
{
|
|
||||||
ret.set(x, data.charAt(x) == '1');
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getFreeSlot(BitSet slots)
|
|
||||||
{
|
|
||||||
int next=slots.nextSetBit(0);
|
|
||||||
slots.clear(next);
|
|
||||||
return next;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int freeSlotCount(String textureToOverride)
|
|
||||||
{
|
|
||||||
return spriteInfo.get(textureToOverride).cardinality();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,323 +0,0 @@
|
|||||||
package cpw.mods.fml.client;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_BINDING_2D;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.src.ModTextureStatic;
|
|
||||||
import net.minecraft.src.RenderEngine;
|
|
||||||
import net.minecraft.src.TextureFX;
|
|
||||||
import net.minecraft.src.ITexturePack;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
public class TextureFXManager
|
|
||||||
{
|
|
||||||
private static final TextureFXManager INSTANCE = new TextureFXManager();
|
|
||||||
|
|
||||||
private class TextureProperties
|
|
||||||
{
|
|
||||||
private int textureId;
|
|
||||||
private Dimension dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Integer,TextureProperties> textureProperties = Maps.newHashMap();
|
|
||||||
private Multimap<String, OverrideInfo> overrideInfo = ArrayListMultimap.create();
|
|
||||||
private HashSet<OverrideInfo> animationSet = new HashSet<OverrideInfo>();
|
|
||||||
|
|
||||||
private List<TextureFX> addedTextureFX = new ArrayList<TextureFX>();
|
|
||||||
|
|
||||||
private Minecraft client;
|
|
||||||
|
|
||||||
void setClient(Minecraft client)
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onUpdateTextureEffect(TextureFX effect)
|
|
||||||
{
|
|
||||||
ITextureFX ifx = (effect instanceof ITextureFX ? ((ITextureFX)effect) : null);
|
|
||||||
|
|
||||||
if (ifx != null && ifx.getErrored())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String name = effect.getClass().getSimpleName();
|
|
||||||
client.field_71424_I.func_76320_a(name);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!FMLClientHandler.instance().hasOptifine())
|
|
||||||
{
|
|
||||||
effect.func_76846_a();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.warning("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name);
|
|
||||||
if (ifx != null)
|
|
||||||
{
|
|
||||||
ifx.setErrored(true);
|
|
||||||
}
|
|
||||||
client.field_71424_I.func_76319_b();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
client.field_71424_I.func_76319_b();
|
|
||||||
|
|
||||||
if (ifx != null)
|
|
||||||
{
|
|
||||||
Dimension dim = getTextureDimensions(effect);
|
|
||||||
int target = ((dim.width >> 4) * (dim.height >> 4)) << 2;
|
|
||||||
if (effect.field_76852_a.length != target)
|
|
||||||
{
|
|
||||||
FMLLog.warning("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_76852_a.length, target);
|
|
||||||
ifx.setErrored(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Quick and dirty image scaling, no smoothing or fanciness, meant for speed as it will be called every tick.
|
|
||||||
public void scaleTextureFXData(byte[] data, ByteBuffer buf, int target, int length)
|
|
||||||
{
|
|
||||||
int sWidth = (int)Math.sqrt(data.length / 4);
|
|
||||||
int factor = target / sWidth;
|
|
||||||
byte[] tmp = new byte[4];
|
|
||||||
|
|
||||||
buf.clear();
|
|
||||||
|
|
||||||
if (factor > 1)
|
|
||||||
{
|
|
||||||
for (int y = 0; y < sWidth; y++)
|
|
||||||
{
|
|
||||||
int sRowOff = sWidth * y;
|
|
||||||
int tRowOff = target * y * factor;
|
|
||||||
for (int x = 0; x < sWidth; x++)
|
|
||||||
{
|
|
||||||
int sPos = (x + sRowOff) * 4;
|
|
||||||
tmp[0] = data[sPos + 0];
|
|
||||||
tmp[1] = data[sPos + 1];
|
|
||||||
tmp[2] = data[sPos + 2];
|
|
||||||
tmp[3] = data[sPos + 3];
|
|
||||||
|
|
||||||
int tPosTop = (x * factor) + tRowOff;
|
|
||||||
for (int y2 = 0; y2 < factor; y2++)
|
|
||||||
{
|
|
||||||
buf.position((tPosTop + (y2 * target)) * 4);
|
|
||||||
for (int x2 = 0; x2 < factor; x2++)
|
|
||||||
{
|
|
||||||
buf.put(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.position(0).limit(length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onPreRegisterEffect(TextureFX effect)
|
|
||||||
{
|
|
||||||
Dimension dim = getTextureDimensions(effect);
|
|
||||||
if (effect instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public int getEffectTexture(TextureFX effect)
|
|
||||||
{
|
|
||||||
Integer id = effectTextures.get(effect);
|
|
||||||
if (id != null)
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
effect.func_76845_a(client.field_71446_o);
|
|
||||||
|
|
||||||
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
GL11.glBindTexture(GL_TEXTURE_2D, old);
|
|
||||||
|
|
||||||
effectTextures.put(effect, id);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onTexturePackChange(RenderEngine engine, ITexturePack texturepack, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
pruneOldTextureFX(texturepack, effects);
|
|
||||||
|
|
||||||
for (TextureFX tex : effects)
|
|
||||||
{
|
|
||||||
if (tex instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)tex).onTexturePackChanged(engine, texturepack, getTextureDimensions(tex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadTextures(texturepack);
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
|
|
||||||
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
|
|
||||||
private ITexturePack earlyTexturePack;
|
|
||||||
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
Dimension dim = new Dimension(width, height);
|
|
||||||
textureDims.put(id, dim);
|
|
||||||
|
|
||||||
for (TextureFX tex : effects)
|
|
||||||
{
|
|
||||||
if (getEffectTexture(tex) == id && tex instanceof ITextureFX)
|
|
||||||
{
|
|
||||||
((ITextureFX)tex).onTextureDimensionsUpdate(width, height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension getTextureDimensions(TextureFX effect)
|
|
||||||
{
|
|
||||||
return getTextureDimensions(getEffectTexture(effect));
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dimension getTextureDimensions(int id)
|
|
||||||
{
|
|
||||||
return textureDims.get(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAnimation(TextureFX anim)
|
|
||||||
{
|
|
||||||
OverrideInfo info=new OverrideInfo();
|
|
||||||
info.index=anim.field_76850_b;
|
|
||||||
info.imageIndex=anim.field_76847_f;
|
|
||||||
info.textureFX=anim;
|
|
||||||
if (animationSet.contains(info)) {
|
|
||||||
animationSet.remove(info);
|
|
||||||
}
|
|
||||||
animationSet.add(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void loadTextures(ITexturePack texturePack)
|
|
||||||
{
|
|
||||||
registerTextureOverrides(client.field_71446_o);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void registerTextureOverrides(RenderEngine renderer) {
|
|
||||||
for (OverrideInfo animationOverride : animationSet) {
|
|
||||||
renderer.func_78355_a(animationOverride.textureFX);
|
|
||||||
addedTextureFX.add(animationOverride.textureFX);
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", animationOverride.index, animationOverride.textureFX.field_76850_b, animationOverride.textureFX.getClass().getSimpleName(), animationOverride.textureFX.field_76847_f));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String fileToOverride : overrideInfo.keySet()) {
|
|
||||||
for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
BufferedImage image=loadImageFromTexturePack(renderer, override.override);
|
|
||||||
ModTextureStatic mts=new ModTextureStatic(override.index, 1, override.texture, image);
|
|
||||||
renderer.func_78355_a(mts);
|
|
||||||
addedTextureFX.add(mts);
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().finer(String.format("Registered texture override %d (%d) on %s (%d)", override.index, mts.field_76850_b, override.texture, mts.field_76847_f));
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().getFMLLogger().throwing("FMLClientHandler", "registerTextureOverrides", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void registerAnimatedTexturesFor(ModContainer mod)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onEarlyTexturePackLoad(ITexturePack fallback)
|
|
||||||
{
|
|
||||||
if (client==null) {
|
|
||||||
// We're far too early- let's wait
|
|
||||||
this.earlyTexturePack = fallback;
|
|
||||||
} else {
|
|
||||||
loadTextures(fallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void pruneOldTextureFX(ITexturePack var1, List<TextureFX> effects)
|
|
||||||
{
|
|
||||||
ListIterator<TextureFX> li = addedTextureFX.listIterator();
|
|
||||||
while (li.hasNext())
|
|
||||||
{
|
|
||||||
TextureFX tex = li.next();
|
|
||||||
if (tex instanceof FMLTextureFX)
|
|
||||||
{
|
|
||||||
if (((FMLTextureFX)tex).unregister(client.field_71446_o, effects))
|
|
||||||
{
|
|
||||||
li.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
effects.remove(tex);
|
|
||||||
li.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void addNewTextureOverride(String textureToOverride, String overridingTexturePath, int location) {
|
|
||||||
OverrideInfo info = new OverrideInfo();
|
|
||||||
info.index = location;
|
|
||||||
info.override = overridingTexturePath;
|
|
||||||
info.texture = textureToOverride;
|
|
||||||
overrideInfo.put(textureToOverride, info);
|
|
||||||
FMLLog.fine("Overriding %s @ %d with %s. %d slots remaining",textureToOverride, location, overridingTexturePath, SpriteHelper.freeSlotCount(textureToOverride));
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
|
|
||||||
{
|
|
||||||
InputStream image=client.field_71418_C.func_77292_e().func_77532_a(path);
|
|
||||||
if (image==null) {
|
|
||||||
throw new RuntimeException(String.format("The requested image path %s is not found",path));
|
|
||||||
}
|
|
||||||
BufferedImage result=ImageIO.read(image);
|
|
||||||
if (result==null)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(String.format("The requested image path %s appears to be corrupted",path));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextureFXManager instance()
|
|
||||||
{
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.src.BaseMod;
|
|
||||||
import net.minecraft.src.Block;
|
|
||||||
import net.minecraft.src.IBlockAccess;
|
|
||||||
import net.minecraft.src.RenderBlocks;
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ModLoaderBlockRendererHandler implements ISimpleBlockRenderingHandler
|
|
||||||
{
|
|
||||||
private int renderId;
|
|
||||||
private boolean render3dInInventory;
|
|
||||||
private BaseMod mod;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mod
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public ModLoaderBlockRendererHandler(int renderId, boolean render3dInInventory, BaseMod mod)
|
|
||||||
{
|
|
||||||
this.renderId=renderId;
|
|
||||||
this.render3dInInventory=render3dInInventory;
|
|
||||||
this.mod=mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderId()
|
|
||||||
{
|
|
||||||
return renderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldRender3DInInventory()
|
|
||||||
{
|
|
||||||
return render3dInInventory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param block
|
|
||||||
* @param modelId
|
|
||||||
* @param renderer
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
|
||||||
{
|
|
||||||
return mod.renderWorldBlock(renderer, world, x, y, z, block, modelId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param block
|
|
||||||
* @param metadata
|
|
||||||
* @param modelID
|
|
||||||
* @param renderer
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
|
||||||
{
|
|
||||||
mod.renderInvBlock(renderer, block, metadata, modelID);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
package cpw.mods.fml.client.modloader;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.src.BaseMod;
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityClientPlayerMP;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.KeyBinding;
|
|
||||||
import net.minecraft.src.NetClientHandler;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import net.minecraft.src.Render;
|
|
||||||
import net.minecraft.src.RenderManager;
|
|
||||||
|
|
||||||
import com.google.common.base.Equivalences;
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.common.base.Suppliers;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Iterators;
|
|
||||||
import com.google.common.collect.MapDifference;
|
|
||||||
import com.google.common.collect.MapDifference.ValueDifference;
|
|
||||||
import com.google.common.collect.MapMaker;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Multimap;
|
|
||||||
import com.google.common.collect.Multimaps;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.modloader.BaseModProxy;
|
|
||||||
import cpw.mods.fml.common.modloader.IModLoaderSidedHelper;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|
||||||
|
|
||||||
public class ModLoaderClientHelper implements IModLoaderSidedHelper
|
|
||||||
{
|
|
||||||
public static int obtainBlockModelIdFor(BaseMod mod, boolean inventoryRenderer)
|
|
||||||
{
|
|
||||||
int renderId=RenderingRegistry.getNextAvailableRenderId();
|
|
||||||
ModLoaderBlockRendererHandler bri=new ModLoaderBlockRendererHandler(renderId, inventoryRenderer, mod);
|
|
||||||
RenderingRegistry.registerBlockHandler(bri);
|
|
||||||
return renderId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void handleFinishLoadingFor(ModLoaderModContainer mc, Minecraft game)
|
|
||||||
{
|
|
||||||
FMLLog.finer("Handling post startup activities for ModLoader mod %s", mc.getModId());
|
|
||||||
BaseMod mod = (BaseMod) mc.getMod();
|
|
||||||
|
|
||||||
Map<Class<? extends Entity>, Render> renderers = Maps.newHashMap(RenderManager.field_78727_a.field_78729_o);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FMLLog.finest("Requesting renderers from basemod %s", mc.getModId());
|
|
||||||
mod.addRenderer(renderers);
|
|
||||||
FMLLog.finest("Received %d renderers from basemod %s", renderers.size(), mc.getModId());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the addRenderer call. Continuing, but expect odd results", mc.getModId());
|
|
||||||
}
|
|
||||||
|
|
||||||
MapDifference<Class<? extends Entity>, Render> difference = Maps.difference(RenderManager.field_78727_a.field_78729_o, renderers, Equivalences.identity());
|
|
||||||
|
|
||||||
for ( Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnLeft().entrySet())
|
|
||||||
{
|
|
||||||
FMLLog.warning("The mod %s attempted to remove an entity renderer %s from the entity map. This will be ignored.", mc.getModId(), e.getKey().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<Class<? extends Entity>, Render> e : difference.entriesOnlyOnRight().entrySet())
|
|
||||||
{
|
|
||||||
FMLLog.finest("Registering ModLoader entity renderer %s as instance of %s", e.getKey().getName(), e.getValue().getClass().getName());
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<Class<? extends Entity>, ValueDifference<Render>> e : difference.entriesDiffering().entrySet())
|
|
||||||
{
|
|
||||||
FMLLog.finest("Registering ModLoader entity rendering override for %s as instance of %s", e.getKey().getName(), e.getValue().rightValue().getClass().getName());
|
|
||||||
RenderingRegistry.registerEntityRenderingHandler(e.getKey(), e.getValue().rightValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mod.registerAnimation(game);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "A severe problem was detected with the mod %s during the registerAnimation call. Continuing, but expect odd results", mc.getModId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModLoaderClientHelper(Minecraft client)
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
ModLoaderHelper.sidedHelper = this;
|
|
||||||
keyBindingContainers = Multimaps.newMultimap(Maps.<ModLoaderModContainer, Collection<ModLoaderKeyBindingHandler>>newHashMap(), new Supplier<Collection<ModLoaderKeyBindingHandler>>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Collection<ModLoaderKeyBindingHandler> get()
|
|
||||||
{
|
|
||||||
return Collections.singleton(new ModLoaderKeyBindingHandler());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private Minecraft client;
|
|
||||||
private static Multimap<ModLoaderModContainer, ModLoaderKeyBindingHandler> keyBindingContainers;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void finishModLoading(ModLoaderModContainer mc)
|
|
||||||
{
|
|
||||||
handleFinishLoadingFor(mc, client);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void registerKeyBinding(BaseModProxy mod, KeyBinding keyHandler, boolean allowRepeat)
|
|
||||||
{
|
|
||||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
|
||||||
ModLoaderKeyBindingHandler handler = Iterables.getOnlyElement(keyBindingContainers.get(mlmc));
|
|
||||||
handler.setModContainer(mlmc);
|
|
||||||
handler.addKeyBinding(keyHandler, allowRepeat);
|
|
||||||
KeyBindingRegistry.registerKeyBinding(handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getClientGui(BaseModProxy mod, EntityPlayer player, int ID, int x, int y, int z)
|
|
||||||
{
|
|
||||||
return ((net.minecraft.src.BaseMod)mod).getContainerGUI((EntityClientPlayerMP) player, ID, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration er)
|
|
||||||
{
|
|
||||||
return ((net.minecraft.src.BaseMod)mod).spawnEntity(er.getModEntityId(), client.field_71441_e, input.scaledX, input.scaledY, input.scaledZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
((net.minecraft.src.BaseMod)mod).clientCustomPayload(client.field_71439_g.field_71174_a, packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<INetworkManager,NetHandler> managerLookups = new MapMaker().weakKeys().weakValues().makeMap();
|
|
||||||
@Override
|
|
||||||
public void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod)
|
|
||||||
{
|
|
||||||
managerLookups.put(manager, netClientHandler);
|
|
||||||
((BaseMod)mod).clientConnect((NetClientHandler)netClientHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod)
|
|
||||||
{
|
|
||||||
if (managerLookups.containsKey(manager))
|
|
||||||
{
|
|
||||||
((BaseMod)mod).clientDisconnect((NetClientHandler) managerLookups.get(manager));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.client.modloader;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
|
||||||
|
|
||||||
import com.google.common.collect.ObjectArrays;
|
|
||||||
import com.google.common.primitives.Booleans;
|
|
||||||
|
|
||||||
import net.minecraft.src.KeyBinding;
|
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ModLoaderKeyBindingHandler extends KeyBindingRegistry.KeyHandler
|
|
||||||
{
|
|
||||||
private ModLoaderModContainer modContainer;
|
|
||||||
private List<KeyBinding> helper;
|
|
||||||
private boolean[] active = new boolean[0];
|
|
||||||
private boolean[] mlRepeats = new boolean[0];
|
|
||||||
private boolean[] armed = new boolean[0];
|
|
||||||
|
|
||||||
public ModLoaderKeyBindingHandler()
|
|
||||||
{
|
|
||||||
super(new KeyBinding[0], new boolean[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setModContainer(ModLoaderModContainer modContainer)
|
|
||||||
{
|
|
||||||
this.modContainer = modContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fireKeyEvent(KeyBinding kb)
|
|
||||||
{
|
|
||||||
((net.minecraft.src.BaseMod)modContainer.getMod()).keyboardEvent(kb);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyDown(EnumSet<TickType> type, KeyBinding kb, boolean end, boolean repeats)
|
|
||||||
{
|
|
||||||
if (!end)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int idx = helper.indexOf(kb);
|
|
||||||
if (type.contains(TickType.CLIENT))
|
|
||||||
{
|
|
||||||
armed[idx] = true;
|
|
||||||
}
|
|
||||||
if (armed[idx] && type.contains(TickType.RENDER) && (!active[idx] || mlRepeats[idx]))
|
|
||||||
{
|
|
||||||
fireKeyEvent(kb);
|
|
||||||
active[idx] = true;
|
|
||||||
armed[idx] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void keyUp(EnumSet<TickType> type, KeyBinding kb, boolean end)
|
|
||||||
{
|
|
||||||
if (!end)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int idx = helper.indexOf(kb);
|
|
||||||
active[idx] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<TickType> ticks()
|
|
||||||
{
|
|
||||||
return EnumSet.of(TickType.CLIENT, TickType.RENDER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return modContainer.getModId() +" KB "+keyBindings[0].field_74512_d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void addKeyBinding(KeyBinding binding, boolean repeats)
|
|
||||||
{
|
|
||||||
this.keyBindings = ObjectArrays.concat(this.keyBindings, binding);
|
|
||||||
this.repeatings = new boolean[this.keyBindings.length];
|
|
||||||
Arrays.fill(this.repeatings, true);
|
|
||||||
this.active = new boolean[this.keyBindings.length];
|
|
||||||
this.armed = new boolean[this.keyBindings.length];
|
|
||||||
this.mlRepeats = Booleans.concat(this.mlRepeats, new boolean[] { repeats });
|
|
||||||
this.keyDown = new boolean[this.keyBindings.length];
|
|
||||||
this.helper = Arrays.asList(this.keyBindings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package cpw.mods.fml.client.registry;
|
|
||||||
|
|
||||||
import net.minecraft.src.TileEntity;
|
|
||||||
import net.minecraft.src.TileEntityRenderer;
|
|
||||||
import net.minecraft.src.TileEntitySpecialRenderer;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
public class ClientRegistry
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Utility method for registering a tile entity and it's renderer at once - generally you should register them separately
|
|
||||||
*
|
|
||||||
* @param tileEntityClass
|
|
||||||
* @param id
|
|
||||||
* @param specialRenderer
|
|
||||||
*/
|
|
||||||
public static void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer)
|
|
||||||
{
|
|
||||||
GameRegistry.registerTileEntity(tileEntityClass, id);
|
|
||||||
bindTileEntitySpecialRenderer(tileEntityClass, specialRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void bindTileEntitySpecialRenderer(Class <? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer specialRenderer)
|
|
||||||
{
|
|
||||||
TileEntityRenderer.field_76963_a.field_76966_m.put(tileEntityClass, specialRenderer);
|
|
||||||
specialRenderer.func_76893_a(TileEntityRenderer.field_76963_a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package cpw.mods.fml.client.registry;
|
|
||||||
|
|
||||||
import net.minecraft.src.Block;
|
|
||||||
import net.minecraft.src.IBlockAccess;
|
|
||||||
import net.minecraft.src.RenderBlocks;
|
|
||||||
|
|
||||||
public interface ISimpleBlockRenderingHandler
|
|
||||||
{
|
|
||||||
public abstract void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer);
|
|
||||||
|
|
||||||
public abstract boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer);
|
|
||||||
|
|
||||||
public abstract boolean shouldRender3DInInventory();
|
|
||||||
|
|
||||||
public abstract int getRenderId();
|
|
||||||
}
|
|
||||||
@@ -1,444 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import static cpw.mods.fml.common.Side.CLIENT;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
|
|
||||||
public abstract class BaseMod implements cpw.mods.fml.common.modloader.BaseModProxy
|
|
||||||
{
|
|
||||||
// CALLBACK MECHANISMS
|
|
||||||
|
|
||||||
public final boolean doTickInGame(TickType tick, boolean tickEnd, Object... data)
|
|
||||||
{
|
|
||||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
|
||||||
boolean hasWorld = mc.field_71441_e != null;
|
|
||||||
// World and render ticks
|
|
||||||
if (tickEnd && ( tick==TickType.RENDER || tick==TickType.CLIENT ) && hasWorld) {
|
|
||||||
return onTickInGame((Float) data[0], mc);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data)
|
|
||||||
{
|
|
||||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
|
||||||
|
|
||||||
boolean hasWorld = mc.field_71441_e != null;
|
|
||||||
|
|
||||||
if (tickEnd && ( tick==TickType.RENDER || ( tick==TickType.CLIENT && hasWorld))) {
|
|
||||||
return onTickInGUI((Float) data[0], mc, mc.field_71462_r);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public final void onRenderHarvest(Map renderers)
|
|
||||||
{
|
|
||||||
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void onRegisterAnimations()
|
|
||||||
{
|
|
||||||
registerAnimation(FMLClientHandler.instance().getClient());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onCrafting(Object... craftingParameters)
|
|
||||||
{
|
|
||||||
takenFromCrafting((EntityPlayer)craftingParameters[0], (ItemStack)craftingParameters[1], (IInventory)craftingParameters[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onSmelting(Object... smeltingParameters)
|
|
||||||
{
|
|
||||||
takenFromFurnace((EntityPlayer)smeltingParameters[0], (ItemStack)smeltingParameters[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean dispense(double x, double y, double z, int xVelocity, int zVelocity, Object... data)
|
|
||||||
{
|
|
||||||
return dispenseEntity((World)data[0], x, y, z, xVelocity, zVelocity, (ItemStack)data[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean onChat(Object... data)
|
|
||||||
{
|
|
||||||
receiveChatPacket(((Packet3Chat)data[0]).field_73476_b);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onServerLogin(Object handler) {
|
|
||||||
serverConnect((NetClientHandler) handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void onServerLogout() {
|
|
||||||
serverDisconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayerLogin(Object player)
|
|
||||||
{
|
|
||||||
onClientLogin((EntityPlayer) player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayerLogout(Object player)
|
|
||||||
{
|
|
||||||
onClientLogout((EntityPlayer)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPlayerChangedDimension(Object player)
|
|
||||||
{
|
|
||||||
onClientDimensionChanged((EntityPlayer)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void onPacket250Packet(Object... data)
|
|
||||||
{
|
|
||||||
receiveCustomPacket((Packet250CustomPayload)data[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void notifyPickup(Object... pickupData)
|
|
||||||
{
|
|
||||||
EntityItem item = (EntityItem) pickupData[0];
|
|
||||||
EntityPlayer player = (EntityPlayer) pickupData[1];
|
|
||||||
onItemPickup(player, item.field_70294_a);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void generate(Random random, int chunkX, int chunkZ, Object... additionalData)
|
|
||||||
{
|
|
||||||
World w = (World) additionalData[0];
|
|
||||||
IChunkProvider cp = (IChunkProvider) additionalData[1];
|
|
||||||
|
|
||||||
if (cp instanceof ChunkProviderGenerate)
|
|
||||||
{
|
|
||||||
generateSurface(w, random, chunkX << 4, chunkZ << 4);
|
|
||||||
}
|
|
||||||
else if (cp instanceof ChunkProviderHell)
|
|
||||||
{
|
|
||||||
generateNether(w, random, chunkX << 4, chunkZ << 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean handleCommand(String command, Object... data)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
// BASEMOD API
|
|
||||||
/**
|
|
||||||
* Override if you wish to provide a fuel item for the furnace and return the fuel value of the item
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param metadata
|
|
||||||
*/
|
|
||||||
public int addFuel(int id, int metadata)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void addRenderer(Map<Class<? extends Entity>, Render> renderers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to perform some action other than just dispensing the item from the dispenser
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVel
|
|
||||||
* @param zVel
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX, double entY, double entZ)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to generate Nether (Hell biome) blocks
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param random
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
*/
|
|
||||||
public void generateNether(World world, Random random, int chunkX, int chunkZ)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override if you wish to generate Overworld (not hell or the end) blocks
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param random
|
|
||||||
* @param chunkX
|
|
||||||
* @param chunkZ
|
|
||||||
*/
|
|
||||||
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback to return a gui screen to display
|
|
||||||
* @param player
|
|
||||||
* @param containerID
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public GuiContainer getContainerGUI(EntityClientPlayerMP player, int containerID, int x, int y, int z)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name of your mod. Defaults to the class name
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get your mod priorities
|
|
||||||
*/
|
|
||||||
public String getPriorities()
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the version of your mod
|
|
||||||
*/
|
|
||||||
public abstract String getVersion();
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void keyboardEvent(KeyBinding event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load your mod
|
|
||||||
*/
|
|
||||||
public abstract void load();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Finish loading your mod
|
|
||||||
*/
|
|
||||||
public void modsLoaded()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle item pickup
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
public void onItemPickup(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ticked every game tick if you have subscribed to tick events through {@link ModLoader#setInGameHook(BaseMod, boolean, boolean)}
|
|
||||||
*
|
|
||||||
* @param time the rendering subtick time (0.0-1.0)
|
|
||||||
* @param minecraftInstance the client
|
|
||||||
* @return true to continue receiving ticks
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public boolean onTickInGame(float time, Minecraft minecraftInstance)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTickInGame(MinecraftServer minecraftServer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Only implemented on the client side
|
|
||||||
* {@link #serverChat(EntityPlayer, Packet3Chat)}
|
|
||||||
*
|
|
||||||
* @param text
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void clientChat(String text)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a client connects
|
|
||||||
* @param handler
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void clientConnect(NetClientHandler handler)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when the client disconnects
|
|
||||||
* @param handler
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void clientDisconnect(NetClientHandler handler)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Called client side to receive a custom payload for this mod
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void receiveCustomPacket(Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void registerAnimation(Minecraft game)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serverConnect(NetHandler handler) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serverDisconnect() {
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Called when someone crafts an item from a crafting table
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
* @param matrix
|
|
||||||
*/
|
|
||||||
public void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when someone takes a smelted item from a furnace
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
public void takenFromFurnace(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The identifier string for the mod- used in client<->server negotiation
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getName() + " " + getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a chat message is received. Return true to stop further processing
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void serverChat(NetServerHandler source, String message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Called when a new client logs in.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onClientLogin(EntityPlayer player)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a client logs out of the server.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void onClientLogout(INetworkManager mgr)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spawn the entity of the supplied type, if it is your mod's
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public Entity spawnEntity(int entityId, World world, double scaledX, double scaledY, double scaledZ)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clientCustomPayload(NetClientHandler handler, Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
public class EntityRendererProxy extends EntityRenderer
|
|
||||||
{
|
|
||||||
public static final String fmlMarker = "This is an FML marker";
|
|
||||||
private Minecraft game;
|
|
||||||
|
|
||||||
public EntityRendererProxy(Minecraft minecraft)
|
|
||||||
{
|
|
||||||
super(minecraft);
|
|
||||||
game = minecraft;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_78480_b(float tick)
|
|
||||||
{
|
|
||||||
super.func_78480_b(tick);
|
|
||||||
//This is where ModLoader does all of it's ticking
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* A static hook library for optifine and other basemod editing code to access FML functions
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class FMLRenderAccessLibrary
|
|
||||||
{
|
|
||||||
public static Logger getLogger()
|
|
||||||
{
|
|
||||||
return FMLLog.getLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void log(Level level, String message)
|
|
||||||
{
|
|
||||||
FMLLog.log(level, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void log(Level level, String message, Throwable throwable)
|
|
||||||
{
|
|
||||||
FMLLog.log(level, throwable, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setTextureDimensions(int textureId, int width, int height, List<TextureFX> textureFXList)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().setTextureDimensions(textureId, width, height, textureFXList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void preRegisterEffect(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().onPreRegisterEffect(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean onUpdateTextureEffect(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
return TextureFXManager.instance().onUpdateTextureEffect(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Dimension getTextureDimensions(TextureFX textureFX)
|
|
||||||
{
|
|
||||||
return TextureFXManager.instance().getTextureDimensions(textureFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void onTexturePackChange(RenderEngine engine, ITexturePack texturePack, List<TextureFX> textureFXList)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().onTexturePackChange(engine, texturePack, textureFXList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
|
||||||
{
|
|
||||||
RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static boolean renderItemAsFull3DBlock(int modelId)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import static java.lang.annotation.ElementType.FIELD;
|
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(value = RUNTIME)
|
|
||||||
@Target(value = FIELD)
|
|
||||||
public @interface MLProp
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Adds additional help to top of configuration file.
|
|
||||||
*/
|
|
||||||
String info() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum value allowed if field is a number.
|
|
||||||
*/
|
|
||||||
double max() default Double.MAX_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimum value allowed if field is a number.
|
|
||||||
*/
|
|
||||||
double min() default Double.MIN_VALUE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides the field name for property key.
|
|
||||||
*/
|
|
||||||
String name() default "";
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,883 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import static cpw.mods.fml.common.Side.CLIENT;
|
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.SpriteHelper;
|
|
||||||
import cpw.mods.fml.client.TextureFXManager;
|
|
||||||
import cpw.mods.fml.client.modloader.ModLoaderClientHelper;
|
|
||||||
import cpw.mods.fml.client.modloader.ModLoaderKeyBindingHandler;
|
|
||||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
||||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.ObfuscationReflectionHelper;
|
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderHelper;
|
|
||||||
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
||||||
import cpw.mods.fml.server.FMLServerHandler;
|
|
||||||
|
|
||||||
public class ModLoader
|
|
||||||
{
|
|
||||||
public static final String fmlMarker = "This is an FML marker";
|
|
||||||
// TODO dirty workaround for millinaire
|
|
||||||
@Deprecated
|
|
||||||
public static final Map<String,Map<String,String>> localizedStrings=Collections.emptyMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds localization info for an achievement, Not used on the server.
|
|
||||||
*
|
|
||||||
* @param achievement The achievement to name
|
|
||||||
* @param name The name
|
|
||||||
* @param description The description
|
|
||||||
*/
|
|
||||||
public static void addAchievementDesc(Achievement achievement, String name, String description)
|
|
||||||
{
|
|
||||||
String achName=achievement.func_75970_i();
|
|
||||||
addLocalization(achName, name);
|
|
||||||
addLocalization(achName+".desc", description);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
*
|
|
||||||
* {@link GameRegistry#getFuelValue(ItemStack))}
|
|
||||||
*
|
|
||||||
* @param id The Item ID
|
|
||||||
* @param metadata The Item Metadata
|
|
||||||
* @return The fuel strength, in ticks, 0 if unhandled
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static int addAllFuel(int id, int metadata)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void addAllRenderers(Map<Class<? extends Entity>, Render> renderers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void addAnimation(TextureFX anim)
|
|
||||||
{
|
|
||||||
TextureFXManager.instance().addAnimation(anim);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new prefix to the armor texture list
|
|
||||||
*
|
|
||||||
* {@link RenderingRegistry#addNewArmourRendererPrefix(String))}
|
|
||||||
*
|
|
||||||
* @param armor The new armor prefix
|
|
||||||
* @return The new armor index
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static int addArmor(String armor)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.addNewArmourRendererPrefix(armor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method adds the supplied biome to the set of candidate biomes for the default world generator type.
|
|
||||||
*
|
|
||||||
* @param biome The biome to add
|
|
||||||
*/
|
|
||||||
public static void addBiome(BiomeGenBase biome)
|
|
||||||
{
|
|
||||||
GameRegistry.addBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addEntityTracker(BaseMod mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval, boolean sendVelocityInfo)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.buildEntityTracker(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addCommand(ICommand command)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.addCommand(command);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Add localization for the specified string
|
|
||||||
*
|
|
||||||
* @param key Key
|
|
||||||
* @param value Value
|
|
||||||
*/
|
|
||||||
public static void addLocalization(String key, String value)
|
|
||||||
{
|
|
||||||
addLocalization(key, "en_US", value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add localization for the specified string
|
|
||||||
*
|
|
||||||
* @param key Key
|
|
||||||
* @param lang Language identifier
|
|
||||||
* @param value Value
|
|
||||||
*/
|
|
||||||
public static void addLocalization(String key, String lang, String value)
|
|
||||||
{
|
|
||||||
LanguageRegistry.instance().addStringLocalization(key, lang, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name the specified minecraft object with the supplied name
|
|
||||||
*
|
|
||||||
* @param instance Item to name
|
|
||||||
* @param name The name to give it
|
|
||||||
*/
|
|
||||||
public static void addName(Object instance, String name)
|
|
||||||
{
|
|
||||||
addName(instance,"en_US",name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unimplemented on the server as it does not generate names
|
|
||||||
*
|
|
||||||
* @param instance Item to name
|
|
||||||
* @param lang Languge identifier
|
|
||||||
* @param name Name to give it
|
|
||||||
*/
|
|
||||||
public static void addName(Object instance, String lang, String name)
|
|
||||||
{
|
|
||||||
LanguageRegistry.instance().addNameForObject(instance, lang, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to register a small image to be applied to a larger texture image,
|
|
||||||
* typically how old ModLoader mods add custom Item/Block textures.
|
|
||||||
*
|
|
||||||
* Forge mods should use setTextureFile in Item/Block
|
|
||||||
*
|
|
||||||
* Will return the icon index it was applied to.
|
|
||||||
*
|
|
||||||
* Unimplemented on the server as it does not render textures
|
|
||||||
*
|
|
||||||
* @param fileToOverride The texture to apply the new image to
|
|
||||||
* @param fileToAdd The new image
|
|
||||||
* @return The 'icon index' in the main image that the new image will be applied to
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static int addOverride(String fileToOverride, String fileToAdd)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.addTextureOverride(fileToOverride, fileToAdd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to register a small image to be applied to a larger texture image,
|
|
||||||
* typically how old ModLoader mods add custom Item/Block textures.
|
|
||||||
*
|
|
||||||
* Forge mods should use setTextureFile in Item/Block
|
|
||||||
*
|
|
||||||
* Unimplemented on the server as it does not render textures
|
|
||||||
*
|
|
||||||
* @param path The texture to apply the new image to
|
|
||||||
* @param overlayPath The new image
|
|
||||||
* @param index Where on the texture to apply it
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void addOverride(String path, String overlayPath, int index)
|
|
||||||
{
|
|
||||||
RenderingRegistry.addTextureOverride(path, overlayPath, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a Shaped Recipe
|
|
||||||
*
|
|
||||||
* @param output The result
|
|
||||||
* @param params The input
|
|
||||||
*/
|
|
||||||
public static void addRecipe(ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
GameRegistry.addRecipe(output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a shapeless recipe
|
|
||||||
*
|
|
||||||
* @param output The result
|
|
||||||
* @param params The input
|
|
||||||
*/
|
|
||||||
public static void addShapelessRecipe(ItemStack output, Object... params)
|
|
||||||
{
|
|
||||||
GameRegistry.addShapelessRecipe(output, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new product to be smelted
|
|
||||||
*
|
|
||||||
* @param input
|
|
||||||
* @param output
|
|
||||||
*/
|
|
||||||
public static void addSmelting(int input, ItemStack output)
|
|
||||||
{
|
|
||||||
GameRegistry.addSmelting(input, output, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new product to be smelted
|
|
||||||
*
|
|
||||||
* @param input
|
|
||||||
* @param output
|
|
||||||
*/
|
|
||||||
public static void addSmelting(int input, ItemStack output, float experience)
|
|
||||||
{
|
|
||||||
GameRegistry.addSmelting(input, output, experience);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void addSpawn(Class<? extends EntityLiving> entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
EntityRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, WorldType.base12Biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a mob to the spawn list
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param weightedProb
|
|
||||||
* @param min
|
|
||||||
* @param max
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
EntityRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addTrade(int profession, TradeEntry entry)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.registerTrade(profession, entry);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Send a packet from the client
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
public static void clientSendPacket(Packet packet)
|
|
||||||
{
|
|
||||||
PacketDispatcher.sendPacketToServer(packet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVel
|
|
||||||
* @param zVel
|
|
||||||
* @param item
|
|
||||||
* @return Always false, not implemented here
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static boolean dispenseEntity(World world, double x, double y, double z, int xVel, int zVel, ItemStack item)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a container and drop all the items in it on the ground around
|
|
||||||
*
|
|
||||||
* @param world
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
*/
|
|
||||||
public static void genericContainerRemoval(World world, int x, int y, int z)
|
|
||||||
{
|
|
||||||
/* TileEntity te = world.func_603_b(x, y, z);
|
|
||||||
|
|
||||||
if (!(te instanceof IInventory))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IInventory inv = (IInventory)te;
|
|
||||||
|
|
||||||
for (int l = 0; l < inv.func_469_c(); l++)
|
|
||||||
{
|
|
||||||
ItemStack itemstack = inv.func_468_c(l);
|
|
||||||
|
|
||||||
if (itemstack == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
float f = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float f1 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float f2 = world.field_1037_n.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
while (itemstack.field_1615_a > 0)
|
|
||||||
{
|
|
||||||
int i1 = world.field_1037_n.nextInt(21) + 10;
|
|
||||||
|
|
||||||
if (i1 > itemstack.field_1615_a)
|
|
||||||
{
|
|
||||||
i1 = itemstack.field_1615_a;
|
|
||||||
}
|
|
||||||
|
|
||||||
itemstack.field_1615_a -= i1;
|
|
||||||
EntityItem entityitem = new EntityItem(world, (float)te.field_823_f + f, (float)te.field_822_g + f1, (float)te.field_821_h + f2, new ItemStack(itemstack.field_1617_c, i1, itemstack.func_21181_i()));
|
|
||||||
float f3 = 0.05F;
|
|
||||||
entityitem.field_608_an = (float) world.field_1037_n.nextGaussian() * f3;
|
|
||||||
entityitem.field_607_ao = (float) world.field_1037_n.nextGaussian() * f3 + 0.2F;
|
|
||||||
entityitem.field_606_ap = (float) world.field_1037_n.nextGaussian() * f3;
|
|
||||||
|
|
||||||
if (itemstack.func_40710_n())
|
|
||||||
{
|
|
||||||
entityitem.field_801_a.func_40706_d((NBTTagCompound) itemstack.func_40709_o().func_40195_b());
|
|
||||||
}
|
|
||||||
|
|
||||||
world.func_674_a(entityitem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/ }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of all BaseMod loaded into the system
|
|
||||||
* {@link ModLoaderModContainer#findAll}
|
|
||||||
*
|
|
||||||
* @return A list containing all loaded ModLoader mods
|
|
||||||
*/
|
|
||||||
public static List<BaseMod> getLoadedMods()
|
|
||||||
{
|
|
||||||
return ModLoaderModContainer.findAll(BaseMod.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a logger instance {@link FMLCommonHandler#getFMLLogger()}
|
|
||||||
*
|
|
||||||
* @return The current logger
|
|
||||||
*/
|
|
||||||
public static Logger getLogger()
|
|
||||||
{
|
|
||||||
return FMLLog.getLogger();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static Minecraft getMinecraftInstance()
|
|
||||||
{
|
|
||||||
return FMLClientHandler.instance().getClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MinecraftServer getMinecraftServerInstance()
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().getMinecraftServerInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a value from a field using reflection
|
|
||||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, int)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param fieldindex
|
|
||||||
* @return The value in the specified field.
|
|
||||||
*/
|
|
||||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, int fieldindex)
|
|
||||||
{
|
|
||||||
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, fieldindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a value from a field using reflection
|
|
||||||
* {@link ObfuscationReflectionHelper#getPrivateValue(Class, Object, String[])}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param field
|
|
||||||
* @return The value in the specified field.
|
|
||||||
*/
|
|
||||||
public static <T, E> T getPrivateValue(Class<? super E> instanceclass, E instance, String field)
|
|
||||||
{
|
|
||||||
return ObfuscationReflectionHelper.getPrivateValue(instanceclass, instance, field);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stubbed method on the server to return a unique model id
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static int getUniqueBlockModelID(BaseMod mod, boolean inventoryRenderer)
|
|
||||||
{
|
|
||||||
return ModLoaderClientHelper.obtainBlockModelIdFor(mod, inventoryRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a new unique entity id
|
|
||||||
* {@link EntityRegistry#findGlobalUniqueEntityId()}
|
|
||||||
*
|
|
||||||
* @return A unique entity ID
|
|
||||||
*/
|
|
||||||
public static int getUniqueEntityId()
|
|
||||||
{
|
|
||||||
return EntityRegistry.findGlobalUniqueEntityId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static int getUniqueSpriteIndex(String path)
|
|
||||||
{
|
|
||||||
return SpriteHelper.getUniqueSpriteIndex(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To properly implement packet 250 protocol you should always check your
|
|
||||||
* channel is active prior to sending the packet
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param channel
|
|
||||||
* @return If the channel is registered to the current connection.
|
|
||||||
*/
|
|
||||||
public static boolean isChannelActive(EntityPlayer player, String channel)
|
|
||||||
{
|
|
||||||
return NetworkRegistry.instance().isChannelActive(channel, (Player)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static boolean isGUIOpen(Class<? extends GuiScreen> gui)
|
|
||||||
{
|
|
||||||
return FMLClientHandler.instance().getClient().field_71462_r != null && FMLClientHandler.instance().getClient().field_71462_r.equals(gui);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the named mod loaded?
|
|
||||||
* {@link Loader#isModLoaded(String)}
|
|
||||||
*
|
|
||||||
* @param modname
|
|
||||||
* @return If the specified mod is loaded
|
|
||||||
*/
|
|
||||||
public static boolean isModLoaded(String modname)
|
|
||||||
{
|
|
||||||
return Loader.isModLoaded(modname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implemented elsewhere
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void loadConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static BufferedImage loadImage(RenderEngine renderEngine, String path) throws Exception
|
|
||||||
{
|
|
||||||
return TextureFXManager.instance().loadImageFromTexturePack(renderEngine, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Call in from elsewhere. Unimplemented here.
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void onItemPickup(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Call in from elsewhere. Unimplemented here.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void onTick(float tick, Minecraft game)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void openGUI(EntityPlayer player, GuiScreen gui)
|
|
||||||
{
|
|
||||||
FMLClientHandler.instance().displayGuiScreen(player, gui);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static void populateChunk(IChunkProvider generator, int chunkX, int chunkZ, World world)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
* {@link FMLNetworkHandler#handlePacket250(Packet250CustomPayload, NetworkManager, NetHandler)}
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void receivePacket(Packet250CustomPayload packet)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static KeyBinding[] registerAllKeys(KeyBinding[] keys)
|
|
||||||
{
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void registerAllTextureOverrides(RenderEngine cache)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new block
|
|
||||||
*
|
|
||||||
* @param block
|
|
||||||
*/
|
|
||||||
public static void registerBlock(Block block)
|
|
||||||
{
|
|
||||||
GameRegistry.registerBlock(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new block
|
|
||||||
*
|
|
||||||
* @param block
|
|
||||||
* @param itemclass
|
|
||||||
*/
|
|
||||||
public static void registerBlock(Block block, Class<? extends ItemBlock> itemclass)
|
|
||||||
{
|
|
||||||
GameRegistry.registerBlock(block, itemclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerContainerID(BaseMod mod, int id)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.buildGuiHelper(mod, id);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Register a new entity ID
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param entityName
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
|
|
||||||
{
|
|
||||||
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new entity ID
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param entityName
|
|
||||||
* @param id
|
|
||||||
* @param background
|
|
||||||
* @param foreground
|
|
||||||
*/
|
|
||||||
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
|
|
||||||
{
|
|
||||||
EntityRegistry.registerGlobalEntityID(entityClass, entityName, id, background, foreground);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void registerKey(BaseMod mod, KeyBinding keyHandler, boolean allowRepeat)
|
|
||||||
{
|
|
||||||
ModLoaderClientHelper.registerKeyBinding(mod, keyHandler, allowRepeat);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the mod for packets on this channel.
|
|
||||||
* {@link NetworkRegistry#registerChannel(IPacketHandler, String)}
|
|
||||||
*
|
|
||||||
* @param mod
|
|
||||||
* @param channel
|
|
||||||
*/
|
|
||||||
public static void registerPacketChannel(BaseMod mod, String channel)
|
|
||||||
{
|
|
||||||
NetworkRegistry.instance().registerChannel(ModLoaderHelper.buildPacketHandlerFor(mod), channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a new tile entity class
|
|
||||||
*
|
|
||||||
* @param tileEntityClass
|
|
||||||
* @param id
|
|
||||||
*/
|
|
||||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
|
|
||||||
{
|
|
||||||
GameRegistry.registerTileEntity(tileEntityClass, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id, TileEntitySpecialRenderer renderer)
|
|
||||||
{
|
|
||||||
ClientRegistry.registerTileEntity(tileEntityClass, id, renderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a biome from the list of generated biomes
|
|
||||||
*
|
|
||||||
* @param biome
|
|
||||||
*/
|
|
||||||
public static void removeBiome(BiomeGenBase biome)
|
|
||||||
{
|
|
||||||
GameRegistry.removeBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
EntityRegistry.removeSpawn(entityClass, spawnList, WorldType.base12Biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityClass
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(Class<? extends EntityLiving> entityClass, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
EntityRegistry.removeSpawn(entityClass, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param spawnList
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList)
|
|
||||||
{
|
|
||||||
EntityRegistry.removeSpawn(entityName, spawnList, WorldType.base12Biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a spawn
|
|
||||||
*
|
|
||||||
* @param entityName
|
|
||||||
* @param spawnList
|
|
||||||
* @param biomes
|
|
||||||
*/
|
|
||||||
public static void removeSpawn(String entityName, EnumCreatureType spawnList, BiomeGenBase... biomes)
|
|
||||||
{
|
|
||||||
EntityRegistry.removeSpawn(entityName, spawnList, biomes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static boolean renderBlockIsItemFull3D(int modelID)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.instance().renderItemAsFull3DBlock(modelID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void renderInvBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
|
|
||||||
{
|
|
||||||
RenderingRegistry.instance().renderInventoryBlock(renderer, block, metadata, modelID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelID)
|
|
||||||
{
|
|
||||||
return RenderingRegistry.instance().renderWorldBlock(renderer, world, x, y, z, block, modelID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration is handled elsewhere
|
|
||||||
* {@link ModLoaderModContainer}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void saveConfig()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a packet from client to server
|
|
||||||
*
|
|
||||||
* @param packet
|
|
||||||
*/
|
|
||||||
public static void sendPacket(Packet packet) {
|
|
||||||
PacketDispatcher.sendPacketToServer(packet);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Send a chat message to the server
|
|
||||||
* {@link FMLNetworkHandler#handleChatMessage(NetHandler, Packet3Chat)}
|
|
||||||
*
|
|
||||||
* @param text
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void serverChat(String text)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@SideOnly(CLIENT)
|
|
||||||
public static void serverLogin(NetClientHandler handler, Packet1Login loginPacket)
|
|
||||||
{
|
|
||||||
//TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void serverSendPacket(NetServerHandler handler, Packet packet)
|
|
||||||
{
|
|
||||||
if (handler != null)
|
|
||||||
{
|
|
||||||
PacketDispatcher.sendPacketToPlayer(packet, (Player)handler.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void serverOpenWindow(EntityPlayerMP player, Container container, int ID, int x, int y, int z)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.openGui(ID, player, container, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicate that you want to receive ticks
|
|
||||||
*
|
|
||||||
* @param mod receiving the events
|
|
||||||
* @param enable indicates whether you want to recieve them or not
|
|
||||||
* @param useClock don't receive render subticks, just world ticks
|
|
||||||
*/
|
|
||||||
public static void setInGameHook(BaseMod mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.updateStandardTicks(mod, enable, useClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void setInGUIHook(BaseMod mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.updateGUITicks(mod, enable, useClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a private field to a value using reflection
|
|
||||||
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, int, Object)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param fieldindex
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, int fieldindex, E value)
|
|
||||||
{
|
|
||||||
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, fieldindex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a private field to a value using reflection
|
|
||||||
* {@link ObfuscationReflectionHelper#setPrivateValue(Class, Object, String, Object)}
|
|
||||||
*
|
|
||||||
* @param instanceclass
|
|
||||||
* @param instance
|
|
||||||
* @param field
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public static <T, E> void setPrivateValue(Class<? super T> instanceclass, T instance, String field, E value)
|
|
||||||
{
|
|
||||||
ObfuscationReflectionHelper.setPrivateValue(instanceclass, instance, value, field);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
* @param matrix
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory matrix)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is a call in hook from modified external code. Implemented elsewhere.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void takenFromFurnace(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Throw the offered exception. Likely will stop the game.
|
|
||||||
*
|
|
||||||
* @param message
|
|
||||||
* @param e
|
|
||||||
*/
|
|
||||||
public static void throwException(String message, Throwable e)
|
|
||||||
{
|
|
||||||
FMLCommonHandler.instance().raiseException(e, message, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void throwException(Throwable e)
|
|
||||||
{
|
|
||||||
throwException("Exception in ModLoader", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.FMLTextureFX;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A texture override for animations, it takes a vertical image of
|
|
||||||
* texture frames and constantly rotates them in the texture.
|
|
||||||
*/
|
|
||||||
public class ModTextureAnimation extends FMLTextureFX
|
|
||||||
{
|
|
||||||
private final int tickRate;
|
|
||||||
private byte[][] images;
|
|
||||||
private int index = 0;
|
|
||||||
private int ticks = 0;
|
|
||||||
|
|
||||||
private String targetTex = null;
|
|
||||||
private BufferedImage imgData = null;
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
this(icon, 1, target, image, tickCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int size, int target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image, tickCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureAnimation(int icon, int size, String target, BufferedImage image, int tickCount)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
|
||||||
|
|
||||||
targetTex = target;
|
|
||||||
field_76849_e = size;
|
|
||||||
field_76847_f = re.func_78341_b(target);
|
|
||||||
|
|
||||||
tickRate = tickCount;
|
|
||||||
ticks = tickCount;
|
|
||||||
imgData = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup()
|
|
||||||
{
|
|
||||||
super.setup();
|
|
||||||
|
|
||||||
int sWidth = imgData.getWidth();
|
|
||||||
int sHeight = imgData.getHeight();
|
|
||||||
int tWidth = tileSizeBase;
|
|
||||||
int tHeight = tileSizeBase;
|
|
||||||
|
|
||||||
|
|
||||||
int frames = (int)Math.floor((double)(sHeight / sWidth));
|
|
||||||
|
|
||||||
if (frames < 1)
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(String.format("Attempted to create a TextureAnimation with no complete frames: %dx%d", sWidth, sHeight));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
images = new byte[frames][];
|
|
||||||
BufferedImage image = imgData;
|
|
||||||
|
|
||||||
if (sWidth != tWidth)
|
|
||||||
{
|
|
||||||
BufferedImage b = new BufferedImage(tWidth, tHeight * frames, 6);
|
|
||||||
Graphics2D g = b.createGraphics();
|
|
||||||
g.drawImage(imgData, 0, 0, tWidth, tHeight * frames, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
|
||||||
g.dispose();
|
|
||||||
image = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int frame = 0; frame < frames; frame++)
|
|
||||||
{
|
|
||||||
int[] pixels = new int[tileSizeSquare];
|
|
||||||
image.getRGB(0, tHeight * frame, tWidth, tHeight, pixels, 0, tWidth);
|
|
||||||
images[frame] = new byte[tileSizeSquare << 2];
|
|
||||||
|
|
||||||
for (int i = 0; i < pixels.length; i++)
|
|
||||||
{
|
|
||||||
int i4 = i * 4;
|
|
||||||
images[frame][i4 + 0] = (byte)(pixels[i] >> 16 & 255);
|
|
||||||
images[frame][i4 + 1] = (byte)(pixels[i] >> 8 & 255);
|
|
||||||
images[frame][i4 + 2] = (byte)(pixels[i] >> 0 & 255);
|
|
||||||
images[frame][i4 + 3] = (byte)(pixels[i] >> 24 & 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void func_76846_a()
|
|
||||||
{
|
|
||||||
if (++ticks >= tickRate)
|
|
||||||
{
|
|
||||||
if (++index >= images.length)
|
|
||||||
{
|
|
||||||
index = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
field_76852_a = images[index];
|
|
||||||
ticks = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void func_76845_a(RenderEngine renderEngine)
|
|
||||||
{
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, field_76847_f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: REMOVE THIS - just for you dan200
|
|
||||||
@Deprecated
|
|
||||||
public void func_783_a()
|
|
||||||
{
|
|
||||||
func_76846_a();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.client.FMLTextureFX;
|
|
||||||
|
|
||||||
public class ModTextureStatic extends FMLTextureFX
|
|
||||||
{
|
|
||||||
private boolean oldanaglyph = false;
|
|
||||||
private int[] pixels = null;
|
|
||||||
private String targetTex = null;
|
|
||||||
private int storedSize;
|
|
||||||
private BufferedImage overrideData = null;
|
|
||||||
private int needApply = 2;
|
|
||||||
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int target, BufferedImage image)
|
|
||||||
{
|
|
||||||
this(icon, 1, target, image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
|
|
||||||
{
|
|
||||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
|
|
||||||
{
|
|
||||||
super(icon);
|
|
||||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
|
||||||
|
|
||||||
targetTex = target;
|
|
||||||
storedSize = size;
|
|
||||||
field_76849_e = size;
|
|
||||||
field_76847_f = re.func_78341_b(target);
|
|
||||||
overrideData = image;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup()
|
|
||||||
{
|
|
||||||
super.setup();
|
|
||||||
int sWidth = overrideData.getWidth();
|
|
||||||
int sHeight = overrideData.getHeight();
|
|
||||||
|
|
||||||
pixels = new int[tileSizeSquare];
|
|
||||||
if (tileSizeBase == sWidth && tileSizeBase == sHeight)
|
|
||||||
{
|
|
||||||
overrideData.getRGB(0, 0, sWidth, sHeight, pixels, 0, sWidth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BufferedImage tmp = new BufferedImage(tileSizeBase, tileSizeBase, 6);
|
|
||||||
Graphics2D gfx = tmp.createGraphics();
|
|
||||||
gfx.drawImage(overrideData, 0, 0, tileSizeBase, tileSizeBase, 0, 0, sWidth, sHeight, (ImageObserver)null);
|
|
||||||
tmp.getRGB(0, 0, tileSizeBase, tileSizeBase, pixels, 0, tileSizeBase);
|
|
||||||
gfx.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_76846_a()
|
|
||||||
{
|
|
||||||
if (oldanaglyph != field_76851_c)
|
|
||||||
{
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
// This makes it so we only apply the texture to the target texture when we need to,
|
|
||||||
//due to the fact that update is called when the Effect is first registered, we actually
|
|
||||||
//need to wait for the next one.
|
|
||||||
field_76849_e = (needApply == 0 ? 0 : storedSize);
|
|
||||||
if (needApply > 0)
|
|
||||||
{
|
|
||||||
needApply--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void func_76845_a(RenderEngine p_76845_1_)
|
|
||||||
{
|
|
||||||
GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
needApply = 2;
|
|
||||||
for (int idx = 0; idx < pixels.length; idx++)
|
|
||||||
{
|
|
||||||
int i = idx * 4;
|
|
||||||
int a = pixels[idx] >> 24 & 255;
|
|
||||||
int r = pixels[idx] >> 16 & 255;
|
|
||||||
int g = pixels[idx] >> 8 & 255;
|
|
||||||
int b = pixels[idx] >> 0 & 255;
|
|
||||||
|
|
||||||
if (field_76851_c)
|
|
||||||
{
|
|
||||||
r = g = b = (r + g + b) / 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
field_76852_a[i + 0] = (byte)r;
|
|
||||||
field_76852_a[i + 1] = (byte)g;
|
|
||||||
field_76852_a[i + 2] = (byte)b;
|
|
||||||
field_76852_a[i + 3] = (byte)a;
|
|
||||||
}
|
|
||||||
|
|
||||||
oldanaglyph = field_76851_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Implementation of http://scale2x.sourceforge.net/algorithm.html
|
|
||||||
public static BufferedImage scale2x(BufferedImage image)
|
|
||||||
{
|
|
||||||
int w = image.getWidth();
|
|
||||||
int h = image.getHeight();
|
|
||||||
BufferedImage tmp = new BufferedImage(w * 2, h * 2, 2);
|
|
||||||
|
|
||||||
for (int x = 0; x < h; ++x)
|
|
||||||
{
|
|
||||||
int x2 = x * 2;
|
|
||||||
for (int y = 0; y < w; ++y)
|
|
||||||
{
|
|
||||||
int y2 = y * 2;
|
|
||||||
int E = image.getRGB(y, x);
|
|
||||||
int D = (x == 0 ? E : image.getRGB(y, x - 1));
|
|
||||||
int B = (y == 0 ? E : image.getRGB(y - 1, x ));
|
|
||||||
int H = (y >= w - 1 ? E : image.getRGB(y + 1, x ));
|
|
||||||
int F = (x >= h - 1 ? E : image.getRGB(y, x + 1));
|
|
||||||
|
|
||||||
int e0, e1, e2, e3;
|
|
||||||
|
|
||||||
if (B != H && D != F)
|
|
||||||
{
|
|
||||||
e0 = D == B ? D : E;
|
|
||||||
e1 = B == F ? F : E;
|
|
||||||
e2 = D == H ? D : E;
|
|
||||||
e3 = H == F ? F : E;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e0 = e1 = e2 = e3 = E;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp.setRGB(y2, x2, e0);
|
|
||||||
tmp.setRGB(y2 + 1, x2, e1);
|
|
||||||
tmp.setRGB(y2, x2 + 1, e2);
|
|
||||||
tmp.setRGB(y2 + 1, x2 + 1, e3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package net.minecraft.src;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Compatibility class for ModLoader -- do not use
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TradeEntry
|
|
||||||
{
|
|
||||||
public final int id;
|
|
||||||
public float chance;
|
|
||||||
public boolean buying;
|
|
||||||
public int min = 0;
|
|
||||||
public int max = 0;
|
|
||||||
|
|
||||||
public TradeEntry(int id, float chance, boolean buying, int min, int max)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
this.chance = chance;
|
|
||||||
this.buying = buying;
|
|
||||||
this.min = min;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TradeEntry(int id, float chance, boolean buying)
|
|
||||||
{
|
|
||||||
this(id, chance, buying, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-227
@@ -1,227 +0,0 @@
|
|||||||
--- commands.py
|
|
||||||
+++ commands.py
|
|
||||||
@@ -58,6 +58,8 @@
|
|
||||||
|
|
||||||
|
|
||||||
def reallyrmtree(path):
|
|
||||||
+ if os.path.isfile(os.path.join(path, 'asm-all-4.0.jar')): #Check if asm exists, indicating the libs folder, if so, don't delete it
|
|
||||||
+ return
|
|
||||||
if not sys.platform.startswith('win'):
|
|
||||||
if os.path.exists(path):
|
|
||||||
shutil.rmtree(path)
|
|
||||||
@@ -584,6 +586,9 @@
|
|
||||||
self.has_astyle_cfg = False
|
|
||||||
if os.path.isfile(self.astyleconf):
|
|
||||||
self.has_astyle_cfg = True
|
|
||||||
+
|
|
||||||
+ #FML Entries
|
|
||||||
+ self.srcshared = os.path.normpath(os.path.join(self.dirsrc, 'common'))
|
|
||||||
|
|
||||||
def creatergcfg(self, reobf=False, keep_lvt=False, keep_generics=False, rg_update=False):
|
|
||||||
"""Create the files necessary for RetroGuard"""
|
|
||||||
@@ -781,7 +786,8 @@
|
|
||||||
testlk = {CLIENT: self.testclient, SERVER: self.testserver}
|
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(srclk[side], os.path.normpath(testlk[side] + '.java'))):
|
|
||||||
- return False
|
|
||||||
+ if not os.path.exists(os.path.join(self.srcshared, os.path.normpath(testlk[side] + '.java'))):
|
|
||||||
+ return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def checkbins(self, side):
|
|
||||||
@@ -1029,6 +1035,10 @@
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
pathlog = {CLIENT: self.clientrecomplog, SERVER: self.serverrecomplog}
|
|
||||||
|
|
||||||
+ if side == SERVER: #Disable server because FML recombines it into client
|
|
||||||
+ self.logger.info('Server side recompiling skipped, this is normal')
|
|
||||||
+ return
|
|
||||||
+
|
|
||||||
if not os.path.exists(pathbinlk[side]):
|
|
||||||
os.makedirs(pathbinlk[side])
|
|
||||||
|
|
||||||
@@ -1041,6 +1051,7 @@
|
|
||||||
all_files = True
|
|
||||||
append_pattern = False
|
|
||||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=append_pattern, all_files=all_files)
|
|
||||||
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=append_pattern, all_files=all_files) #FML, Add Common folder
|
|
||||||
dirs = ' '.join(pkglist)
|
|
||||||
classpath = os.pathsep.join(cplk[side])
|
|
||||||
forkcmd = self.cmdrecomp.format(classpath=classpath, sourcepath=pathsrclk[side], outpath=pathbinlk[side],
|
|
||||||
@@ -1062,7 +1073,7 @@
|
|
||||||
raise
|
|
||||||
|
|
||||||
def startserver(self):
|
|
||||||
- classpath = [self.binserver] + self.cpathserver
|
|
||||||
+ classpath = [self.binserver, self.srcshared] + self.cpathserver
|
|
||||||
classpath = [os.path.join('..', p) for p in classpath]
|
|
||||||
classpath = os.pathsep.join(classpath)
|
|
||||||
os.chdir(self.dirjars)
|
|
||||||
@@ -1070,7 +1081,7 @@
|
|
||||||
self.runmc(forkcmd)
|
|
||||||
|
|
||||||
def startclient(self):
|
|
||||||
- classpath = [self.binclient] + self.cpathclient
|
|
||||||
+ classpath = [self.binclient, self.srcshared] + self.cpathclient
|
|
||||||
classpath = [os.path.join('..', p) for p in classpath]
|
|
||||||
classpath = os.pathsep.join(classpath)
|
|
||||||
natives = os.path.join('..', self.dirnatives)
|
|
||||||
@@ -1197,20 +1208,20 @@
|
|
||||||
with open(self.csvmethods, 'rb') as fh:
|
|
||||||
methodsreader = csv.DictReader(fh)
|
|
||||||
for row in methodsreader:
|
|
||||||
- if int(row['side']) == side:
|
|
||||||
+ if int(row['side']) == side or int(row['side']) == 2:
|
|
||||||
if row['name'] != row['searge']:
|
|
||||||
names['methods'][row['searge']] = row['name']
|
|
||||||
with open(self.csvfields, 'rb') as fh:
|
|
||||||
fieldsreader = csv.DictReader(fh)
|
|
||||||
for row in fieldsreader:
|
|
||||||
- if int(row['side']) == side:
|
|
||||||
+ if int(row['side']) == side or int(row['side']) == 2:
|
|
||||||
if row['name'] != row['searge']:
|
|
||||||
names['fields'][row['searge']] = row['name']
|
|
||||||
if self.has_param_csv:
|
|
||||||
with open(self.csvparams, 'rb') as fh:
|
|
||||||
paramsreader = csv.DictReader(fh)
|
|
||||||
for row in paramsreader:
|
|
||||||
- if int(row['side']) == side:
|
|
||||||
+ if int(row['side']) == side or int(row['side']) == 2:
|
|
||||||
names['params'][row['param']] = row['name']
|
|
||||||
|
|
||||||
regexps = {
|
|
||||||
@@ -1240,6 +1251,11 @@
|
|
||||||
|
|
||||||
# HINT: We pathwalk the sources
|
|
||||||
for path, _, filelist in os.walk(pathsrclk[side], followlinks=True):
|
|
||||||
+ for cur_file in fnmatch.filter(filelist, '*.java'):
|
|
||||||
+ updatefile(os.path.normpath(os.path.join(path, cur_file)))
|
|
||||||
+
|
|
||||||
+ # FML, copy of the above, for the common folder
|
|
||||||
+ for path, _, filelist in os.walk(self.srcshared, followlinks=True):
|
|
||||||
for cur_file in fnmatch.filter(filelist, '*.java'):
|
|
||||||
updatefile(os.path.normpath(os.path.join(path, cur_file)))
|
|
||||||
return True
|
|
||||||
@@ -1322,12 +1338,14 @@
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
|
|
||||||
strip_comments(pathsrclk[side])
|
|
||||||
+ strip_comments(self.srcshared)
|
|
||||||
|
|
||||||
def process_cleanup(self, side):
|
|
||||||
"""Do lots of random cleanups including stripping comments, trailing whitespace and extra blank lines"""
|
|
||||||
pathsrclk = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
|
|
||||||
src_cleanup(pathsrclk[side], fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
|
|
||||||
+ src_cleanup(self.srcshared, fix_imports=True, fix_unicode=True, fix_charval=True, fix_pi=True, fix_round=False)
|
|
||||||
|
|
||||||
def process_javadoc(self, side):
|
|
||||||
"""Add CSV descriptions to methods and fields as javadoc"""
|
|
||||||
@@ -1336,6 +1354,21 @@
|
|
||||||
if not self.has_doc_csv:
|
|
||||||
self.logger.warning('!! javadoc disabled due to no csvs !!')
|
|
||||||
return False
|
|
||||||
+
|
|
||||||
+ #FML Recall this function on the common folder
|
|
||||||
+ #Potential bug: If this is called without a subsiquent rename call, will cause double comments
|
|
||||||
+ if pathsrclk[side] != self.srcshared:
|
|
||||||
+ if side == CLIENT:
|
|
||||||
+ tmp = self.srcclient
|
|
||||||
+ self.srcclient = self.srcshared
|
|
||||||
+ self.process_javadoc(side)
|
|
||||||
+ self.srcclient = tmp
|
|
||||||
+ else:
|
|
||||||
+ tmp = self.srcserver
|
|
||||||
+ self.srcserver = self.srcshared
|
|
||||||
+ self.process_javadoc(side)
|
|
||||||
+ self.srcserver = tmp
|
|
||||||
+
|
|
||||||
|
|
||||||
#HINT: We read the relevant CSVs
|
|
||||||
methodsreader = csv.DictReader(open(self.csvmethods, 'r'))
|
|
||||||
@@ -1344,13 +1377,13 @@
|
|
||||||
methods = {}
|
|
||||||
for row in methodsreader:
|
|
||||||
#HINT: Only include methods that have a non-empty description
|
|
||||||
- if int(row['side']) == side and row['desc']:
|
|
||||||
+ if (int(row['side']) == side or int(row['side']) == 2) and row['desc']:
|
|
||||||
methods[row['searge']] = row['desc'].replace('*/', '* /')
|
|
||||||
|
|
||||||
fields = {}
|
|
||||||
for row in fieldsreader:
|
|
||||||
#HINT: Only include fields that have a non-empty description
|
|
||||||
- if int(row['side']) == side and row['desc']:
|
|
||||||
+ if (int(row['side']) == side or int(row['side']) == 2) and row['desc']:
|
|
||||||
fields[row['searge']] = row['desc'].replace('*/', '* /')
|
|
||||||
|
|
||||||
regexps = {
|
|
||||||
@@ -1422,12 +1455,13 @@
|
|
||||||
|
|
||||||
# HINT: We create the list of source directories based on the list of packages
|
|
||||||
pkglist = filterdirs(pathsrclk[side], '*.java', append_pattern=True)
|
|
||||||
+ pkglist = pkglist + filterdirs(self.srcshared, '*.java', append_pattern=True) #FML, Add Common folder
|
|
||||||
dirs = ' '.join(pkglist)
|
|
||||||
forkcmd = self.cmdastyle.format(classes=dirs, conffile=self.astyleconf)
|
|
||||||
self.runcmd(forkcmd)
|
|
||||||
return True
|
|
||||||
|
|
||||||
- def gathermd5s(self, side, reobf=False):
|
|
||||||
+ def gathermd5s(self, side, reobf=False, skip_fml=False):
|
|
||||||
if not reobf:
|
|
||||||
md5lk = {CLIENT: self.md5client, SERVER: self.md5server}
|
|
||||||
else:
|
|
||||||
@@ -1442,6 +1476,9 @@
|
|
||||||
class_path = ''
|
|
||||||
else:
|
|
||||||
class_path += '/'
|
|
||||||
+ if skip_fml:
|
|
||||||
+ if class_path.startswith('cpw/'):
|
|
||||||
+ continue
|
|
||||||
for class_file in fnmatch.filter(filelist, '*.class'):
|
|
||||||
class_name = class_path + os.path.splitext(class_file)[0]
|
|
||||||
bin_file = os.path.normpath(os.path.join(path, class_file))
|
|
||||||
@@ -1594,6 +1631,9 @@
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
for entry in newfiles:
|
|
||||||
+ if 'commands.py' in entry[0]: #FML, Disable updating of Commands.py
|
|
||||||
+ print 'Update to runtime/commands.py found, but disbled due to using fml'
|
|
||||||
+ continue
|
|
||||||
if entry[3] == 'U':
|
|
||||||
self.logger.info('Retrieving file from server : %s', entry[0])
|
|
||||||
cur_file = os.path.normpath(entry[0])
|
|
||||||
@@ -1614,6 +1654,9 @@
|
|
||||||
md5reoblk = {CLIENT: self.md5reobfclient, SERVER: self.md5reobfserver}
|
|
||||||
outpathlk = {CLIENT: self.srcmodclient, SERVER: self.srcmodserver}
|
|
||||||
src = {CLIENT: self.srcclient, SERVER: self.srcserver}
|
|
||||||
+
|
|
||||||
+ if side == SERVER: #Noop out server side stuff
|
|
||||||
+ return
|
|
||||||
|
|
||||||
# HINT: We need a table for the old md5 and the new ones
|
|
||||||
md5table = {}
|
|
||||||
@@ -1646,6 +1689,7 @@
|
|
||||||
# HINT: We extract the source files for the modified class files
|
|
||||||
for in_class in trgclasses:
|
|
||||||
src_file = os.path.normpath(os.path.join(src[side], in_class + '.java'))
|
|
||||||
+ cmn_file = os.path.normpath(os.path.join(self.srcshared, in_class + '.java'))
|
|
||||||
dest_file = os.path.normpath(os.path.join(outpathlk[side], in_class + '.java'))
|
|
||||||
if os.path.isfile(src_file):
|
|
||||||
if not os.path.exists(os.path.dirname(dest_file)):
|
|
||||||
@@ -1655,4 +1699,15 @@
|
|
||||||
self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
|
||||||
except IOError:
|
|
||||||
self.logger.error('* File %s copy failed', in_class)
|
|
||||||
-
|
|
||||||
+ elif os.path.isfile(cmn_file):
|
|
||||||
+ if not os.path.exists(os.path.dirname(dest_file)):
|
|
||||||
+ os.makedirs(os.path.dirname(dest_file))
|
|
||||||
+ try:
|
|
||||||
+ shutil.copyfile(cmn_file, dest_file)
|
|
||||||
+ self.logger.info('> Outputted %s to %s', in_class.ljust(35), outpathlk[side])
|
|
||||||
+ except IOError:
|
|
||||||
+ self.logger.error('* File %s copy failed', in_class)
|
|
||||||
+
|
|
||||||
+def commands_sanity_check():
|
|
||||||
+ print 'Commands patch applied successfully'
|
|
||||||
+
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A marker interface for retrieving a proxy to a bukkit plugin.
|
|
||||||
* Fields associated with {@link BukkitPluginRef} annotations should be should probably
|
|
||||||
* declare this type and cast down if the target is available (not null)
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface BukkitProxy
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ConcurrentMap;
|
|
||||||
|
|
||||||
import net.minecraft.src.NBTBase;
|
|
||||||
import net.minecraft.src.NBTTagCompound;
|
|
||||||
import net.minecraft.src.NBTTagList;
|
|
||||||
import net.minecraft.src.NBTTagString;
|
|
||||||
import net.minecraft.src.SaveHandler;
|
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
import com.google.common.collect.MapMaker;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.common.eventbus.EventBus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class FMLDummyContainer extends DummyModContainer implements WorldAccessContainer
|
|
||||||
{
|
|
||||||
public FMLDummyContainer()
|
|
||||||
{
|
|
||||||
super(new ModMetadata());
|
|
||||||
ModMetadata meta = getMetadata();
|
|
||||||
meta.modId="FML";
|
|
||||||
meta.name="Forge Mod Loader";
|
|
||||||
meta.version=Loader.instance().getFMLVersionString();
|
|
||||||
meta.credits="Made possible with help from many people";
|
|
||||||
meta.authorList=Arrays.asList("cpw, LexManos");
|
|
||||||
meta.description="The Forge Mod Loader provides the ability for systems to load mods " +
|
|
||||||
"from the file system. It also provides key capabilities for mods to be able " +
|
|
||||||
"to cooperate and provide a good modding environment. " +
|
|
||||||
"The mod loading system is compatible with ModLoader, all your ModLoader " +
|
|
||||||
"mods should work.";
|
|
||||||
meta.url="https://github.com/cpw/FML/wiki";
|
|
||||||
meta.updateUrl="https://github.com/cpw/FML/wiki";
|
|
||||||
meta.screenshots=new String[0];
|
|
||||||
meta.logoFile="";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean registerBus(EventBus bus, LoadController controller)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
|
|
||||||
{
|
|
||||||
NBTTagCompound fmlData = new NBTTagCompound();
|
|
||||||
NBTTagList list = new NBTTagList();
|
|
||||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
|
||||||
{
|
|
||||||
NBTTagCompound mod = new NBTTagCompound();
|
|
||||||
mod.func_74778_a("ModId", mc.getModId());
|
|
||||||
mod.func_74778_a("ModVersion", mc.getVersion());
|
|
||||||
list.func_74742_a(mod);
|
|
||||||
}
|
|
||||||
fmlData.func_74782_a("ModList", list);
|
|
||||||
return fmlData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
|
|
||||||
{
|
|
||||||
if (tag.func_74764_b("ModList"))
|
|
||||||
{
|
|
||||||
NBTTagList modList = tag.func_74761_m("ModList");
|
|
||||||
for (int i = 0; i < modList.func_74745_c(); i++)
|
|
||||||
{
|
|
||||||
NBTTagCompound mod = (NBTTagCompound) modList.func_74743_b(i);
|
|
||||||
String modId = mod.func_74779_i("ModId");
|
|
||||||
String modVersion = mod.func_74779_i("ModVersion");
|
|
||||||
ModContainer container = Loader.instance().getIndexedModList().get(modId);
|
|
||||||
if (container == null)
|
|
||||||
{
|
|
||||||
FMLLog.severe("This world was saved with mod %s which appears to be missing, things may not work well", modId);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!modVersion.equals(container.getVersion()))
|
|
||||||
{
|
|
||||||
FMLLog.info("This world was saved with mod %s version %s and it is now at version %s, things may not work well", modId, modVersion, container.getVersion());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IConsoleHandler
|
|
||||||
{
|
|
||||||
public boolean handleCommand(String command, Object... data);
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.IInventory;
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a crafting handler for the mod container to call
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface ICraftingHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The object array contains these three arguments
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
* @param craftMatrix
|
|
||||||
*/
|
|
||||||
void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The object array contains these two arguments
|
|
||||||
* @param player
|
|
||||||
* @param item
|
|
||||||
*/
|
|
||||||
void onSmelting(EntityPlayer player, ItemStack item);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
public interface ICrashCallable extends Callable<String>
|
|
||||||
{
|
|
||||||
String getLabel();
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite. Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
|
|
||||||
|
|
||||||
public interface IDispenseHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Return -1 if you don't want to dispense anything. the other values seem to have specific meanings
|
|
||||||
* to blockdispenser.
|
|
||||||
*
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVelocity
|
|
||||||
* @param zVelocity
|
|
||||||
* @param world
|
|
||||||
* @param item
|
|
||||||
* @param random
|
|
||||||
* @param entX
|
|
||||||
* @param entY
|
|
||||||
* @param entZ
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
int dispense(double x, double y, double z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IDispenserHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Called to dispense an entity
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @param xVelocity
|
|
||||||
* @param zVelocity
|
|
||||||
* @param world
|
|
||||||
* @param item
|
|
||||||
* @param random
|
|
||||||
* @param entX
|
|
||||||
* @param entY
|
|
||||||
* @param entZ
|
|
||||||
*/
|
|
||||||
int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY, double entZ);
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public interface IFMLHandledException
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.Packet;
|
|
||||||
import net.minecraft.src.Packet131MapData;
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnAdjustmentPacket;
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
|
||||||
import cpw.mods.fml.common.network.ModMissingPacket;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|
||||||
|
|
||||||
public interface IFMLSidedHandler
|
|
||||||
{
|
|
||||||
List<String> getAdditionalBrandingInformation();
|
|
||||||
|
|
||||||
Side getSide();
|
|
||||||
|
|
||||||
void haltGame(String message, Throwable exception);
|
|
||||||
|
|
||||||
void showGuiScreen(Object clientGuiElement);
|
|
||||||
|
|
||||||
Entity spawnEntityIntoClientWorld(EntityRegistration registration, EntitySpawnPacket packet);
|
|
||||||
|
|
||||||
void adjustEntityLocationOnClient(EntitySpawnAdjustmentPacket entitySpawnAdjustmentPacket);
|
|
||||||
|
|
||||||
void beginServerLoading(MinecraftServer server);
|
|
||||||
|
|
||||||
void finishServerLoading();
|
|
||||||
|
|
||||||
MinecraftServer getServer();
|
|
||||||
|
|
||||||
void sendPacket(Packet packet);
|
|
||||||
|
|
||||||
void displayMissingMods(ModMissingPacket modMissingPacket);
|
|
||||||
|
|
||||||
void handleTinyPacket(NetHandler handler, Packet131MapData mapData);
|
|
||||||
|
|
||||||
void setClientCompatibilityLevel(byte compatibilityLevel);
|
|
||||||
|
|
||||||
byte getClientCompatibilityLevel();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
|
|
||||||
public interface IFuelHandler
|
|
||||||
{
|
|
||||||
int getBurnTime(ItemStack fuel);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import net.minecraft.src.EntityItem;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
|
|
||||||
public interface IPickupNotifier
|
|
||||||
{
|
|
||||||
void notifyPickup(EntityItem item, EntityPlayer player);
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface IPlayerTracker
|
|
||||||
{
|
|
||||||
void onPlayerLogin(EntityPlayer player);
|
|
||||||
|
|
||||||
void onPlayerLogout(EntityPlayer player);
|
|
||||||
|
|
||||||
void onPlayerChangedDimension(EntityPlayer player);
|
|
||||||
|
|
||||||
void onPlayerRespawn(EntityPlayer player);
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public interface IScheduledTickHandler extends ITickHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Return the number of actual ticks that will pass
|
|
||||||
* before your next tick will fire. This will be called
|
|
||||||
* just after your last tick fired to compute the next delay.
|
|
||||||
* @return Time until next tick
|
|
||||||
*/
|
|
||||||
public int nextTickSpacing();
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public class LoaderException extends RuntimeException
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = -5675297950958861378L;
|
|
||||||
|
|
||||||
public LoaderException(Throwable wrapped)
|
|
||||||
{
|
|
||||||
super(wrapped);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoaderException()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import argo.jdom.JdomParser;
|
|
||||||
import argo.jdom.JsonNode;
|
|
||||||
import argo.jdom.JsonRootNode;
|
|
||||||
import argo.saj.InvalidSyntaxException;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
public class MetadataCollection
|
|
||||||
{
|
|
||||||
private static JdomParser parser = new JdomParser();
|
|
||||||
private Map<String, ModMetadata> metadatas = Maps.newHashMap();
|
|
||||||
private int metadataVersion = 1;
|
|
||||||
|
|
||||||
public static MetadataCollection from(InputStream inputStream, String sourceName)
|
|
||||||
{
|
|
||||||
if (inputStream == null)
|
|
||||||
{
|
|
||||||
return new MetadataCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
InputStreamReader reader = new InputStreamReader(inputStream);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
JsonRootNode root = parser.parse(reader);
|
|
||||||
if (root.hasElements())
|
|
||||||
{
|
|
||||||
return parse10ModInfo(root);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return parseModInfo(root);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (InvalidSyntaxException e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "The mcmod.info file in %s cannot be parsed as valid JSON. It will be ignored", sourceName);
|
|
||||||
return new MetadataCollection();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw Throwables.propagate(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MetadataCollection parseModInfo(JsonRootNode root)
|
|
||||||
{
|
|
||||||
MetadataCollection mc = new MetadataCollection();
|
|
||||||
mc.metadataVersion = Integer.parseInt(root.getNumberValue("modinfoversion"));
|
|
||||||
mc.parseModMetadataList(root.getNode("modlist"));
|
|
||||||
return mc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MetadataCollection parse10ModInfo(JsonRootNode root)
|
|
||||||
{
|
|
||||||
MetadataCollection mc = new MetadataCollection();
|
|
||||||
mc.parseModMetadataList(root);
|
|
||||||
return mc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseModMetadataList(JsonNode metadataList)
|
|
||||||
{
|
|
||||||
for (JsonNode node : metadataList.getElements())
|
|
||||||
{
|
|
||||||
ModMetadata mmd = new ModMetadata(node);
|
|
||||||
metadatas.put(mmd.modId, mmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModMetadata getMetadataForId(String modId, Map<String, Object> extraData)
|
|
||||||
{
|
|
||||||
if (!metadatas.containsKey(modId))
|
|
||||||
{
|
|
||||||
ModMetadata dummy = new ModMetadata();
|
|
||||||
dummy.modId = modId;
|
|
||||||
dummy.name = (String) extraData.get("name");
|
|
||||||
dummy.version = (String) extraData.get("version");
|
|
||||||
dummy.autogenerated = true;
|
|
||||||
metadatas.put(modId, dummy);
|
|
||||||
}
|
|
||||||
return metadatas.get(modId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.google.common.collect.Sets.SetView;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
|
|
||||||
public class MissingModsException extends RuntimeException
|
|
||||||
{
|
|
||||||
|
|
||||||
public Set<ArtifactVersion> missingMods;
|
|
||||||
|
|
||||||
public MissingModsException(Set<ArtifactVersion> missingMods)
|
|
||||||
{
|
|
||||||
this.missingMods = missingMods;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemBlock;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The new mod style in FML 1.3
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.TYPE)
|
|
||||||
public @interface Mod
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The unique mod identifier for this mod
|
|
||||||
*/
|
|
||||||
String modid();
|
|
||||||
/**
|
|
||||||
* A user friendly name for the mod
|
|
||||||
*/
|
|
||||||
String name() default "";
|
|
||||||
/**
|
|
||||||
* A version string for this mod
|
|
||||||
*/
|
|
||||||
String version() default "";
|
|
||||||
/**
|
|
||||||
* A simple dependency string for this mod (see modloader's "priorities" string specification)
|
|
||||||
*/
|
|
||||||
String dependencies() default "";
|
|
||||||
/**
|
|
||||||
* Whether to use the mcmod.info metadata by default for this mod.
|
|
||||||
* If true, settings in the mcmod.info file will override settings in these annotations.
|
|
||||||
*/
|
|
||||||
boolean useMetadata() default false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The acceptable range of minecraft versions that this mod will load and run in
|
|
||||||
* The default ("empty string") indicates that only the current minecraft version is acceptable.
|
|
||||||
* FML will refuse to run with an error if the minecraft version is not in this range across all mods.
|
|
||||||
* @return A version range as specified by the maven version range specification or the empty string
|
|
||||||
*/
|
|
||||||
String acceptedMinecraftVersions() default "";
|
|
||||||
/**
|
|
||||||
* An optional bukkit plugin that will be injected into the bukkit plugin framework if
|
|
||||||
* this mod is loaded into the FML framework and the bukkit coremod is present.
|
|
||||||
* Instances of the bukkit plugin can be obtained via the {@link BukkitPluginRef} annotation on fields.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String bukkitPlugin() default "";
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "pre-initialization" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface PreInit {}
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "initialization" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface Init {}
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "post-initialization" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface PostInit {}
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "server-starting" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface ServerStarting {}
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "post-initialization" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface ServerStarted {}
|
|
||||||
/**
|
|
||||||
* Mark the designated method as being called at the "post-initialization" phase
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.METHOD)
|
|
||||||
public @interface ServerStopping {}
|
|
||||||
/**
|
|
||||||
* Populate the annotated field with the mod instance.
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface Instance {
|
|
||||||
/**
|
|
||||||
* The mod object to inject into this field
|
|
||||||
*/
|
|
||||||
String value() default "";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Populate the annotated field with the mod's metadata.
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface Metadata {
|
|
||||||
/**
|
|
||||||
* The mod id specifying the metadata to load here
|
|
||||||
*/
|
|
||||||
String value() default "";
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Populate the annotated field with an instance of the Block as specified
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface Block {
|
|
||||||
/**
|
|
||||||
* The block's name
|
|
||||||
*/
|
|
||||||
String name();
|
|
||||||
/**
|
|
||||||
* The associated ItemBlock subtype for the item (can be null for an ItemBlock)
|
|
||||||
*/
|
|
||||||
Class<?> itemTypeClass() default ItemBlock.class;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Populate the annotated field with an Item
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface Item {
|
|
||||||
/**
|
|
||||||
* The name of the item
|
|
||||||
*/
|
|
||||||
String name();
|
|
||||||
/**
|
|
||||||
* The type of the item
|
|
||||||
*/
|
|
||||||
String typeClass();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLClassLoader;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.asm.ASMTransformer;
|
|
||||||
import cpw.mods.fml.common.asm.transformers.AccessTransformer;
|
|
||||||
import cpw.mods.fml.common.modloader.BaseModProxy;
|
|
||||||
import cpw.mods.fml.relauncher.RelaunchClassLoader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A simple delegating class loader used to load mods into the system
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ModClassLoader extends URLClassLoader
|
|
||||||
{
|
|
||||||
private static final List<String> STANDARD_LIBRARIES = ImmutableList.of("jinput.jar", "lwjgl.jar", "lwjgl_util.jar");
|
|
||||||
private RelaunchClassLoader mainClassLoader;
|
|
||||||
|
|
||||||
public ModClassLoader(ClassLoader parent) {
|
|
||||||
super(new URL[0], null);
|
|
||||||
this.mainClassLoader = (RelaunchClassLoader)parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addFile(File modFile) throws MalformedURLException
|
|
||||||
{
|
|
||||||
URL url = modFile.toURI().toURL();
|
|
||||||
mainClassLoader.addURL(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> loadClass(String name) throws ClassNotFoundException
|
|
||||||
{
|
|
||||||
return mainClassLoader.loadClass(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public File[] getParentSources() {
|
|
||||||
List<URL> urls=mainClassLoader.getSources();
|
|
||||||
File[] sources=new File[urls.size()];
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (int i = 0; i<urls.size(); i++)
|
|
||||||
{
|
|
||||||
sources[i]=new File(urls.get(i).toURI());
|
|
||||||
}
|
|
||||||
return sources;
|
|
||||||
}
|
|
||||||
catch (URISyntaxException e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, "Unable to process our input to locate the minecraft code", e);
|
|
||||||
throw new LoaderException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getDefaultLibraries()
|
|
||||||
{
|
|
||||||
return STANDARD_LIBRARIES;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<? extends BaseModProxy> loadBaseModClass(String modClazzName) throws Exception
|
|
||||||
{
|
|
||||||
AccessTransformer transformer = (AccessTransformer)mainClassLoader.getTransformers().get(0);
|
|
||||||
transformer.ensurePublicAccessFor(modClazzName);
|
|
||||||
return (Class<? extends BaseModProxy>) Class.forName(modClazzName, true, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,164 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import static argo.jdom.JsonNodeBuilders.aStringBuilder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import argo.jdom.JsonNode;
|
|
||||||
import argo.jdom.JsonStringNode;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.functions.ModNameFunction;
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
import cpw.mods.fml.common.versioning.VersionParser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ModMetadata
|
|
||||||
{
|
|
||||||
private static final class JsonStringConverter implements Function<JsonNode, Object>
|
|
||||||
{
|
|
||||||
public Object apply(JsonNode arg0)
|
|
||||||
{
|
|
||||||
if (arg0.hasElements())
|
|
||||||
{
|
|
||||||
return Lists.transform(arg0.getElements(), new JsonArrayConverter());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return arg0.getText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final class JsonArrayConverter implements Function<JsonNode, String>
|
|
||||||
{
|
|
||||||
public String apply(JsonNode arg0)
|
|
||||||
{
|
|
||||||
return arg0.getText();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String modId;
|
|
||||||
public String name;
|
|
||||||
public String description;
|
|
||||||
|
|
||||||
public String url = "";
|
|
||||||
public String updateUrl = "";
|
|
||||||
|
|
||||||
public String logoFile = "";
|
|
||||||
public String version = "";
|
|
||||||
public List<String> authorList = Lists.newArrayList();
|
|
||||||
public String credits = "";
|
|
||||||
public String parent = "";
|
|
||||||
public String[] screenshots;
|
|
||||||
|
|
||||||
public ModContainer parentMod;
|
|
||||||
public List<ModContainer> childMods = Lists.newArrayList();
|
|
||||||
|
|
||||||
public boolean useDependencyInformation;
|
|
||||||
public Set<ArtifactVersion> requiredMods;
|
|
||||||
public List<ArtifactVersion> dependencies;
|
|
||||||
public List<ArtifactVersion> dependants;
|
|
||||||
public boolean autogenerated;
|
|
||||||
|
|
||||||
public ModMetadata(JsonNode node)
|
|
||||||
{
|
|
||||||
Map<JsonStringNode, Object> processedFields = Maps.transformValues(node.getFields(), new JsonStringConverter());
|
|
||||||
modId = (String)processedFields.get(aStringBuilder("modid"));
|
|
||||||
if (Strings.isNullOrEmpty(modId))
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, "Found an invalid mod metadata file - missing modid");
|
|
||||||
throw new LoaderException();
|
|
||||||
}
|
|
||||||
name = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("name")));
|
|
||||||
description = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("description")));
|
|
||||||
url = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("url")));
|
|
||||||
updateUrl = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("updateUrl")));
|
|
||||||
logoFile = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("logoFile")));
|
|
||||||
version = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("version")));
|
|
||||||
credits = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("credits")));
|
|
||||||
parent = Strings.nullToEmpty((String)processedFields.get(aStringBuilder("parent")));
|
|
||||||
authorList = Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authors"))),Objects.firstNonNull(((List<String>)processedFields.get(aStringBuilder("authorList"))), authorList));
|
|
||||||
requiredMods = processReferences(processedFields.get(aStringBuilder("requiredMods")), HashSet.class);
|
|
||||||
dependencies = processReferences(processedFields.get(aStringBuilder("dependencies")), ArrayList.class);
|
|
||||||
dependants = processReferences(processedFields.get(aStringBuilder("dependants")), ArrayList.class);
|
|
||||||
useDependencyInformation = Boolean.parseBoolean(Strings.nullToEmpty((String)processedFields.get(aStringBuilder("useDependencyInformation"))));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModMetadata()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T extends Collection<ArtifactVersion>> T processReferences(Object refs, Class<? extends T> retType)
|
|
||||||
{
|
|
||||||
T res = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
res = retType.newInstance();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
// unpossible
|
|
||||||
}
|
|
||||||
|
|
||||||
if (refs == null)
|
|
||||||
{
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
for (String ref : ((List<String>)refs))
|
|
||||||
{
|
|
||||||
res.add(VersionParser.parseVersionReference(ref));
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChildModCountString()
|
|
||||||
{
|
|
||||||
return String.format("%d child mod%s", childMods.size(), childMods.size() != 1 ? "s" : "");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthorList()
|
|
||||||
{
|
|
||||||
return Joiner.on(", ").join(authorList);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getChildModList()
|
|
||||||
{
|
|
||||||
return Joiner.on(", ").join(Lists.transform(childMods, new ModNameFunction()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public String printableSortingRules()
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public enum Side {
|
|
||||||
CLIENT, SERVER, BUKKIT;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return If this is the server environment
|
|
||||||
*/
|
|
||||||
public boolean isServer()
|
|
||||||
{
|
|
||||||
return !isClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return if this is the Client environment
|
|
||||||
*/
|
|
||||||
public boolean isClient()
|
|
||||||
{
|
|
||||||
return this == CLIENT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target(ElementType.FIELD)
|
|
||||||
public @interface SidedProxy
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name of the client side class to load and populate
|
|
||||||
*/
|
|
||||||
String clientSide() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the server side class to load and populate
|
|
||||||
*/
|
|
||||||
String serverSide() default "";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of a special bukkit plugin class to load and populate
|
|
||||||
*/
|
|
||||||
String bukkitSide() default "";
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
public enum TickType {
|
|
||||||
/**
|
|
||||||
* Fired during the world evaluation loop
|
|
||||||
* server and client side
|
|
||||||
*
|
|
||||||
* arg 0 : The world that is ticking
|
|
||||||
*/
|
|
||||||
WORLD,
|
|
||||||
/**
|
|
||||||
* client side
|
|
||||||
* Fired during the render processing phase
|
|
||||||
* arg 0 : float "partial render time"
|
|
||||||
*/
|
|
||||||
RENDER,
|
|
||||||
/**
|
|
||||||
* client side
|
|
||||||
* Fired during the render processing phase if a GUI is open
|
|
||||||
* arg 0 : float "partial render time"
|
|
||||||
* arg 1 : the open gui or null if no gui is open
|
|
||||||
*/
|
|
||||||
GUI,
|
|
||||||
/**
|
|
||||||
* client side
|
|
||||||
* Fired during the client evaluation loop
|
|
||||||
* arg 0 : The open gui or null if no gui is open
|
|
||||||
*/
|
|
||||||
CLIENTGUI,
|
|
||||||
/**
|
|
||||||
* server side
|
|
||||||
* Fired once as the world loads from disk
|
|
||||||
*/
|
|
||||||
WORLDLOAD,
|
|
||||||
/**
|
|
||||||
* client side only
|
|
||||||
* Fired once per client tick loop.
|
|
||||||
*/
|
|
||||||
CLIENT,
|
|
||||||
/**
|
|
||||||
* client and server side.
|
|
||||||
* Fired whenever the players update loop runs.
|
|
||||||
* arg 0 : the player
|
|
||||||
* arg 1 : the world the player is in
|
|
||||||
*/
|
|
||||||
PLAYER,
|
|
||||||
/**
|
|
||||||
* server side only.
|
|
||||||
* This is the server game tick.
|
|
||||||
* Fired once per tick loop on the server.
|
|
||||||
*/
|
|
||||||
SERVER;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Partner ticks that are also cancelled by returning false from onTickInGame
|
|
||||||
*/
|
|
||||||
public EnumSet<TickType> partnerTicks()
|
|
||||||
{
|
|
||||||
if (this==CLIENT) return EnumSet.of(RENDER);
|
|
||||||
if (this==RENDER) return EnumSet.of(CLIENT);
|
|
||||||
if (this==GUI) return EnumSet.of(CLIENTGUI);
|
|
||||||
if (this==CLIENTGUI) return EnumSet.of(GUI);
|
|
||||||
return EnumSet.noneOf(TickType.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.src.NBTBase;
|
|
||||||
import net.minecraft.src.NBTTagCompound;
|
|
||||||
import net.minecraft.src.SaveHandler;
|
|
||||||
import net.minecraft.src.WorldInfo;
|
|
||||||
|
|
||||||
public interface WorldAccessContainer
|
|
||||||
{
|
|
||||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info);
|
|
||||||
public void readData(SaveHandler handler, WorldInfo info, Map<String,NBTBase> propertyMap, NBTTagCompound tag);
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package cpw.mods.fml.common;
|
|
||||||
|
|
||||||
public class WrongMinecraftVersionException extends RuntimeException
|
|
||||||
{
|
|
||||||
|
|
||||||
public ModContainer mod;
|
|
||||||
|
|
||||||
public WrongMinecraftVersionException(ModContainer mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package cpw.mods.fml.common.asm;
|
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.objectweb.asm.Type;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.BlockProxy;
|
|
||||||
import cpw.mods.fml.relauncher.IClassTransformer;
|
|
||||||
|
|
||||||
public class ASMTransformer implements IClassTransformer
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public byte[] transform(String name, byte[] bytes)
|
|
||||||
{
|
|
||||||
if ("net.minecraft.src.Block".equals(name))
|
|
||||||
{
|
|
||||||
ClassReader cr = new ClassReader(bytes);
|
|
||||||
ClassNode cn = new ClassNode(Opcodes.ASM4);
|
|
||||||
cr.accept(cn, ClassReader.EXPAND_FRAMES);
|
|
||||||
cn.interfaces.add(Type.getInternalName(BlockProxy.class));
|
|
||||||
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
|
||||||
cn.accept(cw);
|
|
||||||
return cw.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
package cpw.mods.fml.common.asm;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassVisitor;
|
|
||||||
import org.objectweb.asm.FieldVisitor;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.IFMLCallHook;
|
|
||||||
import cpw.mods.fml.relauncher.RelaunchClassLoader;
|
|
||||||
|
|
||||||
public class FMLSanityChecker implements IFMLCallHook
|
|
||||||
{
|
|
||||||
static class MLDetectorClassVisitor extends ClassVisitor
|
|
||||||
{
|
|
||||||
private boolean foundMarker = false;
|
|
||||||
private MLDetectorClassVisitor()
|
|
||||||
{
|
|
||||||
super(Opcodes.ASM4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldVisitor visitField(int arg0, String arg1, String arg2, String arg3, Object arg4)
|
|
||||||
{
|
|
||||||
if ("fmlMarker".equals(arg1))
|
|
||||||
{
|
|
||||||
foundMarker = true;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private RelaunchClassLoader cl;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void call() throws Exception
|
|
||||||
{
|
|
||||||
byte[] mlClass = cl.getClassBytes("ModLoader");
|
|
||||||
// Only care in obfuscated env
|
|
||||||
if (mlClass == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
MLDetectorClassVisitor mlTester = new MLDetectorClassVisitor();
|
|
||||||
ClassReader cr = new ClassReader(mlClass);
|
|
||||||
cr.accept(mlTester, ClassReader.SKIP_CODE);
|
|
||||||
if (!mlTester.foundMarker)
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog(null, "<html>CRITICAL ERROR<br/>" +
|
|
||||||
"ModLoader was detected in this environment<br/>" +
|
|
||||||
"ForgeModLoader cannot be installed alongside ModLoader<br/>" +
|
|
||||||
"All mods should work without ModLoader being installed<br/>" +
|
|
||||||
"Because ForgeModLoader is 100% compatible with ModLoader<br/>" +
|
|
||||||
"Re-install Minecraft Forge or Forge ModLoader into a clean<br/>" +
|
|
||||||
"jar and try again.",
|
|
||||||
"ForgeModLoader critical error",
|
|
||||||
JOptionPane.ERROR_MESSAGE);
|
|
||||||
throw new RuntimeException("Invalid ModLoader class detected");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void injectData(Map<String, Object> data)
|
|
||||||
{
|
|
||||||
cl = (RelaunchClassLoader) data.get("classLoader");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package cpw.mods.fml.common.asm;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
|
|
||||||
public @interface SideOnly
|
|
||||||
{
|
|
||||||
public Side value();
|
|
||||||
}
|
|
||||||
@@ -1,636 +0,0 @@
|
|||||||
package cpw.mods.fml.common.asm.transformers;
|
|
||||||
|
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Hashtable;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
import java.util.zip.ZipOutputStream;
|
|
||||||
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.Type;
|
|
||||||
import org.objectweb.asm.tree.AnnotationNode;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
|
|
||||||
public class MCPMerger
|
|
||||||
{
|
|
||||||
private static Hashtable<String, ClassInfo> clients = new Hashtable<String, ClassInfo>();
|
|
||||||
private static Hashtable<String, ClassInfo> shared = new Hashtable<String, ClassInfo>();
|
|
||||||
private static Hashtable<String, ClassInfo> servers = new Hashtable<String, ClassInfo>();
|
|
||||||
private static HashSet<String> copyToServer = new HashSet<String>();
|
|
||||||
private static HashSet<String> copyToClient = new HashSet<String>();
|
|
||||||
private static final boolean DEBUG = false;
|
|
||||||
|
|
||||||
public static void main(String[] args)
|
|
||||||
{
|
|
||||||
if (args.length != 3)
|
|
||||||
{
|
|
||||||
System.out.println("Usage: MCPMerger <MapFile> <minecraft.jar> <minecraft_server.jar>");
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
File map_file = new File(args[0]);
|
|
||||||
File client_jar = new File(args[1]);
|
|
||||||
File server_jar = new File(args[2]);
|
|
||||||
File client_jar_tmp = new File(args[1] + ".MergeBack");
|
|
||||||
File server_jar_tmp = new File(args[2] + ".MergeBack");
|
|
||||||
|
|
||||||
|
|
||||||
if (client_jar_tmp.exists() && !client_jar_tmp.delete())
|
|
||||||
{
|
|
||||||
System.out.println("Could not delete temp file: " + client_jar_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server_jar_tmp.exists() && !server_jar_tmp.delete())
|
|
||||||
{
|
|
||||||
System.out.println("Could not delete temp file: " + server_jar_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client_jar.exists())
|
|
||||||
{
|
|
||||||
System.out.println("Could not find minecraft.jar: " + client_jar);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!server_jar.exists())
|
|
||||||
{
|
|
||||||
System.out.println("Could not find minecraft_server.jar: " + server_jar);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client_jar.renameTo(client_jar_tmp))
|
|
||||||
{
|
|
||||||
System.out.println("Could not rename file: " + client_jar + " -> " + client_jar_tmp);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!server_jar.renameTo(server_jar_tmp))
|
|
||||||
{
|
|
||||||
System.out.println("Could not rename file: " + server_jar + " -> " + server_jar_tmp);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!readMapFile(map_file))
|
|
||||||
{
|
|
||||||
System.out.println("Could not read map file: " + map_file);
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
processJar(client_jar_tmp, server_jar_tmp, client_jar, server_jar);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!client_jar_tmp.delete())
|
|
||||||
{
|
|
||||||
System.out.println("Could not delete temp file: " + client_jar_tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!server_jar_tmp.delete())
|
|
||||||
{
|
|
||||||
System.out.println("Could not delete temp file: " + server_jar_tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean readMapFile(File mapFile)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileInputStream fstream = new FileInputStream(mapFile);
|
|
||||||
DataInputStream in = new DataInputStream(fstream);
|
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
|
||||||
|
|
||||||
String line;
|
|
||||||
while ((line = br.readLine()) != null)
|
|
||||||
{
|
|
||||||
boolean toClient = line.charAt(0) == '<';
|
|
||||||
line = line.substring(1);
|
|
||||||
if (toClient) copyToClient.add(line);
|
|
||||||
else copyToServer.add(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
System.err.println("Error: " + e.getMessage());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void processJar(File clientInFile, File serverInFile, File clientOutFile, File serverOutFile) throws IOException
|
|
||||||
{
|
|
||||||
ZipFile cInJar = null;
|
|
||||||
ZipFile sInJar = null;
|
|
||||||
ZipOutputStream cOutJar = null;
|
|
||||||
ZipOutputStream sOutJar = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cInJar = new ZipFile(clientInFile);
|
|
||||||
sInJar = new ZipFile(serverInFile);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException e)
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException("Could not open input file: " + e.getMessage());
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cOutJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(clientOutFile)));
|
|
||||||
sOutJar = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(serverOutFile)));
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException e)
|
|
||||||
{
|
|
||||||
throw new FileNotFoundException("Could not open output file: " + e.getMessage());
|
|
||||||
}
|
|
||||||
Hashtable<String, ZipEntry> cClasses = getClassEntries(cInJar, cOutJar);
|
|
||||||
Hashtable<String, ZipEntry> sClasses = getClassEntries(sInJar, sOutJar);
|
|
||||||
HashSet<String> cAdded = new HashSet<String>();
|
|
||||||
HashSet<String> sAdded = new HashSet<String>();
|
|
||||||
|
|
||||||
for (Entry<String, ZipEntry> entry : cClasses.entrySet())
|
|
||||||
{
|
|
||||||
String name = entry.getKey();
|
|
||||||
ZipEntry cEntry = entry.getValue();
|
|
||||||
ZipEntry sEntry = sClasses.get(name);
|
|
||||||
|
|
||||||
if (sEntry == null)
|
|
||||||
{
|
|
||||||
if (!copyToServer.contains(name))
|
|
||||||
{
|
|
||||||
copyClass(cInJar, cEntry, cOutJar, null, true);
|
|
||||||
cAdded.add(name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.println("Copy class c->s : " + name);
|
|
||||||
}
|
|
||||||
copyClass(cInJar, cEntry, cOutJar, sOutJar, true);
|
|
||||||
cAdded.add(name);
|
|
||||||
sAdded.add(name);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sClasses.remove(name);
|
|
||||||
ClassInfo info = new ClassInfo(name);
|
|
||||||
shared.put(name, info);
|
|
||||||
|
|
||||||
byte[] cData = readEntry(cInJar, entry.getValue());
|
|
||||||
byte[] sData = readEntry(sInJar, sEntry);
|
|
||||||
byte[] data = processClass(cData, sData, info);
|
|
||||||
|
|
||||||
ZipEntry newEntry = new ZipEntry(cEntry.getName());
|
|
||||||
cOutJar.putNextEntry(newEntry);
|
|
||||||
cOutJar.write(data);
|
|
||||||
sOutJar.putNextEntry(newEntry);
|
|
||||||
sOutJar.write(data);
|
|
||||||
cAdded.add(name);
|
|
||||||
sAdded.add(name);
|
|
||||||
}
|
|
||||||
for (Entry<String, ZipEntry> entry : sClasses.entrySet())
|
|
||||||
{
|
|
||||||
if (!copyToClient.contains(entry.getKey()))
|
|
||||||
{
|
|
||||||
copyClass(sInJar, entry.getValue(), null, sOutJar, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.println("Copy class s->c : " + entry.getKey());
|
|
||||||
}
|
|
||||||
copyClass(sInJar, entry.getValue(), cOutJar, sOutJar, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String name : new String[]{SideOnly.class.getName(), Side.class.getName()})
|
|
||||||
{
|
|
||||||
String eName = name.replace(".", "/");
|
|
||||||
byte[] data = getClassBytes(name);
|
|
||||||
ZipEntry newEntry = new ZipEntry(name.replace(".", "/").concat(".class"));
|
|
||||||
if (!cAdded.contains(eName))
|
|
||||||
{
|
|
||||||
cOutJar.putNextEntry(newEntry);
|
|
||||||
cOutJar.write(data);
|
|
||||||
}
|
|
||||||
if (!sAdded.contains(eName))
|
|
||||||
{
|
|
||||||
sOutJar.putNextEntry(newEntry);
|
|
||||||
sOutJar.write(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (cInJar != null)
|
|
||||||
{
|
|
||||||
try { cInJar.close(); } catch (IOException e){}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sInJar != null)
|
|
||||||
{
|
|
||||||
try { sInJar.close(); } catch (IOException e) {}
|
|
||||||
}
|
|
||||||
if (cOutJar != null)
|
|
||||||
{
|
|
||||||
try { cOutJar.close(); } catch (IOException e){}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sOutJar != null)
|
|
||||||
{
|
|
||||||
try { sOutJar.close(); } catch (IOException e) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void copyClass(ZipFile inJar, ZipEntry entry, ZipOutputStream outJar, ZipOutputStream outJar2, boolean isClientOnly) throws IOException
|
|
||||||
{
|
|
||||||
ClassReader reader = new ClassReader(readEntry(inJar, entry));
|
|
||||||
ClassNode classNode = new ClassNode();
|
|
||||||
|
|
||||||
reader.accept(classNode, 0);
|
|
||||||
|
|
||||||
if (!classNode.name.equals("bct")) //Special case CodecMus so I dont have to make a new patch, anyone who uses this in production code is.. bad.
|
|
||||||
{
|
|
||||||
if (classNode.visibleAnnotations == null) classNode.visibleAnnotations = new ArrayList<AnnotationNode>();
|
|
||||||
classNode.visibleAnnotations.add(getSideAnn(isClientOnly));
|
|
||||||
}
|
|
||||||
|
|
||||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
|
||||||
classNode.accept(writer);
|
|
||||||
byte[] data = writer.toByteArray();
|
|
||||||
|
|
||||||
ZipEntry newEntry = new ZipEntry(entry.getName());
|
|
||||||
if (outJar != null)
|
|
||||||
{
|
|
||||||
outJar.putNextEntry(newEntry);
|
|
||||||
outJar.write(data);
|
|
||||||
}
|
|
||||||
if (outJar2 != null)
|
|
||||||
{
|
|
||||||
outJar2.putNextEntry(newEntry);
|
|
||||||
outJar2.write(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AnnotationNode getSideAnn(boolean isClientOnly)
|
|
||||||
{
|
|
||||||
AnnotationNode ann = new AnnotationNode(Type.getDescriptor(SideOnly.class));
|
|
||||||
ann.values = new ArrayList<Object>();
|
|
||||||
ann.values.add("value");
|
|
||||||
ann.values.add(new String[]{ Type.getDescriptor(Side.class), (isClientOnly ? "CLIENT" : "SERVER")});
|
|
||||||
return ann;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static Hashtable<String, ZipEntry> getClassEntries(ZipFile inFile, ZipOutputStream outFile) throws IOException
|
|
||||||
{
|
|
||||||
Hashtable<String, ZipEntry> ret = new Hashtable<String, ZipEntry>();
|
|
||||||
for (ZipEntry entry : Collections.list((Enumeration<ZipEntry>)inFile.entries()))
|
|
||||||
{
|
|
||||||
if (entry.isDirectory())
|
|
||||||
{
|
|
||||||
outFile.putNextEntry(entry);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String entryName = entry.getName();
|
|
||||||
if (!entryName.endsWith(".class") || entryName.startsWith("."))
|
|
||||||
{
|
|
||||||
ZipEntry newEntry = new ZipEntry(entry.getName());
|
|
||||||
outFile.putNextEntry(newEntry);
|
|
||||||
outFile.write(readEntry(inFile, entry));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret.put(entryName.replace(".class", ""), entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
private static byte[] readEntry(ZipFile inFile, ZipEntry entry) throws IOException
|
|
||||||
{
|
|
||||||
return readFully(inFile.getInputStream(entry));
|
|
||||||
}
|
|
||||||
private static byte[] readFully(InputStream stream) throws IOException
|
|
||||||
{
|
|
||||||
byte[] data = new byte[4096];
|
|
||||||
ByteArrayOutputStream entryBuffer = new ByteArrayOutputStream();
|
|
||||||
int len;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
len = stream.read(data);
|
|
||||||
if (len > 0)
|
|
||||||
{
|
|
||||||
entryBuffer.write(data, 0, len);
|
|
||||||
}
|
|
||||||
} while (len != -1);
|
|
||||||
|
|
||||||
return entryBuffer.toByteArray();
|
|
||||||
}
|
|
||||||
private static class ClassInfo
|
|
||||||
{
|
|
||||||
public String name;
|
|
||||||
public ArrayList<FieldNode> cField = new ArrayList<FieldNode>();
|
|
||||||
public ArrayList<FieldNode> sField = new ArrayList<FieldNode>();
|
|
||||||
public ArrayList<MethodNode> cMethods = new ArrayList<MethodNode>();
|
|
||||||
public ArrayList<MethodNode> sMethods = new ArrayList<MethodNode>();
|
|
||||||
public ClassInfo(String name){ this.name = name; }
|
|
||||||
public boolean isSame() { return (cField.size() == 0 && sField.size() == 0 && cMethods.size() == 0 && sMethods.size() == 0); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] processClass(byte[] cIn, byte[] sIn, ClassInfo info)
|
|
||||||
{
|
|
||||||
ClassNode cClassNode = getClassNode(cIn);
|
|
||||||
ClassNode sClassNode = getClassNode(sIn);
|
|
||||||
|
|
||||||
processFields(cClassNode, sClassNode, info);
|
|
||||||
processMethods(cClassNode, sClassNode, info);
|
|
||||||
|
|
||||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
|
|
||||||
cClassNode.accept(writer);
|
|
||||||
return writer.toByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ClassNode getClassNode(byte[] data)
|
|
||||||
{
|
|
||||||
ClassReader reader = new ClassReader(data);
|
|
||||||
ClassNode classNode = new ClassNode();
|
|
||||||
reader.accept(classNode, 0);
|
|
||||||
return classNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static void processFields(ClassNode cClass, ClassNode sClass, ClassInfo info)
|
|
||||||
{
|
|
||||||
List<FieldNode> cFields = cClass.fields;
|
|
||||||
List<FieldNode> sFields = sClass.fields;
|
|
||||||
|
|
||||||
int sI = 0;
|
|
||||||
for (int x = 0; x < cFields.size(); x++)
|
|
||||||
{
|
|
||||||
FieldNode cF = cFields.get(x);
|
|
||||||
if (sI < sFields.size())
|
|
||||||
{
|
|
||||||
if (!cF.name.equals(sFields.get(sI).name))
|
|
||||||
{
|
|
||||||
boolean serverHas = false;
|
|
||||||
for (int y = sI + 1; y < sFields.size(); y++)
|
|
||||||
{
|
|
||||||
if (cF.name.equals(sFields.get(y).name))
|
|
||||||
{
|
|
||||||
serverHas = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (serverHas)
|
|
||||||
{
|
|
||||||
boolean clientHas = false;
|
|
||||||
FieldNode sF = sFields.get(sI);
|
|
||||||
for (int y = x + 1; y < cFields.size(); y++)
|
|
||||||
{
|
|
||||||
if (sF.name.equals(cFields.get(y).name))
|
|
||||||
{
|
|
||||||
clientHas = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!clientHas)
|
|
||||||
{
|
|
||||||
if (sF.visibleAnnotations == null) sF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
|
||||||
sF.visibleAnnotations.add(getSideAnn(false));
|
|
||||||
cFields.add(x++, sF);
|
|
||||||
info.sField.add(sF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cF.visibleAnnotations == null) cF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
|
||||||
cF.visibleAnnotations.add(getSideAnn(true));
|
|
||||||
sFields.add(sI, cF);
|
|
||||||
info.cField.add(cF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (cF.visibleAnnotations == null) cF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
|
||||||
cF.visibleAnnotations.add(getSideAnn(true));
|
|
||||||
sFields.add(sI, cF);
|
|
||||||
info.cField.add(cF);
|
|
||||||
}
|
|
||||||
sI++;
|
|
||||||
}
|
|
||||||
if (sFields.size() != cFields.size())
|
|
||||||
{
|
|
||||||
for (int x = cFields.size(); x < sFields.size(); x++)
|
|
||||||
{
|
|
||||||
FieldNode sF = sFields.get(x);
|
|
||||||
if (sF.visibleAnnotations == null) sF.visibleAnnotations = new ArrayList<AnnotationNode>();
|
|
||||||
sF.visibleAnnotations.add(getSideAnn(true));
|
|
||||||
cFields.add(x++, sF);
|
|
||||||
info.sField.add(sF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class MethodWrapper
|
|
||||||
{
|
|
||||||
private MethodNode node;
|
|
||||||
public boolean client;
|
|
||||||
public boolean server;
|
|
||||||
public MethodWrapper(MethodNode node)
|
|
||||||
{
|
|
||||||
this.node = node;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj == null || !(obj instanceof MethodWrapper)) return false;
|
|
||||||
MethodWrapper mw = (MethodWrapper) obj;
|
|
||||||
boolean eq = Objects.equal(node.name, mw.node.name) && Objects.equal(node.desc, mw.node.desc);
|
|
||||||
if (eq)
|
|
||||||
{
|
|
||||||
mw.client = this.client | mw.client;
|
|
||||||
mw.server = this.server | mw.server;
|
|
||||||
this.client = this.client | mw.client;
|
|
||||||
this.server = this.server | mw.server;
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.printf(" eq: %s %s\n", this, mw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return eq;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return Objects.hashCode(node.name, node.desc);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return Objects.toStringHelper(this).add("name", node.name).add("desc",node.desc).add("server",server).add("client",client).toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static void processMethods(ClassNode cClass, ClassNode sClass, ClassInfo info)
|
|
||||||
{
|
|
||||||
List<MethodNode> cMethods = (List<MethodNode>)cClass.methods;
|
|
||||||
List<MethodNode> sMethods = (List<MethodNode>)sClass.methods;
|
|
||||||
LinkedHashSet<MethodWrapper> allMethods = Sets.newLinkedHashSet();
|
|
||||||
|
|
||||||
int cPos = 0;
|
|
||||||
int sPos = 0;
|
|
||||||
int cLen = cMethods.size();
|
|
||||||
int sLen = sMethods.size();
|
|
||||||
String clientName = "";
|
|
||||||
String lastName = clientName;
|
|
||||||
String serverName = "";
|
|
||||||
while (cPos < cLen || sPos < sLen)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (sPos>=sLen)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MethodNode sM = sMethods.get(sPos);
|
|
||||||
serverName = sM.name;
|
|
||||||
if (!serverName.equals(lastName) && cPos != cLen)
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.printf("Server -skip : %s %s %d (%s %d) %d [%s]\n", sClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MethodWrapper mw = new MethodWrapper(sM);
|
|
||||||
mw.server = true;
|
|
||||||
allMethods.add(mw);
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.printf("Server *add* : %s %s %d (%s %d) %d [%s]\n", sClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
|
||||||
}
|
|
||||||
sPos++;
|
|
||||||
}
|
|
||||||
while (sPos < sLen);
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (cPos>=cLen)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MethodNode cM = cMethods.get(cPos);
|
|
||||||
lastName = clientName;
|
|
||||||
clientName = cM.name;
|
|
||||||
if (!clientName.equals(lastName) && sPos != sLen)
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.printf("Client -skip : %s %s %d (%s %d) %d [%s]\n", cClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
MethodWrapper mw = new MethodWrapper(cM);
|
|
||||||
mw.client = true;
|
|
||||||
allMethods.add(mw);
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.printf("Client *add* : %s %s %d (%s %d) %d [%s]\n", cClass.name, clientName, cLen - cPos, serverName, sLen - sPos, allMethods.size(), lastName);
|
|
||||||
}
|
|
||||||
cPos++;
|
|
||||||
}
|
|
||||||
while (cPos < cLen);
|
|
||||||
}
|
|
||||||
|
|
||||||
cMethods.clear();
|
|
||||||
sMethods.clear();
|
|
||||||
|
|
||||||
for (MethodWrapper mw : allMethods)
|
|
||||||
{
|
|
||||||
if (DEBUG)
|
|
||||||
{
|
|
||||||
System.out.println(mw);
|
|
||||||
}
|
|
||||||
cMethods.add(mw.node);
|
|
||||||
sMethods.add(mw.node);
|
|
||||||
if (mw.server && mw.client)
|
|
||||||
{
|
|
||||||
// no op
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mw.node.visibleAnnotations == null) mw.node.visibleAnnotations = Lists.newArrayListWithExpectedSize(1);
|
|
||||||
mw.node.visibleAnnotations.add(getSideAnn(mw.client));
|
|
||||||
if (mw.client)
|
|
||||||
{
|
|
||||||
info.sMethods.add(mw.node);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
info.cMethods.add(mw.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] getClassBytes(String name) throws IOException
|
|
||||||
{
|
|
||||||
InputStream classStream = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
classStream = MCPMerger.class.getResourceAsStream("/" + name.replace('.', '/').concat(".class"));
|
|
||||||
return readFully(classStream);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (classStream != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
classStream.close();
|
|
||||||
}
|
|
||||||
catch (IOException e){}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package cpw.mods.fml.common.discovery;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
public interface ITypeDiscoverer
|
|
||||||
{
|
|
||||||
public static Pattern classFile = Pattern.compile("([^\\s$]+).class$");
|
|
||||||
|
|
||||||
public List<ModContainer> discover(ModCandidate candidate, ASMDataTable table);
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package cpw.mods.fml.common.discovery.asm;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import org.objectweb.asm.Label;
|
|
||||||
import org.objectweb.asm.MethodVisitor;
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
|
|
||||||
public class ModMethodVisitor extends MethodVisitor
|
|
||||||
{
|
|
||||||
|
|
||||||
private ASMModParser discoverer;
|
|
||||||
private boolean inCode;
|
|
||||||
private LinkedList<Label> labels = Lists.newLinkedList();
|
|
||||||
private String foundProperties;
|
|
||||||
private boolean validProperties;
|
|
||||||
|
|
||||||
public ModMethodVisitor(String name, ASMModParser discoverer)
|
|
||||||
{
|
|
||||||
super(Opcodes.ASM4);
|
|
||||||
this.discoverer = discoverer;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void visitCode()
|
|
||||||
{
|
|
||||||
labels.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitLdcInsn(Object cst)
|
|
||||||
{
|
|
||||||
if (cst instanceof String && labels.size() == 1)
|
|
||||||
{
|
|
||||||
foundProperties = (String) cst;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void visitInsn(int opcode)
|
|
||||||
{
|
|
||||||
if (Opcodes.ARETURN == opcode && labels.size() == 1 && foundProperties != null)
|
|
||||||
{
|
|
||||||
validProperties = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void visitLabel(Label label)
|
|
||||||
{
|
|
||||||
labels.push(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitEnd()
|
|
||||||
{
|
|
||||||
if (validProperties)
|
|
||||||
{
|
|
||||||
discoverer.setBaseModProperties(foundProperties);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
public class FMLEvent
|
|
||||||
{
|
|
||||||
public final String getEventType()
|
|
||||||
{
|
|
||||||
return getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
|
||||||
|
|
||||||
public class FMLInitializationEvent extends FMLStateEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public FMLInitializationEvent(Object... data)
|
|
||||||
{
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModState getModState()
|
|
||||||
{
|
|
||||||
return ModState.INITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
|
||||||
|
|
||||||
public class FMLLoadCompleteEvent extends FMLStateEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public FMLLoadCompleteEvent(Object... data)
|
|
||||||
{
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModState getModState()
|
|
||||||
{
|
|
||||||
return ModState.AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
public class FMLLoadEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
|
||||||
|
|
||||||
public class FMLServerStartedEvent extends FMLStateEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public FMLServerStartedEvent(Object... data)
|
|
||||||
{
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModState getModState()
|
|
||||||
{
|
|
||||||
return ModState.AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
|
||||||
|
|
||||||
public class FMLServerStoppingEvent extends FMLStateEvent
|
|
||||||
{
|
|
||||||
|
|
||||||
public FMLServerStoppingEvent(Object... data)
|
|
||||||
{
|
|
||||||
super(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModState getModState()
|
|
||||||
{
|
|
||||||
return ModState.AVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package cpw.mods.fml.common.event;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.LoaderState.ModState;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
|
|
||||||
public abstract class FMLStateEvent extends FMLEvent
|
|
||||||
{
|
|
||||||
public FMLStateEvent(Object... data)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract ModState getModState();
|
|
||||||
|
|
||||||
public void applyModContainer(ModContainer activeContainer)
|
|
||||||
{
|
|
||||||
// NO OP
|
|
||||||
}
|
|
||||||
|
|
||||||
public Side getSide()
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().getSide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package cpw.mods.fml.common.functions;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
public final class ModIdFunction implements Function<ModContainer, String>
|
|
||||||
{
|
|
||||||
public String apply(ModContainer container)
|
|
||||||
{
|
|
||||||
return container.getModId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package cpw.mods.fml.common.functions;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
|
|
||||||
public class ModNameFunction implements Function<ModContainer, String>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public String apply(ModContainer input)
|
|
||||||
{
|
|
||||||
return input.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.GuiScreen;
|
|
||||||
import net.minecraft.src.IInventory;
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.NetClientHandler;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetServerHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import net.minecraft.src.WorldClient;
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.asm.SideOnly;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Marker interface for BaseMod
|
|
||||||
*
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface BaseModProxy
|
|
||||||
{
|
|
||||||
void modsLoaded();
|
|
||||||
|
|
||||||
void load();
|
|
||||||
|
|
||||||
String getName();
|
|
||||||
|
|
||||||
String getPriorities();
|
|
||||||
|
|
||||||
String getVersion();
|
|
||||||
|
|
||||||
boolean doTickInGUI(TickType type, boolean end, Object... tickData);
|
|
||||||
boolean doTickInGame(TickType type, boolean end, Object... tickData);
|
|
||||||
void generateSurface(World w, Random random, int i, int j);
|
|
||||||
void generateNether(World w, Random random, int i, int j);
|
|
||||||
int addFuel(int itemId, int damage);
|
|
||||||
void takenFromCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix);
|
|
||||||
void takenFromFurnace(EntityPlayer player, ItemStack item);
|
|
||||||
|
|
||||||
public abstract void onClientLogout(INetworkManager manager);
|
|
||||||
|
|
||||||
public abstract void onClientLogin(EntityPlayer player);
|
|
||||||
|
|
||||||
public abstract void serverDisconnect();
|
|
||||||
|
|
||||||
public abstract void serverConnect(NetHandler handler);
|
|
||||||
|
|
||||||
public abstract void receiveCustomPacket(Packet250CustomPayload packet);
|
|
||||||
|
|
||||||
public abstract void clientChat(String text);
|
|
||||||
|
|
||||||
public abstract void onItemPickup(EntityPlayer player, ItemStack item);
|
|
||||||
|
|
||||||
public abstract int dispenseEntity(World world, ItemStack item, Random rnd, int x, int y, int z, int xVel, int zVel, double entX,
|
|
||||||
double entY, double entZ);
|
|
||||||
|
|
||||||
public abstract void serverCustomPayload(NetServerHandler handler, Packet250CustomPayload packet);
|
|
||||||
|
|
||||||
public abstract void serverChat(NetServerHandler source, String message);
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BaseModTicker implements ITickHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
private EnumSet<TickType> ticks;
|
|
||||||
private boolean clockTickTrigger;
|
|
||||||
private boolean sendGuiTicks;
|
|
||||||
|
|
||||||
|
|
||||||
BaseModTicker(BaseModProxy mod, boolean guiTicker)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
this.ticks = EnumSet.of(TickType.WORLDLOAD);
|
|
||||||
this.sendGuiTicks = guiTicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseModTicker(EnumSet<TickType> ticks, boolean guiTicker)
|
|
||||||
{
|
|
||||||
this.ticks = ticks;
|
|
||||||
this.sendGuiTicks = guiTicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tickStart(EnumSet<TickType> types, Object... tickData)
|
|
||||||
{
|
|
||||||
tickBaseMod(types, false, tickData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tickEnd(EnumSet<TickType> types, Object... tickData)
|
|
||||||
{
|
|
||||||
tickBaseMod(types, true, tickData);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tickBaseMod(EnumSet<TickType> types, boolean end, Object... tickData)
|
|
||||||
{
|
|
||||||
if (FMLCommonHandler.instance().getSide().isClient() && ( ticks.contains(TickType.CLIENT) || ticks.contains(TickType.WORLDLOAD)))
|
|
||||||
{
|
|
||||||
EnumSet cTypes=EnumSet.copyOf(types);
|
|
||||||
if ( ( end && types.contains(TickType.CLIENT)) || types.contains(TickType.WORLDLOAD))
|
|
||||||
{
|
|
||||||
clockTickTrigger = true;
|
|
||||||
cTypes.remove(TickType.CLIENT);
|
|
||||||
cTypes.remove(TickType.WORLDLOAD);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (end && clockTickTrigger && types.contains(TickType.RENDER))
|
|
||||||
{
|
|
||||||
clockTickTrigger = false;
|
|
||||||
cTypes.remove(TickType.RENDER);
|
|
||||||
cTypes.add(TickType.CLIENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
sendTick(cTypes, end, tickData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sendTick(types, end, tickData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendTick(EnumSet<TickType> types, boolean end, Object... tickData)
|
|
||||||
{
|
|
||||||
for (TickType type : types)
|
|
||||||
{
|
|
||||||
if (!ticks.contains(type))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean keepTicking=true;
|
|
||||||
if (sendGuiTicks)
|
|
||||||
{
|
|
||||||
keepTicking = mod.doTickInGUI(type, end, tickData);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
keepTicking = mod.doTickInGame(type, end, tickData);
|
|
||||||
}
|
|
||||||
if (!keepTicking) {
|
|
||||||
ticks.remove(type);
|
|
||||||
ticks.removeAll(type.partnerTicks());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<TickType> ticks()
|
|
||||||
{
|
|
||||||
return (clockTickTrigger ? EnumSet.of(TickType.RENDER) : ticks);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return mod.getClass().getSimpleName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMod(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet250CustomPayload;
|
|
||||||
|
|
||||||
public interface IModLoaderSidedHelper
|
|
||||||
{
|
|
||||||
|
|
||||||
void finishModLoading(ModLoaderModContainer mc);
|
|
||||||
|
|
||||||
Object getClientGui(BaseModProxy mod, EntityPlayer player, int iD, int x, int y, int z);
|
|
||||||
|
|
||||||
Entity spawnEntity(BaseModProxy mod, EntitySpawnPacket input, EntityRegistration registration);
|
|
||||||
|
|
||||||
void sendClientPacket(BaseModProxy mod, Packet250CustomPayload packet);
|
|
||||||
|
|
||||||
void clientConnectionOpened(NetHandler netClientHandler, INetworkManager manager, BaseModProxy mod);
|
|
||||||
|
|
||||||
boolean clientConnectionClosed(INetworkManager manager, BaseModProxy mod);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetServerHandler;
|
|
||||||
import net.minecraft.src.Packet3Chat;
|
|
||||||
import cpw.mods.fml.common.network.IChatListener;
|
|
||||||
|
|
||||||
public class ModLoaderChatListener implements IChatListener
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
|
|
||||||
public ModLoaderChatListener(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet3Chat serverChat(NetHandler handler, Packet3Chat message)
|
|
||||||
{
|
|
||||||
mod.serverChat((NetServerHandler)handler, message.field_73476_b);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Packet3Chat clientChat(NetHandler handler, Packet3Chat message)
|
|
||||||
{
|
|
||||||
mod.clientChat(message.field_73476_b);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.NetHandler;
|
|
||||||
import net.minecraft.src.NetLoginHandler;
|
|
||||||
import net.minecraft.src.INetworkManager;
|
|
||||||
import net.minecraft.src.Packet1Login;
|
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
|
||||||
import cpw.mods.fml.common.network.Player;
|
|
||||||
|
|
||||||
public class ModLoaderConnectionHandler implements IConnectionHandler
|
|
||||||
{
|
|
||||||
private BaseModProxy mod;
|
|
||||||
|
|
||||||
public ModLoaderConnectionHandler(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
|
||||||
{
|
|
||||||
mod.onClientLogin((EntityPlayer)player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionClosed(INetworkManager manager)
|
|
||||||
{
|
|
||||||
if (!ModLoaderHelper.sidedHelper.clientConnectionClosed(manager, mod))
|
|
||||||
{
|
|
||||||
mod.serverDisconnect();
|
|
||||||
mod.onClientLogout(manager);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clientLoggedIn(NetHandler nh, INetworkManager manager, Packet1Login login)
|
|
||||||
{
|
|
||||||
mod.serverConnect(nh);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.sidedHelper.clientConnectionOpened(netClientHandler, manager, mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.IInventory;
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import cpw.mods.fml.common.ICraftingHandler;
|
|
||||||
|
|
||||||
public class ModLoaderCraftingHelper implements ICraftingHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
|
|
||||||
public ModLoaderCraftingHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
|
||||||
{
|
|
||||||
mod.takenFromCrafting(player, item, craftMatrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSmelting(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
mod.takenFromFurnace(player, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import cpw.mods.fml.common.IDispenseHandler;
|
|
||||||
import cpw.mods.fml.common.IDispenserHandler;
|
|
||||||
|
|
||||||
public class ModLoaderDispenseHelper implements IDispenserHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
|
|
||||||
public ModLoaderDispenseHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int dispense(int x, int y, int z, int xVelocity, int zVelocity, World world, ItemStack item, Random random, double entX, double entY,
|
|
||||||
double entZ)
|
|
||||||
{
|
|
||||||
int ret = mod.dispenseEntity(world, item, random, x, y, z, xVelocity, zVelocity, entX, entY, entZ);
|
|
||||||
return ret == 0 ? -1 : ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.common.network.EntitySpawnPacket;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|
||||||
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
|
|
||||||
public class ModLoaderEntitySpawnCallback implements Function<EntitySpawnPacket, Entity>
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
private EntityRegistration registration;
|
|
||||||
private boolean isAnimal;
|
|
||||||
|
|
||||||
public ModLoaderEntitySpawnCallback(BaseModProxy mod, EntityRegistration er)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
this.registration = er;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity apply(EntitySpawnPacket input)
|
|
||||||
{
|
|
||||||
return ModLoaderHelper.sidedHelper.spawnEntity(mod, input, registration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.src.ItemStack;
|
|
||||||
import cpw.mods.fml.common.IFuelHandler;
|
|
||||||
|
|
||||||
public class ModLoaderFuelHelper implements IFuelHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
|
|
||||||
public ModLoaderFuelHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getBurnTime(ItemStack fuel)
|
|
||||||
{
|
|
||||||
return mod.addFuel(fuel.field_77993_c, fuel.field_77993_c);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import net.minecraft.src.Container;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.World;
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
|
|
||||||
public class ModLoaderGuiHelper implements IGuiHandler
|
|
||||||
{
|
|
||||||
|
|
||||||
private BaseModProxy mod;
|
|
||||||
private int id;
|
|
||||||
private Container container;
|
|
||||||
|
|
||||||
ModLoaderGuiHelper(BaseModProxy mod, int id)
|
|
||||||
{
|
|
||||||
this.mod = mod;
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
|
||||||
{
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
|
||||||
{
|
|
||||||
return ModLoaderHelper.getClientSideGui(mod, player, ID, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void injectContainer(Container container)
|
|
||||||
{
|
|
||||||
this.container = container;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getMod()
|
|
||||||
{
|
|
||||||
return mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,206 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
|
||||||
import com.google.common.collect.ListMultimap;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
|
|
||||||
import net.minecraft.src.BaseMod;
|
|
||||||
import net.minecraft.src.Container;
|
|
||||||
import net.minecraft.src.Entity;
|
|
||||||
import net.minecraft.src.EntityDragon;
|
|
||||||
import net.minecraft.src.EntityPlayer;
|
|
||||||
import net.minecraft.src.IAnimals;
|
|
||||||
import net.minecraft.src.ICommand;
|
|
||||||
import net.minecraft.src.TradeEntry;
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.ICraftingHandler;
|
|
||||||
import cpw.mods.fml.common.IDispenseHandler;
|
|
||||||
import cpw.mods.fml.common.IDispenserHandler;
|
|
||||||
import cpw.mods.fml.common.IFuelHandler;
|
|
||||||
import cpw.mods.fml.common.IPickupNotifier;
|
|
||||||
import cpw.mods.fml.common.IWorldGenerator;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.network.IChatListener;
|
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
|
||||||
import cpw.mods.fml.common.network.IGuiHandler;
|
|
||||||
import cpw.mods.fml.common.network.IPacketHandler;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
|
||||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
|
||||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author cpw
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public class ModLoaderHelper
|
|
||||||
{
|
|
||||||
public static IModLoaderSidedHelper sidedHelper;
|
|
||||||
|
|
||||||
private static Map<Integer, ModLoaderGuiHelper> guiHelpers = Maps.newHashMap();
|
|
||||||
|
|
||||||
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
|
||||||
BaseModTicker ticker = mlmc.getGameTickHandler();
|
|
||||||
EnumSet<TickType> ticks = ticker.ticks();
|
|
||||||
// If we're enabled we get render ticks
|
|
||||||
if (enable && !useClock) {
|
|
||||||
ticks.add(TickType.RENDER);
|
|
||||||
} else {
|
|
||||||
ticks.remove(TickType.RENDER);
|
|
||||||
}
|
|
||||||
// If we're enabled but we want clock ticks, or we're server side we get game ticks
|
|
||||||
if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) {
|
|
||||||
ticks.add(TickType.CLIENT);
|
|
||||||
ticks.add(TickType.WORLDLOAD);
|
|
||||||
} else {
|
|
||||||
ticks.remove(TickType.CLIENT);
|
|
||||||
ticks.remove(TickType.WORLDLOAD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock)
|
|
||||||
{
|
|
||||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
|
||||||
EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks();
|
|
||||||
// If we're enabled and we don't want clock ticks we get render ticks
|
|
||||||
if (enable && !useClock) {
|
|
||||||
ticks.add(TickType.RENDER);
|
|
||||||
} else {
|
|
||||||
ticks.remove(TickType.RENDER);
|
|
||||||
}
|
|
||||||
// If we're enabled but we want clock ticks, or we're server side we get world ticks
|
|
||||||
if (enable && useClock) {
|
|
||||||
ticks.add(TickType.CLIENT);
|
|
||||||
ticks.add(TickType.WORLDLOAD);
|
|
||||||
} else {
|
|
||||||
ticks.remove(TickType.CLIENT);
|
|
||||||
ticks.remove(TickType.WORLDLOAD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IPacketHandler buildPacketHandlerFor(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderPacketHandler(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IWorldGenerator buildWorldGenHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderWorldGenerator(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IFuelHandler buildFuelHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderFuelHelper(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ICraftingHandler buildCraftingHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderCraftingHelper(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void finishModLoading(ModLoaderModContainer mc)
|
|
||||||
{
|
|
||||||
if (sidedHelper != null)
|
|
||||||
{
|
|
||||||
sidedHelper.finishModLoading(mc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IConnectionHandler buildConnectionHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderConnectionHandler(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IPickupNotifier buildPickupHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderPickupNotifier(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void buildGuiHelper(BaseModProxy mod, int id)
|
|
||||||
{
|
|
||||||
ModLoaderGuiHelper handler = new ModLoaderGuiHelper(mod, id);
|
|
||||||
guiHelpers.put(id, handler);
|
|
||||||
NetworkRegistry.instance().registerGuiHandler(mod, handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void openGui(int id, EntityPlayer player, Container container, int x, int y, int z)
|
|
||||||
{
|
|
||||||
ModLoaderGuiHelper helper = guiHelpers.get(id);
|
|
||||||
helper.injectContainer(container);
|
|
||||||
player.openGui(helper.getMod(), id, player.field_70170_p, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Object getClientSideGui(BaseModProxy mod, EntityPlayer player, int ID, int x, int y, int z)
|
|
||||||
{
|
|
||||||
if (sidedHelper != null)
|
|
||||||
{
|
|
||||||
return sidedHelper.getClientGui(mod, player, ID, x, y, z);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDispenserHandler buildDispenseHelper(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderDispenseHelper(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void buildEntityTracker(BaseModProxy mod, Class<? extends Entity> entityClass, int entityTypeId, int updateRange, int updateInterval,
|
|
||||||
boolean sendVelocityInfo)
|
|
||||||
{
|
|
||||||
EntityRegistration er = EntityRegistry.registerModLoaderEntity(mod, entityClass, entityTypeId, updateRange, updateInterval, sendVelocityInfo);
|
|
||||||
er.setCustomSpawning(new ModLoaderEntitySpawnCallback(mod, er), EntityDragon.class.isAssignableFrom(entityClass) || IAnimals.class.isAssignableFrom(entityClass));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ModLoaderVillageTradeHandler[] tradeHelpers = new ModLoaderVillageTradeHandler[6];
|
|
||||||
|
|
||||||
public static void registerTrade(int profession, TradeEntry entry)
|
|
||||||
{
|
|
||||||
assert profession < tradeHelpers.length : "The profession is out of bounds";
|
|
||||||
if (tradeHelpers[profession] == null)
|
|
||||||
{
|
|
||||||
tradeHelpers[profession] = new ModLoaderVillageTradeHandler();
|
|
||||||
VillagerRegistry.instance().registerVillageTradeHandler(profession, tradeHelpers[profession]);
|
|
||||||
}
|
|
||||||
|
|
||||||
tradeHelpers[profession].addTrade(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addCommand(ICommand command)
|
|
||||||
{
|
|
||||||
ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer();
|
|
||||||
if (mlmc!=null)
|
|
||||||
{
|
|
||||||
mlmc.addServerCommand(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IChatListener buildChatListener(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return new ModLoaderChatListener(mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,619 +0,0 @@
|
|||||||
/*
|
|
||||||
* The FML Forge Mod Loader suite.
|
|
||||||
* Copyright (C) 2012 cpw
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
|
|
||||||
* Software Foundation; either version 2.1 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
package cpw.mods.fml.common.modloader;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.src.ICommand;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.google.common.eventbus.EventBus;
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
|
||||||
import cpw.mods.fml.common.FMLLog;
|
|
||||||
import cpw.mods.fml.common.LoadController;
|
|
||||||
import cpw.mods.fml.common.Loader;
|
|
||||||
import cpw.mods.fml.common.LoaderException;
|
|
||||||
import cpw.mods.fml.common.MetadataCollection;
|
|
||||||
import cpw.mods.fml.common.ModClassLoader;
|
|
||||||
import cpw.mods.fml.common.ModContainer;
|
|
||||||
import cpw.mods.fml.common.ModMetadata;
|
|
||||||
import cpw.mods.fml.common.ProxyInjector;
|
|
||||||
import cpw.mods.fml.common.Side;
|
|
||||||
import cpw.mods.fml.common.TickType;
|
|
||||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
|
||||||
import cpw.mods.fml.common.discovery.ASMDataTable.ASMData;
|
|
||||||
import cpw.mods.fml.common.discovery.ContainerType;
|
|
||||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
|
||||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import cpw.mods.fml.common.registry.TickRegistry;
|
|
||||||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
|
||||||
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
|
||||||
import cpw.mods.fml.common.versioning.VersionRange;
|
|
||||||
|
|
||||||
public class ModLoaderModContainer implements ModContainer
|
|
||||||
{
|
|
||||||
public BaseModProxy mod;
|
|
||||||
private File modSource;
|
|
||||||
public Set<ArtifactVersion> requirements = Sets.newHashSet();
|
|
||||||
public ArrayList<ArtifactVersion> dependencies = Lists.newArrayList();
|
|
||||||
public ArrayList<ArtifactVersion> dependants = Lists.newArrayList();
|
|
||||||
private ContainerType sourceType;
|
|
||||||
private ModMetadata metadata;
|
|
||||||
private ProxyInjector sidedProxy;
|
|
||||||
private BaseModTicker gameTickHandler;
|
|
||||||
private BaseModTicker guiTickHandler;
|
|
||||||
private String modClazzName;
|
|
||||||
private String modId;
|
|
||||||
private EventBus bus;
|
|
||||||
private LoadController controller;
|
|
||||||
private boolean enabled = true;
|
|
||||||
private String sortingProperties;
|
|
||||||
private ArtifactVersion processedVersion;
|
|
||||||
private boolean isNetworkMod;
|
|
||||||
private List<ICommand> serverCommands = Lists.newArrayList();
|
|
||||||
|
|
||||||
public ModLoaderModContainer(String className, File modSource, String sortingProperties)
|
|
||||||
{
|
|
||||||
this.modClazzName = className;
|
|
||||||
this.modSource = modSource;
|
|
||||||
this.modId = className.contains(".") ? className.substring(className.lastIndexOf('.')+1) : className;
|
|
||||||
this.sortingProperties = Strings.isNullOrEmpty(sortingProperties) ? "" : sortingProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We only instantiate this for "not mod mods"
|
|
||||||
* @param instance
|
|
||||||
*/
|
|
||||||
ModLoaderModContainer(BaseModProxy instance) {
|
|
||||||
this.mod=instance;
|
|
||||||
this.gameTickHandler = new BaseModTicker(instance, false);
|
|
||||||
this.guiTickHandler = new BaseModTicker(instance, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void configureMod(Class<? extends BaseModProxy> modClazz, ASMDataTable asmData)
|
|
||||||
{
|
|
||||||
File configDir = Loader.instance().getConfigDir();
|
|
||||||
File modConfig = new File(configDir, String.format("%s.cfg", getModId()));
|
|
||||||
Properties props = new Properties();
|
|
||||||
|
|
||||||
boolean existingConfigFound = false;
|
|
||||||
boolean mlPropFound = false;
|
|
||||||
|
|
||||||
if (modConfig.exists())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FMLLog.fine("Reading existing configuration file for %s : %s", getModId(), modConfig.getName());
|
|
||||||
FileReader configReader = new FileReader(modConfig);
|
|
||||||
props.load(configReader);
|
|
||||||
configReader.close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "Error occured reading mod configuration file %s", modConfig.getName());
|
|
||||||
throw new LoaderException(e);
|
|
||||||
}
|
|
||||||
existingConfigFound = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer comments = new StringBuffer();
|
|
||||||
comments.append("MLProperties: name (type:default) min:max -- information\n");
|
|
||||||
|
|
||||||
|
|
||||||
List<ModProperty> mlPropFields = Lists.newArrayList();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (ASMData dat : Sets.union(asmData.getAnnotationsFor(this).get("net.minecraft.src.MLProp"), asmData.getAnnotationsFor(this).get("MLProp")))
|
|
||||||
{
|
|
||||||
if (dat.getClassName().equals(modClazzName))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mlPropFields.add(new ModProperty(modClazz.getDeclaredField(dat.getObjectName()), dat.getAnnotationInfo()));
|
|
||||||
FMLLog.finest("Found an MLProp field %s in %s", dat.getObjectName(), getModId());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.WARNING, e, "An error occured trying to access field %s in mod %s", dat.getObjectName(), getModId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (ModProperty property : mlPropFields)
|
|
||||||
{
|
|
||||||
if (!Modifier.isStatic(property.field().getModifiers()))
|
|
||||||
{
|
|
||||||
FMLLog.info("The MLProp field %s in mod %s appears not to be static", property.field().getName(), getModId());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
FMLLog.finest("Considering MLProp field %s", property.field().getName());
|
|
||||||
Field f = property.field();
|
|
||||||
String propertyName = !Strings.nullToEmpty(property.name()).isEmpty() ? property.name() : f.getName();
|
|
||||||
String propertyValue = null;
|
|
||||||
Object defaultValue = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
defaultValue = f.get(null);
|
|
||||||
propertyValue = props.getProperty(propertyName, extractValue(defaultValue));
|
|
||||||
Object currentValue = parseValue(propertyValue, property, f.getType(), propertyName);
|
|
||||||
FMLLog.finest("Configuration for %s.%s found values default: %s, configured: %s, interpreted: %s", modClazzName, propertyName, defaultValue, propertyValue, currentValue);
|
|
||||||
|
|
||||||
if (currentValue != null && !currentValue.equals(defaultValue))
|
|
||||||
{
|
|
||||||
FMLLog.finest("Configuration for %s.%s value set to: %s", modClazzName, propertyName, currentValue);
|
|
||||||
f.set(null, currentValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "Invalid configuration found for %s in %s", propertyName, modConfig.getName());
|
|
||||||
throw new LoaderException(e);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
comments.append(String.format("MLProp : %s (%s:%s", propertyName, f.getType().getName(), defaultValue));
|
|
||||||
|
|
||||||
if (property.min() != Double.MIN_VALUE)
|
|
||||||
{
|
|
||||||
comments.append(",>=").append(String.format("%.1f", property.min()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property.max() != Double.MAX_VALUE)
|
|
||||||
{
|
|
||||||
comments.append(",<=").append(String.format("%.1f", property.max()));
|
|
||||||
}
|
|
||||||
|
|
||||||
comments.append(")");
|
|
||||||
|
|
||||||
if (!Strings.nullToEmpty(property.info()).isEmpty())
|
|
||||||
{
|
|
||||||
comments.append(" -- ").append(property.info());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (propertyValue != null)
|
|
||||||
{
|
|
||||||
props.setProperty(propertyName, extractValue(propertyValue));
|
|
||||||
}
|
|
||||||
comments.append("\n");
|
|
||||||
}
|
|
||||||
mlPropFound = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (!mlPropFound && !existingConfigFound)
|
|
||||||
{
|
|
||||||
FMLLog.fine("No MLProp configuration for %s found or required. No file written", getModId());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mlPropFound && existingConfigFound)
|
|
||||||
{
|
|
||||||
File mlPropBackup = new File(modConfig.getParent(),modConfig.getName()+".bak");
|
|
||||||
FMLLog.fine("MLProp configuration file for %s found but not required. Attempting to rename file to %s", getModId(), mlPropBackup.getName());
|
|
||||||
boolean renamed = modConfig.renameTo(mlPropBackup);
|
|
||||||
if (renamed)
|
|
||||||
{
|
|
||||||
FMLLog.fine("Unused MLProp configuration file for %s renamed successfully to %s", getModId(), mlPropBackup.getName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FMLLog.fine("Unused MLProp configuration file for %s renamed UNSUCCESSFULLY to %s", getModId(), mlPropBackup.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileWriter configWriter = new FileWriter(modConfig);
|
|
||||||
props.store(configWriter, comments.toString());
|
|
||||||
configWriter.close();
|
|
||||||
FMLLog.fine("Configuration for %s written to %s", getModId(), modConfig.getName());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.SEVERE, e, "Error trying to write the config file %s", modConfig.getName());
|
|
||||||
throw new LoaderException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Object parseValue(String val, ModProperty property, Class<?> type, String propertyName)
|
|
||||||
{
|
|
||||||
if (type.isAssignableFrom(String.class))
|
|
||||||
{
|
|
||||||
return (String)val;
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Boolean.TYPE) || type.isAssignableFrom(Boolean.class))
|
|
||||||
{
|
|
||||||
return Boolean.parseBoolean(val);
|
|
||||||
}
|
|
||||||
else if (Number.class.isAssignableFrom(type) || type.isPrimitive())
|
|
||||||
{
|
|
||||||
Number n = null;
|
|
||||||
|
|
||||||
if (type.isAssignableFrom(Double.TYPE) || Double.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Double.parseDouble(val);
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Float.TYPE) || Float.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Float.parseFloat(val);
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Long.TYPE) || Long.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Long.parseLong(val);
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Integer.TYPE) || Integer.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Integer.parseInt(val);
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Short.TYPE) || Short.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Short.parseShort(val);
|
|
||||||
}
|
|
||||||
else if (type.isAssignableFrom(Byte.TYPE) || Byte.class.isAssignableFrom(type))
|
|
||||||
{
|
|
||||||
n = Byte.parseByte(val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException(String.format("MLProp declared on %s of type %s, an unsupported type",propertyName, type.getName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
double dVal = n.doubleValue();
|
|
||||||
if ((property.min()!=Double.MIN_VALUE && dVal < property.min()) || (property.max()!=Double.MAX_VALUE && dVal > property.max()))
|
|
||||||
{
|
|
||||||
FMLLog.warning("Configuration for %s.%s found value %s outside acceptable range %s,%s", modClazzName,propertyName, n, property.min(), property.max());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalArgumentException(String.format("MLProp declared on %s of type %s, an unsupported type",propertyName, type.getName()));
|
|
||||||
}
|
|
||||||
private String extractValue(Object value)
|
|
||||||
{
|
|
||||||
if (String.class.isInstance(value))
|
|
||||||
{
|
|
||||||
return (String)value;
|
|
||||||
}
|
|
||||||
else if (Number.class.isInstance(value) || Boolean.class.isInstance(value))
|
|
||||||
{
|
|
||||||
return String.valueOf(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("MLProp declared on non-standard type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return mod != null ? mod.getName() : modId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static ModContainer findContainerFor(BaseModProxy mod)
|
|
||||||
{
|
|
||||||
return FMLCommonHandler.instance().findContainerFor(mod);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSortingRules()
|
|
||||||
{
|
|
||||||
return sortingProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches(Object mod)
|
|
||||||
{
|
|
||||||
return this.mod == mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find all the BaseMods in the system
|
|
||||||
* @param <A>
|
|
||||||
*/
|
|
||||||
public static <A extends BaseModProxy> List<A> findAll(Class<A> clazz)
|
|
||||||
{
|
|
||||||
ArrayList<A> modList = new ArrayList<A>();
|
|
||||||
|
|
||||||
for (ModContainer mc : Loader.instance().getActiveModList())
|
|
||||||
{
|
|
||||||
if (mc instanceof ModLoaderModContainer && mc.getMod()!=null)
|
|
||||||
{
|
|
||||||
modList.add((A)((ModLoaderModContainer)mc).mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return modList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getSource()
|
|
||||||
{
|
|
||||||
return modSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getMod()
|
|
||||||
{
|
|
||||||
return mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<ArtifactVersion> getRequirements()
|
|
||||||
{
|
|
||||||
return requirements;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ArtifactVersion> getDependants()
|
|
||||||
{
|
|
||||||
return dependants;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ArtifactVersion> getDependencies()
|
|
||||||
{
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return modId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ModMetadata getMetadata()
|
|
||||||
{
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVersion()
|
|
||||||
{
|
|
||||||
if (mod == null || mod.getVersion() == null)
|
|
||||||
{
|
|
||||||
return "Not available";
|
|
||||||
}
|
|
||||||
return mod.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseModTicker getGameTickHandler()
|
|
||||||
{
|
|
||||||
return this.gameTickHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseModTicker getGUITickHandler()
|
|
||||||
{
|
|
||||||
return this.guiTickHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModId()
|
|
||||||
{
|
|
||||||
return modId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bindMetadata(MetadataCollection mc)
|
|
||||||
{
|
|
||||||
Map<String, Object> dummyMetadata = ImmutableMap.<String,Object>builder().put("name", modId).put("version", "1.0").build();
|
|
||||||
this.metadata = mc.getMetadataForId(modId, dummyMetadata);
|
|
||||||
Loader.instance().computeDependencies(sortingProperties, getRequirements(), getDependencies(), getDependants());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEnabledState(boolean enabled)
|
|
||||||
{
|
|
||||||
this.enabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean registerBus(EventBus bus, LoadController controller)
|
|
||||||
{
|
|
||||||
if (this.enabled)
|
|
||||||
{
|
|
||||||
FMLLog.fine("Enabling mod %s", getModId());
|
|
||||||
this.bus = bus;
|
|
||||||
this.controller = controller;
|
|
||||||
bus.register(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lifecycle mod events
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void constructMod(FMLConstructionEvent event)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ModClassLoader modClassLoader = event.getModClassLoader();
|
|
||||||
modClassLoader.addFile(modSource);
|
|
||||||
EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
|
|
||||||
this.gameTickHandler = new BaseModTicker(ticks, false);
|
|
||||||
this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
|
|
||||||
Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
|
|
||||||
configureMod(modClazz, event.getASMHarvestedData());
|
|
||||||
isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
|
|
||||||
ModLoaderNetworkHandler dummyHandler = null;
|
|
||||||
if (!isNetworkMod)
|
|
||||||
{
|
|
||||||
FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
|
|
||||||
dummyHandler = new ModLoaderNetworkHandler(this);
|
|
||||||
FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
|
|
||||||
}
|
|
||||||
Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
|
|
||||||
ctor.setAccessible(true);
|
|
||||||
mod = modClazz.newInstance();
|
|
||||||
if (dummyHandler != null)
|
|
||||||
{
|
|
||||||
dummyHandler.setBaseMod(mod);
|
|
||||||
}
|
|
||||||
ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide());
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
controller.errorOccurred(this, e);
|
|
||||||
Throwables.propagateIfPossible(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.gameTickHandler.setMod(mod);
|
|
||||||
this.guiTickHandler.setMod(mod);
|
|
||||||
TickRegistry.registerTickHandler(this.gameTickHandler, Side.CLIENT);
|
|
||||||
TickRegistry.registerTickHandler(this.guiTickHandler, Side.CLIENT);
|
|
||||||
GameRegistry.registerWorldGenerator(ModLoaderHelper.buildWorldGenHelper(mod));
|
|
||||||
GameRegistry.registerFuelHandler(ModLoaderHelper.buildFuelHelper(mod));
|
|
||||||
GameRegistry.registerCraftingHandler(ModLoaderHelper.buildCraftingHelper(mod));
|
|
||||||
GameRegistry.registerPickupHandler(ModLoaderHelper.buildPickupHelper(mod));
|
|
||||||
GameRegistry.registerDispenserHandler(ModLoaderHelper.buildDispenseHelper(mod));
|
|
||||||
NetworkRegistry.instance().registerChatListener(ModLoaderHelper.buildChatListener(mod));
|
|
||||||
NetworkRegistry.instance().registerConnectionHandler(ModLoaderHelper.buildConnectionHelper(mod));
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
controller.errorOccurred(this, e);
|
|
||||||
Throwables.propagateIfPossible(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void init(FMLInitializationEvent event)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mod.load();
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
controller.errorOccurred(this, t);
|
|
||||||
Throwables.propagateIfPossible(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void postInit(FMLPostInitializationEvent event)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mod.modsLoaded();
|
|
||||||
}
|
|
||||||
catch (Throwable t)
|
|
||||||
{
|
|
||||||
controller.errorOccurred(this, t);
|
|
||||||
Throwables.propagateIfPossible(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void loadComplete(FMLLoadCompleteEvent complete)
|
|
||||||
{
|
|
||||||
ModLoaderHelper.finishModLoading(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void serverStarting(FMLServerStartingEvent evt)
|
|
||||||
{
|
|
||||||
for (ICommand cmd : serverCommands)
|
|
||||||
{
|
|
||||||
evt.registerServerCommand(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public ArtifactVersion getProcessedVersion()
|
|
||||||
{
|
|
||||||
if (processedVersion == null)
|
|
||||||
{
|
|
||||||
processedVersion = new DefaultArtifactVersion(modId, getVersion());
|
|
||||||
}
|
|
||||||
return processedVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isImmutable()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNetworkMod()
|
|
||||||
{
|
|
||||||
return this.isNetworkMod;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDisplayVersion()
|
|
||||||
{
|
|
||||||
return metadata!=null ? metadata.version : getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addServerCommand(ICommand command)
|
|
||||||
{
|
|
||||||
serverCommands .add(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VersionRange acceptableMinecraftVersionRange()
|
|
||||||
{
|
|
||||||
return Loader.instance().getMinecraftModContainer().getStaticVersionRange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loaded 100 of 517 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user