mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab39b7e4e0 | ||
|
|
a420927007 | ||
|
|
7581ead65f | ||
|
|
146b08a8cd | ||
|
|
67121d9ebc | ||
|
|
6eba0ebb93 | ||
|
|
39eb036b0e | ||
|
|
8b6ef01ecc | ||
|
|
c4b0fea9ee | ||
|
|
698b1558cd | ||
|
|
bfcce919b9 | ||
|
|
4380ca026e | ||
|
|
f6a378e136 | ||
|
|
dcabad2bd1 | ||
|
|
64bf7bb3be | ||
|
|
fb88b021c5 | ||
|
|
d899f8fb84 | ||
|
|
5328701219 | ||
|
|
bca990cc93 | ||
|
|
9d34bbece7 | ||
|
|
0cbc685d3c | ||
|
|
0923c2c2b8 | ||
|
|
30e44e19e9 | ||
|
|
51271dcc3a | ||
|
|
7ddc5469b4 | ||
|
|
3c936e88f2 | ||
|
|
53275ff0ac | ||
|
|
f6dc40c07d | ||
|
|
959eaf0218 | ||
|
|
005e0c8451 | ||
|
|
7916a21682 | ||
|
|
ae1321b8c8 | ||
|
|
4aaabdd0e0 | ||
|
|
9d95952dc1 | ||
|
|
fd859812eb | ||
|
|
d8cb28911c | ||
|
|
ca2d49b4cd | ||
|
|
0b41756125 | ||
|
|
ecd4a259ec | ||
|
|
bf66e45699 | ||
|
|
a6c6a79916 | ||
|
|
7c79a4226f | ||
|
|
66018bd168 | ||
|
|
924db0ff03 | ||
|
|
08960ffb7b | ||
|
|
f9955efb08 | ||
|
|
fd3f948e4c | ||
|
|
309fe700cd | ||
|
|
4cc11b220a | ||
|
|
27524a02ae | ||
|
|
44b21681e2 | ||
|
|
f2b1622355 | ||
|
|
0c11a1544f | ||
|
|
cf81ad7b15 | ||
|
|
b417594e71 | ||
|
|
42938a1e7f | ||
|
|
134fbaa1ff | ||
|
|
1fc1570663 | ||
|
|
07db77401d | ||
|
|
c683bce659 | ||
|
|
59df94bd90 | ||
|
|
4caf09cd33 | ||
|
|
6ff24351d3 | ||
|
|
9f4ef7b38a | ||
|
|
7cc7056c57 | ||
|
|
2a02804379 | ||
|
|
c539d5389a | ||
|
|
b4779be2f6 | ||
|
|
cbcdbf56bb | ||
|
|
d6d4735a70 | ||
|
|
6bb769268f | ||
|
|
5de6cf571c | ||
|
|
f35a53bad5 | ||
|
|
10efdbc085 | ||
|
|
dcefcc9047 | ||
|
|
d48f4d0a94 | ||
|
|
aa07fa4443 | ||
|
|
d879b2c70d | ||
|
|
17e5480b6e | ||
|
|
a059a9a7fb | ||
|
|
8dc71d5ffa | ||
|
|
b9c2968c0e | ||
|
|
0edeb1e04b | ||
|
|
dce17105ea | ||
|
|
277fc4ea7d | ||
|
|
53659fca06 | ||
|
|
0e91787efb | ||
|
|
a5358eb916 | ||
|
|
5b82e18afc | ||
|
|
47305ff691 | ||
|
|
ef0e0d7393 | ||
|
|
a8cce392ab | ||
|
|
bcaf8b7e79 | ||
|
|
31e330090a | ||
|
|
2af2795288 | ||
|
|
5aa313cf00 | ||
|
|
46dfaa6d0c | ||
|
|
6283e9327e | ||
|
|
9c2f0ddfad | ||
|
|
619ceefa49 | ||
|
|
8af641a86d | ||
|
|
ae4f979318 | ||
|
|
3aef547046 | ||
|
|
ff36d4f1d3 | ||
|
|
de5daadf11 | ||
|
|
38275c8232 | ||
|
|
b0190bb50d | ||
|
|
3c51b1a8c8 | ||
|
|
676ecab52e | ||
|
|
6da8a19094 | ||
|
|
9879143b96 | ||
|
|
37f91681d9 | ||
|
|
7cff6f4c80 | ||
|
|
9ccf454b88 | ||
|
|
97f715bf6d | ||
|
|
647e476c8f | ||
|
|
f9c68bba81 | ||
|
|
e2ae05ccb6 | ||
|
|
71cb9dfe52 | ||
|
|
69700d2227 | ||
|
|
a7ce64dfbc | ||
|
|
126d7e3ebe | ||
|
|
da39ed066c | ||
|
|
d9865fed66 | ||
|
|
de521cf531 | ||
|
|
24989689b3 | ||
|
|
0d93bec5e7 | ||
|
|
fa7ff7c6e7 | ||
|
|
1dadcb12be | ||
|
|
53294b843b | ||
|
|
ba69a1a6fd | ||
|
|
6fafbf3b09 | ||
|
|
016e303379 | ||
|
|
5d01fa55b1 | ||
|
|
2519822b25 | ||
|
|
6f693206de | ||
|
|
948f7145d1 | ||
|
|
f590ce8641 | ||
|
|
261ba628df | ||
|
|
ce8882e89c | ||
|
|
98285e4df6 | ||
|
|
22609b1d54 | ||
|
|
5131aed7bd | ||
|
|
d2682ab969 | ||
|
|
4600b015d9 | ||
|
|
63140bcf7f | ||
|
|
ec0691538f | ||
|
|
68fd0049fb | ||
|
|
7cd820d855 | ||
|
|
5f8d501ed6 | ||
|
|
224987aa83 | ||
|
|
dae471e7d7 | ||
|
|
cd2982f9b1 | ||
|
|
10192959f9 | ||
|
|
eeb701cb16 | ||
|
|
bc8374d71c | ||
|
|
7a1de8c13d | ||
|
|
7170a8c4c6 | ||
|
|
2affeae979 | ||
|
|
cc169c3ea1 | ||
|
|
a22bcf7e72 | ||
|
|
bbcc515063 | ||
|
|
906dcb999d | ||
|
|
9febf999c0 | ||
|
|
c69958e34b | ||
|
|
b2dddf545b | ||
|
|
5f20829165 | ||
|
|
20cac56bfb | ||
|
|
08826ed84b | ||
|
|
06701348d6 | ||
|
|
e35755c3e3 | ||
|
|
e2fe13bd17 | ||
|
|
a35457ecb7 | ||
|
|
79cda09594 | ||
|
|
5c0217d316 | ||
|
|
52ec4f7c57 | ||
|
|
ff2696dff8 | ||
|
|
27d5dc0a25 | ||
|
|
01d0e6a481 | ||
|
|
7adaef9aed | ||
|
|
195542c5fb | ||
|
|
af9229d3bc | ||
|
|
ba6c2c88ed | ||
|
|
7d24c2259b | ||
|
|
a6b7ba06c6 | ||
|
|
f6471c3c08 | ||
|
|
8d2ebdf25f | ||
|
|
86ccfb1d68 | ||
|
|
7e7870026e | ||
|
|
53ce6f69e7 | ||
|
|
81a791bac7 | ||
|
|
7c016d9ee8 | ||
|
|
5d82316059 | ||
|
|
d35098ab9e | ||
|
|
c410a2d9fc | ||
|
|
0705670f1d | ||
|
|
d889765b10 | ||
|
|
a3c268b577 | ||
|
|
a59c5fbd8c | ||
|
|
aca429f17b | ||
|
|
6db5d2ed26 | ||
|
|
7525d209b6 | ||
|
|
78f68847d2 | ||
|
|
63d3fd2e84 | ||
|
|
219f5adf61 | ||
|
|
9662b5a657 | ||
|
|
086d02896f | ||
|
|
8586de3222 | ||
|
|
2bfda259fa | ||
|
|
5217f6f8bb | ||
|
|
3b648d826f | ||
|
|
f8be9a237c | ||
|
|
ebf0e7617a | ||
|
|
f1c7a2c134 | ||
|
|
32e577d5bf | ||
|
|
2d7f22ade8 | ||
|
|
23c6d0ef55 | ||
|
|
6998e76d3f | ||
|
|
af23e296f2 | ||
|
|
fcd13f5e71 | ||
|
|
bcda92e941 | ||
|
|
013c0b0feb | ||
|
|
24c05a73ce | ||
|
|
ced81b5c93 | ||
|
|
c7f9d5a529 | ||
|
|
cbc873bc8b | ||
|
|
c8b3719810 | ||
|
|
4c26057a4e | ||
|
|
0bbee11b3c | ||
|
|
729d8fb721 | ||
|
|
7ba54ffd48 | ||
|
|
256d865db6 | ||
|
|
1275aa732e | ||
|
|
4778c33902 | ||
|
|
127605ec3e | ||
|
|
f7736e9a0a | ||
|
|
ea7c11baf4 | ||
|
|
755dd9b954 | ||
|
|
a21ad8fa9d | ||
|
|
9701e944c2 | ||
|
|
a905fe578b | ||
|
|
85497cbf6e | ||
|
|
5ac6f2289b | ||
|
|
e68cfa9f72 | ||
|
|
bb15efd037 | ||
|
|
7d700c9ad2 | ||
|
|
61a6b67d51 | ||
|
|
96286b77f9 | ||
|
|
7b6b88b002 | ||
|
|
1b7190c50b | ||
|
|
e6bbcf6a3d | ||
|
|
b12e0bff2a | ||
|
|
aaccbb8247 | ||
|
|
c45ed6f6d8 | ||
|
|
dd5b51aac1 | ||
|
|
27d9edac67 | ||
|
|
a08357a845 | ||
|
|
9a3bc1fff5 | ||
|
|
4ae1abd7d4 | ||
|
|
d5a4ee2c10 | ||
|
|
5849458443 | ||
|
|
7a43d2f96a | ||
|
|
b0195f31e4 | ||
|
|
58e69af1b3 | ||
|
|
03ae909762 | ||
|
|
04c2ed554d | ||
|
|
f3cbc6c262 | ||
|
|
42fc3c9516 | ||
|
|
b301b1f70c | ||
|
|
eb1ddab278 | ||
|
|
0456c4d5ae | ||
|
|
fa3feda0d5 | ||
|
|
f2a33ea9f6 | ||
|
|
e7f492a15b | ||
|
|
5fe0a0ea5a | ||
|
|
2e152c52c4 | ||
|
|
7f018dad0f | ||
|
|
deb5df542e | ||
|
|
4a6a49e073 | ||
|
|
0737601dbf | ||
|
|
0a56e19d47 | ||
|
|
5f90e0788b | ||
|
|
36ab17474b | ||
|
|
96ee4caf39 | ||
|
|
3980bf79da | ||
|
|
5eb99791b0 | ||
|
|
6924fef324 | ||
|
|
25ef7e3469 | ||
|
|
507f184144 | ||
|
|
bc1434ff04 | ||
|
|
bab2de72bc | ||
|
|
fcc43e0aaa | ||
|
|
fc70334343 | ||
|
|
db52113a7e | ||
|
|
243aa60bf9 | ||
|
|
acf8e468f3 | ||
|
|
dc10db1d90 | ||
|
|
576a1294da | ||
|
|
8145de123e | ||
|
|
e530089639 | ||
|
|
d63a9b1b10 | ||
|
|
a3e8f0cbe4 | ||
|
|
7b062dd390 | ||
|
|
83e7130216 | ||
|
|
cdad2dc55a | ||
|
|
9d66c91c86 | ||
|
|
1c7341b982 | ||
|
|
5e6c346c7c | ||
|
|
3d9b5b1472 | ||
|
|
7578f0813b | ||
|
|
71b3ba2041 | ||
|
|
f95ca18707 | ||
|
|
711e92a59f | ||
|
|
26c55d89ef | ||
|
|
51b55eaf25 | ||
|
|
4454d3f341 | ||
|
|
bb52a6b062 | ||
|
|
80511409ff | ||
|
|
51628825e5 | ||
|
|
e625622b6e | ||
|
|
9e1f038c16 | ||
|
|
0b01545a03 | ||
|
|
c8abc41aa0 | ||
|
|
3b79370be1 | ||
|
|
eb2549c773 | ||
|
|
d881baa581 | ||
|
|
f81c0cb58f | ||
|
|
0fe2584b77 | ||
|
|
5fc3e7e913 | ||
|
|
2e1033b045 | ||
|
|
80fd60eaff | ||
|
|
f848955263 | ||
|
|
d01758e90d | ||
|
|
5f6e1167f4 | ||
|
|
63a205c043 | ||
|
|
022cefc72a | ||
|
|
3fa0c70f2b | ||
|
|
a008339c6e | ||
|
|
172ea90c59 | ||
|
|
cc08cb46c8 | ||
|
|
fd59ab261f | ||
|
|
2cef9c5cb2 | ||
|
|
cc54645bf3 | ||
|
|
2b40a5e3ce | ||
|
|
ae81ad58ea | ||
|
|
36298e2bfe | ||
|
|
7b19768c4c | ||
|
|
094d80fe66 | ||
|
|
bba42d4230 | ||
|
|
621fb050ce | ||
|
|
5fbc70173c | ||
|
|
72d22c5827 | ||
|
|
12e8d95e9f | ||
|
|
14b9d639a2 | ||
|
|
5f62afb5f2 | ||
|
|
33bf2c8a69 | ||
|
|
56084b584d | ||
|
|
b0bfea4e03 | ||
|
|
aa0c902d22 | ||
|
|
d9a1c718bf | ||
|
|
f436b3e62d | ||
|
|
8576fe6dbe | ||
|
|
1d2d0ea5cd | ||
|
|
5d43695710 | ||
|
|
0e1a1202d8 | ||
|
|
9d3a274cb6 | ||
|
|
2a2e201f4a | ||
|
|
7f1b938cae | ||
|
|
132d53583d | ||
|
|
0620a64813 | ||
|
|
05afb0c347 | ||
|
|
185b9f8368 | ||
|
|
ea2c07c727 | ||
|
|
1a9e13f880 | ||
|
|
d97ec2763c | ||
|
|
534b241e9f | ||
|
|
0513182e3c | ||
|
|
741a90c6bd | ||
|
|
68eb0d15dc | ||
|
|
8660d0471f | ||
|
|
0a6dc66749 | ||
|
|
488eb30272 | ||
|
|
d2d2032f93 | ||
|
|
58fde290f8 | ||
|
|
246152d3c4 | ||
|
|
ee7aa93416 | ||
|
|
bad0639e90 | ||
|
|
6f49bba302 | ||
|
|
b01d87f0c6 | ||
|
|
08a636c34f | ||
|
|
3322996885 | ||
|
|
b43d63a7ad | ||
|
|
c8e0b4a193 | ||
|
|
c4972b7658 | ||
|
|
8462f3b17c | ||
|
|
1e2c63f486 | ||
|
|
e68577ffd3 | ||
|
|
9d919f8ac9 | ||
|
|
67d9dac16d | ||
|
|
978bfd6eb1 | ||
|
|
539ee0ea88 | ||
|
|
f85ab543ee | ||
|
|
51414375e4 | ||
|
|
2b9a2b5c1a | ||
|
|
51b008c391 | ||
|
|
0d84da021f | ||
|
|
3059e517c5 | ||
|
|
f8f1b4211b | ||
|
|
30a390d4bf | ||
|
|
790030ab05 | ||
|
|
d73f4fb7b3 | ||
|
|
6f7ac27c96 | ||
|
|
6ae2353f41 | ||
|
|
c62061728b | ||
|
|
796b53f549 | ||
|
|
6c6f664c30 | ||
|
|
2e47771860 | ||
|
|
75a80f2f75 | ||
|
|
aaf6dd2b2e | ||
|
|
af011d1a57 | ||
|
|
e653204638 | ||
|
|
adf0e3ab7d | ||
|
|
eeef1137a8 | ||
|
|
49886aa633 | ||
|
|
28f7f523ee | ||
|
|
b917d48cff | ||
|
|
79ebdfa145 | ||
|
|
612a8a71b0 | ||
|
|
b93217397c | ||
|
|
baf95e747a | ||
|
|
eeeb4d37e8 | ||
|
|
b3d8e4ea68 | ||
|
|
b463476815 | ||
|
|
c71b7554e0 | ||
|
|
3c8bd6346f | ||
|
|
0296803fe3 | ||
|
|
b1f8af7f55 | ||
|
|
3c0ef2cce8 | ||
|
|
aab5b04a6d | ||
|
|
4e45156eaf | ||
|
|
9e91b0ca81 | ||
|
|
08eb897996 | ||
|
|
0da954cc10 | ||
|
|
a1b68d938d | ||
|
|
325423ab02 | ||
|
|
9523059d85 | ||
|
|
95c12b6c20 | ||
|
|
b6199c202e | ||
|
|
367c5d1ede | ||
|
|
ef5d66ebd2 | ||
|
|
3953eb3f6c | ||
|
|
b149ccbc17 | ||
|
|
df0b1751e6 | ||
|
|
bb756115fa | ||
|
|
48a9e24630 | ||
|
|
3896a63016 | ||
|
|
50144d178a | ||
|
|
e0840e392c | ||
|
|
e6bfb6b7b3 | ||
|
|
165cbd1c48 | ||
|
|
bd5e7f8118 | ||
|
|
ccee30b15e | ||
|
|
32f26561b1 | ||
|
|
ea0be720a1 | ||
|
|
b31fbe528a | ||
|
|
2f13622d37 | ||
|
|
03c4282ebf | ||
|
|
5ff5f1b0d5 | ||
|
|
07fa6615f8 | ||
|
|
941c2b1d14 | ||
|
|
aa67bc5da6 | ||
|
|
946166f13e | ||
|
|
6ab5ef1315 | ||
|
|
5c647d4515 | ||
|
|
906ced3c32 | ||
|
|
164fa8f646 | ||
|
|
f075264d6f | ||
|
|
cf3447feea | ||
|
|
78b1b54e2b | ||
|
|
b7eac150cc | ||
|
|
a9876475c1 | ||
|
|
46296328ff | ||
|
|
5f3ece629c | ||
|
|
a6827f9820 | ||
|
|
40d02fe6c3 | ||
|
|
572bc48a25 | ||
|
|
1959e414e2 | ||
|
|
08a875c39a | ||
|
|
90be589ffa | ||
|
|
780865cfed | ||
|
|
d795f1b898 | ||
|
|
ecf8d29724 | ||
|
|
8ca1179e04 | ||
|
|
96e23516f6 | ||
|
|
2102965fac | ||
|
|
436f7fc550 | ||
|
|
2b10a2b874 | ||
|
|
9ee5053b71 | ||
|
|
30494f8ddb | ||
|
|
21e505c334 | ||
|
|
7e668ca9ac | ||
|
|
1d556a5668 | ||
|
|
8654623271 | ||
|
|
e1c0cad8e1 | ||
|
|
a6c45a7ade | ||
|
|
cd34090eb8 | ||
|
|
ae478c92a2 | ||
|
|
439dbd8bb3 | ||
|
|
9cf0a5b68b | ||
|
|
6eb9915690 | ||
|
|
ca7a404fc8 | ||
|
|
4a1a0be51d | ||
|
|
521b8a16c4 | ||
|
|
d4e7a5c68e | ||
|
|
b474c2ca7a | ||
|
|
4142f7c728 | ||
|
|
54c440d75c | ||
|
|
954d46e587 | ||
|
|
198539479f | ||
|
|
30680d0268 | ||
|
|
c1c88644ae | ||
|
|
36ce23073c | ||
|
|
45e2d12d06 | ||
|
|
e18a7569f8 | ||
|
|
3470b44e9a | ||
|
|
23cfb03a3b | ||
|
|
918f91bc44 | ||
|
|
6ff7584f96 | ||
|
|
b15289113b | ||
|
|
99faaae9f6 | ||
|
|
0999017fda | ||
|
|
34f4b58f69 | ||
|
|
e9af710cf4 | ||
|
|
74104fe5d0 | ||
|
|
45cc0bd87c | ||
|
|
77c5caffd5 | ||
|
|
f5335d59cc | ||
|
|
28abe2cc3c | ||
|
|
745d601831 | ||
|
|
9fd39ebe79 | ||
|
|
4f05808b8e | ||
|
|
c8e249f919 | ||
|
|
7adccac8ec | ||
|
|
0a12840e68 | ||
|
|
1bd3e96e6e | ||
|
|
cdbdd0d6fb | ||
|
|
743d10d50e | ||
|
|
797399ff7f | ||
|
|
9332673944 | ||
|
|
f9563e5a34 | ||
|
|
84fd2a147e | ||
|
|
cfd368e18f | ||
|
|
a9c795b54c | ||
|
|
8fb4546437 | ||
|
|
d316d74933 | ||
|
|
ebfaf83bd9 | ||
|
|
a103fbc0e6 | ||
|
|
a4fa417114 | ||
|
|
a47cca7e42 | ||
|
|
80ac3017bd | ||
|
|
ec517d5f28 | ||
|
|
899b28bffe | ||
|
|
217d5562ff | ||
|
|
b0f8d495bb | ||
|
|
295542c357 | ||
|
|
4db6c4cfc4 | ||
|
|
efc6b9abbb | ||
|
|
430d94de95 | ||
|
|
e0cb56381f | ||
|
|
f9c283a2e5 | ||
|
|
6c45b43eee | ||
|
|
de69b7dfd0 | ||
|
|
5f5b509c7a | ||
|
|
29606e2c39 | ||
|
|
412952be5b | ||
|
|
79e0165362 | ||
|
|
e47a6402e1 | ||
|
|
465525119c | ||
|
|
43a16d5389 | ||
|
|
303288e8b1 | ||
|
|
eb5940664c | ||
|
|
1a6743331b | ||
|
|
c8df5b832e | ||
|
|
fc1089713f | ||
|
|
0866d88126 | ||
|
|
8d0b58ee6f | ||
|
|
fa41058ba1 | ||
|
|
296a484f4b | ||
|
|
7d5d191fc2 | ||
|
|
d55ddfcebc | ||
|
|
7147cdb1c1 | ||
|
|
cba1de122a | ||
|
|
68669e2679 | ||
|
|
4374f67759 | ||
|
|
5e998776cb | ||
|
|
b09e72a2fc | ||
|
|
2e3d1a3c09 | ||
|
|
96b4fd1da1 | ||
|
|
d3c80c326a | ||
|
|
b74d977225 | ||
|
|
73202259fa | ||
|
|
01cf29a202 | ||
|
|
71ececdbb4 | ||
|
|
81efd38fee | ||
|
|
b3c715c312 | ||
|
|
8c54873afd | ||
|
|
50b9abc13f | ||
|
|
ca351b527d | ||
|
|
e4714bc4c5 | ||
|
|
06e2f914c1 | ||
|
|
3805eddd34 | ||
|
|
e842fd95b4 | ||
|
|
5f752fc967 | ||
|
|
f40bdeca97 | ||
|
|
24017d6810 | ||
|
|
5a24b2d73c | ||
|
|
4c38edf532 | ||
|
|
af24dc6096 | ||
|
|
865e4e2b45 | ||
|
|
41617a0227 | ||
|
|
ab2d8fa01b | ||
|
|
80dfdbf749 | ||
|
|
dbd19b0cad | ||
|
|
70671858c2 | ||
|
|
0c064485b1 | ||
|
|
0d090070a9 | ||
|
|
9029d380a3 | ||
|
|
71c14b815e | ||
|
|
64d7c4eaa5 | ||
|
|
62079e3549 | ||
|
|
a632ec6ce6 | ||
|
|
be8bccc72e | ||
|
|
a7fde237bb | ||
|
|
f68bdb0493 | ||
|
|
e03a4db2b9 | ||
|
|
54594ee1de | ||
|
|
98aecd7f6b | ||
|
|
f58df75bea | ||
|
|
43a6d0da62 | ||
|
|
a525cab5ff | ||
|
|
d39c279203 | ||
|
|
0a7095afa9 | ||
|
|
36672fef83 | ||
|
|
57ea20d083 | ||
|
|
6c5ef9347c | ||
|
|
60da9094ef | ||
|
|
f9087cb291 | ||
|
|
635f13f825 | ||
|
|
55830256d3 | ||
|
|
ac58bb2f5a | ||
|
|
a066018c9f | ||
|
|
0bc9138aa4 | ||
|
|
b626c888b0 | ||
|
|
492cbc3628 | ||
|
|
32353f0db1 | ||
|
|
7aa43a4217 | ||
|
|
09580515a0 | ||
|
|
65165cd41c | ||
|
|
391668114d | ||
|
|
ae80a7b322 | ||
|
|
9093263d8c | ||
|
|
e008ae3ef1 | ||
|
|
c0164f29cd | ||
|
|
9ddb57297f | ||
|
|
eb4688bf5e | ||
|
|
519da32391 | ||
|
|
f9728e8f3f | ||
|
|
25bfc1407b | ||
|
|
303bd03533 | ||
|
|
6b54b52ec4 | ||
|
|
89becaca02 | ||
|
|
d9ca67e162 | ||
|
|
ff655de27e | ||
|
|
ee0cb12810 | ||
|
|
6da6e9da07 | ||
|
|
ad41dfaeaf | ||
|
|
7a0a7bf8e0 | ||
|
|
65551ce233 | ||
|
|
c63efa917d | ||
|
|
7544055fa4 | ||
|
|
cb5b5cde1f | ||
|
|
a58a7fd365 | ||
|
|
99c6662f9d | ||
|
|
ca0e32cfd2 | ||
|
|
c84d99aa22 | ||
|
|
0443ef5a9e | ||
|
|
e962c2a94d | ||
|
|
8c2e171a16 | ||
|
|
4fb8eb96d0 | ||
|
|
7549eb90a7 | ||
|
|
df132a0296 | ||
|
|
e499a6d375 | ||
|
|
fe5f5e690e | ||
|
|
21cd975ae3 | ||
|
|
32073a5bc1 | ||
|
|
6cf8408752 | ||
|
|
7a77b61ddd | ||
|
|
ad09526bee | ||
|
|
e3e3ea54f9 | ||
|
|
cb9c26d49c | ||
|
|
cf88896ad7 | ||
|
|
0d44234239 | ||
|
|
96c045137d | ||
|
|
0e3037e85d | ||
|
|
5c334d7627 | ||
|
|
7246914605 | ||
|
|
d9b72a2282 | ||
|
|
4eb05ed571 | ||
|
|
5a8def7d00 | ||
|
|
90be31ddc8 | ||
|
|
dddb9b3189 | ||
|
|
0c06d3b47a | ||
|
|
cc96840aa8 | ||
|
|
f78eba09fd | ||
|
|
b2c1eae652 | ||
|
|
8fed427251 | ||
|
|
b2d309b17e | ||
|
|
8d6f893083 | ||
|
|
faba7e2a07 | ||
|
|
baf1e771e9 | ||
|
|
461a30812b | ||
|
|
4b64c15ae8 | ||
|
|
3625a409a5 | ||
|
|
8533f974e8 | ||
|
|
667db45b1d | ||
|
|
bafbac3d51 | ||
|
|
92c095412d | ||
|
|
ea31a51285 | ||
|
|
8f66346aeb | ||
|
|
9741d6348f | ||
|
|
8c762223a4 | ||
|
|
ffd2fbcc84 | ||
|
|
b0f4497bbe | ||
|
|
97f6138cf8 | ||
|
|
f65f042910 | ||
|
|
7ad79b42bc | ||
|
|
4f172ae9a5 | ||
|
|
5fadba7ddc | ||
|
|
ffd4d4afc3 | ||
|
|
d304f40295 | ||
|
|
ffd4b38801 | ||
|
|
efb27ed1ea | ||
|
|
aab3385c2d | ||
|
|
9e732ee935 | ||
|
|
571e441502 | ||
|
|
18c8ac0b31 | ||
|
|
7d700916d9 | ||
|
|
b0f5f88482 | ||
|
|
c6030b9125 | ||
|
|
81e4ae2af9 | ||
|
|
543535e1a0 | ||
|
|
647f6fdf34 | ||
|
|
90e0eaf5f5 | ||
|
|
4ea7e8d828 | ||
|
|
cf4f1377d4 | ||
|
|
bf8f5aa306 | ||
|
|
9564575d77 | ||
|
|
9776e0937a | ||
|
|
7b9971b20f | ||
|
|
89d9fb3556 | ||
|
|
c3f62ed8bf | ||
|
|
5c5cf3e7e7 | ||
|
|
94045ea73e | ||
|
|
e15c596e42 | ||
|
|
b317d10ade | ||
|
|
31bd8d438d | ||
|
|
8b78f21199 | ||
|
|
8a8f5af084 | ||
|
|
f5a8974bb6 | ||
|
|
fd5b7359e2 | ||
|
|
077e05e0ed | ||
|
|
abdcd23d8b | ||
|
|
fb04d10886 | ||
|
|
3e8711580e | ||
|
|
f48dafda7e | ||
|
|
a42369e081 | ||
|
|
6397939c9e | ||
|
|
c9af365d44 | ||
|
|
b6d543f15e | ||
|
|
8c3ebc7f87 | ||
|
|
ee70b21460 | ||
|
|
acb6777ab5 | ||
|
|
f7ab5684e9 | ||
|
|
8a8af5265e | ||
|
|
f72d672e0d | ||
|
|
094c2bca2e | ||
|
|
5d5d4cb448 | ||
|
|
380c4ad2da | ||
|
|
e57f1c230c | ||
|
|
88e0ecf2cf | ||
|
|
56ab2fd797 | ||
|
|
81cce7b6ac | ||
|
|
745fa93f3f | ||
|
|
c5af747da9 | ||
|
|
c40499ab05 | ||
|
|
2e1aa99f54 | ||
|
|
70a6a316d7 | ||
|
|
e418dddbcf | ||
|
|
bf127348c9 | ||
|
|
75907e3815 | ||
|
|
c4ad7c3e2c | ||
|
|
562e8e8021 | ||
|
|
c3fbd27a8d | ||
|
|
a990c0bdc8 | ||
|
|
561b0fbe55 | ||
|
|
475918a1ca | ||
|
|
a85d82a859 | ||
|
|
ae97ad2bca | ||
|
|
8eddb7f1b9 | ||
|
|
29fabb12e0 | ||
|
|
34bcca2640 | ||
|
|
38bd039a93 | ||
|
|
033eedb50f | ||
|
|
51ca5e028b | ||
|
|
9b5208fa30 | ||
|
|
85fd1d010d | ||
|
|
499610e44f | ||
|
|
13294083a9 | ||
|
|
5f203ce808 | ||
|
|
dfc26937ca | ||
|
|
22be4b49d5 | ||
|
|
bc932a28ae | ||
|
|
e9f1c83ff8 | ||
|
|
30be6d4bab | ||
|
|
1169ba9efb | ||
|
|
33ec5cdc44 | ||
|
|
be14c33ed1 | ||
|
|
b12872eed1 | ||
|
|
35caa32ad1 | ||
|
|
98aab2083b | ||
|
|
2b588ebce6 | ||
|
|
d4ba95f606 | ||
|
|
83504eb2e1 | ||
|
|
7f5ec0eaef | ||
|
|
68ba3a84d6 | ||
|
|
125b134d87 | ||
|
|
f9236c4c98 | ||
|
|
02e857827d | ||
|
|
7e5560e60d | ||
|
|
f35783f0fb | ||
|
|
e74ef3e86e | ||
|
|
ae59f1abb4 | ||
|
|
c0b09854b3 | ||
|
|
2b61ea417b | ||
|
|
e57886e05a | ||
|
|
b0520f3656 | ||
|
|
3e9349bf7b | ||
|
|
d5549d770d | ||
|
|
4034cfe9dc | ||
|
|
7864f2c8ea | ||
|
|
c157875ecd | ||
|
|
dac329bcf1 | ||
|
|
d072d91081 | ||
|
|
e156ec2940 | ||
|
|
14295fd4b3 | ||
|
|
895580de42 | ||
|
|
2c9e11299e | ||
|
|
ca011729d3 | ||
|
|
0f25e6ec6b | ||
|
|
af2b5eb6f6 | ||
|
|
b207111c50 | ||
|
|
05b2a19bac | ||
|
|
0c308a5f07 | ||
|
|
ab62ca7b1f | ||
|
|
50992f2112 | ||
|
|
6cd56ebed6 | ||
|
|
f3caada13a | ||
|
|
27d922d470 |
No files matched your search
+9
-2
@@ -1,7 +1,14 @@
|
||||
* text eol=lf
|
||||
*.bat text eol=crlf
|
||||
*.patch text
|
||||
*.patch text eol=lf
|
||||
*.java text eol=lf
|
||||
*.gradle text eol=crlf
|
||||
*.png binary
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.zip binary
|
||||
*.jar binary
|
||||
*.lzma binary
|
||||
*.zip binary
|
||||
*.pyd binary
|
||||
*.cfg text eol=lf
|
||||
*.py text eol=lf
|
||||
+26
-6
@@ -1,7 +1,27 @@
|
||||
*.DS_Store
|
||||
/logs/
|
||||
/*.pyc
|
||||
/forge-*/
|
||||
/patches-old/
|
||||
/mcp/
|
||||
#eclipse
|
||||
/bin
|
||||
/.settings
|
||||
/.classpath
|
||||
|
||||
#idea
|
||||
/.idea
|
||||
*.iml
|
||||
|
||||
#gradle
|
||||
/build
|
||||
/.gradle
|
||||
|
||||
#occupational hazards
|
||||
/eclipse/
|
||||
/repo/
|
||||
/buildSrc
|
||||
|
||||
#Patch rejects
|
||||
*.rej
|
||||
/patches-/
|
||||
# FML changelog
|
||||
changelog.txt
|
||||
/patches_old/
|
||||
/patches_old_bak/
|
||||
*.py
|
||||
*.7z
|
||||
@@ -0,0 +1,10 @@
|
||||
Contributing to Forge
|
||||
=====================
|
||||
|
||||
1) Keep patches to Minecraft classes minimal. If you need a lot of things done, you may either add to relevant forge classes or make a new class.
|
||||
|
||||
2) An example mod must be provided for all PRs adding events/hooks to Forge. Whether it's a full mod using your proposed hooks, or just a pastebin containing a simple example, an example mod is required. Please also explain in detail what your new hook does.
|
||||
|
||||
3) Follow Forge coding guidelines (braces on newlines, spaces instead of tabs, etc)
|
||||
|
||||
For more information, refer to [the wiki](https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge)
|
||||
@@ -1,6 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Ant-Version: Apache Ant 1.8.2
|
||||
Created-By: 1.7.0_09-b30 (Oracle Corporation)
|
||||
Main-Class: net.minecraft.server.MinecraftServer
|
||||
Class-Path: minecraft_server.jar
|
||||
|
||||
File renamed without changes.
@@ -24,9 +24,9 @@ the Minecraft sources that are required to have Minecraft Forge working.
|
||||
1. Scope
|
||||
--------
|
||||
|
||||
The present license is granted to any user of Minecraft Forge. As a
|
||||
prerequisite, a user of Minecraft Forge must own a legally aquired copy of
|
||||
Minecraft
|
||||
The present license is granted to any user of Minecraft Forge, for all files included
|
||||
unless stated otherwise in the file itself. As a prerequisite, a user of Minecraft
|
||||
Forge must own a legally aquired copy of Minecraft.
|
||||
|
||||
2. Play rights
|
||||
--------------
|
||||
File renamed without changes.
File renamed without changes.
+36
@@ -0,0 +1,36 @@
|
||||
*** HOW TO INSTALL ***
|
||||
For Mod Users:
|
||||
|
||||
Download the latest installer from http://files.minecraftforge.net and follow instructions given by the installer.
|
||||
|
||||
|
||||
For Mod Devs:
|
||||
|
||||
Download the latest Forge source distribution from http://files.minecraftforge.net and unzip it to a folder.
|
||||
Open a command prompt, navigate to the directory where you unzipped the Forge sources, and run:
|
||||
If you have Gradle: gradle setupDevWorkspace
|
||||
If you DO NOT have Gradle installed:
|
||||
Windows: ./gradlew.bat setupDevWorkspace
|
||||
MacOS/Linux: ./gradlew setupDevWorkspace
|
||||
|
||||
If you wish to use the Eclipse IDE, run gradle eclipse instead of gradle setupDevWorkspace, or install the Gradle plugin for Eclipse and import the Forge source folder as a Gradle project.
|
||||
|
||||
To get the decompiled classes:
|
||||
If you have Gradle: gradle setupDecompWorkspace
|
||||
If you DO NOT have Gradle installed:
|
||||
Windows: ./gradlew.bat setupDecompWorkspace
|
||||
MacOS/Linux: ./gradlew setupDecompWorkspace
|
||||
|
||||
For Contributors: (Note: This assumes you have Gradle installed. If you don't, use ./gradlew(.bat) instead of gradle.
|
||||
|
||||
Clone this repository to a folder.
|
||||
Open a command prompt and navigate to the folder where you cloned this repo.
|
||||
Run gradle setupForge to setup your development environment.
|
||||
|
||||
To use Eclipse, point your Eclipse workspace at the eclipse folder inside the repo.
|
||||
|
||||
|
||||
Requirements (for both mod devs and contributors):
|
||||
You must have a JDK installed and accessible.
|
||||
If you do not wish to use the gradle wrapper, you can install Gradle from http://www.gradle.org/ .
|
||||
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
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.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
deployJars
|
||||
}
|
||||
|
||||
import static net.minecraftforge.gradle.dev.ForgeDevPlugin.*
|
||||
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'forgedev'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
flatDir {
|
||||
name "fileRepo"
|
||||
dirs "repo"
|
||||
}
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = '1.8'
|
||||
mcpVersion = '9.10'
|
||||
mappings = 'snapshot_nodoc_20141130'
|
||||
fmlDir = projectDir.getAbsolutePath() + "/fml";
|
||||
mainClass = 'net.minecraftforge.fml.relauncher.ServerLaunchWrapper'
|
||||
tweakClass = 'net.minecraftforge.fml.common.launcher.FMLTweaker'
|
||||
installerVersion = "1.4"
|
||||
}
|
||||
|
||||
group = 'net.minecraftforge'
|
||||
version = getVersionFromJava(getProject(), 'src/main/java/net/minecraftforge/common/ForgeVersion.java')
|
||||
|
||||
jenkins {
|
||||
job = 'minecraftforge'
|
||||
}
|
||||
|
||||
// crowdin stuff
|
||||
if (project.hasProperty("crowdinKey"))
|
||||
tasks.getLocalizations.apiKey = project.crowdinKey
|
||||
|
||||
|
||||
launch4j {
|
||||
jreMinVersion = '1.6.0'
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
add getProject().repositories.mavenLocal()
|
||||
}
|
||||
repositories.mavenDeployer {
|
||||
configuration = configurations.deployJars
|
||||
|
||||
if (project.hasProperty("filesmaven")) {
|
||||
logger.info('Publishing to files server')
|
||||
repository(url: project.filesmaven.url) {
|
||||
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
|
||||
}
|
||||
} else {
|
||||
logger.info('Publishing to repo folder')
|
||||
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||
}
|
||||
|
||||
pom {
|
||||
groupId = project.group
|
||||
version = project.version
|
||||
artifactId = project.archivesBaseName
|
||||
}
|
||||
pom.project {
|
||||
name project.archivesBaseName
|
||||
packaging 'jar'
|
||||
description 'Minecraft Forge API'
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge'
|
||||
connection 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git'
|
||||
developerConnection 'scm:git:[email protected]:MinecraftForge/MinecraftForge.git'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'github'
|
||||
url 'https://github.com/MinecraftForge/MinecraftForge/issues'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Forge Public License'
|
||||
url 'https://raw.github.com/MinecraftForge/MinecraftForge/master/MinecraftForge-License.txt'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'cpw'
|
||||
name 'cpw'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'LexManos'
|
||||
name 'Lex Manos'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'AbrarSyed'
|
||||
name 'Abrar Syed'
|
||||
roles { role 'contributor' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import os, os.path, sys
|
||||
from optparse import OptionParser
|
||||
|
||||
forge_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
mcp_dir = os.path.abspath('..')
|
||||
|
||||
from forge import build_forge_dev
|
||||
|
||||
def main():
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-m', '--mcp-dir', action='store', dest='mcp_dir', help='MCP Path', default=None)
|
||||
parser.add_option('-b', '--build', action='store', dest='build', help='Build number', default=None)
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
build_num = 0
|
||||
if not options.build is None:
|
||||
try:
|
||||
build_num = int(options.build)
|
||||
except:
|
||||
pass
|
||||
|
||||
fml_dir = os.path.join(forge_dir, 'fml')
|
||||
mcp_dir = os.path.join(forge_dir, 'mcp')
|
||||
|
||||
if not options.mcp_dir is None:
|
||||
mcp_dir = os.path.abspath(options.mcp_dir)
|
||||
elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
|
||||
mcp_dir = os.path.abspath('..')
|
||||
|
||||
sys.exit(build_forge_dev(mcp_dir, forge_dir, fml_dir, build_num))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,89 +0,0 @@
|
||||
import os, os.path, sys, re
|
||||
import json, urllib2
|
||||
from pprint import pprint
|
||||
from urlparse import urlparse
|
||||
import base64
|
||||
import optparse, ast
|
||||
|
||||
class PreemptiveBasicAuthHandler(urllib2.BaseHandler):
|
||||
def __init__(self, password_mgr=None):
|
||||
if password_mgr is None:
|
||||
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
|
||||
self.passwd = password_mgr
|
||||
self.add_password = self.passwd.add_password
|
||||
|
||||
def http_request(self,req):
|
||||
uri = req.get_full_url()
|
||||
user, pw = self.passwd.find_user_password(None,uri)
|
||||
if pw is None: return req
|
||||
raw = "%s:%s" % (user, pw)
|
||||
auth = 'Basic %s' % base64.b64encode(raw).strip()
|
||||
req.add_unredirected_header('Authorization', auth)
|
||||
return req
|
||||
|
||||
def https_request(self,req):
|
||||
return self.http_request(req)
|
||||
|
||||
def getBuildInfo(url, current_version=None):
|
||||
handler = PreemptiveBasicAuthHandler()
|
||||
handler.add_password(None, 'jenkins.minecraftforge.net:81', 'console_script', 'fd584bffa72fcac12181f37f80001200')
|
||||
file = urllib2.build_opener(handler).open(url)
|
||||
data = file.read()
|
||||
file.close()
|
||||
data = ast.literal_eval(data)['allBuilds']
|
||||
data = sorted(data, key=lambda key: key['number'], reverse=False)
|
||||
|
||||
items = []
|
||||
output = []
|
||||
|
||||
for build in data:
|
||||
build['actions'] = filter(lambda act: act is not None, build['actions'])
|
||||
build['actions'] = filter(lambda act: 'text' in act, build['actions'])
|
||||
build['actions'] = filter(lambda act: not ' ' in act['text'], build['actions'])
|
||||
if len(build['actions']) == 0:
|
||||
build['version'] = current_version
|
||||
current_version = None
|
||||
else:
|
||||
build['version'] = build['actions'][0]['text']
|
||||
build['items'] = build['changeSet']['items']
|
||||
for item in build['items']:
|
||||
item['author'] = item['author']['fullName']
|
||||
if build['result'] != 'SUCCESS':
|
||||
items += build['items']
|
||||
else:
|
||||
build['items'] = items + build['items']
|
||||
items = []
|
||||
output += [build]
|
||||
build.pop('changeSet')
|
||||
build.pop('actions')
|
||||
return sorted(output, key=lambda key: key['number'], reverse=True)
|
||||
|
||||
def make_changelog(job_path, target_build, change_file, current_version=None):
|
||||
builds = getBuildInfo('%s/api/python?tree=allBuilds[result,number,actions[text],changeSet[items[author[fullName],comment]]]&pretty=true' % job_path, current_version)
|
||||
|
||||
log = [ "Changelog:" ]
|
||||
|
||||
for build in builds:
|
||||
if int(build['number']) > target_build: continue
|
||||
if len(build['items']) == 0: continue
|
||||
log.append('')
|
||||
if build['version'] is None:
|
||||
log.append('Build %s' % build['number'])
|
||||
else:
|
||||
log.append('Build %s' % build['version'])
|
||||
for change in build['items']:
|
||||
comments = filter(lambda cmt: len(cmt) > 0, change['comment'].split('\n'))
|
||||
if len(comments) > 1:
|
||||
log.append('\t' + change['author'])
|
||||
for comment in comments:
|
||||
log.append('\t\t' + comment)
|
||||
elif len(comments) == 1:
|
||||
log.append('\t%s: %s' % (change['author'], comments[0]))
|
||||
|
||||
file = open(change_file, 'wb')
|
||||
for line in log:
|
||||
file.write('%s\n' % line)
|
||||
file.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
make_changelog("http://jenkins.minecraftforge.net:81/job/minecraftforge/", 70000, 'changelog.txt', 'pinecone')
|
||||
@@ -1,44 +0,0 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.world.EnumGameType;
|
||||
import net.minecraft.util.EnumOS;
|
||||
import net.minecraft.client.settings.EnumOptions;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraftforge.common.EnumHelper;
|
||||
|
||||
public class EnumHelperClient extends EnumHelper
|
||||
{
|
||||
|
||||
private static Class[][] clentTypes =
|
||||
{
|
||||
{EnumGameType.class, int.class, String.class},
|
||||
{EnumOptions.class, String.class, boolean.class, boolean.class},
|
||||
{EnumOS.class},
|
||||
{EnumRarity.class, int.class, String.class}
|
||||
};
|
||||
|
||||
public static EnumGameType addGameType(String name, int id, String displayName)
|
||||
{
|
||||
return addEnum(EnumGameType.class, name, id, displayName);
|
||||
}
|
||||
|
||||
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
|
||||
{
|
||||
return addEnum(EnumOptions.class, name, langName, isSlider, isToggle);
|
||||
}
|
||||
|
||||
public static EnumOS addOS2(String name)
|
||||
{
|
||||
return addEnum(EnumOS.class, name);
|
||||
}
|
||||
|
||||
public static EnumRarity addRarity(String name, int color, String displayName)
|
||||
{
|
||||
return addEnum(EnumRarity.class, name, color, displayName);
|
||||
}
|
||||
|
||||
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
|
||||
{
|
||||
return addEnum(clentTypes, enumType, enumName, paramValues);
|
||||
}
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.PixelFormat;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
|
||||
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
|
||||
|
||||
public class ForgeHooksClient
|
||||
{
|
||||
static TextureManager engine()
|
||||
{
|
||||
return FMLClientHandler.instance().getClient().renderEngine;
|
||||
}
|
||||
|
||||
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type)
|
||||
{
|
||||
String result = armor.getItem().getArmorTexture(armor, entity, slot, layer);
|
||||
return result != null ? result : _default;
|
||||
}
|
||||
|
||||
public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks)
|
||||
{
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
|
||||
if (customRenderer == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION))
|
||||
{
|
||||
GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING))
|
||||
{
|
||||
GL11.glTranslatef(0.0F, -bobing, 0.0F);
|
||||
}
|
||||
boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);
|
||||
|
||||
engine.func_110577_a(item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
|
||||
Block block = (item.itemID < Block.blocksList.length ? Block.blocksList[item.itemID] : null);
|
||||
if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType())))
|
||||
{
|
||||
int renderType = (block != null ? block.getRenderType() : 1);
|
||||
float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F);
|
||||
|
||||
if (RenderItem.renderInFrame)
|
||||
{
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
int size = item.stackSize;
|
||||
int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1))));
|
||||
|
||||
for(int j = 0; j < count; j++)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
if (j > 0)
|
||||
{
|
||||
GL11.glTranslatef(
|
||||
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
|
||||
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
|
||||
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale);
|
||||
}
|
||||
customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean renderInventoryItem(RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y)
|
||||
{
|
||||
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY);
|
||||
if (customRenderer == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
engine.func_110577_a(item.getItemSpriteNumber() == 0 ? TextureMap.field_110575_b : TextureMap.field_110576_c);
|
||||
if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel);
|
||||
GL11.glScalef(10F, 10F, 10F);
|
||||
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
||||
GL11.glScalef(1.0F, 1.0F, -1F);
|
||||
GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if(inColor)
|
||||
{
|
||||
int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
|
||||
float r = (float)(color >> 16 & 0xff) / 255F;
|
||||
float g = (float)(color >> 8 & 0xff) / 255F;
|
||||
float b = (float)(color & 0xff) / 255F;
|
||||
GL11.glColor4f(r, g, b, 1.0F);
|
||||
}
|
||||
|
||||
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
|
||||
renderBlocks.useInventoryTint = inColor;
|
||||
customRenderer.renderItem(INVENTORY, item, renderBlocks);
|
||||
renderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(x, y, -3.0F + zLevel);
|
||||
|
||||
if (inColor)
|
||||
{
|
||||
int color = Item.itemsList[item.itemID].getColorFromItemStack(item, 0);
|
||||
float r = (float)(color >> 16 & 255) / 255.0F;
|
||||
float g = (float)(color >> 8 & 255) / 255.0F;
|
||||
float b = (float)(color & 255) / 255.0F;
|
||||
GL11.glColor4f(r, g, b, 1.0F);
|
||||
}
|
||||
|
||||
customRenderer.renderItem(INVENTORY, item, renderBlocks);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item)
|
||||
{
|
||||
if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
customRenderer.renderItem(type, item, renderBlocks, entity);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glTranslatef(0.0F, -0.3F, 0.0F);
|
||||
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
|
||||
customRenderer.renderItem(type, item, renderBlocks, entity);
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
//Optifine Helper Functions u.u, these are here specifically for Optifine
|
||||
//Note: When using Optfine, these methods are invoked using reflection, which
|
||||
//incurs a major performance penalty.
|
||||
public static void orientBedCamera(Minecraft mc, EntityLivingBase entity)
|
||||
{
|
||||
int x = MathHelper.floor_double(entity.posX);
|
||||
int y = MathHelper.floor_double(entity.posY);
|
||||
int z = MathHelper.floor_double(entity.posZ);
|
||||
Block block = Block.blocksList[mc.theWorld.getBlockId(x, y, z)];
|
||||
|
||||
if (block != null && block.isBed(mc.theWorld, x, y, z, entity))
|
||||
{
|
||||
int var12 = block.getBedDirection(mc.theWorld, x, y, z);
|
||||
GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, MovingObjectPosition target, int subID, ItemStack currentItem, float partialTicks)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, currentItem, partialTicks));
|
||||
}
|
||||
|
||||
public static void dispatchRenderLast(RenderGlobal context, float partialTicks)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, partialTicks));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPre(TextureMap map)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map));
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPost(TextureMap map)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* This is added for Optifine's convenience. And to explode if a ModMaker is developing.
|
||||
* @param texture
|
||||
*/
|
||||
public static void onTextureLoadPre(String texture)
|
||||
{
|
||||
if (Tessellator.renderingWorldRenderer)
|
||||
{
|
||||
String msg = String.format("Warning: Texture %s not preloaded, will cause render glitches!", texture);
|
||||
System.out.println(msg);
|
||||
if (Tessellator.class.getPackage() != null)
|
||||
{
|
||||
if (Tessellator.class.getPackage().getName().startsWith("net.minecraft."))
|
||||
{
|
||||
Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
if (mc.ingameGUI != null)
|
||||
{
|
||||
mc.ingameGUI.getChatGUI().printChatMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int renderPass = -1;
|
||||
public static void setRenderPass(int pass)
|
||||
{
|
||||
renderPass = pass;
|
||||
}
|
||||
|
||||
public static ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBiped _default)
|
||||
{
|
||||
ModelBiped modelbiped = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID);
|
||||
return modelbiped == null ? _default : modelbiped;
|
||||
}
|
||||
|
||||
static int stencilBits = 0;
|
||||
public static void createDisplay() throws LWJGLException
|
||||
{
|
||||
ImageIO.setUseCache(false); //Disable on-disc stream cache should speed up texture pack reloading.
|
||||
PixelFormat format = new PixelFormat().withDepthBits(24);
|
||||
try
|
||||
{
|
||||
//TODO: Figure out how to determine the max bits.
|
||||
Display.create(format.withStencilBits(8));
|
||||
stencilBits = 8;
|
||||
}
|
||||
catch(LWJGLException e)
|
||||
{
|
||||
Display.create(format);
|
||||
stencilBits = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.gui.GuiControls;
|
||||
import net.minecraft.client.gui.GuiSlot;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class GuiControlsScrollPanel extends GuiSlot
|
||||
{
|
||||
private GuiControls controls;
|
||||
private GameSettings options;
|
||||
private Minecraft mc;
|
||||
private String[] message;
|
||||
private int _mouseX;
|
||||
private int _mouseY;
|
||||
private int selected = -1;
|
||||
|
||||
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
|
||||
{
|
||||
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
|
||||
this.controls = controls;
|
||||
this.options = options;
|
||||
this.mc = mc;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSize()
|
||||
{
|
||||
return options.keyBindings.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void elementClicked(int i, boolean flag)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
if (selected == -1)
|
||||
{
|
||||
selected = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
options.setKeyBinding(selected, -100);
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSelected(int i)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void func_130003_c() {}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mX, int mY, float f)
|
||||
{
|
||||
_mouseX = mX;
|
||||
_mouseY = mY;
|
||||
|
||||
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
|
||||
{
|
||||
if (Mouse.next() && Mouse.getEventButtonState())
|
||||
{
|
||||
System.out.println(Mouse.getEventButton());
|
||||
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
}
|
||||
}
|
||||
|
||||
super.drawScreen(mX, mY, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
|
||||
{
|
||||
int width = 70;
|
||||
int height = 20;
|
||||
xPosition -= 20;
|
||||
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
|
||||
int k = (flag ? 2 : 1);
|
||||
|
||||
mc.renderEngine.func_110577_a(TextureMap.field_110576_c);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
|
||||
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
|
||||
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
|
||||
|
||||
boolean conflict = false;
|
||||
for (int x = 0; x < options.keyBindings.length; x++)
|
||||
{
|
||||
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
|
||||
{
|
||||
conflict = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index);
|
||||
str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str);
|
||||
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public boolean keyTyped(char c, int i)
|
||||
{
|
||||
if (selected != -1)
|
||||
{
|
||||
options.setKeyBinding(selected, i);
|
||||
selected = -1;
|
||||
KeyBinding.resetKeyBindingArrayAndHash();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
@Cancelable
|
||||
public class ClientChatReceivedEvent extends Event
|
||||
{
|
||||
public String message;
|
||||
public ClientChatReceivedEvent(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public abstract class RenderLivingEvent extends Event
|
||||
{
|
||||
public final EntityLivingBase entity;
|
||||
public final RendererLivingEntity renderer;
|
||||
|
||||
public RenderLivingEvent(EntityLivingBase entity, RendererLivingEntity renderer)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
public abstract static class Specials extends RenderLivingEvent
|
||||
{
|
||||
public Specials(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); }
|
||||
|
||||
@Cancelable
|
||||
public static class Pre extends Specials
|
||||
{
|
||||
public Pre(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); }
|
||||
}
|
||||
public static class Post extends Specials
|
||||
{
|
||||
public Post(EntityLivingBase entity, RendererLivingEntity renderer){ super(entity, renderer); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
|
||||
/***
|
||||
* Raised when the SoundManager tries to play a normal sound,
|
||||
* dogs barking, footsteps, etc. THe majority of all sounds during normal game play.
|
||||
*
|
||||
* If you return null from this function it will prevent the sound from being played,
|
||||
* you can return a different entry if you want to change the sound being played.
|
||||
*/
|
||||
public class PlaySoundEvent extends SoundResultEvent
|
||||
{
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlaySoundEvent(SoundManager manager, SoundPoolEntry source, String name, float x, float y, float z, float volume, float pitch)
|
||||
{
|
||||
super(manager, source, name, volume, pitch);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
|
||||
public class PlaySoundSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlaySoundSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
|
||||
public class PlayStreamingSourceEvent extends SoundEvent
|
||||
{
|
||||
public final SoundManager manager;
|
||||
public final String name;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public PlayStreamingSourceEvent(SoundManager manager, String name, float x, float y, float z)
|
||||
{
|
||||
this.manager = manager;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package net.minecraftforge.client.event.sound;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import net.minecraft.client.audio.SoundPoolEntry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class SoundEvent extends Event
|
||||
{
|
||||
public SoundEvent(){}
|
||||
|
||||
public static SoundPoolEntry getResult(SoundResultEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.result;
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.client.model.obj.ObjModelLoader;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Common interface for advanced model loading from files, based on file suffix
|
||||
* Model support can be queried through the {@link #getSupportedSuffixes()} method.
|
||||
* Instances can be created by calling {@link #loadModel(String)} with a class-loadable-path
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class AdvancedModelLoader {
|
||||
private static Map<String, IModelCustomLoader> instances = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* Register a new model handler
|
||||
* @param modelHandler The model handler to register
|
||||
*/
|
||||
public static void registerModelHandler(IModelCustomLoader modelHandler)
|
||||
{
|
||||
for (String suffix : modelHandler.getSuffixes())
|
||||
{
|
||||
instances.put(suffix, modelHandler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the model from the supplied classpath resolvable resource name
|
||||
* @param resourceName The resource name
|
||||
* @return A model
|
||||
* @throws IllegalArgumentException if the resource name cannot be understood
|
||||
* @throws ModelFormatException if the underlying model handler cannot parse the model format
|
||||
*/
|
||||
public static IModelCustom loadModel(String resourceName) throws IllegalArgumentException, ModelFormatException
|
||||
{
|
||||
int i = resourceName.lastIndexOf('.');
|
||||
if (i == -1)
|
||||
{
|
||||
FMLLog.severe("The resource name %s is not valid", resourceName);
|
||||
throw new IllegalArgumentException("The resource name is not valid");
|
||||
}
|
||||
String suffix = resourceName.substring(i+1);
|
||||
IModelCustomLoader loader = instances.get(suffix);
|
||||
if (loader == null)
|
||||
{
|
||||
FMLLog.severe("The resource name %s is not supported", resourceName);
|
||||
throw new IllegalArgumentException("The resource name is not supported");
|
||||
}
|
||||
|
||||
URL resource = AdvancedModelLoader.class.getResource(resourceName);
|
||||
if (resource == null)
|
||||
{
|
||||
FMLLog.severe("The resource name %s could not be found", resourceName);
|
||||
throw new IllegalArgumentException("The resource name could not be found");
|
||||
}
|
||||
return loader.loadInstance(resourceName, resource);
|
||||
}
|
||||
|
||||
public static Collection<String> getSupportedSuffixes()
|
||||
{
|
||||
return instances.keySet();
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
{
|
||||
registerModelHandler(new ObjModelLoader());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
|
||||
|
||||
public interface IModelCustom {
|
||||
String getType();
|
||||
void renderAll();
|
||||
void renderPart(String partName);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Instances of this class act as factories for their model type
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface IModelCustomLoader {
|
||||
/**
|
||||
* Get the main type name for this loader
|
||||
* @return the type name
|
||||
*/
|
||||
String getType();
|
||||
/**
|
||||
* Get resource suffixes this model loader recognizes
|
||||
* @return a list of suffixes
|
||||
*/
|
||||
String[] getSuffixes();
|
||||
/**
|
||||
* Load a model instance from the supplied path
|
||||
* @param resourceName The resource name to load
|
||||
* @param resource The URL associated with the classloader resource
|
||||
* @return A model instance
|
||||
* @throws ModelFormatException if the model format is not correct
|
||||
*/
|
||||
IModelCustom loadInstance(String resourceName, URL resource) throws ModelFormatException;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
/**
|
||||
* Thrown if there is a problem parsing the model
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class ModelFormatException extends RuntimeException {
|
||||
|
||||
public ModelFormatException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public ModelFormatException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public ModelFormatException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public ModelFormatException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.Vec3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Face
|
||||
{
|
||||
|
||||
public Vertex[] vertices;
|
||||
public Vertex[] vertexNormals;
|
||||
public Vertex faceNormal;
|
||||
public TextureCoordinate[] textureCoordinates;
|
||||
|
||||
public void addFaceForRender(Tessellator tessellator)
|
||||
{
|
||||
addFaceForRender(tessellator, 0.0005F);
|
||||
}
|
||||
|
||||
public void addFaceForRender(Tessellator tessellator, float textureOffset)
|
||||
{
|
||||
if (faceNormal == null)
|
||||
{
|
||||
faceNormal = this.calculateFaceNormal();
|
||||
}
|
||||
|
||||
tessellator.setNormal(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||
|
||||
float averageU = 0F;
|
||||
float averageV = 0F;
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
for (int i = 0; i < textureCoordinates.length; ++i)
|
||||
{
|
||||
averageU += textureCoordinates[i].u;
|
||||
averageV += textureCoordinates[i].v;
|
||||
}
|
||||
|
||||
averageU = averageU / textureCoordinates.length;
|
||||
averageV = averageV / textureCoordinates.length;
|
||||
}
|
||||
|
||||
float offsetU, offsetV;
|
||||
|
||||
for (int i = 0; i < vertices.length; ++i)
|
||||
{
|
||||
|
||||
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||
{
|
||||
offsetU = textureOffset;
|
||||
offsetV = textureOffset;
|
||||
|
||||
if (textureCoordinates[i].u > averageU)
|
||||
{
|
||||
offsetU = -offsetU;
|
||||
}
|
||||
if (textureCoordinates[i].v > averageV)
|
||||
{
|
||||
offsetV = -offsetV;
|
||||
}
|
||||
|
||||
tessellator.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV);
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.addVertex(vertices[i].x, vertices[i].y, vertices[i].z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Vertex calculateFaceNormal()
|
||||
{
|
||||
Vec3 v1 = Vec3.createVectorHelper(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
|
||||
Vec3 v2 = Vec3.createVectorHelper(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
|
||||
Vec3 normalVector = null;
|
||||
|
||||
normalVector = v1.crossProduct(v2).normalize();
|
||||
|
||||
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GroupObject
|
||||
{
|
||||
|
||||
public String name;
|
||||
public ArrayList<Face> faces = new ArrayList<Face>();
|
||||
public int glDrawingMode;
|
||||
|
||||
public GroupObject()
|
||||
{
|
||||
this("");
|
||||
}
|
||||
|
||||
public GroupObject(String name)
|
||||
{
|
||||
this(name, -1);
|
||||
}
|
||||
|
||||
public GroupObject(String name, int glDrawingMode)
|
||||
{
|
||||
this.name = name;
|
||||
this.glDrawingMode = glDrawingMode;
|
||||
}
|
||||
|
||||
public void render()
|
||||
{
|
||||
if (faces.size() > 0)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawing(glDrawingMode);
|
||||
render(tessellator);
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
public void render(Tessellator tessellator)
|
||||
{
|
||||
if (faces.size() > 0)
|
||||
{
|
||||
for (Face face : faces)
|
||||
{
|
||||
face.addFaceForRender(tessellator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import net.minecraftforge.client.model.IModelCustomLoader;
|
||||
import net.minecraftforge.client.model.ModelFormatException;
|
||||
|
||||
public class ObjModelLoader implements IModelCustomLoader {
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "OBJ model";
|
||||
}
|
||||
|
||||
private static final String[] types = { "obj" };
|
||||
@Override
|
||||
public String[] getSuffixes()
|
||||
{
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelCustom loadInstance(String resourceName, URL resource) throws ModelFormatException
|
||||
{
|
||||
return new WavefrontObject(resourceName, resource);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureCoordinate
|
||||
{
|
||||
|
||||
public float u, v, w;
|
||||
|
||||
public TextureCoordinate(float u, float v)
|
||||
{
|
||||
this(u, v, 0F);
|
||||
}
|
||||
|
||||
public TextureCoordinate(float u, float v, float w)
|
||||
{
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.w = w;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class Vertex
|
||||
{
|
||||
|
||||
public float x, y, z;
|
||||
|
||||
public Vertex(float x, float y)
|
||||
{
|
||||
this(x, y, 0F);
|
||||
}
|
||||
|
||||
public Vertex(float x, float y, float z)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,583 +0,0 @@
|
||||
package net.minecraftforge.client.model.obj;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
import net.minecraftforge.client.model.ModelFormatException;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Wavefront Object importer
|
||||
* Based heavily off of the specifications found at http://en.wikipedia.org/wiki/Wavefront_.obj_file
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class WavefrontObject implements IModelCustom
|
||||
{
|
||||
|
||||
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(v( (\\-){0,1}\\d+\\.\\d+){3,4} *$)");
|
||||
private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *\\n)|(vn( (\\-){0,1}\\d+\\.\\d+){3,4} *$)");
|
||||
private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *$)");
|
||||
private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)");
|
||||
private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)");
|
||||
private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)");
|
||||
private static Pattern face_V_Pattern = Pattern.compile("(f( \\d+){3,4} *\\n)|(f( \\d+){3,4} *$)");
|
||||
private static Pattern groupObjectPattern = Pattern.compile("([go]( [\\w\\d]+) *\\n)|([go]( [\\w\\d]+) *$)");
|
||||
|
||||
private static Matcher vertexMatcher, vertexNormalMatcher, textureCoordinateMatcher;
|
||||
private static Matcher face_V_VT_VN_Matcher, face_V_VT_Matcher, face_V_VN_Matcher, face_V_Matcher;
|
||||
private static Matcher groupObjectMatcher;
|
||||
|
||||
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
||||
public ArrayList<Vertex> vertexNormals = new ArrayList<Vertex>();
|
||||
public ArrayList<TextureCoordinate> textureCoordinates = new ArrayList<TextureCoordinate>();
|
||||
public ArrayList<GroupObject> groupObjects = new ArrayList<GroupObject>();
|
||||
private GroupObject currentGroupObject;
|
||||
private String fileName;
|
||||
|
||||
public WavefrontObject(String fileName, URL resource) throws ModelFormatException
|
||||
{
|
||||
this.fileName = fileName;
|
||||
loadObjModel(resource);
|
||||
}
|
||||
|
||||
private void loadObjModel(URL fileURL) throws ModelFormatException
|
||||
{
|
||||
BufferedReader reader = null;
|
||||
InputStream inputStream = null;
|
||||
|
||||
String currentLine = null;
|
||||
int lineCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
inputStream = fileURL.openStream();
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
|
||||
while ((currentLine = reader.readLine()) != null)
|
||||
{
|
||||
lineCount++;
|
||||
currentLine = currentLine.replaceAll("\\s+", " ").trim();
|
||||
|
||||
if (currentLine.startsWith("#") || currentLine.length() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (currentLine.startsWith("v "))
|
||||
{
|
||||
Vertex vertex = parseVertex(currentLine, lineCount);
|
||||
if (vertex != null)
|
||||
{
|
||||
vertices.add(vertex);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("vn "))
|
||||
{
|
||||
Vertex vertex = parseVertexNormal(currentLine, lineCount);
|
||||
if (vertex != null)
|
||||
{
|
||||
vertexNormals.add(vertex);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("vt "))
|
||||
{
|
||||
TextureCoordinate textureCoordinate = parseTextureCoordinate(currentLine, lineCount);
|
||||
if (textureCoordinate != null)
|
||||
{
|
||||
textureCoordinates.add(textureCoordinate);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("f "))
|
||||
{
|
||||
|
||||
if (currentGroupObject == null)
|
||||
{
|
||||
currentGroupObject = new GroupObject("Default");
|
||||
}
|
||||
|
||||
Face face = parseFace(currentLine, lineCount);
|
||||
|
||||
if (face != null)
|
||||
{
|
||||
currentGroupObject.faces.add(face);
|
||||
}
|
||||
}
|
||||
else if (currentLine.startsWith("g ") | currentLine.startsWith("o "))
|
||||
{
|
||||
GroupObject group = parseGroupObject(currentLine, lineCount);
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
if (currentGroupObject != null)
|
||||
{
|
||||
groupObjects.add(currentGroupObject);
|
||||
}
|
||||
}
|
||||
|
||||
currentGroupObject = group;
|
||||
}
|
||||
}
|
||||
|
||||
groupObjects.add(currentGroupObject);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new ModelFormatException("IO Exception reading model format", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
reader.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// hush
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
inputStream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// hush
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderAll()
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (currentGroupObject != null)
|
||||
{
|
||||
tessellator.startDrawing(currentGroupObject.glDrawingMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
tessellator.startDrawing(GL11.GL_TRIANGLES);
|
||||
}
|
||||
|
||||
for (GroupObject groupObject : groupObjects)
|
||||
{
|
||||
groupObject.render(tessellator);
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderOnly(String... groupNames)
|
||||
{
|
||||
for (GroupObject groupObject : groupObjects)
|
||||
{
|
||||
for (String groupName : groupNames)
|
||||
{
|
||||
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderPart(String partName)
|
||||
{
|
||||
for (GroupObject groupObject : groupObjects)
|
||||
{
|
||||
if (partName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderAllExcept(String... excludedGroupNames)
|
||||
{
|
||||
for (GroupObject groupObject : groupObjects)
|
||||
{
|
||||
for (String excludedGroupName : excludedGroupNames)
|
||||
{
|
||||
if (!excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||
{
|
||||
groupObject.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vertex parseVertex(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
Vertex vertex = null;
|
||||
|
||||
if (isValidVertexLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 2)
|
||||
{
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]));
|
||||
}
|
||||
else if (tokens.length == 3)
|
||||
{
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return vertex;
|
||||
}
|
||||
|
||||
private Vertex parseVertexNormal(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
Vertex vertexNormal = null;
|
||||
|
||||
if (isValidVertexNormalLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 3)
|
||||
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return vertexNormal;
|
||||
}
|
||||
|
||||
private TextureCoordinate parseTextureCoordinate(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
TextureCoordinate textureCoordinate = null;
|
||||
|
||||
if (isValidTextureCoordinateLine(line))
|
||||
{
|
||||
line = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = line.split(" ");
|
||||
|
||||
try
|
||||
{
|
||||
if (tokens.length == 2)
|
||||
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]));
|
||||
else if (tokens.length == 3)
|
||||
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return textureCoordinate;
|
||||
}
|
||||
|
||||
private Face parseFace(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
Face face = null;
|
||||
|
||||
if (isValidFaceLine(line))
|
||||
{
|
||||
face = new Face();
|
||||
|
||||
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||
String[] tokens = trimmedLine.split(" ");
|
||||
String[] subTokens = null;
|
||||
|
||||
if (tokens.length == 3)
|
||||
{
|
||||
if (currentGroupObject.glDrawingMode == -1)
|
||||
{
|
||||
currentGroupObject.glDrawingMode = GL11.GL_TRIANGLES;
|
||||
}
|
||||
else if (currentGroupObject.glDrawingMode != GL11.GL_TRIANGLES)
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 4, found " + tokens.length + ")");
|
||||
}
|
||||
}
|
||||
else if (tokens.length == 4)
|
||||
{
|
||||
if (currentGroupObject.glDrawingMode == -1)
|
||||
{
|
||||
currentGroupObject.glDrawingMode = GL11.GL_QUADS;
|
||||
}
|
||||
else if (currentGroupObject.glDrawingMode != GL11.GL_QUADS)
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 3, found " + tokens.length + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ...
|
||||
if (isValidFace_V_VT_VN_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||
face.vertexNormals = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("/");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[2]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||
else if (isValidFace_V_VT_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("/");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1//vn1 v2//vn2 v3//vn3 ...
|
||||
else if (isValidFace_V_VN_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
face.vertexNormals = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
subTokens = tokens[i].split("//");
|
||||
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[1]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
// f v1 v2 v3 ...
|
||||
else if (isValidFace_V_Line(line))
|
||||
{
|
||||
face.vertices = new Vertex[tokens.length];
|
||||
|
||||
for (int i = 0; i < tokens.length; ++i)
|
||||
{
|
||||
face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1);
|
||||
}
|
||||
|
||||
face.faceNormal = face.calculateFaceNormal();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return face;
|
||||
}
|
||||
|
||||
private GroupObject parseGroupObject(String line, int lineCount) throws ModelFormatException
|
||||
{
|
||||
GroupObject group = null;
|
||||
|
||||
if (isValidGroupObjectLine(line))
|
||||
{
|
||||
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||
|
||||
if (trimmedLine.length() > 0)
|
||||
{
|
||||
group = new GroupObject(trimmedLine);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid vertex
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid vertex, false otherwise
|
||||
*/
|
||||
private static boolean isValidVertexLine(String line)
|
||||
{
|
||||
if (vertexMatcher != null)
|
||||
{
|
||||
vertexMatcher.reset();
|
||||
}
|
||||
|
||||
vertexMatcher = vertexPattern.matcher(line);
|
||||
return vertexMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid vertex normal
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid vertex normal, false otherwise
|
||||
*/
|
||||
private static boolean isValidVertexNormalLine(String line)
|
||||
{
|
||||
if (vertexNormalMatcher != null)
|
||||
{
|
||||
vertexNormalMatcher.reset();
|
||||
}
|
||||
|
||||
vertexNormalMatcher = vertexNormalPattern.matcher(line);
|
||||
return vertexNormalMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid texture coordinate
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid texture coordinate, false otherwise
|
||||
*/
|
||||
private static boolean isValidTextureCoordinateLine(String line)
|
||||
{
|
||||
if (textureCoordinateMatcher != null)
|
||||
{
|
||||
textureCoordinateMatcher.reset();
|
||||
}
|
||||
|
||||
textureCoordinateMatcher = textureCoordinatePattern.matcher(line);
|
||||
return textureCoordinateMatcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices, texture coordinates, and vertex normals
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1/vt1/vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VT_VN_Line(String line)
|
||||
{
|
||||
if (face_V_VT_VN_Matcher != null)
|
||||
{
|
||||
face_V_VT_VN_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VT_VN_Matcher = face_V_VT_VN_Pattern.matcher(line);
|
||||
return face_V_VT_VN_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices and texture coordinates
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1/vt1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VT_Line(String line)
|
||||
{
|
||||
if (face_V_VT_Matcher != null)
|
||||
{
|
||||
face_V_VT_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VT_Matcher = face_V_VT_Pattern.matcher(line);
|
||||
return face_V_VT_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by vertices and vertex normals
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1//vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_VN_Line(String line)
|
||||
{
|
||||
if (face_V_VN_Matcher != null)
|
||||
{
|
||||
face_V_VN_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_VN_Matcher = face_V_VN_Pattern.matcher(line);
|
||||
return face_V_VN_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face that is described by only vertices
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches the format "f v1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||
*/
|
||||
private static boolean isValidFace_V_Line(String line)
|
||||
{
|
||||
if (face_V_Matcher != null)
|
||||
{
|
||||
face_V_Matcher.reset();
|
||||
}
|
||||
|
||||
face_V_Matcher = face_V_Pattern.matcher(line);
|
||||
return face_V_Matcher.matches();
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid face of any of the possible face formats
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid face that matches any of the valid face formats, false otherwise
|
||||
*/
|
||||
private static boolean isValidFaceLine(String line)
|
||||
{
|
||||
return isValidFace_V_VT_VN_Line(line) || isValidFace_V_VT_Line(line) || isValidFace_V_VN_Line(line) || isValidFace_V_Line(line);
|
||||
}
|
||||
|
||||
/***
|
||||
* Verifies that the given line from the model file is a valid group (or object)
|
||||
* @param line the line being validated
|
||||
* @return true if the line is a valid group (or object), false otherwise
|
||||
*/
|
||||
private static boolean isValidGroupObjectLine(String line)
|
||||
{
|
||||
if (groupObjectMatcher != null)
|
||||
{
|
||||
groupObjectMatcher.reset();
|
||||
}
|
||||
|
||||
groupObjectMatcher = groupObjectPattern.matcher(line);
|
||||
return groupObjectMatcher.matches();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "obj";
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
#Main Forge Access Transformer configuration file
|
||||
# Tessellator
|
||||
public-f bff.a #FD:Tessellator/field_78398_a #instance
|
||||
public bff.u #FD:Tessellator/field_78409_u #drawMode
|
||||
public bff.v #FD:Tessellator/field_78408_v #xOffset
|
||||
public bff.w #FD:Tessellator/field_78407_w #yOffset
|
||||
public bff.x #FD:Tessellator/field_78417_x #zOffset
|
||||
public bff.z #FD:Tessellator/field_78415_z #isDrawing
|
||||
# ItemPickaxe
|
||||
public yi.<init>(ILxy;)V #MD:ItemPickaxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f yi.c #FD:ItemPickaxe/field_77867_c #blocksEffectiveAgainst
|
||||
# ItemAxe
|
||||
public xv.<init>(ILxy;)V #MD:ItemAxe/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f xv.c #FD:ItemAxe/field_77868_c #blocksEffectiveAgainst
|
||||
# ItemSpade
|
||||
public yt.<init>(ILxy;)V #MD:ItemSpade/<init>(ILnet/minecraft/src/EnumToolMaterial;) #constructor
|
||||
public+f yt.c #FD:ItemSpade/field_77866_c #blocksEffectiveAgainst
|
||||
# ItemTool
|
||||
public xe.a #FD:ItemTool/field_77864_a #efficiencyOnProperMaterial
|
||||
public xe.d #FD:ItemTool/field_77865_bY #damageVsEntity
|
||||
# EntityEnderman
|
||||
public td.br #FD:EntityEnderman/field_70827_d #carriableBlocks
|
||||
# RenderEngine
|
||||
# -- MISSING MAPPING public bge.f(Ljava/lang/String;)I #MD:RenderEngine/func_78341_b #getTexture
|
||||
# -- MISSING MAPPING public bge.i #FD:RenderEngine/field_94154_l #terrainTextureMap
|
||||
# -- MISSING MAPPING public bge.j #FD:RenderEngine/field_94155_m #itemTextureMap
|
||||
# RenderGlobal
|
||||
public bfa.k #FD:RenderGlobal/field_72769_h #theWorld
|
||||
public bfa.l #FD:RenderGlobal/field_72770_i #renderEngine
|
||||
public bfa.t #FD:RenderGlobal/field_72777_q #mc
|
||||
public bfa.u #FD:RenderGlobal/field_72776_r #globalRenderBlocks
|
||||
public bfa.H #FD:RenderGlobal/field_72738_E #damagedBlocks
|
||||
# SoundManager
|
||||
public blc.b #FD:SoundManager/field_77381_a #sndSystem
|
||||
public blc.d #FD:SoundManager/field_77379_b #soundPoolSounds
|
||||
public blc.e #FD:SoundManager/field_77380_c #soundPoolStreaming
|
||||
public blc.f #FD:SoundManager/field_77377_d #soundPoolMusic
|
||||
# EntityMinecart
|
||||
protected sq.* #FD:EntityMinecart/* # All private -> protected
|
||||
# -- MISSING MAPPING public py.h()Z #MD:EntityMinecart/func_70490_h #isMinecartPowered
|
||||
# Block
|
||||
public aqs.<init>(ILajv;)V #MD:Block/<init>(ILnet/minecraft/src/Material;) #Constructor
|
||||
public aqs.<init>(IILajv;)V #MD:Block/<init>(IILnet/minecraft/src/Material;) #Constructor
|
||||
public aqs.cH #FD:Block/field_72029_cc #blockResistance
|
||||
public aqs.cG #FD:Block/field_71989_cb #blockHardness
|
||||
# -- MISSING MAPPING public amq.r()Lamq; #MD:Block/func_71912_p #setRequiresSelfNotify
|
||||
public aqs.a(Laqw;)Laqs; #MD:Block/func_71884_a #setStepSound
|
||||
public aqs.b(F)Laqs; #MD:Block/func_71894_b #setResistance
|
||||
public aqs.c(F)Laqs; #MD:Block/func_71848_c #setHardness
|
||||
public aqs.k(I)Laqs; #MD:Block/func_71868_h #setLightOpacity
|
||||
public aqs.a(F)Laqs; #MD:Block/func_71900_a #setLightValue
|
||||
public aqs.r()Laqs; #MD:Block/func_71875_q #setBlockUnbreakable
|
||||
public aqs.b(Z)Laqs; #MD:Block/func_71907_b #setTickRandomly
|
||||
public aqs.a(FFFFFF)V #MD:Block/func_71905_a #setBlockBounds
|
||||
# NetServerHandler
|
||||
public jx.f #FD:NetServerHandler/field_72572_g #playerInAirTime
|
||||
# TileEntity
|
||||
public asi.k #FD:TileEntity/field_70331_k #worldObj
|
||||
# BlockLeavesBase
|
||||
public ara.d #FD:BlockLeavesBase/field_72131_c #graphicsLevel
|
||||
# Item
|
||||
public xx.<init>(I)V #MD:Item/<init>(I) #Constructor
|
||||
public xx.e(I)Lxx; #MD:Item/func_77656_e #setMaxDamage
|
||||
public-f xx.h(Lxz;)Lmp; #MD:Item/func_77650_f #getIconIndex
|
||||
public xx.c(Ljava/lang/String;)Lxx; #MD:Item/func_77631_c #setPotionEffect
|
||||
# RailLogic
|
||||
public ams #CL:BlockBaseRailLogic
|
||||
public ams.a()I #MD:BlockBaseRailLogic/func_94505_a #getNAdjacentTiles
|
||||
# EntityPlayer
|
||||
public ua.a(Lsp;)V #MD:EntityPlayer/func_71012_a #joinEntityItemWithWorld
|
||||
public ua.i()V #MD:EntityPlayer/func_71053_j #closeScreen
|
||||
public ua.b #FD:EntityPlayer/field_71076_b #sleepTimer
|
||||
# EntityPlayerMP
|
||||
public bcx.a(Lsp;)V #MD:EntityClientPlayerMP/func_71012_a #joinEntityItemWithWorld
|
||||
# World Gen Chests Related
|
||||
public mh.* #FD:WeightedRandomChestContent/* #all
|
||||
public jp.T #FD:WorldServer/field_73069_S #bonusChestContent
|
||||
public agc.a #FD:StructureMineshaftPieces/field_78818_a #mineshaftChestContents
|
||||
public ahg.i #FD:ComponentScatteredFeatureDesertPyramid/field_74941_i #itemsToGenerateInTemple
|
||||
public ahh.l #FD:ComponentScatteredFeatureJunglePyramid/field_74943_l #junglePyramidsChestContents
|
||||
public ahh.m #FD:ComponentScatteredFeatureJunglePyramid/field_74944_m #junglePyramidsDispenserContents
|
||||
public ahr.a #FD:ComponentStrongholdChestCorridor/field_75003_a #strongholdChestContents
|
||||
public ahv.b #FD:ComponentStrongholdLibrary/field_75007_b #strongholdLibraryChestContents
|
||||
public aia.c #FD:ComponentStrongholdRoomCrossing/field_75014_c #strongholdCorridorChestContents
|
||||
public ajb.a #FD:ComponentVillageHouse2/field_74918_a #villageBlacksmithChestContents
|
||||
# AnvilChunkLoader.chunkSaveLocation
|
||||
public adz.d #FD:AnvilChunkLoader/field_75825_d
|
||||
# ChunkProviderServer.currentChunkLoader
|
||||
public jo.e #FD:ChunkProviderServer/field_73247_e
|
||||
# PlayerManager
|
||||
public jm.a(IIZ)Ljn; #MD:PlayerManager/func_72690_a #getOrCreateChunkWatcher
|
||||
# PlayerInstance
|
||||
public jn #CL:PlayerInstance
|
||||
# World
|
||||
public-f abr.A #FD:World/field_72982_D #villageCollectionObj
|
||||
public abr.G #FD:World/field_72993_I #activeChunkSet
|
||||
# EntityLiving
|
||||
public od.b #FD:EntityLiving/field_70728_aV #experienceValue
|
||||
# -- MISSING MAPPING public ng.bt #FD:EntityLiving/field_94063_bt #combatTracker
|
||||
public od.d #FD:EntityLiving/field_70715_bh #targetTasks
|
||||
# GuiFlatPresets
|
||||
public avq.a(Ljava/lang/String;ILacl;Ljava/util/List;[Lafy;)V #MD:GuiFlatPresets/func_82294_a
|
||||
public avq.a(Ljava/lang/String;ILacl;[Lafy;)V #MD:GuiFlatPresets/func_82297_a
|
||||
# BiomeGenBase
|
||||
public acl.*() #MD:BiomeGenBase/* #Everything protected->public
|
||||
# MapGenVillage
|
||||
public-f aip.e #FD:MapGenVillage/field_75055_e #villageSpawnBiomes
|
||||
# ShapedRecipes
|
||||
public+f aad.d #FD:ShapedRecipes/field_77574_d #recipeItems
|
||||
public+f aad.b #FD:ShapedRecipes/field_77576_b #recipeWidth
|
||||
public+f aad.c #FD:ShapedRecipes/field_77577_c #recipeHeight
|
||||
# ShapelessRecipes
|
||||
public aae.b #FD:ShapelessRecipes/field_77579_b #recipeItems
|
||||
# GuiContainer
|
||||
protected awp.a(Lvz;)V #MD:GuiContainer/func_74192_a #drawSlotInventory
|
||||
# ContainerPlayer
|
||||
protected vq.h #FD:ContainerPlayer/field_82862_h #player
|
||||
# BlockButton
|
||||
protected amy.n(Labr;III)V #MD:BlockButton/func_82535_o #checkActivation
|
||||
protected-f amy.a #FD:BlockButton/field_82537_a #sensible
|
||||
# BiomeDecorator
|
||||
public acp.* #FD:BiomeDecorator/* # All private -> protected
|
||||
# CreativeTabs
|
||||
public-f wr.a #FD:CreativeTabs/field_78032_a # creativeTabArray non-final
|
||||
# Packet
|
||||
public ex.a(IZZLjava/lang/Class;)V #MD:Packet/func_73285_a #addIdClassMapping
|
||||
# SaveHandler
|
||||
public alj.b()Ljava/io/File; #MD:SaveHandler/func_75765_b
|
||||
# World stuff
|
||||
public abr.b(Lnk;)V #MD:World/func_72847_b #releaseEntitySkin
|
||||
public abr.m #FD:World/field_73003_n #prevRainingStrength
|
||||
public abr.n #FD:World/field_73004_o #rainingStrength
|
||||
public abr.p #FD:World/field_73017_q #thunderingStrength
|
||||
public abr.o #FD:World/field_73018_p #prevThunderingStrength
|
||||
#WorldClient
|
||||
public bcu.b(Lnk;)V #MD:WorldClient/func_72847_b #releaseEntitySkin
|
||||
#WorldServer
|
||||
public jp.b(Lnk;)V #MD:WorldServer/func_72847_b #releaseEntitySkin
|
||||
public jp.N #FD:WorldServer/field_73068_P #allPlayersSleeping
|
||||
#TextureMap
|
||||
public bhz.g #FD:TextureMap/field_94255_a
|
||||
# -- MISSING MAPPING public bir.b #FD:TextureMap/field_94253_b
|
||||
public bhz.h #FD:TextureMap/field_94254_c
|
||||
# -- MISSING MAPPING public bir.d #FD:TextureMap/field_94251_d
|
||||
#Potion
|
||||
public nf.b(II)Lnf; #MD:Potion/func_76399_b #setIconIndex
|
||||
#PotionHelper
|
||||
public zk.m #FD:PotionHelper/field_77927_l #potionRequirements
|
||||
public zk.n #FD:PotionHelper/field_77928_m #potionAmplifiers
|
||||
#PotionEffect
|
||||
public ng.b #FD:PotionEffect/field_76460_b #duration
|
||||
#BlockFluid
|
||||
protected aov.a #FD:BlockFluid/field_94425_a #theIcon
|
||||
#GuiIngame
|
||||
protected ava.* #FD:GuiIngame/* # All private -> protected
|
||||
protected ava.*() #MD:GuiIngame/* # All private -> protected
|
||||
#ItemStack
|
||||
default xz.f #FD:ItemStack/field_77991_e # make default access for itemDamage
|
||||
#GuiSlot
|
||||
protected avx.b(IIII)V #MD:GuiSlot/func_77206_b #overlayBackground
|
||||
#EntityPlayer
|
||||
public ua.bu #FD:EntityPlayer/field_71092_bJ #username
|
||||
@@ -1,301 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.*;
|
||||
import net.minecraft.world.biome.*;
|
||||
import static net.minecraft.world.biome.BiomeGenBase.*;
|
||||
import static net.minecraftforge.common.BiomeDictionary.Type.*;
|
||||
|
||||
public class BiomeDictionary
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
FOREST,
|
||||
PLAINS,
|
||||
MOUNTAIN,
|
||||
HILLS,
|
||||
SWAMP,
|
||||
WATER,
|
||||
DESERT,
|
||||
FROZEN,
|
||||
JUNGLE,
|
||||
WASTELAND,
|
||||
BEACH,
|
||||
NETHER,
|
||||
END,
|
||||
MUSHROOM,
|
||||
MAGICAL;
|
||||
}
|
||||
|
||||
private static final int BIOME_LIST_SIZE = 256;
|
||||
private static BiomeInfo[] biomeList = new BiomeInfo[BIOME_LIST_SIZE];
|
||||
private static ArrayList<BiomeGenBase>[] typeInfoList = new ArrayList[Type.values().length];
|
||||
|
||||
private static class BiomeInfo
|
||||
{
|
||||
public EnumSet<Type> typeList;
|
||||
|
||||
public BiomeInfo(Type[] types)
|
||||
{
|
||||
typeList = EnumSet.noneOf(Type.class);
|
||||
for(Type t : types)
|
||||
{
|
||||
typeList.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
registerVanillaBiomes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a biome with a specific biome type
|
||||
*
|
||||
* @param biome the biome to be registered
|
||||
* @param type the type to register the biome as
|
||||
* @return returns true if the biome was registered successfully
|
||||
*/
|
||||
public static boolean registerBiomeType(BiomeGenBase biome, Type ... types)
|
||||
{
|
||||
if(BiomeGenBase.biomeList[biome.biomeID] != null)
|
||||
{
|
||||
for(Type type : types)
|
||||
{
|
||||
if(typeInfoList[type.ordinal()] == null)
|
||||
{
|
||||
typeInfoList[type.ordinal()] = new ArrayList<BiomeGenBase>();
|
||||
}
|
||||
|
||||
typeInfoList[type.ordinal()].add(biome);
|
||||
}
|
||||
|
||||
if(biomeList[biome.biomeID] == null)
|
||||
{
|
||||
biomeList[biome.biomeID] = new BiomeInfo(types);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(Type type : types)
|
||||
{
|
||||
biomeList[biome.biomeID].typeList.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of biomes registered with a specific type
|
||||
*
|
||||
* @param type the Type to look for
|
||||
* @return a list of biomes of the specified type, null if there are none
|
||||
*/
|
||||
public static BiomeGenBase[] getBiomesForType(Type type)
|
||||
{
|
||||
if(typeInfoList[type.ordinal()] != null)
|
||||
{
|
||||
return (BiomeGenBase[])typeInfoList[type.ordinal()].toArray(new BiomeGenBase[0]);
|
||||
}
|
||||
|
||||
return new BiomeGenBase[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of Types that a specific biome is registered with
|
||||
*
|
||||
* @param biome the biome to check
|
||||
* @return the list of types, null if there are none
|
||||
*/
|
||||
public static Type[] getTypesForBiome(BiomeGenBase biome)
|
||||
{
|
||||
checkRegistration(biome);
|
||||
|
||||
if(biomeList[biome.biomeID] != null)
|
||||
{
|
||||
return (Type[])biomeList[biome.biomeID].typeList.toArray(new Type[0]);
|
||||
}
|
||||
|
||||
return new Type[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if two biomes are registered as having the same type
|
||||
*
|
||||
* @param biomeA
|
||||
* @param biomeB
|
||||
* @return returns true if a common type is found, false otherwise
|
||||
*/
|
||||
public static boolean areBiomesEquivalent(BiomeGenBase biomeA, BiomeGenBase biomeB)
|
||||
{
|
||||
int a = biomeA.biomeID;
|
||||
int b = biomeB.biomeID;
|
||||
|
||||
checkRegistration(biomeA);
|
||||
checkRegistration(biomeB);
|
||||
|
||||
if(biomeList[a] != null && biomeList[b] != null)
|
||||
{
|
||||
for(Type type : biomeList[a].typeList)
|
||||
{
|
||||
if(containsType(biomeList[b], type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the given biome is registered as being a specific type
|
||||
*
|
||||
* @param biome the biome to be considered
|
||||
* @param type the type to check for
|
||||
* @return returns true if the biome is registered as being of type type, false otherwise
|
||||
*/
|
||||
public static boolean isBiomeOfType(BiomeGenBase biome, Type type)
|
||||
{
|
||||
checkRegistration(biome);
|
||||
|
||||
if(biomeList[biome.biomeID] != null)
|
||||
{
|
||||
return containsType(biomeList[biome.biomeID], type);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the given biome has been registered as being of any type
|
||||
* @param biome the biome to consider
|
||||
* @return returns true if the biome has been registered, false otherwise
|
||||
*/
|
||||
public static boolean isBiomeRegistered(BiomeGenBase biome)
|
||||
{
|
||||
return biomeList[biome.biomeID] != null;
|
||||
}
|
||||
|
||||
public static boolean isBiomeRegistered(int biomeID)
|
||||
{
|
||||
return biomeList[biomeID] != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through the biome list and automatically adds tags to any biome that does not have any
|
||||
* This should be called in postInit to make sure all biomes have been registered
|
||||
*
|
||||
* DO NOT call this during world generation
|
||||
*/
|
||||
public static void registerAllBiomes()
|
||||
{
|
||||
for(int i = 0; i < BIOME_LIST_SIZE; i++)
|
||||
{
|
||||
if(BiomeGenBase.biomeList[i] != null)
|
||||
{
|
||||
checkRegistration(BiomeGenBase.biomeList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically looks for and registers a given biome with appropriate tags
|
||||
* This method is called automatically if a biome has not been registered with any tags,
|
||||
* And another method requests information about it
|
||||
*
|
||||
* NOTE: You can opt out of having your biome registered by registering it as type NULL
|
||||
*
|
||||
* @param biome the biome to be considered
|
||||
*/
|
||||
public static void makeBestGuess(BiomeGenBase biome)
|
||||
{
|
||||
if(biome.theBiomeDecorator.treesPerChunk >= 3)
|
||||
{
|
||||
if(biome.isHighHumidity() && biome.temperature >= 1.0F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, JUNGLE);
|
||||
}
|
||||
else if(!biome.isHighHumidity())
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, FOREST);
|
||||
}
|
||||
}
|
||||
else if(biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F)
|
||||
{
|
||||
if(!biome.isHighHumidity() || biome.minHeight >= 0.0F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, PLAINS);
|
||||
}
|
||||
}
|
||||
|
||||
if(biome.isHighHumidity() && biome.minHeight < 0.0F && (biome.maxHeight <= 0.3F && biome.maxHeight >= 0.0F))
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, SWAMP);
|
||||
}
|
||||
|
||||
if(biome.minHeight <= -0.5F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, WATER);
|
||||
}
|
||||
|
||||
if(biome.maxHeight >= 1.5F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, MOUNTAIN);
|
||||
}
|
||||
|
||||
if(biome.getEnableSnow() || biome.temperature < 0.2F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, FROZEN);
|
||||
}
|
||||
|
||||
if(!biome.isHighHumidity() && biome.temperature >= 1.0F)
|
||||
{
|
||||
BiomeDictionary.registerBiomeType(biome, DESERT);
|
||||
}
|
||||
}
|
||||
|
||||
//Internal implementation
|
||||
private static void checkRegistration(BiomeGenBase biome)
|
||||
{
|
||||
if(!isBiomeRegistered(biome))
|
||||
{
|
||||
makeBestGuess(biome);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean containsType(BiomeInfo info, Type type)
|
||||
{
|
||||
return info.typeList.contains(type);
|
||||
}
|
||||
|
||||
private static void registerVanillaBiomes()
|
||||
{
|
||||
registerBiomeType(ocean, WATER );
|
||||
registerBiomeType(plains, PLAINS );
|
||||
registerBiomeType(desert, DESERT );
|
||||
registerBiomeType(extremeHills, MOUNTAIN );
|
||||
registerBiomeType(forest, FOREST );
|
||||
registerBiomeType(taiga, FOREST, FROZEN);
|
||||
registerBiomeType(taigaHills, FOREST, FROZEN);
|
||||
registerBiomeType(swampland, SWAMP );
|
||||
registerBiomeType(river, WATER );
|
||||
registerBiomeType(frozenOcean, WATER, FROZEN);
|
||||
registerBiomeType(frozenRiver, WATER, FROZEN);
|
||||
registerBiomeType(icePlains, FROZEN );
|
||||
registerBiomeType(iceMountains, FROZEN );
|
||||
registerBiomeType(beach, BEACH );
|
||||
registerBiomeType(desertHills, DESERT );
|
||||
registerBiomeType(jungle, JUNGLE );
|
||||
registerBiomeType(jungleHills, JUNGLE );
|
||||
registerBiomeType(forestHills, FOREST );
|
||||
registerBiomeType(sky, END );
|
||||
registerBiomeType(hell, NETHER );
|
||||
registerBiomeType(mushroomIsland, MUSHROOM );
|
||||
registerBiomeType(extremeHillsEdge, MOUNTAIN );
|
||||
registerBiomeType(mushroomIslandShore, MUSHROOM, BEACH);
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.structure.MapGenStronghold;
|
||||
import net.minecraft.world.gen.structure.MapGenVillage;
|
||||
import net.minecraft.world.biome.WorldChunkManager;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class BiomeManager
|
||||
{
|
||||
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
|
||||
{
|
||||
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.add(biome);
|
||||
MapGenVillage.villageSpawnBiomes = biomes;
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeVillageBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (MapGenVillage.villageSpawnBiomes.contains(biome))
|
||||
{
|
||||
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
|
||||
biomes.remove(biome);
|
||||
MapGenVillage.villageSpawnBiomes = biomes;
|
||||
}
|
||||
}
|
||||
|
||||
public static void addStrongholdBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (!MapGenStronghold.allowedBiomes.contains(biome))
|
||||
{
|
||||
MapGenStronghold.allowedBiomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeStrongholdBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (MapGenStronghold.allowedBiomes.contains(biome))
|
||||
{
|
||||
MapGenStronghold.allowedBiomes.remove(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addSpawnBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (!WorldChunkManager.allowedBiomes.contains(biome))
|
||||
{
|
||||
WorldChunkManager.allowedBiomes.add(biome);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeSpawnBiome(BiomeGenBase biome)
|
||||
{
|
||||
if (WorldChunkManager.allowedBiomes.contains(biome))
|
||||
{
|
||||
WorldChunkManager.allowedBiomes.remove(biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,927 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import static net.minecraftforge.common.Property.Type.BOOLEAN;
|
||||
import static net.minecraftforge.common.Property.Type.DOUBLE;
|
||||
import static net.minecraftforge.common.Property.Type.INTEGER;
|
||||
import static net.minecraftforge.common.Property.Type.STRING;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||
|
||||
/**
|
||||
* This class offers advanced configurations capabilities, allowing to provide
|
||||
* various categories for configuration variables.
|
||||
*/
|
||||
public class Configuration
|
||||
{
|
||||
private static boolean[] configMarkers = new boolean[Item.itemsList.length];
|
||||
private static final int ITEM_SHIFT = 256;
|
||||
private static final int MAX_BLOCKS = 4096;
|
||||
|
||||
public static final String CATEGORY_GENERAL = "general";
|
||||
public static final String CATEGORY_BLOCK = "block";
|
||||
public static final String CATEGORY_ITEM = "item";
|
||||
public static final String ALLOWED_CHARS = "._-";
|
||||
public static final String DEFAULT_ENCODING = "UTF-8";
|
||||
public static final String CATEGORY_SPLITTER = ".";
|
||||
public static final String NEW_LINE;
|
||||
private static final Pattern CONFIG_START = Pattern.compile("START: \"([^\\\"]+)\"");
|
||||
private static final Pattern CONFIG_END = Pattern.compile("END: \"([^\\\"]+)\"");
|
||||
public static final CharMatcher allowedProperties = CharMatcher.JAVA_LETTER_OR_DIGIT.or(CharMatcher.anyOf(ALLOWED_CHARS));
|
||||
private static Configuration PARENT = null;
|
||||
|
||||
File file;
|
||||
|
||||
private Map<String, ConfigCategory> categories = new TreeMap<String, ConfigCategory>();
|
||||
private Map<String, Configuration> children = new TreeMap<String, Configuration>();
|
||||
|
||||
private boolean caseSensitiveCustomCategories;
|
||||
public String defaultEncoding = DEFAULT_ENCODING;
|
||||
private String fileName = null;
|
||||
public boolean isChild = false;
|
||||
private boolean changed = false;
|
||||
|
||||
static
|
||||
{
|
||||
Arrays.fill(configMarkers, false);
|
||||
NEW_LINE = System.getProperty("line.separator");
|
||||
}
|
||||
|
||||
public Configuration(){}
|
||||
|
||||
/**
|
||||
* Create a configuration file for the file given in parameter.
|
||||
*/
|
||||
public Configuration(File file)
|
||||
{
|
||||
this.file = file;
|
||||
String basePath = ((File)(FMLInjectionData.data()[6])).getAbsolutePath().replace(File.separatorChar, '/').replace("/.", "");
|
||||
String path = file.getAbsolutePath().replace(File.separatorChar, '/').replace("/./", "/").replace(basePath, "");
|
||||
if (PARENT != null)
|
||||
{
|
||||
PARENT.setChild(path, this);
|
||||
isChild = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = path;
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
public Configuration(File file, boolean caseSensitiveCustomCategories)
|
||||
{
|
||||
this(file);
|
||||
this.caseSensitiveCustomCategories = caseSensitiveCustomCategories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets or create a block id property. If the block id property key is
|
||||
* already in the configuration, then it will be used. Otherwise,
|
||||
* defaultId will be used, except if already taken, in which case this
|
||||
* will try to determine a free default id.
|
||||
*/
|
||||
public Property getBlock(String key, int defaultID) { return getBlock(CATEGORY_BLOCK, key, defaultID, null); }
|
||||
public Property getBlock(String key, int defaultID, String comment) { return getBlock(CATEGORY_BLOCK, key, defaultID, comment); }
|
||||
public Property getBlock(String category, String key, int defaultID) { return getBlockInternal(category, key, defaultID, null, 256, Block.blocksList.length); }
|
||||
public Property getBlock(String category, String key, int defaultID, String comment) { return getBlockInternal(category, key, defaultID, comment, 256, Block.blocksList.length); }
|
||||
|
||||
/**
|
||||
* Special version of getBlock to be used when you want to garentee the ID you get is below 256
|
||||
* This should ONLY be used by mods who do low level terrain generation, or ones that add new
|
||||
* biomes.
|
||||
* EXA: ExtraBiomesXL
|
||||
*
|
||||
* Specifically, if your block is used BEFORE the Chunk is created, and placed in the terrain byte array directly.
|
||||
* If you add a new biome and you set the top/filler block, they need to be <256, nothing else.
|
||||
*
|
||||
* If you're adding a new ore, DON'T call this function.
|
||||
*
|
||||
* Normal mods such as '50 new ores' do not need to be below 256 so should use the normal getBlock
|
||||
*/
|
||||
public Property getTerrainBlock(String category, String key, int defaultID, String comment)
|
||||
{
|
||||
return getBlockInternal(category, key, defaultID, comment, 0, 256);
|
||||
}
|
||||
|
||||
private Property getBlockInternal(String category, String key, int defaultID, String comment, int lower, int upper)
|
||||
{
|
||||
Property prop = get(category, key, -1, comment);
|
||||
|
||||
if (prop.getInt() != -1)
|
||||
{
|
||||
configMarkers[prop.getInt()] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaultID < lower)
|
||||
{
|
||||
FMLLog.warning(
|
||||
"Mod attempted to get a block ID with a default in the Terrain Generation section, " +
|
||||
"mod authors should make sure there defaults are above 256 unless explicitly needed " +
|
||||
"for terrain generation. Most ores do not need to be below 256.");
|
||||
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
|
||||
defaultID = upper - 1;
|
||||
}
|
||||
|
||||
if (Block.blocksList[defaultID] == null && !configMarkers[defaultID])
|
||||
{
|
||||
prop.set(defaultID);
|
||||
configMarkers[defaultID] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = upper - 1; j > 0; j--)
|
||||
{
|
||||
if (Block.blocksList[j] == null && !configMarkers[j])
|
||||
{
|
||||
prop.set(j);
|
||||
configMarkers[j] = true;
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("No more block ids available for " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Property getItem(String key, int defaultID) { return getItem(CATEGORY_ITEM, key, defaultID, null); }
|
||||
public Property getItem(String key, int defaultID, String comment) { return getItem(CATEGORY_ITEM, key, defaultID, comment); }
|
||||
public Property getItem(String category, String key, int defaultID) { return getItem(category, key, defaultID, null); }
|
||||
|
||||
public Property getItem(String category, String key, int defaultID, String comment)
|
||||
{
|
||||
Property prop = get(category, key, -1, comment);
|
||||
int defaultShift = defaultID + ITEM_SHIFT;
|
||||
|
||||
if (prop.getInt() != -1)
|
||||
{
|
||||
configMarkers[prop.getInt() + ITEM_SHIFT] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defaultID < MAX_BLOCKS - ITEM_SHIFT)
|
||||
{
|
||||
FMLLog.warning(
|
||||
"Mod attempted to get a item ID with a default value in the block ID section, " +
|
||||
"mod authors should make sure there defaults are above %d unless explicitly needed " +
|
||||
"so that all block ids are free to store blocks.", MAX_BLOCKS - ITEM_SHIFT);
|
||||
FMLLog.warning("Config \"%s\" Category: \"%s\" Key: \"%s\" Default: %d", fileName, category, key, defaultID);
|
||||
}
|
||||
|
||||
if (Item.itemsList[defaultShift] == null && !configMarkers[defaultShift] && defaultShift >= Block.blocksList.length)
|
||||
{
|
||||
prop.set(defaultID);
|
||||
configMarkers[defaultShift] = true;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = Item.itemsList.length - 1; x >= ITEM_SHIFT; x--)
|
||||
{
|
||||
if (Item.itemsList[x] == null && !configMarkers[x])
|
||||
{
|
||||
prop.set(x - ITEM_SHIFT);
|
||||
configMarkers[x] = true;
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
|
||||
throw new RuntimeException("No more item ids available for " + key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Integer.toString(defaultValue), comment, INTEGER);
|
||||
if (!prop.isIntValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Boolean.toString(defaultValue), comment, BOOLEAN);
|
||||
if (!prop.isBooleanValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double defaultValue, String comment)
|
||||
{
|
||||
Property prop = get(category, key, Double.toString(defaultValue), comment, DOUBLE);
|
||||
if (!prop.isDoubleValue())
|
||||
{
|
||||
prop.set(defaultValue);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue, String comment)
|
||||
{
|
||||
return get(category, key, defaultValue, comment, STRING);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue, String comment)
|
||||
{
|
||||
return get(category, key, defaultValue, comment, STRING);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, int[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Integer.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, INTEGER);
|
||||
if (!prop.isIntList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, double[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Double.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, DOUBLE);
|
||||
|
||||
if (!prop.isDoubleList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean[] defaultValue)
|
||||
{
|
||||
return get(category, key, defaultValue, null);
|
||||
}
|
||||
|
||||
public Property get(String category, String key, boolean[] defaultValue, String comment)
|
||||
{
|
||||
String[] values = new String[defaultValue.length];
|
||||
for (int i = 0; i < defaultValue.length; i++)
|
||||
{
|
||||
values[i] = Boolean.toString(defaultValue[i]);
|
||||
}
|
||||
|
||||
Property prop = get(category, key, values, comment, BOOLEAN);
|
||||
|
||||
if (!prop.isBooleanList())
|
||||
{
|
||||
prop.set(values);
|
||||
}
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String defaultValue, String comment, Property.Type type)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
{
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
ConfigCategory cat = getCategory(category);
|
||||
|
||||
if (cat.containsKey(key))
|
||||
{
|
||||
Property prop = cat.get(key);
|
||||
|
||||
if (prop.getType() == null)
|
||||
{
|
||||
prop = new Property(prop.getName(), prop.getString(), type);
|
||||
cat.put(key, prop);
|
||||
}
|
||||
|
||||
prop.comment = comment;
|
||||
return prop;
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
Property prop = new Property(key, defaultValue, type);
|
||||
prop.set(defaultValue); //Set and mark as dirty to signify it should save
|
||||
cat.put(key, prop);
|
||||
prop.comment = comment;
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Property get(String category, String key, String[] defaultValue, String comment, Property.Type type)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
{
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
ConfigCategory cat = getCategory(category);
|
||||
|
||||
if (cat.containsKey(key))
|
||||
{
|
||||
Property prop = cat.get(key);
|
||||
|
||||
if (prop.getType() == null)
|
||||
{
|
||||
prop = new Property(prop.getName(), prop.getString(), type);
|
||||
cat.put(key, prop);
|
||||
}
|
||||
|
||||
prop.comment = comment;
|
||||
|
||||
return prop;
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
Property prop = new Property(key, defaultValue, type);
|
||||
prop.comment = comment;
|
||||
cat.put(key, prop);
|
||||
return prop;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCategory(String category)
|
||||
{
|
||||
return categories.get(category) != null;
|
||||
}
|
||||
|
||||
public boolean hasKey(String category, String key)
|
||||
{
|
||||
ConfigCategory cat = categories.get(category);
|
||||
return cat != null && cat.containsKey(key);
|
||||
}
|
||||
|
||||
public void load()
|
||||
{
|
||||
if (PARENT != null && PARENT != this)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BufferedReader buffer = null;
|
||||
UnicodeInputStreamReader input = null;
|
||||
try
|
||||
{
|
||||
if (file.getParentFile() != null)
|
||||
{
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.createNewFile())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.canRead())
|
||||
{
|
||||
input = new UnicodeInputStreamReader(new FileInputStream(file), defaultEncoding);
|
||||
defaultEncoding = input.getEncoding();
|
||||
buffer = new BufferedReader(input);
|
||||
|
||||
String line;
|
||||
ConfigCategory currentCat = null;
|
||||
Property.Type type = null;
|
||||
ArrayList<String> tmpList = null;
|
||||
int lineNum = 0;
|
||||
String name = null;
|
||||
|
||||
while (true)
|
||||
{
|
||||
lineNum++;
|
||||
line = buffer.readLine();
|
||||
|
||||
if (line == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Matcher start = CONFIG_START.matcher(line);
|
||||
Matcher end = CONFIG_END.matcher(line);
|
||||
|
||||
if (start.matches())
|
||||
{
|
||||
fileName = start.group(1);
|
||||
categories = new TreeMap<String, ConfigCategory>();
|
||||
continue;
|
||||
}
|
||||
else if (end.matches())
|
||||
{
|
||||
fileName = end.group(1);
|
||||
Configuration child = new Configuration();
|
||||
child.categories = categories;
|
||||
this.children.put(fileName, child);
|
||||
continue;
|
||||
}
|
||||
|
||||
int nameStart = -1, nameEnd = -1;
|
||||
boolean skip = false;
|
||||
boolean quoted = false;
|
||||
|
||||
for (int i = 0; i < line.length() && !skip; ++i)
|
||||
{
|
||||
if (Character.isLetterOrDigit(line.charAt(i)) || ALLOWED_CHARS.indexOf(line.charAt(i)) != -1 || (quoted && line.charAt(i) != '"'))
|
||||
{
|
||||
if (nameStart == -1)
|
||||
{
|
||||
nameStart = i;
|
||||
}
|
||||
|
||||
nameEnd = i;
|
||||
}
|
||||
else if (Character.isWhitespace(line.charAt(i)))
|
||||
{
|
||||
// ignore space charaters
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (line.charAt(i))
|
||||
{
|
||||
case '#':
|
||||
skip = true;
|
||||
continue;
|
||||
|
||||
case '"':
|
||||
if (quoted)
|
||||
{
|
||||
quoted = false;
|
||||
}
|
||||
if (!quoted && nameStart == -1)
|
||||
{
|
||||
quoted = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case '{':
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
String qualifiedName = ConfigCategory.getQualifiedName(name, currentCat);
|
||||
|
||||
ConfigCategory cat = categories.get(qualifiedName);
|
||||
if (cat == null)
|
||||
{
|
||||
currentCat = new ConfigCategory(name, currentCat);
|
||||
categories.put(qualifiedName, currentCat);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentCat = cat;
|
||||
}
|
||||
name = null;
|
||||
|
||||
break;
|
||||
|
||||
case '}':
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Config file corrupt, attepted to close to many categories '%s:%d'", fileName, lineNum));
|
||||
}
|
||||
currentCat = currentCat.parent;
|
||||
break;
|
||||
|
||||
case '=':
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
|
||||
}
|
||||
|
||||
Property prop = new Property(name, line.substring(i + 1), type, true);
|
||||
i = line.length();
|
||||
|
||||
currentCat.put(name, prop);
|
||||
|
||||
break;
|
||||
|
||||
case ':':
|
||||
type = Property.Type.tryParse(line.substring(nameStart, nameEnd + 1).charAt(0));
|
||||
nameStart = nameEnd = -1;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
if (tmpList != null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
|
||||
}
|
||||
|
||||
name = line.substring(nameStart, nameEnd + 1);
|
||||
|
||||
if (currentCat == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("'%s' has no scope in '%s:%d'", name, fileName, lineNum));
|
||||
}
|
||||
|
||||
tmpList = new ArrayList<String>();
|
||||
|
||||
skip = true;
|
||||
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (tmpList == null)
|
||||
{
|
||||
throw new RuntimeException(String.format("Malformed list property \"%s:%d\"", fileName, lineNum));
|
||||
}
|
||||
|
||||
currentCat.put(name, new Property(name, tmpList.toArray(new String[tmpList.size()]), type));
|
||||
name = null;
|
||||
tmpList = null;
|
||||
type = null;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new RuntimeException(String.format("Unknown character '%s' in '%s:%d'", line.charAt(i), fileName, lineNum));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quoted)
|
||||
{
|
||||
throw new RuntimeException(String.format("Unmatched quote in '%s:%d'", fileName, lineNum));
|
||||
}
|
||||
else if (tmpList != null && !skip)
|
||||
{
|
||||
tmpList.add(line.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (buffer != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
buffer.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
if (input != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
input.close();
|
||||
} catch (IOException e){}
|
||||
}
|
||||
}
|
||||
|
||||
resetChangedState();
|
||||
}
|
||||
|
||||
public void save()
|
||||
{
|
||||
if (PARENT != null && PARENT != this)
|
||||
{
|
||||
PARENT.save();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (file.getParentFile() != null)
|
||||
{
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
if (!file.exists() && !file.createNewFile())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.canWrite())
|
||||
{
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
BufferedWriter buffer = new BufferedWriter(new OutputStreamWriter(fos, defaultEncoding));
|
||||
|
||||
buffer.write("# Configuration file" + NEW_LINE + NEW_LINE);
|
||||
|
||||
if (children.isEmpty())
|
||||
{
|
||||
save(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Map.Entry<String, Configuration> entry : children.entrySet())
|
||||
{
|
||||
buffer.write("START: \"" + entry.getKey() + "\"" + NEW_LINE);
|
||||
entry.getValue().save(buffer);
|
||||
buffer.write("END: \"" + entry.getKey() + "\"" + NEW_LINE + NEW_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
buffer.close();
|
||||
fos.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void save(BufferedWriter out) throws IOException
|
||||
{
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
if (!cat.isChild())
|
||||
{
|
||||
cat.write(out, 0);
|
||||
out.newLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigCategory getCategory(String category)
|
||||
{
|
||||
ConfigCategory ret = categories.get(category);
|
||||
|
||||
if (ret == null)
|
||||
{
|
||||
if (category.contains(CATEGORY_SPLITTER))
|
||||
{
|
||||
String[] hierarchy = category.split("\\"+CATEGORY_SPLITTER);
|
||||
ConfigCategory parent = categories.get(hierarchy[0]);
|
||||
|
||||
if (parent == null)
|
||||
{
|
||||
parent = new ConfigCategory(hierarchy[0]);
|
||||
categories.put(parent.getQualifiedName(), parent);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
for (int i = 1; i < hierarchy.length; i++)
|
||||
{
|
||||
String name = ConfigCategory.getQualifiedName(hierarchy[i], parent);
|
||||
ConfigCategory child = categories.get(name);
|
||||
|
||||
if (child == null)
|
||||
{
|
||||
child = new ConfigCategory(hierarchy[i], parent);
|
||||
categories.put(name, child);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
ret = child;
|
||||
parent = child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = new ConfigCategory(category);
|
||||
categories.put(category, ret);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void removeCategory(ConfigCategory category)
|
||||
{
|
||||
for (ConfigCategory child : category.getChildren())
|
||||
{
|
||||
removeCategory(child);
|
||||
}
|
||||
|
||||
if (categories.containsKey(category.getQualifiedName()))
|
||||
{
|
||||
categories.remove(category.getQualifiedName());
|
||||
if (category.parent != null)
|
||||
{
|
||||
category.parent.removeChild(category);
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void addCustomCategoryComment(String category, String comment)
|
||||
{
|
||||
if (!caseSensitiveCustomCategories)
|
||||
category = category.toLowerCase(Locale.ENGLISH);
|
||||
getCategory(category).setComment(comment);
|
||||
}
|
||||
|
||||
private void setChild(String name, Configuration child)
|
||||
{
|
||||
if (!children.containsKey(name))
|
||||
{
|
||||
children.put(name, child);
|
||||
changed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Configuration old = children.get(name);
|
||||
child.categories = old.categories;
|
||||
child.fileName = old.fileName;
|
||||
old.changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void enableGlobalConfig()
|
||||
{
|
||||
PARENT = new Configuration(new File(Loader.instance().getConfigDir(), "global.cfg"));
|
||||
PARENT.load();
|
||||
}
|
||||
|
||||
public static class UnicodeInputStreamReader extends Reader
|
||||
{
|
||||
private final InputStreamReader input;
|
||||
private final String defaultEnc;
|
||||
|
||||
public UnicodeInputStreamReader(InputStream source, String encoding) throws IOException
|
||||
{
|
||||
defaultEnc = encoding;
|
||||
String enc = encoding;
|
||||
byte[] data = new byte[4];
|
||||
|
||||
PushbackInputStream pbStream = new PushbackInputStream(source, data.length);
|
||||
int read = pbStream.read(data, 0, data.length);
|
||||
int size = 0;
|
||||
|
||||
int bom16 = (data[0] & 0xFF) << 8 | (data[1] & 0xFF);
|
||||
int bom24 = bom16 << 8 | (data[2] & 0xFF);
|
||||
int bom32 = bom24 << 8 | (data[3] & 0xFF);
|
||||
|
||||
if (bom24 == 0xEFBBBF)
|
||||
{
|
||||
enc = "UTF-8";
|
||||
size = 3;
|
||||
}
|
||||
else if (bom16 == 0xFEFF)
|
||||
{
|
||||
enc = "UTF-16BE";
|
||||
size = 2;
|
||||
}
|
||||
else if (bom16 == 0xFFFE)
|
||||
{
|
||||
enc = "UTF-16LE";
|
||||
size = 2;
|
||||
}
|
||||
else if (bom32 == 0x0000FEFF)
|
||||
{
|
||||
enc = "UTF-32BE";
|
||||
size = 4;
|
||||
}
|
||||
else if (bom32 == 0xFFFE0000) //This will never happen as it'll be caught by UTF-16LE,
|
||||
{ //but if anyone ever runs across a 32LE file, i'd like to disect it.
|
||||
enc = "UTF-32LE";
|
||||
size = 4;
|
||||
}
|
||||
|
||||
if (size < read)
|
||||
{
|
||||
pbStream.unread(data, size, read - size);
|
||||
}
|
||||
|
||||
this.input = new InputStreamReader(pbStream, enc);
|
||||
}
|
||||
|
||||
public String getEncoding()
|
||||
{
|
||||
return input.getEncoding();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws IOException
|
||||
{
|
||||
return input.read(cbuf, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasChanged()
|
||||
{
|
||||
if (changed) return true;
|
||||
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
if (cat.hasChanged()) return true;
|
||||
}
|
||||
|
||||
for (Configuration child : children.values())
|
||||
{
|
||||
if (child.hasChanged()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void resetChangedState()
|
||||
{
|
||||
changed = false;
|
||||
for (ConfigCategory cat : categories.values())
|
||||
{
|
||||
cat.resetChangedState();
|
||||
}
|
||||
|
||||
for (Configuration child : children.values())
|
||||
{
|
||||
child.resetChangedState();
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getCategoryNames()
|
||||
{
|
||||
return ImmutableSet.copyOf(categories.keySet());
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
//Preliminary, simple Fake Player class
|
||||
public class FakePlayer extends EntityPlayer
|
||||
{
|
||||
public FakePlayer(World world, String name)
|
||||
{
|
||||
super(world, name);
|
||||
}
|
||||
|
||||
public void sendChatToPlayer(String s){}
|
||||
public boolean canCommandSenderUseCommand(int i, String s){ return false; }
|
||||
public ChunkCoordinates getPlayerCoordinates()
|
||||
{
|
||||
return new ChunkCoordinates(0,0,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_110122_a(ChatMessageComponent chatmessagecomponent){}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
//To be expanded for generic Mod fake players?
|
||||
public class FakePlayerFactory
|
||||
{
|
||||
private static FakePlayer MINECRAFT_PLAYER = null;
|
||||
|
||||
public static FakePlayer getMinecraft(World world)
|
||||
{
|
||||
if (MINECRAFT_PLAYER == null)
|
||||
{
|
||||
MINECRAFT_PLAYER = new FakePlayer(world, "[Minecraft]");
|
||||
}
|
||||
return MINECRAFT_PLAYER;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
public enum ForgeDirection
|
||||
{
|
||||
/** -Y */
|
||||
DOWN(0, -1, 0),
|
||||
|
||||
/** +Y */
|
||||
UP(0, 1, 0),
|
||||
|
||||
/** -Z */
|
||||
NORTH(0, 0, -1),
|
||||
|
||||
/** +Z */
|
||||
SOUTH(0, 0, 1),
|
||||
|
||||
/** -X */
|
||||
WEST(-1, 0, 0),
|
||||
|
||||
/** +X */
|
||||
EAST(1, 0, 0),
|
||||
|
||||
/**
|
||||
* Used only by getOrientation, for invalid inputs
|
||||
*/
|
||||
UNKNOWN(0, 0, 0);
|
||||
|
||||
public final int offsetX;
|
||||
public final int offsetY;
|
||||
public final int offsetZ;
|
||||
public final int flag;
|
||||
public static final ForgeDirection[] VALID_DIRECTIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST};
|
||||
public static final int[] OPPOSITES = {1, 0, 3, 2, 5, 4, 6};
|
||||
// Left hand rule rotation matrix for all possible axes of rotation
|
||||
public static final int[][] ROTATION_MATRIX = {
|
||||
{0, 1, 4, 5, 3, 2, 6},
|
||||
{0, 1, 5, 4, 2, 3, 6},
|
||||
{5, 4, 2, 3, 0, 1, 6},
|
||||
{4, 5, 2, 3, 1, 0, 6},
|
||||
{2, 3, 1, 0, 4, 5, 6},
|
||||
{3, 2, 0, 1, 4, 5, 6},
|
||||
{0, 1, 2, 3, 4, 5, 6},
|
||||
};
|
||||
|
||||
private ForgeDirection(int x, int y, int z)
|
||||
{
|
||||
offsetX = x;
|
||||
offsetY = y;
|
||||
offsetZ = z;
|
||||
flag = 1 << ordinal();
|
||||
}
|
||||
|
||||
public static ForgeDirection getOrientation(int id)
|
||||
{
|
||||
if (id >= 0 && id < VALID_DIRECTIONS.length)
|
||||
{
|
||||
return VALID_DIRECTIONS[id];
|
||||
}
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
||||
public ForgeDirection getOpposite()
|
||||
{
|
||||
return getOrientation(OPPOSITES[ordinal()]);
|
||||
}
|
||||
|
||||
public ForgeDirection getRotation(ForgeDirection axis)
|
||||
{
|
||||
return getOrientation(ROTATION_MATRIX[axis.ordinal()][ordinal()]);
|
||||
}
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.management.PlayerInstance;
|
||||
import net.minecraft.world.storage.SaveHandler;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.common.network.ForgeConnectionHandler;
|
||||
import net.minecraftforge.common.network.ForgeNetworkHandler;
|
||||
import net.minecraftforge.common.network.ForgePacketHandler;
|
||||
import net.minecraftforge.common.network.ForgeTinyPacketHandler;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.LoadController;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.WorldAccessContainer;
|
||||
import cpw.mods.fml.common.event.FMLConstructionEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
|
||||
import static net.minecraftforge.common.ForgeVersion.*;
|
||||
|
||||
@NetworkMod(
|
||||
channels = "FORGE",
|
||||
connectionHandler = ForgeConnectionHandler.class,
|
||||
packetHandler = ForgePacketHandler.class,
|
||||
tinyPacketHandler = ForgeTinyPacketHandler.class
|
||||
)
|
||||
public class ForgeDummyContainer extends DummyModContainer implements WorldAccessContainer
|
||||
{
|
||||
public static int clumpingThreshold = 64;
|
||||
public static boolean legacyFurnaceSides = false;
|
||||
public static boolean removeErroringEntities = false;
|
||||
public static boolean removeErroringTileEntities = false;
|
||||
public static boolean disableStitchedFileSaving = false;
|
||||
|
||||
public ForgeDummyContainer()
|
||||
{
|
||||
super(new ModMetadata());
|
||||
ModMetadata meta = getMetadata();
|
||||
meta.modId = "Forge";
|
||||
meta.name = "Minecraft Forge";
|
||||
meta.version = String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
|
||||
meta.credits = "Made possible with help from many people";
|
||||
meta.authorList = Arrays.asList("LexManos", "Eloraam", "Spacetoad");
|
||||
meta.description = "Minecraft Forge is a common open source API allowing a broad range of mods " +
|
||||
"to work cooperatively together. It allows many mods to be created without " +
|
||||
"them editing the main Minecraft code.";
|
||||
meta.url = "http://MinecraftForge.net";
|
||||
meta.updateUrl = "http://MinecraftForge.net/forum/index.php/topic,5.0.html";
|
||||
meta.screenshots = new String[0];
|
||||
meta.logoFile = "/forge_logo.png";
|
||||
|
||||
Configuration config = null;
|
||||
File cfgFile = new File(Loader.instance().getConfigDir(), "forge.cfg");
|
||||
try
|
||||
{
|
||||
config = new Configuration(cfgFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Error loading forge.cfg, deleting file and resetting: ");
|
||||
e.printStackTrace();
|
||||
|
||||
if (cfgFile.exists())
|
||||
cfgFile.delete();
|
||||
|
||||
config = new Configuration(cfgFile);
|
||||
}
|
||||
if (!config.isChild)
|
||||
{
|
||||
config.load();
|
||||
Property enableGlobalCfg = config.get(Configuration.CATEGORY_GENERAL, "enableGlobalConfig", false);
|
||||
if (enableGlobalCfg.getBoolean(false))
|
||||
{
|
||||
Configuration.enableGlobalConfig();
|
||||
}
|
||||
}
|
||||
Property prop;
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "clumpingThreshold", 64);
|
||||
prop.comment = "Controls the number threshold at which Packet51 is preferred over Packet52, default and minimum 64, maximum 1024";
|
||||
clumpingThreshold = prop.getInt(64);
|
||||
if (clumpingThreshold > 1024 || clumpingThreshold < 64)
|
||||
{
|
||||
clumpingThreshold = 64;
|
||||
prop.set(64);
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "legacyFurnaceOutput", false);
|
||||
prop.comment = "Controls the sides of vanilla furnaces for Forge's ISidedInventroy, Vanilla defines the output as the bottom, but mods/Forge define it as the sides. Settings this to true will restore the old side relations.";
|
||||
legacyFurnaceSides = prop.getBoolean(false);
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringEntities", false);
|
||||
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
|
||||
removeErroringEntities = prop.getBoolean(false);
|
||||
|
||||
if (removeErroringEntities)
|
||||
{
|
||||
FMLLog.warning("Enableing removal of erroring Entities USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "removeErroringTileEntities", false);
|
||||
prop.comment = "Set this to just remove any TileEntity that throws a error in there update method instead of closing the server and reporting a crash log. BE WARNED THIS COULD SCREW UP EVERYTHING USE SPARINGLY WE ARE NOT RESPONSIBLE FOR DAMAGES.";
|
||||
removeErroringTileEntities = prop.getBoolean(false);
|
||||
|
||||
if (removeErroringTileEntities)
|
||||
{
|
||||
FMLLog.warning("Enableing removal of erroring Tile Entities USE AT YOUR OWN RISK");
|
||||
}
|
||||
|
||||
prop = config.get(Configuration.CATEGORY_GENERAL, "disableStitchedFileSaving", true);
|
||||
prop.comment = "Set this to just disable the texture stitcher from writing the 'debug.stitched_{name}.png file to disc. Just a small performance tweak. Default: true";
|
||||
disableStitchedFileSaving = prop.getBoolean(true);
|
||||
|
||||
if (config.hasChanged())
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean registerBus(EventBus bus, LoadController controller)
|
||||
{
|
||||
bus.register(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void modConstruction(FMLConstructionEvent evt)
|
||||
{
|
||||
FMLLog.info("Registering Forge Packet Handler");
|
||||
try
|
||||
{
|
||||
FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
|
||||
FMLLog.info("Succeeded registering Forge Packet Handler");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void preInit(FMLPreInitializationEvent evt)
|
||||
{
|
||||
ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void postInit(FMLPostInitializationEvent evt)
|
||||
{
|
||||
ForgeChunkManager.loadConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getDataForWriting(SaveHandler handler, WorldInfo info)
|
||||
{
|
||||
NBTTagCompound forgeData = new NBTTagCompound();
|
||||
NBTTagCompound dimData = DimensionManager.saveDimensionDataMap();
|
||||
forgeData.setCompoundTag("DimensionData", dimData);
|
||||
return forgeData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(SaveHandler handler, WorldInfo info, Map<String, NBTBase> propertyMap, NBTTagCompound tag)
|
||||
{
|
||||
if (tag.hasKey("DimensionData"))
|
||||
{
|
||||
DimensionManager.loadDimensionDataMap(tag.hasKey("DimensionData") ? tag.getCompoundTag("DimensionData") : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,401 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.NetServerHandler;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.WeightedRandomItem;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
|
||||
|
||||
public class ForgeHooks
|
||||
{
|
||||
static class GrassEntry extends WeightedRandomItem
|
||||
{
|
||||
public final Block block;
|
||||
public final int metadata;
|
||||
public GrassEntry(Block block, int meta, int weight)
|
||||
{
|
||||
super(weight);
|
||||
this.block = block;
|
||||
this.metadata = meta;
|
||||
}
|
||||
}
|
||||
|
||||
static class SeedEntry extends WeightedRandomItem
|
||||
{
|
||||
public final ItemStack seed;
|
||||
public SeedEntry(ItemStack seed, int weight)
|
||||
{
|
||||
super(weight);
|
||||
this.seed = seed;
|
||||
}
|
||||
}
|
||||
static final List<GrassEntry> grassList = new ArrayList<GrassEntry>();
|
||||
static final List<SeedEntry> seedList = new ArrayList<SeedEntry>();
|
||||
|
||||
public static void plantGrass(World world, int x, int y, int z)
|
||||
{
|
||||
GrassEntry grass = (GrassEntry)WeightedRandom.getRandomItem(world.rand, grassList);
|
||||
if (grass == null || grass.block == null || !grass.block.canBlockStay(world, x, y, z))
|
||||
{
|
||||
return;
|
||||
}
|
||||
world.setBlock(x, y, z, grass.block.blockID, grass.metadata, 3);
|
||||
}
|
||||
|
||||
public static ItemStack getGrassSeed(World world)
|
||||
{
|
||||
SeedEntry entry = (SeedEntry)WeightedRandom.getRandomItem(world.rand, seedList);
|
||||
if (entry == null || entry.seed == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return entry.seed.copy();
|
||||
}
|
||||
|
||||
private static boolean toolInit = false;
|
||||
static HashMap<Item, List> toolClasses = new HashMap<Item, List>();
|
||||
static HashMap<List, Integer> toolHarvestLevels = new HashMap<List, Integer>();
|
||||
static HashSet<List> toolEffectiveness = new HashSet<List>();
|
||||
|
||||
public static boolean canHarvestBlock(Block block, EntityPlayer player, int metadata)
|
||||
{
|
||||
if (block.blockMaterial.isToolNotRequired())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemStack stack = player.inventory.getCurrentItem();
|
||||
if (stack == null)
|
||||
{
|
||||
return player.canHarvestBlock(block);
|
||||
}
|
||||
|
||||
List info = toolClasses.get(stack.getItem());
|
||||
if (info == null)
|
||||
{
|
||||
return player.canHarvestBlock(block);
|
||||
}
|
||||
|
||||
Object[] tmp = info.toArray();
|
||||
String toolClass = (String)tmp[0];
|
||||
int harvestLevel = (Integer)tmp[1];
|
||||
|
||||
Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass));
|
||||
if (blockHarvestLevel == null)
|
||||
{
|
||||
return player.canHarvestBlock(block);
|
||||
}
|
||||
|
||||
if (blockHarvestLevel > harvestLevel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean canToolHarvestBlock(Block block, int metadata, ItemStack stack)
|
||||
{
|
||||
if (stack == null) return false;
|
||||
List info = toolClasses.get(stack.getItem());
|
||||
if (info == null) return false;
|
||||
|
||||
Object[] tmp = info.toArray();
|
||||
String toolClass = (String)tmp[0];
|
||||
int harvestLevel = (Integer)tmp[1];
|
||||
|
||||
Integer blockHarvestLevel = toolHarvestLevels.get(Arrays.asList(block, metadata, toolClass));
|
||||
return !(blockHarvestLevel == null || blockHarvestLevel > harvestLevel);
|
||||
}
|
||||
|
||||
public static float blockStrength(Block block, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float hardness = block.getBlockHardness(world, x, y, z);
|
||||
if (hardness < 0.0F)
|
||||
{
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
if (!canHarvestBlock(block, player, metadata))
|
||||
{
|
||||
float speed = ForgeEventFactory.getBreakSpeed(player, block, metadata, 1.0f);
|
||||
return (speed < 0 ? 0 : speed) / hardness / 100F;
|
||||
}
|
||||
else
|
||||
{
|
||||
return player.getCurrentPlayerStrVsBlock(block, false, metadata) / hardness / 30F;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isToolEffective(ItemStack stack, Block block, int metadata)
|
||||
{
|
||||
List toolClass = toolClasses.get(stack.getItem());
|
||||
return toolClass != null && toolEffectiveness.contains(Arrays.asList(block, metadata, toolClass.get(0)));
|
||||
}
|
||||
|
||||
static void initTools()
|
||||
{
|
||||
if (toolInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
toolInit = true;
|
||||
|
||||
MinecraftForge.setToolClass(Item.pickaxeWood, "pickaxe", 0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeStone, "pickaxe", 1);
|
||||
MinecraftForge.setToolClass(Item.pickaxeIron, "pickaxe", 2);
|
||||
MinecraftForge.setToolClass(Item.pickaxeGold, "pickaxe", 0);
|
||||
MinecraftForge.setToolClass(Item.pickaxeDiamond, "pickaxe", 3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.axeWood, "axe", 0);
|
||||
MinecraftForge.setToolClass(Item.axeStone, "axe", 1);
|
||||
MinecraftForge.setToolClass(Item.axeIron, "axe", 2);
|
||||
MinecraftForge.setToolClass(Item.axeGold, "axe", 0);
|
||||
MinecraftForge.setToolClass(Item.axeDiamond, "axe", 3);
|
||||
|
||||
MinecraftForge.setToolClass(Item.shovelWood, "shovel", 0);
|
||||
MinecraftForge.setToolClass(Item.shovelStone, "shovel", 1);
|
||||
MinecraftForge.setToolClass(Item.shovelIron, "shovel", 2);
|
||||
MinecraftForge.setToolClass(Item.shovelGold, "shovel", 0);
|
||||
MinecraftForge.setToolClass(Item.shovelDiamond, "shovel", 3);
|
||||
|
||||
for (Block block : ItemPickaxe.blocksEffectiveAgainst)
|
||||
{
|
||||
MinecraftForge.setBlockHarvestLevel(block, "pickaxe", 0);
|
||||
}
|
||||
|
||||
for (Block block : ItemSpade.blocksEffectiveAgainst)
|
||||
{
|
||||
MinecraftForge.setBlockHarvestLevel(block, "shovel", 0);
|
||||
}
|
||||
|
||||
for (Block block : ItemAxe.blocksEffectiveAgainst)
|
||||
{
|
||||
MinecraftForge.setBlockHarvestLevel(block, "axe", 0);
|
||||
}
|
||||
|
||||
MinecraftForge.setBlockHarvestLevel(Block.obsidian, "pickaxe", 3);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreEmerald, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreDiamond, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockDiamond, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreGold, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockGold, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreIron, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockIron, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreLapis, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.blockLapis, "pickaxe", 1);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstone, "pickaxe", 2);
|
||||
MinecraftForge.setBlockHarvestLevel(Block.oreRedstoneGlowing, "pickaxe", 2);
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstone, "pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.obsidian, "pickaxe");
|
||||
MinecraftForge.removeBlockEffectiveness(Block.oreRedstoneGlowing, "pickaxe");
|
||||
}
|
||||
|
||||
public static int getTotalArmorValue(EntityPlayer player)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int x = 0; x < player.inventory.armorInventory.length; x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.armorInventory[x];
|
||||
if (stack != null && stack.getItem() instanceof ISpecialArmor)
|
||||
{
|
||||
ret += ((ISpecialArmor)stack.getItem()).getArmorDisplay(player, stack, x);
|
||||
}
|
||||
else if (stack != null && stack.getItem() instanceof ItemArmor)
|
||||
{
|
||||
ret += ((ItemArmor)stack.getItem()).damageReduceAmount;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
grassList.add(new GrassEntry(Block.plantYellow, 0, 20));
|
||||
grassList.add(new GrassEntry(Block.plantRed, 0, 10));
|
||||
seedList.add(new SeedEntry(new ItemStack(Item.seeds), 10));
|
||||
initTools();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player uses 'pick block', calls new Entity and Block hooks.
|
||||
*/
|
||||
public static boolean onPickBlock(MovingObjectPosition target, EntityPlayer player, World world)
|
||||
{
|
||||
ItemStack result = null;
|
||||
boolean isCreative = player.capabilities.isCreativeMode;
|
||||
|
||||
if (target.typeOfHit == EnumMovingObjectType.TILE)
|
||||
{
|
||||
int x = target.blockX;
|
||||
int y = target.blockY;
|
||||
int z = target.blockZ;
|
||||
Block var8 = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
|
||||
if (var8 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
result = var8.getPickBlock(target, world, x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target.typeOfHit != EnumMovingObjectType.ENTITY || target.entityHit == null || !isCreative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
result = target.entityHit.getPickedResult(target);
|
||||
}
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
ItemStack stack = player.inventory.getStackInSlot(x);
|
||||
if (stack != null && stack.isItemEqual(result) && ItemStack.areItemStackTagsEqual(stack, result))
|
||||
{
|
||||
player.inventory.currentItem = x;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCreative)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int slot = player.inventory.getFirstEmptyStack();
|
||||
if (slot < 0 || slot >= 9)
|
||||
{
|
||||
slot = player.inventory.currentItem;
|
||||
}
|
||||
|
||||
player.inventory.setInventorySlotContents(slot, result);
|
||||
player.inventory.currentItem = slot;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Optifine Helper Functions u.u, these are here specifically for Optifine
|
||||
//Note: When using Optfine, these methods are invoked using reflection, which
|
||||
//incurs a major performance penalty.
|
||||
public static void onLivingSetAttackTarget(EntityLivingBase entity, EntityLivingBase target)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new LivingSetAttackTargetEvent(entity, target));
|
||||
}
|
||||
|
||||
public static boolean onLivingUpdate(EntityLivingBase entity)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingUpdateEvent(entity));
|
||||
}
|
||||
|
||||
public static boolean onLivingAttack(EntityLivingBase entity, DamageSource src, float amount)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingAttackEvent(entity, src, amount));
|
||||
}
|
||||
|
||||
public static float onLivingHurt(EntityLivingBase entity, DamageSource src, float amount)
|
||||
{
|
||||
LivingHurtEvent event = new LivingHurtEvent(entity, src, amount);
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.ammount);
|
||||
}
|
||||
|
||||
public static boolean onLivingDeath(EntityLivingBase entity, DamageSource src)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingDeathEvent(entity, src));
|
||||
}
|
||||
|
||||
public static boolean onLivingDrops(EntityLivingBase entity, DamageSource source, ArrayList<EntityItem> drops, int lootingLevel, boolean recentlyHit, int specialDropValue)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingDropsEvent(entity, source, drops, lootingLevel, recentlyHit, specialDropValue));
|
||||
}
|
||||
|
||||
public static float onLivingFall(EntityLivingBase entity, float distance)
|
||||
{
|
||||
LivingFallEvent event = new LivingFallEvent(entity, distance);
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? 0.0f : event.distance);
|
||||
}
|
||||
|
||||
public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLivingBase entity)
|
||||
{
|
||||
return block != null && block.isLadder(world, x, y, z, entity);
|
||||
}
|
||||
|
||||
public static void onLivingJump(EntityLivingBase entity)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new LivingJumpEvent(entity));
|
||||
}
|
||||
|
||||
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item)
|
||||
{
|
||||
player.captureDrops = true;
|
||||
EntityItem ret = player.dropPlayerItemWithRandomChoice(item, false);
|
||||
player.capturedDrops.clear();
|
||||
player.captureDrops = false;
|
||||
|
||||
ItemTossEvent event = new ItemTossEvent(ret, player);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
player.joinEntityItemWithWorld(event.entityItem);
|
||||
return event.entityItem;
|
||||
}
|
||||
|
||||
public static float getEnchantPower(World world, int x, int y, int z)
|
||||
{
|
||||
if (world.isAirBlock(x, y, z))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
return (block == null ? 0 : block.getEnchantPowerBonus(world, x, y, z));
|
||||
}
|
||||
|
||||
public static ChatMessageComponent onServerChatEvent(NetServerHandler net, String raw, ChatMessageComponent comp)
|
||||
{
|
||||
ServerChatEvent event = new ServerChatEvent(net.playerEntity, raw, comp);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return event.component;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
public class ForgeVersion
|
||||
{
|
||||
//This number is incremented every time we remove deprecated code/major API changes, never reset
|
||||
public static final int majorVersion = 8;
|
||||
//This number is incremented every minecraft release, never reset
|
||||
public static final int minorVersion = 9;
|
||||
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
|
||||
public static final int revisionVersion = 0;
|
||||
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
|
||||
public static final int buildVersion = 0;
|
||||
|
||||
public static int getMajorVersion()
|
||||
{
|
||||
return majorVersion;
|
||||
}
|
||||
|
||||
public static int getMinorVersion()
|
||||
{
|
||||
return minorVersion;
|
||||
}
|
||||
|
||||
public static int getRevisionVersion()
|
||||
{
|
||||
return revisionVersion;
|
||||
}
|
||||
|
||||
public static int getBuildVersion()
|
||||
{
|
||||
return buildVersion;
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return String.format("%d.%d.%d.%d", majorVersion, minorVersion, revisionVersion, buildVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPlantable
|
||||
{
|
||||
public EnumPlantType getPlantType(World world, int x, int y, int z);
|
||||
public int getPlantID(World world, int x, int y, int z);
|
||||
public int getPlantMetadata(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
/** Inventory ranges mapped by side. This class is implemented by TileEntities
|
||||
* that provide different inventory slot ranges to different sides.
|
||||
*/
|
||||
@Deprecated //A equivalent Interface is now in Minecraft Vanilla will be removed next major MC version
|
||||
public interface ISidedInventory extends IInventory
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the start of the side inventory.
|
||||
* @param side The global side to get the start of range.
|
||||
*/
|
||||
@Deprecated
|
||||
int getStartInventorySide(ForgeDirection side);
|
||||
|
||||
/**
|
||||
* Get the size of the side inventory.
|
||||
* @param side The global side.
|
||||
*/
|
||||
@Deprecated
|
||||
int getSizeInventorySide(ForgeDirection side);
|
||||
}
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.*;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeHooks.GrassEntry;
|
||||
import net.minecraftforge.common.ForgeHooks.SeedEntry;
|
||||
import net.minecraftforge.event.EventBus;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class MinecraftForge
|
||||
{
|
||||
/**
|
||||
* The core Forge EventBusses, all events for Forge will be fired on these,
|
||||
* you should use this to register all your listeners.
|
||||
* This replaces every register*Handler() function in the old version of Forge.
|
||||
* TERRAIN_GEN_BUS for terrain gen events
|
||||
* ORE_GEN_BUS for ore gen events
|
||||
* EVENT_BUS for everything else
|
||||
*/
|
||||
public static final EventBus EVENT_BUS = new EventBus();
|
||||
public static final EventBus TERRAIN_GEN_BUS = new EventBus();
|
||||
public static final EventBus ORE_GEN_BUS = new EventBus();
|
||||
|
||||
private static final ForgeInternalHandler INTERNAL_HANDLER = new ForgeInternalHandler();
|
||||
|
||||
|
||||
/** Register a new plant to be planted when bonemeal is used on grass.
|
||||
* @param block The block to place.
|
||||
* @param metadata The metadata to set for the block when being placed.
|
||||
* @param weight The weight of the plant, where red flowers are
|
||||
* 10 and yellow flowers are 20.
|
||||
*/
|
||||
public static void addGrassPlant(Block block, int metadata, int weight)
|
||||
{
|
||||
ForgeHooks.grassList.add(new GrassEntry(block, metadata, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new seed to be dropped when breaking tall grass.
|
||||
*
|
||||
* @param seed The item to drop as a seed.
|
||||
* @param weight The relative probability of the seeds,
|
||||
* where wheat seeds are 10.
|
||||
*/
|
||||
public static void addGrassSeed(ItemStack seed, int weight)
|
||||
{
|
||||
ForgeHooks.seedList.add(new SeedEntry(seed, weight));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Register a tool as a tool class with a given harvest level.
|
||||
*
|
||||
* @param tool The custom tool to register.
|
||||
* @param toolClass The tool class to register as. The predefined tool
|
||||
* clases are "pickaxe", "shovel", "axe". You can add
|
||||
* others for custom tools.
|
||||
* @param harvestLevel The harvest level of the tool.
|
||||
*/
|
||||
public static void setToolClass(Item tool, String toolClass, int harvestLevel)
|
||||
{
|
||||
ForgeHooks.toolClasses.put(tool, Arrays.asList(toolClass, harvestLevel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block to be harvested by a tool class. This is the metadata
|
||||
* sensitive version, use it if your blocks are using metadata variants.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param block The block to register.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param harvestLevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block block, int metadata, String toolClass, int harvestLevel)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
*
|
||||
* @param block The block to remove effectiveness from.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to remove the effectiveness mapping from.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block block, int metadata, String toolClass)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a block to be harvested by a tool class.
|
||||
* By default, this sets the block class as effective against that type.
|
||||
*
|
||||
* @param block The block to register.
|
||||
* @param toolClass The tool class to register as able to remove this block.
|
||||
* You may register the same block multiple times with different tool
|
||||
* classes, if multiple tool types can be used to harvest this block.
|
||||
* @param harvestLevel The minimum tool harvest level required to successfully
|
||||
* harvest the block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void setBlockHarvestLevel(Block block, String toolClass, int harvestLevel)
|
||||
{
|
||||
for (int metadata = 0; metadata < 16; metadata++)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolHarvestLevels.put(key, harvestLevel);
|
||||
ForgeHooks.toolEffectiveness.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block harvest level for a particular tool class.
|
||||
*
|
||||
* @param block The block to check.
|
||||
* @param metadata The metadata for the block subtype.
|
||||
* @param toolClass The tool class to check as able to remove this block.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
* @return The harvest level or -1 if no mapping exists.
|
||||
*/
|
||||
public static int getBlockHarvestLevel(Block block, int metadata, String toolClass)
|
||||
{
|
||||
ForgeHooks.initTools();
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
Integer harvestLevel = ForgeHooks.toolHarvestLevels.get(key);
|
||||
return (harvestLevel == null ? -1 : harvestLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a block effectiveness mapping. Since setBlockHarvestLevel
|
||||
* makes the tool class effective against the block by default, this can be
|
||||
* used to remove that mapping. This will force a block to be harvested at
|
||||
* the same speed regardless of tool quality, while still requiring a given
|
||||
* harvesting level.
|
||||
*
|
||||
* @param block The block to remove effectiveness from.
|
||||
* @param toolClass The tool class to remove the effectiveness mapping from.
|
||||
* @see MinecraftForge#setToolClass for details on tool classes.
|
||||
*/
|
||||
public static void removeBlockEffectiveness(Block block, String toolClass)
|
||||
{
|
||||
for (int metadata = 0; metadata < 16; metadata++)
|
||||
{
|
||||
List key = Arrays.asList(block, metadata, toolClass);
|
||||
ForgeHooks.toolEffectiveness.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method invoked by FML before any other mods are loaded.
|
||||
*/
|
||||
public static void initialize()
|
||||
{
|
||||
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
|
||||
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion());
|
||||
|
||||
Block filler = new Block(0, Material.air)
|
||||
{
|
||||
@SideOnly(Side.CLIENT) public void func_94332_a(IconRegister register){}
|
||||
};
|
||||
Block.blocksList[0] = null;
|
||||
Block.opaqueCubeLookup[0] = false;
|
||||
Block.lightOpacity[0] = 0;
|
||||
filler.setUnlocalizedName("ForgeFiller");
|
||||
|
||||
for (int x = 256; x < 4096; x++)
|
||||
{
|
||||
if (Item.itemsList[x] != null)
|
||||
{
|
||||
Block.blocksList[x] = filler;
|
||||
}
|
||||
}
|
||||
|
||||
boolean[] temp = new boolean[4096];
|
||||
System.arraycopy(EntityEnderman.carriableBlocks, 0, temp, 0, EntityEnderman.carriableBlocks.length);
|
||||
EntityEnderman.carriableBlocks = temp;
|
||||
|
||||
EVENT_BUS.register(INTERNAL_HANDLER);
|
||||
OreDictionary.getOreName(0);
|
||||
|
||||
//Force these classes to be defined, Should prevent derp error hiding.
|
||||
new CrashReport("ThisIsFake", new Exception("Not real"));
|
||||
}
|
||||
|
||||
public static String getBrandingVersion()
|
||||
{
|
||||
return "Minecraft Forge "+ ForgeVersion.getVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,409 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraftforge.common.Property.Type;
|
||||
|
||||
public class Property
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
STRING,
|
||||
INTEGER,
|
||||
BOOLEAN,
|
||||
DOUBLE;
|
||||
|
||||
private static Type[] values = {STRING, INTEGER, BOOLEAN, DOUBLE};
|
||||
|
||||
public static Type tryParse(char id)
|
||||
{
|
||||
for (int x = 0; x < values.length; x++)
|
||||
{
|
||||
if (values[x].getID() == id)
|
||||
{
|
||||
return values[x];
|
||||
}
|
||||
}
|
||||
|
||||
return STRING;
|
||||
}
|
||||
|
||||
public char getID()
|
||||
{
|
||||
return name().charAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
public String comment;
|
||||
private String[] values;
|
||||
|
||||
private final boolean wasRead;
|
||||
private final boolean isList;
|
||||
private final Type type;
|
||||
private boolean changed = false;
|
||||
|
||||
public Property()
|
||||
{
|
||||
wasRead = false;
|
||||
type = null;
|
||||
isList = false;
|
||||
}
|
||||
|
||||
public Property(String name, String value, Type type)
|
||||
{
|
||||
this(name, value, type, false);
|
||||
}
|
||||
|
||||
Property(String name, String value, Type type, boolean read)
|
||||
{
|
||||
setName(name);
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
wasRead = read;
|
||||
isList = false;
|
||||
}
|
||||
|
||||
public Property(String name, String[] values, Type type)
|
||||
{
|
||||
this(name, values, type, false);
|
||||
}
|
||||
|
||||
Property(String name, String[] values, Type type, boolean read)
|
||||
{
|
||||
setName(name);
|
||||
this.type = type;
|
||||
this.values = values;
|
||||
wasRead = read;
|
||||
isList = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as it's raw string.
|
||||
*
|
||||
* @return current value
|
||||
*/
|
||||
public String getString()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as an integer,
|
||||
* if the value is not a valid integer, it will return -1.
|
||||
*
|
||||
* @return The value
|
||||
*/
|
||||
public int getInt()
|
||||
{
|
||||
return getInt(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as an integer,
|
||||
* if the value is not a valid integer, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide if the current value is not a valid integer
|
||||
* @return The value
|
||||
*/
|
||||
public int getInt(int _default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value stored in this property can be converted to an integer.
|
||||
* @return True if the type of the Property is an Integer
|
||||
*/
|
||||
public boolean isIntValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Integer.parseInt(value);
|
||||
return true;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as a boolean,
|
||||
* if the value is not a valid boolean, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide
|
||||
* @return The value as a boolean, or the default
|
||||
*/
|
||||
public boolean getBoolean(boolean _default)
|
||||
{
|
||||
if (isBooleanValue())
|
||||
{
|
||||
return Boolean.parseBoolean(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value held by this property is a valid boolean value.
|
||||
* @return True if it is a boolean value
|
||||
*/
|
||||
public boolean isBooleanValue()
|
||||
{
|
||||
return ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current value held by this property is a valid double value.
|
||||
* @return True if the value can be converted to an double
|
||||
*/
|
||||
public boolean isDoubleValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.parseDouble(value);
|
||||
return true;
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value in this property as a double,
|
||||
* if the value is not a valid double, it will return the
|
||||
* provided default.
|
||||
*
|
||||
* @param _default The default to provide if the current value is not a valid double
|
||||
* @return The value
|
||||
*/
|
||||
public double getDouble(double _default)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Double.parseDouble(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
|
||||
public String[] getStringList()
|
||||
{
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public int[] getIntList()
|
||||
{
|
||||
ArrayList<Integer> nums = new ArrayList<Integer>();
|
||||
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
nums.add(Integer.parseInt(value));
|
||||
}
|
||||
catch (NumberFormatException e){}
|
||||
}
|
||||
|
||||
int[] primitives = new int[nums.size()];
|
||||
|
||||
for (int i = 0; i < nums.size(); i++)
|
||||
{
|
||||
primitives[i] = nums.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of the current values stored in this property can be converted to an integer.
|
||||
* @return True if the type of the Property is an Integer List
|
||||
*/
|
||||
public boolean isIntList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
Integer.parseInt(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boolean value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public boolean[] getBooleanList()
|
||||
{
|
||||
ArrayList<Boolean> tmp = new ArrayList<Boolean>();
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
tmp.add(Boolean.parseBoolean(value));
|
||||
}
|
||||
catch (NumberFormatException e){}
|
||||
}
|
||||
|
||||
boolean[] primitives = new boolean[tmp.size()];
|
||||
|
||||
for (int i = 0; i < tmp.size(); i++)
|
||||
{
|
||||
primitives[i] = tmp.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of current values stored in this property can be converted to a boolean.
|
||||
* @return True if it is a boolean value
|
||||
*/
|
||||
public boolean isBooleanList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
if (!"true".equalsIgnoreCase(value) && !"false".equalsIgnoreCase(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the double value of all values that can
|
||||
* be parsed in the list.
|
||||
*
|
||||
* @return Array of length 0 if none of the values could be parsed.
|
||||
*/
|
||||
public double[] getDoubleList()
|
||||
{
|
||||
ArrayList<Double> tmp = new ArrayList<Double>();
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
tmp.add(Double.parseDouble(value));
|
||||
}
|
||||
catch (NumberFormatException e) {}
|
||||
}
|
||||
|
||||
double[] primitives = new double[tmp.size()];
|
||||
|
||||
for (int i = 0; i < tmp.size(); i++)
|
||||
{
|
||||
primitives[i] = tmp.get(i);
|
||||
}
|
||||
|
||||
return primitives;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if all of the current values stored in this property can be converted to a double.
|
||||
* @return True if the type of the Property is a double List
|
||||
*/
|
||||
public boolean isDoubleList()
|
||||
{
|
||||
for (String value : values)
|
||||
{
|
||||
try
|
||||
{
|
||||
Double.parseDouble(value);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this config value was just created, or if it was read from the config file.
|
||||
* This is useful for mods who auto-assign there blocks to determine if the ID returned is
|
||||
* a configured one, or a automatically generated one.
|
||||
*
|
||||
* @return True if this property was loaded from the config file with a value
|
||||
*/
|
||||
public boolean wasRead()
|
||||
{
|
||||
return wasRead;
|
||||
}
|
||||
|
||||
public Type getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isList()
|
||||
{
|
||||
return isList;
|
||||
}
|
||||
|
||||
public boolean hasChanged(){ return changed; }
|
||||
void resetChangedState(){ changed = false; }
|
||||
|
||||
public void set(String value)
|
||||
{
|
||||
this.value = value;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
public void set(String[] values)
|
||||
{
|
||||
this.values = values;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
public void set(int value){ set(Integer.toString(value)); }
|
||||
public void set(boolean value){ set(Boolean.toString(value)); }
|
||||
public void set(double value){ set(Double.toString(value)); }
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockChest;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockDropper;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.world.World;
|
||||
import static net.minecraftforge.common.ForgeDirection.*;
|
||||
|
||||
public class RotationHelper {
|
||||
|
||||
private static final ForgeDirection[] UP_DOWN_AXES = new ForgeDirection[] { UP, DOWN };
|
||||
public static ForgeDirection[] getValidVanillaBlockRotations(Block block)
|
||||
{
|
||||
return block instanceof BlockChest ? UP_DOWN_AXES : VALID_DIRECTIONS;
|
||||
}
|
||||
|
||||
public static boolean rotateVanillaBlock(Block block, World worldObj, int x, int y, int z, ForgeDirection axis)
|
||||
{
|
||||
if (worldObj.isRemote)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (block instanceof BlockChest && (axis == UP || axis == DOWN))
|
||||
{
|
||||
return rotateBlock(worldObj, x, y, z, axis, 0x7);
|
||||
}
|
||||
if (block instanceof BlockPistonBase || block instanceof BlockDropper || block instanceof BlockDispenser)
|
||||
{
|
||||
return rotateBlock(worldObj, x, y, z, axis, 0x7);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean rotateBlock(World worldObj, int x, int y, int z, ForgeDirection axis, int mask)
|
||||
{
|
||||
int rotMeta = worldObj.getBlockMetadata(x, y, z);
|
||||
int masked = rotMeta & ~mask;
|
||||
ForgeDirection orientation = ForgeDirection.getOrientation(rotMeta & mask);
|
||||
ForgeDirection rotated = orientation.getRotation(axis);
|
||||
worldObj.setBlockMetadataWithNotify(x,y,z,rotated.ordinal() & mask | masked,3);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ForgeConnectionHandler implements IConnectionHandler {
|
||||
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionClosed(INetworkManager manager)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraftforge.common.ForgeDummyContainer;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkModHandler;
|
||||
|
||||
public class ForgeNetworkHandler extends NetworkModHandler
|
||||
{
|
||||
public ForgeNetworkHandler(ForgeDummyContainer container)
|
||||
{
|
||||
super(container,container.getClass().getAnnotation(NetworkMod.class));
|
||||
configureNetworkMod(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptVersion(String version)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.common.primitives.UnsignedBytes;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.network.FMLNetworkException;
|
||||
|
||||
public abstract class ForgePacket
|
||||
{
|
||||
public static final String CHANNEL_ID = "FORGE";
|
||||
enum Type
|
||||
{
|
||||
/**
|
||||
* Registers a dimension for a provider on client
|
||||
*/
|
||||
REGISTERDIMENSION(DimensionRegisterPacket.class);
|
||||
|
||||
private Class<? extends ForgePacket> packetType;
|
||||
private ConcurrentMap<INetworkManager, ForgePacket> partTracker;
|
||||
|
||||
private Type(Class<? extends ForgePacket> clazz)
|
||||
{
|
||||
this.packetType = clazz;
|
||||
}
|
||||
|
||||
ForgePacket make()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.packetType.newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Throwables.propagateIfPossible(e);
|
||||
FMLLog.log(Level.SEVERE, e, "A bizarre critical error occured during packet encoding");
|
||||
throw new FMLNetworkException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ForgePacket consumePart(INetworkManager network, byte[] data)
|
||||
{
|
||||
if (partTracker == null)
|
||||
{
|
||||
partTracker = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
}
|
||||
if (!partTracker.containsKey(network))
|
||||
{
|
||||
partTracker.put(network, make());
|
||||
}
|
||||
|
||||
ForgePacket pkt = partTracker.get(network);
|
||||
|
||||
ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
|
||||
int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
|
||||
int chunkLength = bdi.readInt();
|
||||
|
||||
if (pkt.partials == null)
|
||||
{
|
||||
pkt.partials = new byte[chunkTotal][];
|
||||
}
|
||||
|
||||
pkt.partials[chunkIdx] = new byte[chunkLength];
|
||||
bdi.readFully(pkt.partials[chunkIdx]);
|
||||
for (int i = 0; i < pkt.partials.length; i++)
|
||||
{
|
||||
if (pkt.partials[i] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return pkt;
|
||||
}
|
||||
}
|
||||
|
||||
private Type type;
|
||||
private byte[][] partials;
|
||||
|
||||
public static Packet250CustomPayload[] makePacketSet(ForgePacket packet)
|
||||
{
|
||||
byte[] packetData = packet.generatePacket();
|
||||
|
||||
if (packetData.length < 32000)
|
||||
{
|
||||
return new Packet250CustomPayload[]
|
||||
{
|
||||
new Packet250CustomPayload(CHANNEL_ID,
|
||||
Bytes.concat(new byte[]
|
||||
{
|
||||
UnsignedBytes.checkedCast(0), //IsMultipart: False
|
||||
UnsignedBytes.checkedCast(packet.getID())
|
||||
},
|
||||
packetData))
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[][] chunks = new byte[packetData.length / 32000 + 1][];
|
||||
for (int i = 0; i < packetData.length / 32000 + 1; i++)
|
||||
{
|
||||
int len = Math.min(32000, packetData.length - i* 32000);
|
||||
chunks[i] = Bytes.concat(new byte[]
|
||||
{
|
||||
UnsignedBytes.checkedCast(1), //IsMultipart: True
|
||||
UnsignedBytes.checkedCast(packet.getID()), //Packet ID
|
||||
UnsignedBytes.checkedCast(i), //Part Number
|
||||
UnsignedBytes.checkedCast(chunks.length), //Total Parts
|
||||
},
|
||||
Ints.toByteArray(len), //Length
|
||||
Arrays.copyOfRange(packetData, i * 32000, len + i * 32000));
|
||||
}
|
||||
|
||||
Packet250CustomPayload[] ret = new Packet250CustomPayload[chunks.length];
|
||||
for (int i = 0; i < chunks.length; i++)
|
||||
{
|
||||
ret[i] = new Packet250CustomPayload(CHANNEL_ID, chunks[i]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
public static ForgePacket readPacket(INetworkManager network, byte[] payload)
|
||||
{
|
||||
boolean multipart = UnsignedBytes.toInt(payload[0]) == 1;
|
||||
int type = UnsignedBytes.toInt(payload[1]);
|
||||
Type eType = Type.values()[type];
|
||||
byte[] data = Arrays.copyOfRange(payload, 2, payload.length);
|
||||
|
||||
if (multipart)
|
||||
{
|
||||
ForgePacket pkt = eType.consumePart(network, data);
|
||||
if (pkt != null)
|
||||
{
|
||||
return pkt.consumePacket(Bytes.concat(pkt.partials));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return eType.make().consumePacket(data);
|
||||
}
|
||||
}
|
||||
|
||||
public ForgePacket()
|
||||
{
|
||||
for (Type t : Type.values())
|
||||
{
|
||||
if (t.packetType == getClass())
|
||||
{
|
||||
type = t;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
throw new RuntimeException("ForgePacket constructor called on ungregistered type.");
|
||||
}
|
||||
}
|
||||
|
||||
public byte getID()
|
||||
{
|
||||
return UnsignedBytes.checkedCast(type.ordinal());
|
||||
}
|
||||
|
||||
public abstract byte[] generatePacket();
|
||||
|
||||
public abstract ForgePacket consumePacket(byte[] data);
|
||||
|
||||
public abstract void execute(INetworkManager network, EntityPlayer player);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.NetLoginHandler;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.FMLPacket;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
public class ForgePacketHandler implements IPacketHandler {
|
||||
|
||||
@Override
|
||||
public void onPacketData(INetworkManager network, Packet250CustomPayload packet, Player player)
|
||||
{
|
||||
ForgePacket pkt = ForgePacket.readPacket(network, packet.data);
|
||||
// Part of an incomplete multipart packet
|
||||
if (pkt == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pkt.execute(network, (EntityPlayer)player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.common.network;
|
||||
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraft.network.packet.Packet131MapData;
|
||||
import cpw.mods.fml.common.network.ITinyPacketHandler;
|
||||
|
||||
public class ForgeTinyPacketHandler implements ITinyPacketHandler {
|
||||
|
||||
@Override
|
||||
public void handle(NetHandler handler, Packet131MapData mapData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* This software is provided under the terms of the Minecraft Forge Public
|
||||
* License v1.0.
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.network.packet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.NetHandler;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.network.ForgePacket;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
/**
|
||||
* This class offers the ability for servers to register dimensions on client.
|
||||
*/
|
||||
public class DimensionRegisterPacket extends ForgePacket
|
||||
{
|
||||
|
||||
/** The dimension ID to register on client */
|
||||
public int dimensionId;
|
||||
/** The provider ID to register with dimension on client */
|
||||
public int providerId;
|
||||
|
||||
// nullary constructor required by ForgePacket.make()
|
||||
public DimensionRegisterPacket() {}
|
||||
|
||||
public DimensionRegisterPacket(int dimensionId, int providerId)
|
||||
{
|
||||
this.dimensionId = dimensionId;
|
||||
this.providerId = providerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] generatePacket()
|
||||
{
|
||||
ByteArrayDataOutput dat = ByteStreams.newDataOutput();
|
||||
dat.writeInt(this.dimensionId);
|
||||
dat.writeInt(this.providerId);
|
||||
return dat.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgePacket consumePacket(byte[] data)
|
||||
{
|
||||
ByteArrayDataInput dat = ByteStreams.newDataInput(data);
|
||||
dimensionId = dat.readInt();
|
||||
providerId = dat.readInt();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(INetworkManager network, EntityPlayer player)
|
||||
{
|
||||
if (!(player instanceof EntityPlayerMP))
|
||||
{
|
||||
if (!DimensionManager.isDimensionRegistered(dimensionId))
|
||||
{
|
||||
DimensionManager.registerDimension(dimensionId, providerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
||||
public class ASMEventHandler implements IEventListener
|
||||
{
|
||||
private static int IDs = 0;
|
||||
private static final String HANDLER_DESC = Type.getInternalName(IEventListener.class);
|
||||
private static final String HANDLER_FUNC_DESC = Type.getMethodDescriptor(IEventListener.class.getDeclaredMethods()[0]);
|
||||
private static final ASMClassLoader LOADER = new ASMClassLoader();
|
||||
private static final HashMap<Method, Class<?>> cache = Maps.newHashMap();
|
||||
|
||||
private final IEventListener handler;
|
||||
private final ForgeSubscribe subInfo;
|
||||
public ASMEventHandler(Object target, Method method) throws Exception
|
||||
{
|
||||
handler = (IEventListener)createWrapper(method).getConstructor(Object.class).newInstance(target);
|
||||
subInfo = method.getAnnotation(ForgeSubscribe.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(Event event)
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
if (!event.isCancelable() || !event.isCanceled() || subInfo.receiveCanceled())
|
||||
{
|
||||
handler.invoke(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public EventPriority getPriority()
|
||||
{
|
||||
return subInfo.priority();
|
||||
}
|
||||
|
||||
public Class<?> createWrapper(Method callback)
|
||||
{
|
||||
if (cache.containsKey(callback))
|
||||
{
|
||||
return cache.get(callback);
|
||||
}
|
||||
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
MethodVisitor mv;
|
||||
|
||||
String name = getUniqueName(callback);
|
||||
String desc = name.replace('.', '/');
|
||||
String instType = Type.getInternalName(callback.getDeclaringClass());
|
||||
String eventType = Type.getInternalName(callback.getParameterTypes()[0]);
|
||||
|
||||
/*
|
||||
System.out.println("Name: " + name);
|
||||
System.out.println("Desc: " + desc);
|
||||
System.out.println("InstType: " + instType);
|
||||
System.out.println("Callback: " + callback.getName() + Type.getMethodDescriptor(callback));
|
||||
System.out.println("Event: " + eventType);
|
||||
*/
|
||||
|
||||
cw.visit(V1_6, ACC_PUBLIC | ACC_SUPER, desc, null, "java/lang/Object", new String[]{ HANDLER_DESC });
|
||||
|
||||
cw.visitSource(".dynamic", null);
|
||||
{
|
||||
cw.visitField(ACC_PUBLIC, "instance", "Ljava/lang/Object;", null, null).visitEnd();
|
||||
}
|
||||
{
|
||||
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Ljava/lang/Object;)V", null, null);
|
||||
mv.visitCode();
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitFieldInsn(PUTFIELD, desc, "instance", "Ljava/lang/Object;");
|
||||
mv.visitInsn(RETURN);
|
||||
mv.visitMaxs(2, 2);
|
||||
mv.visitEnd();
|
||||
}
|
||||
{
|
||||
mv = cw.visitMethod(ACC_PUBLIC, "invoke", HANDLER_FUNC_DESC, null, null);
|
||||
mv.visitCode();
|
||||
mv.visitVarInsn(ALOAD, 0);
|
||||
mv.visitFieldInsn(GETFIELD, desc, "instance", "Ljava/lang/Object;");
|
||||
mv.visitTypeInsn(CHECKCAST, instType);
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitTypeInsn(CHECKCAST, eventType);
|
||||
mv.visitMethodInsn(INVOKEVIRTUAL, instType, callback.getName(), Type.getMethodDescriptor(callback));
|
||||
mv.visitInsn(RETURN);
|
||||
mv.visitMaxs(2, 2);
|
||||
mv.visitEnd();
|
||||
}
|
||||
cw.visitEnd();
|
||||
Class<?> ret = LOADER.define(name, cw.toByteArray());
|
||||
cache.put(callback, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private String getUniqueName(Method callback)
|
||||
{
|
||||
return String.format("%s_%d_%s_%s_%s", getClass().getName(), IDs++,
|
||||
callback.getDeclaringClass().getSimpleName(),
|
||||
callback.getName(),
|
||||
callback.getParameterTypes()[0].getSimpleName());
|
||||
}
|
||||
|
||||
private static class ASMClassLoader extends ClassLoader
|
||||
{
|
||||
private ASMClassLoader()
|
||||
{
|
||||
super(ASMClassLoader.class.getClassLoader());
|
||||
}
|
||||
|
||||
public Class<?> define(String name, byte[] data)
|
||||
{
|
||||
return defineClass(name, data, 0, data.length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = TYPE)
|
||||
public @interface Cancelable{}
|
||||
@@ -1,21 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
|
||||
@Cancelable
|
||||
public class CommandEvent extends Event
|
||||
{
|
||||
|
||||
public final ICommand command;
|
||||
public final ICommandSender sender;
|
||||
public String[] parameters;
|
||||
public Throwable exception;
|
||||
|
||||
public CommandEvent(ICommand command, ICommandSender sender, String[] parameters)
|
||||
{
|
||||
this.command = command;
|
||||
this.sender = sender;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**
|
||||
* Base Event class that all other events are derived from
|
||||
*/
|
||||
public class Event
|
||||
{
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = TYPE)
|
||||
public @interface HasResult{}
|
||||
|
||||
public enum Result
|
||||
{
|
||||
DENY,
|
||||
DEFAULT,
|
||||
ALLOW
|
||||
}
|
||||
|
||||
private boolean isCanceled = false;
|
||||
private final boolean isCancelable;
|
||||
private Result result = Result.DEFAULT;
|
||||
private final boolean hasResult;
|
||||
private static ListenerList listeners = new ListenerList();
|
||||
|
||||
private static final Map<Class, Map<Class, Boolean>> annotationMap = new ConcurrentHashMap<Class, Map<Class, Boolean>>();
|
||||
|
||||
public Event()
|
||||
{
|
||||
setup();
|
||||
isCancelable = hasAnnotation(Cancelable.class);
|
||||
hasResult = hasAnnotation(HasResult.class);
|
||||
}
|
||||
|
||||
private boolean hasAnnotation(Class annotation)
|
||||
{
|
||||
Class me = this.getClass();
|
||||
Map<Class, Boolean> list = annotationMap.get(me);
|
||||
if (list == null)
|
||||
{
|
||||
list = new ConcurrentHashMap<Class, Boolean>();
|
||||
annotationMap.put(me, list);
|
||||
}
|
||||
|
||||
Boolean cached = list.get(annotation);
|
||||
if (cached != null)
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
Class cls = me;
|
||||
while (cls != Event.class)
|
||||
{
|
||||
if (cls.isAnnotationPresent(annotation))
|
||||
{
|
||||
list.put(annotation, true);
|
||||
return true;
|
||||
}
|
||||
cls = cls.getSuperclass();
|
||||
}
|
||||
|
||||
list.put(annotation, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this function is cancelable at all.
|
||||
* @return If access to setCanceled should be allowed
|
||||
*/
|
||||
public boolean isCancelable()
|
||||
{
|
||||
return isCancelable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this event is canceled and should stop executing.
|
||||
* @return The current canceled state
|
||||
*/
|
||||
public boolean isCanceled()
|
||||
{
|
||||
return isCanceled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state of this event, not all events are cancelable, and any attempt to
|
||||
* cancel a event that can't be will result in a IllegalArgumentException.
|
||||
*
|
||||
* The functionality of setting the canceled state is defined on a per-event bases.
|
||||
*
|
||||
* @param cancel The new canceled value
|
||||
*/
|
||||
public void setCanceled(boolean cancel)
|
||||
{
|
||||
if (!isCancelable())
|
||||
{
|
||||
throw new IllegalArgumentException("Attempted to cancel a uncancelable event");
|
||||
}
|
||||
isCanceled = cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this event expects a significant result value.
|
||||
*/
|
||||
public boolean hasResult()
|
||||
{
|
||||
return hasResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value set as the result of this event
|
||||
*/
|
||||
public Result getResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the result value for this event, not all events can have a result set, and any attempt to
|
||||
* set a result for a event that isn't expecting it will result in a IllegalArgumentException.
|
||||
*
|
||||
* The functionality of setting the result is defined on a per-event bases.
|
||||
*
|
||||
* @param value The new result
|
||||
*/
|
||||
public void setResult(Result value)
|
||||
{
|
||||
result = value;
|
||||
}
|
||||
/**
|
||||
* Called by the base constructor, this is used by ASM generated
|
||||
* event classes to setup various functionality such as the listener's list.
|
||||
*/
|
||||
protected void setup()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ListenerList object that contains all listeners
|
||||
* that are registered to this event.
|
||||
*
|
||||
* @return Listener List
|
||||
*/
|
||||
public ListenerList getListenerList()
|
||||
{
|
||||
return listeners;
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
public class EventBus
|
||||
{
|
||||
private static int maxID = 0;
|
||||
|
||||
private ConcurrentHashMap<Object, ArrayList<IEventListener>> listeners = new ConcurrentHashMap<Object, ArrayList<IEventListener>>();
|
||||
private final int busID = maxID++;
|
||||
|
||||
public EventBus()
|
||||
{
|
||||
ListenerList.resize(busID + 1);
|
||||
}
|
||||
|
||||
public void register(Object target)
|
||||
{
|
||||
if (listeners.containsKey(target))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Set<? extends Class<?>> supers = TypeToken.of(target.getClass()).getTypes().rawTypes();
|
||||
for (Method method : target.getClass().getMethods())
|
||||
{
|
||||
for (Class<?> cls : supers)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method real = cls.getDeclaredMethod(method.getName(), method.getParameterTypes());
|
||||
if (real.isAnnotationPresent(ForgeSubscribe.class))
|
||||
{
|
||||
Class<?>[] parameterTypes = method.getParameterTypes();
|
||||
if (parameterTypes.length != 1)
|
||||
{
|
||||
throw new IllegalArgumentException(
|
||||
"Method " + method + " has @ForgeSubscribe annotation, but requires " + parameterTypes.length +
|
||||
" arguments. Event handler methods must require a single argument."
|
||||
);
|
||||
}
|
||||
|
||||
Class<?> eventType = parameterTypes[0];
|
||||
|
||||
if (!Event.class.isAssignableFrom(eventType))
|
||||
{
|
||||
throw new IllegalArgumentException("Method " + method + " has @ForgeSubscribe annotation, but takes a argument that is not a Event " + eventType);
|
||||
}
|
||||
|
||||
register(eventType, target, method);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (NoSuchMethodException e)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void register(Class<?> eventType, Object target, Method method)
|
||||
{
|
||||
try
|
||||
{
|
||||
Constructor<?> ctr = eventType.getConstructor();
|
||||
ctr.setAccessible(true);
|
||||
Event event = (Event)ctr.newInstance();
|
||||
ASMEventHandler listener = new ASMEventHandler(target, method);
|
||||
event.getListenerList().register(busID, listener.getPriority(), listener);
|
||||
|
||||
ArrayList<IEventListener> others = listeners.get(target);
|
||||
if (others == null)
|
||||
{
|
||||
others = new ArrayList<IEventListener>();
|
||||
listeners.put(target, others);
|
||||
}
|
||||
others.add(listener);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister(Object object)
|
||||
{
|
||||
ArrayList<IEventListener> list = listeners.remove(object);
|
||||
for (IEventListener listener : list)
|
||||
{
|
||||
ListenerList.unregiterAll(busID, listener);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean post(Event event)
|
||||
{
|
||||
IEventListener[] listeners = event.getListenerList().getListeners(busID);
|
||||
for (IEventListener listener : listeners)
|
||||
{
|
||||
listener.invoke(event);
|
||||
}
|
||||
return (event.isCancelable() ? event.isCanceled() : false);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
public enum EventPriority
|
||||
{
|
||||
/*Priority of event listeners, listeners will be sorted with respect to this priority level.
|
||||
*
|
||||
* Note:
|
||||
* Due to using a ArrayList in the ListenerList,
|
||||
* these need to stay in a contiguous index starting at 0. {Default ordinal}
|
||||
*/
|
||||
HIGHEST, //First to execute
|
||||
HIGH,
|
||||
NORMAL,
|
||||
LOW,
|
||||
LOWEST //Last to execute
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.Event.Result;
|
||||
import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ForgeEventFactory
|
||||
{
|
||||
public static boolean doPlayerHarvestCheck(EntityPlayer player, Block block, boolean success)
|
||||
{
|
||||
PlayerEvent.HarvestCheck event = new PlayerEvent.HarvestCheck(player, block, success);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.success;
|
||||
}
|
||||
|
||||
public static float getBreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
PlayerEvent.BreakSpeed event = new PlayerEvent.BreakSpeed(player, block, metadata, original);
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed);
|
||||
}
|
||||
|
||||
public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
PlayerInteractEvent event = new PlayerInteractEvent(player, action, x, y, z, face);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
public static void onPlayerDestroyItem(EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, stack));
|
||||
}
|
||||
|
||||
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, world, x, y, z);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getResult();
|
||||
}
|
||||
|
||||
public static boolean doSpecialSpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new LivingSpawnEvent.SpecialSpawn(entity, world, x, y, z));
|
||||
}
|
||||
|
||||
public static List getPotentialSpawns(WorldServer world, EnumCreatureType type, int x, int y, int z, List oldList)
|
||||
{
|
||||
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, x, y, z, oldList);
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return event.list;
|
||||
}
|
||||
|
||||
public static int getMaxSpawnPackSize(EntityLiving entity)
|
||||
{
|
||||
LivingPackSizeEvent maxCanSpawnEvent = new LivingPackSizeEvent(entity);
|
||||
MinecraftForge.EVENT_BUS.post(maxCanSpawnEvent);
|
||||
return maxCanSpawnEvent.getResult() == Result.ALLOW ? maxCanSpawnEvent.maxPackSize : entity.getMaxSpawnedInChunk();
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
|
||||
@Retention(value = RUNTIME)
|
||||
@Target(value = METHOD)
|
||||
public @interface ForgeSubscribe
|
||||
{
|
||||
public EventPriority priority() default EventPriority.NORMAL;
|
||||
public boolean receiveCanceled() default false;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
|
||||
|
||||
public interface IEventListener
|
||||
{
|
||||
public void invoke(Event event);
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class ListenerList
|
||||
{
|
||||
private static ArrayList<ListenerList> allLists = new ArrayList<ListenerList>();
|
||||
private static int maxSize = 0;
|
||||
|
||||
private ListenerList parent;
|
||||
private ListenerListInst[] lists = new ListenerListInst[0];
|
||||
|
||||
public ListenerList()
|
||||
{
|
||||
allLists.add(this);
|
||||
resizeLists(maxSize);
|
||||
}
|
||||
|
||||
public ListenerList(ListenerList parent)
|
||||
{
|
||||
allLists.add(this);
|
||||
this.parent = parent;
|
||||
resizeLists(maxSize);
|
||||
}
|
||||
|
||||
public static void resize(int max)
|
||||
{
|
||||
if (max <= maxSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.resizeLists(max);
|
||||
}
|
||||
maxSize = max;
|
||||
}
|
||||
|
||||
public void resizeLists(int max)
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
parent.resizeLists(max);
|
||||
}
|
||||
|
||||
if (lists.length >= max)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ListenerListInst[] newList = new ListenerListInst[max];
|
||||
int x = 0;
|
||||
for (; x < lists.length; x++)
|
||||
{
|
||||
newList[x] = lists[x];
|
||||
}
|
||||
for(; x < max; x++)
|
||||
{
|
||||
if (parent != null)
|
||||
{
|
||||
newList[x] = new ListenerListInst(parent.getInstance(x));
|
||||
}
|
||||
else
|
||||
{
|
||||
newList[x] = new ListenerListInst();
|
||||
}
|
||||
}
|
||||
lists = newList;
|
||||
}
|
||||
|
||||
public static void clearBusID(int id)
|
||||
{
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.lists[id].dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected ListenerListInst getInstance(int id)
|
||||
{
|
||||
return lists[id];
|
||||
}
|
||||
|
||||
public IEventListener[] getListeners(int id)
|
||||
{
|
||||
return lists[id].getListeners();
|
||||
}
|
||||
|
||||
public void register(int id, EventPriority priority, IEventListener listener)
|
||||
{
|
||||
lists[id].register(priority, listener);
|
||||
}
|
||||
|
||||
public void unregister(int id, IEventListener listener)
|
||||
{
|
||||
lists[id].unregister(listener);
|
||||
}
|
||||
|
||||
public static void unregiterAll(int id, IEventListener listener)
|
||||
{
|
||||
for (ListenerList list : allLists)
|
||||
{
|
||||
list.unregister(id, listener);
|
||||
}
|
||||
}
|
||||
|
||||
private class ListenerListInst
|
||||
{
|
||||
private boolean rebuild = true;
|
||||
private IEventListener[] listeners;
|
||||
private ArrayList<ArrayList<IEventListener>> priorities;
|
||||
private ListenerListInst parent;
|
||||
|
||||
private ListenerListInst()
|
||||
{
|
||||
int count = EventPriority.values().length;
|
||||
priorities = new ArrayList<ArrayList<IEventListener>>(count);
|
||||
|
||||
for (int x = 0; x < count; x++)
|
||||
{
|
||||
priorities.add(new ArrayList<IEventListener>());
|
||||
}
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
for (ArrayList<IEventListener> listeners : priorities)
|
||||
{
|
||||
listeners.clear();
|
||||
}
|
||||
priorities.clear();
|
||||
parent = null;
|
||||
listeners = null;
|
||||
}
|
||||
|
||||
private ListenerListInst(ListenerListInst parent)
|
||||
{
|
||||
this();
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a ArrayList containing all listeners for this event,
|
||||
* and all parent events for the specified priority.
|
||||
*
|
||||
* The list is returned with the listeners for the children events first.
|
||||
*
|
||||
* @param priority The Priority to get
|
||||
* @return ArrayList containing listeners
|
||||
*/
|
||||
public ArrayList<IEventListener> getListeners(EventPriority priority)
|
||||
{
|
||||
ArrayList<IEventListener> ret = new ArrayList<IEventListener>(priorities.get(priority.ordinal()));
|
||||
if (parent != null)
|
||||
{
|
||||
ret.addAll(parent.getListeners(priority));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a full list of all listeners for all priority levels.
|
||||
* Including all parent listeners.
|
||||
*
|
||||
* List is returned in proper priority order.
|
||||
*
|
||||
* Automatically rebuilds the internal Array cache if its information is out of date.
|
||||
*
|
||||
* @return Array containing listeners
|
||||
*/
|
||||
public IEventListener[] getListeners()
|
||||
{
|
||||
if (shouldRebuild()) buildCache();
|
||||
return listeners;
|
||||
}
|
||||
|
||||
protected boolean shouldRebuild()
|
||||
{
|
||||
return rebuild || (parent != null && parent.shouldRebuild());
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild the local Array of listeners, returns early if there is no work to do.
|
||||
*/
|
||||
private void buildCache()
|
||||
{
|
||||
if(parent != null && parent.shouldRebuild())
|
||||
{
|
||||
parent.buildCache();
|
||||
}
|
||||
|
||||
ArrayList<IEventListener> ret = new ArrayList<IEventListener>();
|
||||
for (EventPriority value : EventPriority.values())
|
||||
{
|
||||
ret.addAll(getListeners(value));
|
||||
}
|
||||
listeners = ret.toArray(new IEventListener[ret.size()]);
|
||||
rebuild = false;
|
||||
}
|
||||
|
||||
public void register(EventPriority priority, IEventListener listener)
|
||||
{
|
||||
priorities.get(priority.ordinal()).add(listener);
|
||||
rebuild = true;
|
||||
}
|
||||
|
||||
public void unregister(IEventListener listener)
|
||||
{
|
||||
for(ArrayList<IEventListener> list : priorities)
|
||||
{
|
||||
if (list.remove(listener))
|
||||
{
|
||||
rebuild = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
|
||||
@Cancelable
|
||||
public class ServerChatEvent extends Event
|
||||
{
|
||||
public final String message, username;
|
||||
public final EntityPlayerMP player;
|
||||
public ChatMessageComponent component;
|
||||
public ServerChatEvent(EntityPlayerMP player, String message, ChatMessageComponent component)
|
||||
{
|
||||
super();
|
||||
this.message = message;
|
||||
this.player = player;
|
||||
this.username = player.username;
|
||||
this.component = component;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event.brewing;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class PotionBrewedEvent extends Event
|
||||
{
|
||||
/**
|
||||
* The brewing stacks in the brewing stand. Each index has the possibility to be null, so make sure you check.
|
||||
*/
|
||||
public ItemStack[] brewingStacks;
|
||||
public PotionBrewedEvent(ItemStack[] brewingStacks)
|
||||
{
|
||||
this.brewingStacks = brewingStacks;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class EntityEvent extends Event
|
||||
{
|
||||
public final Entity entity;
|
||||
|
||||
public EntityEvent(Entity entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public static class EntityConstructing extends EntityEvent
|
||||
{
|
||||
public EntityConstructing(Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CanUpdate extends EntityEvent
|
||||
{
|
||||
public boolean canUpdate = false;
|
||||
public CanUpdate(Entity entity)
|
||||
{
|
||||
super(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static class EnteringChunk extends EntityEvent
|
||||
{
|
||||
public int newChunkX;
|
||||
public int newChunkZ;
|
||||
public int oldChunkX;
|
||||
public int oldChunkZ;
|
||||
|
||||
public EnteringChunk(Entity entity, int newChunkX, int newChunkZ, int oldChunkX, int oldChunkZ)
|
||||
{
|
||||
super(entity);
|
||||
this.newChunkX = newChunkX;
|
||||
this.newChunkZ = newChunkZ;
|
||||
this.oldChunkX = oldChunkX;
|
||||
this.oldChunkZ = oldChunkZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class EntityJoinWorldEvent extends EntityEvent
|
||||
{
|
||||
|
||||
public final World world;
|
||||
|
||||
public EntityJoinWorldEvent(Entity entity, World world)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlaySoundAtEntityEvent extends EntityEvent
|
||||
{
|
||||
public String name;
|
||||
public final float volume;
|
||||
public final float pitch;
|
||||
|
||||
public PlaySoundAtEntityEvent(Entity entity, String name, float volume, float pitch)
|
||||
{
|
||||
super(entity);
|
||||
this.name = name;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingAttackEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final float ammount;
|
||||
public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingDeathEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public LivingDeathEvent(EntityLivingBase entity, DamageSource source)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingDropsEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final ArrayList<EntityItem> drops;
|
||||
public final int lootingLevel;
|
||||
public final boolean recentlyHit;
|
||||
public final int specialDropValue;
|
||||
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, ArrayList<EntityItem> drops, int lootingLevel, boolean recentlyHit, int specialDropValue)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.drops = drops;
|
||||
this.lootingLevel = lootingLevel;
|
||||
this.recentlyHit = recentlyHit;
|
||||
this.specialDropValue = specialDropValue;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class LivingEvent extends EntityEvent
|
||||
{
|
||||
public final EntityLivingBase entityLiving;
|
||||
public LivingEvent(EntityLivingBase entity)
|
||||
{
|
||||
super(entity);
|
||||
entityLiving = entity;
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class LivingUpdateEvent extends LivingEvent
|
||||
{
|
||||
public LivingUpdateEvent(EntityLivingBase e){ super(e); }
|
||||
}
|
||||
|
||||
public static class LivingJumpEvent extends LivingEvent
|
||||
{
|
||||
public LivingJumpEvent(EntityLivingBase e){ super(e); }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingFallEvent extends LivingEvent
|
||||
{
|
||||
public float distance;
|
||||
public LivingFallEvent(EntityLivingBase entity, float distance)
|
||||
{
|
||||
super(entity);
|
||||
this.distance = distance;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class LivingHurtEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public float ammount;
|
||||
public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
public class LivingSetAttackTargetEvent extends LivingEvent
|
||||
{
|
||||
|
||||
public final EntityLivingBase target;
|
||||
public LivingSetAttackTargetEvent(EntityLivingBase entity, EntityLivingBase target)
|
||||
{
|
||||
super(entity);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event.HasResult;
|
||||
|
||||
public class LivingSpawnEvent extends LivingEvent
|
||||
{
|
||||
public final World world;
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
|
||||
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity);
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires before mob spawn events.
|
||||
*
|
||||
* Result is significant:
|
||||
* DEFAULT: use vanilla spawn rules
|
||||
* ALLOW: allow the spawn
|
||||
* DENY: deny the spawn
|
||||
*
|
||||
*/
|
||||
@HasResult
|
||||
public static class CheckSpawn extends LivingSpawnEvent
|
||||
{
|
||||
public CheckSpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class SpecialSpawn extends LivingSpawnEvent
|
||||
{
|
||||
public SpecialSpawn(EntityLiving entity, World world, float x, float y, float z)
|
||||
{
|
||||
super(entity, world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
|
||||
public class MinecartCollisionEvent extends MinecartEvent
|
||||
{
|
||||
public final Entity collider;
|
||||
|
||||
public MinecartCollisionEvent(EntityMinecart minecart, Entity collider)
|
||||
{
|
||||
super(minecart);
|
||||
this.collider = collider;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
public class MinecartEvent extends EntityEvent
|
||||
{
|
||||
public final EntityMinecart minecart;
|
||||
|
||||
public MinecartEvent(EntityMinecart minecart)
|
||||
{
|
||||
super(minecart);
|
||||
this.minecart = minecart;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class MinecartInteractEvent extends MinecartEvent
|
||||
{
|
||||
public final EntityPlayer player;
|
||||
|
||||
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player)
|
||||
{
|
||||
super(minecart);
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
|
||||
public class MinecartUpdateEvent extends MinecartEvent
|
||||
{
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
|
||||
public MinecartUpdateEvent(EntityMinecart minecart, float x, float y, float z)
|
||||
{
|
||||
super(minecart);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ArrowLooseEvent extends PlayerEvent
|
||||
{
|
||||
public final ItemStack bow;
|
||||
public int charge;
|
||||
|
||||
public ArrowLooseEvent(EntityPlayer player, ItemStack bow, int charge)
|
||||
{
|
||||
super(player);
|
||||
this.bow = bow;
|
||||
this.charge = charge;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class ArrowNockEvent extends PlayerEvent
|
||||
{
|
||||
public ItemStack result;
|
||||
|
||||
public ArrowNockEvent(EntityPlayer player, ItemStack result)
|
||||
{
|
||||
super(player);
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class AttackEntityEvent extends PlayerEvent
|
||||
{
|
||||
public final Entity target;
|
||||
public AttackEntityEvent(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class EntityInteractEvent extends PlayerEvent
|
||||
{
|
||||
public final Entity target;
|
||||
public EntityInteractEvent(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PlayerDestroyItemEvent extends PlayerEvent
|
||||
{
|
||||
public final ItemStack original;
|
||||
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original)
|
||||
{
|
||||
super(player);
|
||||
this.original = original;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
public class PlayerEvent extends LivingEvent
|
||||
{
|
||||
public final EntityPlayer entityPlayer;
|
||||
public PlayerEvent(EntityPlayer player)
|
||||
{
|
||||
super(player);
|
||||
entityPlayer = player;
|
||||
}
|
||||
|
||||
public static class HarvestCheck extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public boolean success;
|
||||
|
||||
public HarvestCheck(EntityPlayer player, Block block, boolean success)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.success = success;
|
||||
}
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class BreakSpeed extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public final int metadata;
|
||||
public final float originalSpeed;
|
||||
public float newSpeed = 0.0f;
|
||||
|
||||
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
this.originalSpeed = original;
|
||||
this.newSpeed = original;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
import static net.minecraftforge.event.Event.Result;
|
||||
import static net.minecraftforge.event.Event.Result.*;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerInteractEvent extends PlayerEvent
|
||||
{
|
||||
public static enum Action
|
||||
{
|
||||
RIGHT_CLICK_AIR,
|
||||
RIGHT_CLICK_BLOCK,
|
||||
LEFT_CLICK_BLOCK
|
||||
}
|
||||
|
||||
public final Action action;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int face;
|
||||
|
||||
public Result useBlock = DEFAULT;
|
||||
public Result useItem = DEFAULT;
|
||||
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
super(player);
|
||||
this.action = action;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.face = face;
|
||||
if (face == -1) useBlock = DENY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCanceled(boolean cancel)
|
||||
{
|
||||
super.setCanceled(cancel);
|
||||
useBlock = (cancel ? DENY : useBlock == DENY ? DEFAULT : useBlock);
|
||||
useItem = (cancel ? DENY : useItem == DENY ? DEFAULT : useItem);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EnumStatus;
|
||||
|
||||
public class PlayerSleepInBedEvent extends PlayerEvent
|
||||
{
|
||||
public EnumStatus result = null;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public PlayerSleepInBedEvent(EntityPlayer player, int x, int y, int z)
|
||||
{
|
||||
super(player);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.*;
|
||||
|
||||
public class DecorateBiomeEvent extends Event
|
||||
{
|
||||
public final World world;
|
||||
public final Random rand;
|
||||
public final int chunkX;
|
||||
public final int chunkZ;
|
||||
|
||||
public DecorateBiomeEvent(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
this.world = world;
|
||||
this.rand = rand;
|
||||
this.chunkX = worldX;
|
||||
this.chunkZ = worldZ;
|
||||
}
|
||||
|
||||
public static class Pre extends DecorateBiomeEvent
|
||||
{
|
||||
public Pre(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends DecorateBiomeEvent
|
||||
{
|
||||
public Post(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when a chunk is decorated with a biome feature.
|
||||
*
|
||||
* You can set the result to DENY to prevent the default biome decoration.
|
||||
*/
|
||||
@HasResult
|
||||
public static class Decorate extends DecorateBiomeEvent
|
||||
{
|
||||
/** Use CUSTOM to filter custom event types
|
||||
*/
|
||||
public static enum EventType { BIG_SHROOM, CACTUS, CLAY, DEAD_BUSH, LILYPAD, FLOWERS, GRASS, LAKE, PUMPKIN, REED, SAND, SAND_PASS2, SHROOM, TREE, CUSTOM }
|
||||
|
||||
public final EventType type;
|
||||
|
||||
public Decorate(World world, Random rand, int worldX, int worldZ, EventType type)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.event.*;
|
||||
|
||||
public class OreGenEvent extends Event
|
||||
{
|
||||
public final World world;
|
||||
public final Random rand;
|
||||
public final int worldX;
|
||||
public final int worldZ;
|
||||
|
||||
public OreGenEvent(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
this.world = world;
|
||||
this.rand = rand;
|
||||
this.worldX = worldX;
|
||||
this.worldZ = worldZ;
|
||||
}
|
||||
|
||||
public static class Pre extends OreGenEvent
|
||||
{
|
||||
public Pre(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends OreGenEvent
|
||||
{
|
||||
public Post(World world, Random rand, int worldX, int worldZ)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when an ore is generated in a chunk.
|
||||
*
|
||||
* You can set the result to DENY to prevent the default ore generation.
|
||||
*/
|
||||
@HasResult
|
||||
public static class GenerateMinable extends OreGenEvent
|
||||
{
|
||||
public static enum EventType { COAL, DIAMOND, DIRT, GOLD, GRAVEL, IRON, LAPIS, REDSTONE, CUSTOM }
|
||||
|
||||
public final EventType type;
|
||||
public final WorldGenerator generator;
|
||||
|
||||
public GenerateMinable(World world, Random rand, WorldGenerator generator, int worldX, int worldZ, EventType type)
|
||||
{
|
||||
super(world, rand, worldX, worldZ);
|
||||
this.generator = generator;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.event.world.*;
|
||||
|
||||
public class PopulateChunkEvent extends ChunkProviderEvent
|
||||
{
|
||||
public final World world;
|
||||
public final Random rand;
|
||||
public final int chunkX;
|
||||
public final int chunkZ;
|
||||
public final boolean hasVillageGenerated;
|
||||
|
||||
public PopulateChunkEvent(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
|
||||
{
|
||||
super(chunkProvider);
|
||||
this.world = world;
|
||||
this.rand = rand;
|
||||
this.chunkX = chunkX;
|
||||
this.chunkZ = chunkZ;
|
||||
this.hasVillageGenerated = hasVillageGenerated;
|
||||
}
|
||||
|
||||
public static class Pre extends PopulateChunkEvent
|
||||
{
|
||||
public Pre(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
|
||||
{
|
||||
super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends PopulateChunkEvent
|
||||
{
|
||||
public Post(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated)
|
||||
{
|
||||
super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This event is fired when a chunk is populated with a terrain feature.
|
||||
*
|
||||
* You can set the result to DENY to prevent the default generation
|
||||
* of a terrain feature.
|
||||
*/
|
||||
@HasResult
|
||||
public static class Populate extends PopulateChunkEvent
|
||||
{
|
||||
/** Use CUSTOM to filter custom event types
|
||||
*/
|
||||
public static enum EventType { DUNGEON, FIRE, GLOWSTONE, ICE, LAKE, LAVA, NETHER_LAVA, CUSTOM }
|
||||
|
||||
public final EventType type;
|
||||
|
||||
public Populate(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated, EventType type)
|
||||
{
|
||||
super(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.Event.HasResult;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
/**
|
||||
* This event is fired when a sapling grows a tree.
|
||||
*
|
||||
* You can set the result to DENY to prevent the default tree growth.
|
||||
*/
|
||||
@HasResult
|
||||
public class SaplingGrowTreeEvent extends WorldEvent
|
||||
{
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final Random rand;
|
||||
|
||||
public SaplingGrowTreeEvent(World world, Random rand, int x, int y, int z)
|
||||
{
|
||||
super(world);
|
||||
this.rand = rand;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import net.minecraft.world.gen.layer.GenLayer;
|
||||
import net.minecraft.world.WorldType;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class WorldTypeEvent extends Event
|
||||
{
|
||||
public final WorldType worldType;
|
||||
|
||||
public WorldTypeEvent(WorldType worldType)
|
||||
{
|
||||
this.worldType = worldType;
|
||||
}
|
||||
|
||||
public static class BiomeSize extends WorldTypeEvent
|
||||
{
|
||||
public final byte originalSize;
|
||||
public byte newSize;
|
||||
|
||||
public BiomeSize(WorldType worldType, byte original)
|
||||
{
|
||||
super(worldType);
|
||||
originalSize = original;
|
||||
newSize = original;
|
||||
}
|
||||
}
|
||||
|
||||
public static class InitBiomeGens extends WorldTypeEvent
|
||||
{
|
||||
public final long seed;
|
||||
public final GenLayer[] originalBiomeGens;
|
||||
public GenLayer[] newBiomeGens;
|
||||
|
||||
public InitBiomeGens(WorldType worldType, long seed, GenLayer[] original)
|
||||
{
|
||||
super(worldType);
|
||||
this.seed = seed;
|
||||
originalBiomeGens = original;
|
||||
newBiomeGens = original.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ChunkDataEvent extends ChunkEvent
|
||||
{
|
||||
private final NBTTagCompound data;
|
||||
|
||||
public ChunkDataEvent(Chunk chunk, NBTTagCompound data)
|
||||
{
|
||||
super(chunk);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public NBTTagCompound getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public static class Load extends ChunkDataEvent
|
||||
{
|
||||
public Load(Chunk chunk, NBTTagCompound data)
|
||||
{
|
||||
super(chunk, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Save extends ChunkDataEvent
|
||||
{
|
||||
public Save(Chunk chunk, NBTTagCompound data)
|
||||
{
|
||||
super(chunk, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ChunkEvent extends WorldEvent
|
||||
{
|
||||
private final Chunk chunk;
|
||||
|
||||
public ChunkEvent(Chunk chunk)
|
||||
{
|
||||
super(chunk.worldObj);
|
||||
this.chunk = chunk;
|
||||
}
|
||||
|
||||
public Chunk getChunk()
|
||||
{
|
||||
return chunk;
|
||||
}
|
||||
|
||||
public static class Load extends ChunkEvent
|
||||
{
|
||||
public Load(Chunk chunk)
|
||||
{
|
||||
super(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Unload extends ChunkEvent
|
||||
{
|
||||
public Unload(Chunk chunk)
|
||||
{
|
||||
super(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.management.PlayerInstance;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class ChunkWatchEvent extends Event
|
||||
{
|
||||
public final ChunkCoordIntPair chunk;
|
||||
public final EntityPlayerMP player;
|
||||
|
||||
public ChunkWatchEvent(ChunkCoordIntPair chunk, EntityPlayerMP player)
|
||||
{
|
||||
this.chunk = chunk;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public static class Watch extends ChunkWatchEvent
|
||||
{
|
||||
public Watch(ChunkCoordIntPair chunk, EntityPlayerMP player) { super(chunk, player); }
|
||||
}
|
||||
|
||||
public static class UnWatch extends ChunkWatchEvent
|
||||
{
|
||||
public UnWatch(ChunkCoordIntPair chunkLocation, EntityPlayerMP player) { super(chunkLocation, player); }
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.SpawnListEntry;
|
||||
import net.minecraftforge.event.Cancelable;
|
||||
import net.minecraftforge.event.Event;
|
||||
|
||||
public class WorldEvent extends Event
|
||||
{
|
||||
public final World world;
|
||||
|
||||
public WorldEvent(World world)
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public static class Load extends WorldEvent
|
||||
{
|
||||
public Load(World world) { super(world); }
|
||||
}
|
||||
|
||||
public static class Unload extends WorldEvent
|
||||
{
|
||||
public Unload(World world) { super(world); }
|
||||
}
|
||||
|
||||
public static class Save extends WorldEvent
|
||||
{
|
||||
public Save(World world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by WorldServer to gather a list of all possible entities that can spawn at the specified location.
|
||||
* Canceling the event will result in a empty list, meaning no entity will be spawned.
|
||||
*/
|
||||
@Cancelable
|
||||
public static class PotentialSpawns extends WorldEvent
|
||||
{
|
||||
public final EnumCreatureType type;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final List<SpawnListEntry> list;
|
||||
|
||||
public PotentialSpawns(World world, EnumCreatureType type, int x, int y, int z, List oldList)
|
||||
{
|
||||
super(world);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.type = type;
|
||||
if (oldList != null)
|
||||
{
|
||||
this.list = (List<SpawnListEntry>)oldList;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.list = new ArrayList<SpawnListEntry>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Implementors of this interface are a liquid which may receive a block implementation and can be placed in the world.
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface IBlockLiquid extends ILiquid {
|
||||
/**
|
||||
* Controls the type of block that is generated by this IBlockLiquid
|
||||
*
|
||||
*/
|
||||
public enum BlockType {
|
||||
/**
|
||||
* No block. Completeness really.
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Vanilla style block, up to 8 flowing states. May be able to generate new sources.
|
||||
*/
|
||||
VANILLA,
|
||||
/**
|
||||
* Finite liquid style, uses cellular automata to model flowing behaviour.
|
||||
*/
|
||||
FINITE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this liquid, when placed in a specific configuration, generate new source blocks of the liquid.
|
||||
* @return if this liquid will generate new sources
|
||||
*/
|
||||
public boolean willGenerateSources();
|
||||
|
||||
/**
|
||||
* @return the distance this liquid will flow if placed in the world. Maximum of 7 levels for vanilla types.
|
||||
*/
|
||||
public int getFlowDistance();
|
||||
|
||||
/**
|
||||
* @return the RGB rendering for this liquid
|
||||
*/
|
||||
public byte[] getLiquidRGB();
|
||||
|
||||
/**
|
||||
* Get the texture file for rendering the liquid
|
||||
* @return the texture file for this liquid
|
||||
*/
|
||||
public String getLiquidBlockTextureFile();
|
||||
/**
|
||||
* Custom properties of the liquid.
|
||||
* @return a compound tag of custom liquid properties
|
||||
*/
|
||||
public NBTTagCompound getLiquidProperties();
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
/**
|
||||
* Liquids implement this interface
|
||||
*
|
||||
*/
|
||||
public interface ILiquid {
|
||||
|
||||
/**
|
||||
* The itemId of the liquid item
|
||||
* @return the itemId
|
||||
*/
|
||||
public int stillLiquidId();
|
||||
|
||||
/**
|
||||
* Is this liquid a metadata based liquid
|
||||
* @return if this is a metadata liquid
|
||||
*/
|
||||
public boolean isMetaSensitive();
|
||||
|
||||
/**
|
||||
* The item metadata of the liquid
|
||||
* @return the metadata of the liquid
|
||||
*/
|
||||
public int stillLiquidMeta();
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
/**
|
||||
* A tank is the unit of interaction with liquid inventories.
|
||||
*
|
||||
* @author cpw
|
||||
*/
|
||||
public interface ILiquidTank {
|
||||
|
||||
/**
|
||||
* @return LiquidStack representing the liquid contained in the tank, null if empty.
|
||||
*/
|
||||
LiquidStack getLiquid();
|
||||
|
||||
/**
|
||||
* @return capacity of this tank
|
||||
*/
|
||||
int getCapacity();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param resource
|
||||
* @param doFill
|
||||
* @return Amount of liquid used for filling.
|
||||
*/
|
||||
int fill(LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
*
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
* @return Null if nothing was drained, otherwise a LiquidStack containing the drained.
|
||||
*/
|
||||
LiquidStack drain(int maxDrain, boolean doDrain);
|
||||
|
||||
/**
|
||||
* Positive values indicate a positive liquid pressure (liquid wants to leave this tank)
|
||||
* Negative values indicate a negative liquid pressure (liquid wants to fill this tank)
|
||||
* Zero indicates no pressure
|
||||
*
|
||||
* @return a number indicating tank pressure
|
||||
*/
|
||||
public int getTankPressure();
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package net.minecraftforge.liquids;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ITankContainer {
|
||||
|
||||
/**
|
||||
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is pumped in from.
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(ForgeDirection from, LiquidStack resource, boolean doFill);
|
||||
/**
|
||||
* Fills liquid into the specified internal tank.
|
||||
* @param tankIndex the index of the tank to fill
|
||||
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
|
||||
* @param doFill If false filling will only be simulated.
|
||||
* @return Amount of resource that was filled into internal tanks.
|
||||
*/
|
||||
int fill(int tankIndex, LiquidStack resource, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
|
||||
* @param from Orientation the liquid is drained to.
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(ForgeDirection from, int maxDrain, boolean doDrain);
|
||||
/**
|
||||
* Drains liquid out of the specified internal tank.
|
||||
* @param tankIndex the index of the tank to drain
|
||||
* @param maxDrain Maximum amount of liquid to drain.
|
||||
* @param doDrain If false draining will only be simulated.
|
||||
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
|
||||
*/
|
||||
LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain);
|
||||
|
||||
/**
|
||||
* @param direction tank side: UNKNOWN for default tank set
|
||||
* @return Array of {@link LiquidTank}s contained in this ITankContainer for this direction
|
||||
*/
|
||||
ILiquidTank[] getTanks(ForgeDirection direction);
|
||||
|
||||
/**
|
||||
* Return the tank that this tank container desired to be used for the specified liquid type from the specified direction
|
||||
*
|
||||
* @param direction the direction
|
||||
* @param type the liquid type, null is always an acceptable value
|
||||
* @return a tank or null for no such tank
|
||||
*/
|
||||
ILiquidTank getTank(ForgeDirection direction, LiquidStack type);
|
||||
|
||||
}
|
||||
Loaded 100 of 648 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user