mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-27 15:23:11 +00:00
Compare commits
529
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f175d70f0c | ||
|
|
958393a4fe | ||
|
|
130626343b | ||
|
|
3d3b842923 | ||
|
|
300f01be8b | ||
|
|
a231e67167 | ||
|
|
960b8b43bf | ||
|
|
9668cffe59 | ||
|
|
b6b110b63d | ||
|
|
8ca32457d0 | ||
|
|
e095a6018a | ||
|
|
29cb32b6ee | ||
|
|
5cc8488928 | ||
|
|
3e6ea173fc | ||
|
|
198f7cb3e8 | ||
|
|
8a179dd206 | ||
|
|
6ebb3220dd | ||
|
|
0caf89e539 | ||
|
|
e3cc9352b1 | ||
|
|
b3e480a6cb | ||
|
|
891fef6585 | ||
|
|
a81841bdfd | ||
|
|
9fc2160965 | ||
|
|
0bf904f2a4 | ||
|
|
6187a7306d | ||
|
|
5b867c531f | ||
|
|
745ef0841f | ||
|
|
7dedef21fe | ||
|
|
20ebc18f6a | ||
|
|
6e96cba6fe | ||
|
|
db8aee2c25 | ||
|
|
90e4eb0366 | ||
|
|
b0a2e6e274 | ||
|
|
e621da2082 | ||
|
|
f7ea2e9243 | ||
|
|
a55e699210 | ||
|
|
1372804bc9 | ||
|
|
4e3c073fef | ||
|
|
9d76815744 | ||
|
|
d790afc047 | ||
|
|
3b1b1af852 | ||
|
|
3077326c16 | ||
|
|
2536488e53 | ||
|
|
6770a9fe6f | ||
|
|
f24694680e | ||
|
|
8db0ea3f34 | ||
|
|
8775fbb9c4 | ||
|
|
7732cebf68 | ||
|
|
79dc0eb5bc | ||
|
|
ef5efd2e8b | ||
|
|
f5912ef2e3 | ||
|
|
1515ebe33f | ||
|
|
567b1dbce5 | ||
|
|
1efa92adad | ||
|
|
bd0e7fabca | ||
|
|
c6d11305bb | ||
|
|
a4892aee06 | ||
|
|
8186653910 | ||
|
|
25ab0916a7 | ||
|
|
cc6959eb03 | ||
|
|
861791f4fb | ||
|
|
5b6540f637 | ||
|
|
1f55def09f | ||
|
|
4de0ee4b1a | ||
|
|
bcdd765870 | ||
|
|
98ff754306 | ||
|
|
1ed32d46dc | ||
|
|
3d01f50100 | ||
|
|
64977b87a9 | ||
|
|
dd842a182c | ||
|
|
3fa1b1e0e2 | ||
|
|
3fce70a406 | ||
|
|
3df15eae97 | ||
|
|
0374c1c521 | ||
|
|
b0d67ac917 | ||
|
|
f51f09845a | ||
|
|
c94876b02e | ||
|
|
e8f069375f | ||
|
|
b50fd74e9c | ||
|
|
51229e972b | ||
|
|
95a72f0e08 | ||
|
|
6afa01da74 | ||
|
|
7895fce275 | ||
|
|
d5b8ef6ea9 | ||
|
|
f87b76347e | ||
|
|
14853a2481 | ||
|
|
2cd049d40e | ||
|
|
f01cde7659 | ||
|
|
56cda9f9e2 | ||
|
|
3da14b3bbe | ||
|
|
97c7533ffb | ||
|
|
d2df9beb31 | ||
|
|
dab5a0dbf3 | ||
|
|
6090f198e6 | ||
|
|
c29f8cf846 | ||
|
|
77ec41812d | ||
|
|
258465a654 | ||
|
|
adbc077736 | ||
|
|
adf317d6a1 | ||
|
|
508f6e5d64 | ||
|
|
c174db3f15 | ||
|
|
e1b3f20078 | ||
|
|
54781c290e | ||
|
|
9c2ef02383 | ||
|
|
6a244c12c4 | ||
|
|
399c5f53dd | ||
|
|
b9724d9369 | ||
|
|
c92f8bdd7c | ||
|
|
ab7769a45d | ||
|
|
d2c03bc903 | ||
|
|
e8664328ed | ||
|
|
84e395e470 | ||
|
|
0a01bb008b | ||
|
|
f73f79da7b | ||
|
|
16f207ce80 | ||
|
|
18f31ac3ef | ||
|
|
b205d3f53f | ||
|
|
6505967826 | ||
|
|
78e9291fc6 | ||
|
|
6c4e12e968 | ||
|
|
ebf5a23ab9 | ||
|
|
161e38cbda | ||
|
|
948dcdcbce | ||
|
|
0b99ba974f | ||
|
|
2407653e96 | ||
|
|
acfb5b1d48 | ||
|
|
232b64e819 | ||
|
|
7438c7075c | ||
|
|
9615e1cbf0 | ||
|
|
98c633e13d | ||
|
|
704dbf6eec | ||
|
|
bf7190ce21 | ||
|
|
883ae61395 | ||
|
|
a203f2ff6b | ||
|
|
fee5c6ee76 | ||
|
|
fb003da0a3 | ||
|
|
0e774f4e66 | ||
|
|
25763691ca | ||
|
|
bc053b2690 | ||
|
|
9761008907 | ||
|
|
1a7acf4d28 | ||
|
|
c21752b80d | ||
|
|
80c364455d | ||
|
|
aef677868b | ||
|
|
09c1c49529 | ||
|
|
18fb84de69 | ||
|
|
271917c765 | ||
|
|
e9c6c75ac9 | ||
|
|
7d09bf606f | ||
|
|
098561a01d | ||
|
|
e292a4d35c | ||
|
|
52a985765c | ||
|
|
4f8811d376 | ||
|
|
bfcf33975c | ||
|
|
f3052c3353 | ||
|
|
b4a5c070e2 | ||
|
|
c8457bb7d3 | ||
|
|
0734dc4d0b | ||
|
|
9f53884572 | ||
|
|
c9033aa93e | ||
|
|
09df769db8 | ||
|
|
a5f7d8bed2 | ||
|
|
f66330d878 | ||
|
|
273ac040de | ||
|
|
4f54c9bb28 | ||
|
|
96c7032523 | ||
|
|
7910578318 | ||
|
|
f7001d205e | ||
|
|
a28bbe6e34 | ||
|
|
56a9dc1524 | ||
|
|
eb293ceb63 | ||
|
|
45e0dcbc05 | ||
|
|
e92cffd2b2 | ||
|
|
56b8683686 | ||
|
|
879993cf22 | ||
|
|
8d14239c53 | ||
|
|
5ada5ddec3 | ||
|
|
2812153280 | ||
|
|
95f34a7c29 | ||
|
|
7693487343 | ||
|
|
a7d8d5db39 | ||
|
|
c935e85a2f | ||
|
|
417574fb3c | ||
|
|
d2c420d193 | ||
|
|
c2ccede395 | ||
|
|
5f6a826ed9 | ||
|
|
8e230af664 | ||
|
|
b34192182e | ||
|
|
ee1c260d3d | ||
|
|
62b23e8102 | ||
|
|
2632a9b1cd | ||
|
|
e8e27d421a | ||
|
|
92213031f8 | ||
|
|
d04aac3b29 | ||
|
|
66ac56434a | ||
|
|
ba45bd5606 | ||
|
|
d1316f1309 | ||
|
|
fe6a4ba9de | ||
|
|
f81fab984a | ||
|
|
1bbc575f6e | ||
|
|
f1c11fcd06 | ||
|
|
6edad9fae0 | ||
|
|
c1b2400549 | ||
|
|
f22bebbf21 | ||
|
|
513af871aa | ||
|
|
e1aa537670 | ||
|
|
86551892e3 | ||
|
|
b2eafe5c88 | ||
|
|
f14e168555 | ||
|
|
a8155c8b17 | ||
|
|
f40e088bc0 | ||
|
|
7ecd7d246f | ||
|
|
dadf2784a8 | ||
|
|
8081eb2c2c | ||
|
|
72c1d37225 | ||
|
|
5ea7f44058 | ||
|
|
7f53e01184 | ||
|
|
2eb1854eda | ||
|
|
a22814940b | ||
|
|
482298021e | ||
|
|
99f8e98017 | ||
|
|
1f6dc04a71 | ||
|
|
bad29bfdc3 | ||
|
|
4eb5b5f2f0 | ||
|
|
69a5c0e6ee | ||
|
|
ab0b8f11d4 | ||
|
|
d238a82451 | ||
|
|
80340dbd75 | ||
|
|
44ff338023 | ||
|
|
fc9893ac32 | ||
|
|
4d236cb898 | ||
|
|
e424230f96 | ||
|
|
3f35dadb41 | ||
|
|
2a249bf5a4 | ||
|
|
14d41f3548 | ||
|
|
3531f9f23e | ||
|
|
ea4014fc1e | ||
|
|
96ba5e2997 | ||
|
|
949eefb873 | ||
|
|
8a99073d40 | ||
|
|
0a5a38341f | ||
|
|
4440ea5a1c | ||
|
|
e69a0fc977 | ||
|
|
8d072f0c89 | ||
|
|
5b62c4fdc8 | ||
|
|
d9449622b9 | ||
|
|
b9b8ac3b43 | ||
|
|
65134a3786 | ||
|
|
018d488bee | ||
|
|
a70ace4742 | ||
|
|
c67ee59120 | ||
|
|
4d04a057eb | ||
|
|
204535479c | ||
|
|
7640a1fe88 | ||
|
|
c5e9b34a5e | ||
|
|
15b8b291fd | ||
|
|
e29f044e2e | ||
|
|
37a49cb720 | ||
|
|
1aedac721a | ||
|
|
3715e470aa | ||
|
|
5ca8909dbf | ||
|
|
510cd6d4bd | ||
|
|
f0aef4e73c | ||
|
|
11bf706a32 | ||
|
|
fe1ec6276d | ||
|
|
b1dff2ec2c | ||
|
|
101f4de7ed | ||
|
|
2679df71c4 | ||
|
|
18630c9618 | ||
|
|
f203c24551 | ||
|
|
7a1b507b08 | ||
|
|
f07d996eb7 | ||
|
|
36a9507c22 | ||
|
|
5b5b11b330 | ||
|
|
91720df96d | ||
|
|
de63822afb | ||
|
|
669c83917f | ||
|
|
606bac83f4 | ||
|
|
80f07a4dc6 | ||
|
|
8654ce8ad3 | ||
|
|
42c47a3a3e | ||
|
|
644e3e2a6f | ||
|
|
95dc2e0717 | ||
|
|
dd9d4df44b | ||
|
|
0ca9a9f46c | ||
|
|
0a11fb0431 | ||
|
|
043c6a6cc2 | ||
|
|
fb7454ab71 | ||
|
|
33e7fbb633 | ||
|
|
23379df0b0 | ||
|
|
c9ba859d34 | ||
|
|
77ccfb5606 | ||
|
|
b9ecf92fa3 | ||
|
|
3cd9aef9a1 | ||
|
|
c2e91139b2 | ||
|
|
66e51a1ba8 | ||
|
|
31d5e89144 | ||
|
|
52e3e0baaa | ||
|
|
e67ac46197 | ||
|
|
5e31096c7e | ||
|
|
6acf2bace1 | ||
|
|
b81a18ff65 | ||
|
|
e54d274b88 | ||
|
|
e8a0523d56 | ||
|
|
d712c01657 | ||
|
|
05485ddaa6 | ||
|
|
c087930016 | ||
|
|
a805df0e9e | ||
|
|
5b6cc1471b | ||
|
|
b3fa0c09d1 | ||
|
|
18b67f804b | ||
|
|
d28ffa6adc | ||
|
|
bcb688c079 | ||
|
|
9b992731c2 | ||
|
|
b02ac628e9 | ||
|
|
7f6933483f | ||
|
|
73fcfce454 | ||
|
|
a8d2b12ef9 | ||
|
|
76032e1e28 | ||
|
|
eff505cdb9 | ||
|
|
3d5ffbba4c | ||
|
|
7a18bed394 | ||
|
|
e4749970ef | ||
|
|
b6b3467251 | ||
|
|
1c791480d5 | ||
|
|
dc7c33bfa0 | ||
|
|
244e7fb4f8 | ||
|
|
3a0eeeac07 | ||
|
|
88875ab99b | ||
|
|
e311705327 | ||
|
|
086e46dc46 | ||
|
|
04c8aab837 | ||
|
|
5d31d6d6fb | ||
|
|
89068c4dff | ||
|
|
d29f035139 | ||
|
|
ce1ac164dc | ||
|
|
6da8cdf831 | ||
|
|
7def78aa90 | ||
|
|
fd6eb37369 | ||
|
|
ccd3a5da98 | ||
|
|
ceee7ad85f | ||
|
|
b576e4b178 | ||
|
|
546e02a9fe | ||
|
|
16003b93ba | ||
|
|
6cf7918cb8 | ||
|
|
e9351c5302 | ||
|
|
521a256378 | ||
|
|
c1c1aef1f5 | ||
|
|
da804448a8 | ||
|
|
e47c65fbdf | ||
|
|
02f3ed037c | ||
|
|
238fd317e4 | ||
|
|
87d7f699e8 | ||
|
|
7eb22f8720 | ||
|
|
1a2ba79745 | ||
|
|
e6b4917b64 | ||
|
|
c29f50214e | ||
|
|
b2f07d2a02 | ||
|
|
d8140da431 | ||
|
|
47dce05cfa | ||
|
|
ab4acbe5eb | ||
|
|
587fd70876 | ||
|
|
d820b68a7d | ||
|
|
bce6e35675 | ||
|
|
b6b9f71677 | ||
|
|
63daee5e56 | ||
|
|
c6f7c17854 | ||
|
|
61ac42d270 | ||
|
|
989cd173fb | ||
|
|
8cafbceed7 | ||
|
|
292a70ab6e | ||
|
|
a575e58ac7 | ||
|
|
b6e7a2f570 | ||
|
|
69418714dd | ||
|
|
de89faed70 | ||
|
|
2b8c983e8a | ||
|
|
733774e7a3 | ||
|
|
a63add7bff | ||
|
|
f6c10901d9 | ||
|
|
c313f51750 | ||
|
|
1d4acb8076 | ||
|
|
bdf3ab1a56 | ||
|
|
b51f786f53 | ||
|
|
6d5c8ca435 | ||
|
|
9d6c0b4c56 | ||
|
|
49181f3df6 | ||
|
|
92e5c4adc7 | ||
|
|
409e1f2a8d | ||
|
|
15c056556d | ||
|
|
76f2ddf18e | ||
|
|
6a69f807f1 | ||
|
|
b9d82c5da5 | ||
|
|
72270a3f64 | ||
|
|
89ca4b8313 | ||
|
|
52031271b4 | ||
|
|
88ccb54fe3 | ||
|
|
bba4eb14cc | ||
|
|
de3715cbf3 | ||
|
|
acf8ab44d7 | ||
|
|
c7925b2b6c | ||
|
|
72c2673768 | ||
|
|
a0e6277a3b | ||
|
|
df5ee936ce | ||
|
|
19d6bb119c | ||
|
|
05b8538154 | ||
|
|
48c783dd25 | ||
|
|
3f15f9524b | ||
|
|
f53db65b88 | ||
|
|
539538d551 | ||
|
|
dbbaea9235 | ||
|
|
13a23165c2 | ||
|
|
69fe6b2950 | ||
|
|
aff48957cd | ||
|
|
b3f3ecfe2e | ||
|
|
2fc407ce61 | ||
|
|
9834066b4b | ||
|
|
6aa1a877e5 | ||
|
|
ae7de51dbf | ||
|
|
4ec705dd74 | ||
|
|
b51bff6772 | ||
|
|
1998750489 | ||
|
|
220eb8016a | ||
|
|
a27a6f1609 | ||
|
|
d91991482a | ||
|
|
d7d22c1a3e | ||
|
|
e8825d74e7 | ||
|
|
0937feb979 | ||
|
|
8373bae017 | ||
|
|
38accb20fb | ||
|
|
c961a5d922 | ||
|
|
63d12aa759 | ||
|
|
2b94b20e2e | ||
|
|
ec9f55d17a | ||
|
|
3e8c507556 | ||
|
|
dc6445bb6e | ||
|
|
510bd94c5c | ||
|
|
5ee263e9de | ||
|
|
e8133a8522 | ||
|
|
411ec67624 | ||
|
|
26bc19c207 | ||
|
|
e241b75065 | ||
|
|
b97a0f6126 | ||
|
|
3d2df578a6 | ||
|
|
ea9ba2c4cc | ||
|
|
56d81eef56 | ||
|
|
9fee31d784 | ||
|
|
079e5e34c4 | ||
|
|
3ebf64f38b | ||
|
|
736a4b2051 | ||
|
|
5747b4535b | ||
|
|
3c128450b5 | ||
|
|
76eeeb1be9 | ||
|
|
8cd24b9a3b | ||
|
|
f40c6477de | ||
|
|
bc32f7743e | ||
|
|
70f9ffefc3 | ||
|
|
6cf27b1ba5 | ||
|
|
35f2dd4073 | ||
|
|
61cdd8c487 | ||
|
|
43fe8323ff | ||
|
|
932bb9eadc | ||
|
|
f39548d97b | ||
|
|
c5a75cf770 | ||
|
|
c9ed833e59 | ||
|
|
f08a6ca75c | ||
|
|
7c929f912e | ||
|
|
e3f02860e8 | ||
|
|
07b03d1ef1 | ||
|
|
af42494561 | ||
|
|
e8b28010b4 | ||
|
|
3e5563cbb4 | ||
|
|
68bb02b171 | ||
|
|
e38869f07d | ||
|
|
19f9dee682 | ||
|
|
475842d115 | ||
|
|
594fbd7f69 | ||
|
|
0845c25190 | ||
|
|
bb600eed3f | ||
|
|
e1213b2d5a | ||
|
|
12565b1389 | ||
|
|
213b43d213 | ||
|
|
db9c1f9529 | ||
|
|
43f9f489dd | ||
|
|
0501c65153 | ||
|
|
7c4a3fa349 | ||
|
|
c7b2ef5511 | ||
|
|
8c29a4fea1 | ||
|
|
be9e39465e | ||
|
|
00ccec53f3 | ||
|
|
89837f9497 | ||
|
|
0bc3e5b9a5 | ||
|
|
33823e3546 | ||
|
|
a053b51b57 | ||
|
|
a548d3094d | ||
|
|
6e7fcff757 | ||
|
|
9d95dec6af | ||
|
|
6061dc8227 | ||
|
|
72667593f1 | ||
|
|
b2aee3cb7b | ||
|
|
9c5cf0087a | ||
|
|
cbded297d6 | ||
|
|
33432d7779 | ||
|
|
71b065250f | ||
|
|
99c6ccd85c | ||
|
|
c45419a985 | ||
|
|
ef90465d9b | ||
|
|
037dfe573a | ||
|
|
bd5c2eb171 | ||
|
|
a3eb353a5d | ||
|
|
4238b71fc3 | ||
|
|
992a02c945 | ||
|
|
67abd1ec9e | ||
|
|
2d585bd280 | ||
|
|
f00a88a1bc | ||
|
|
450c68c244 | ||
|
|
f5a089e959 | ||
|
|
7838b21ee7 | ||
|
|
750703f7f8 | ||
|
|
d977fc7331 | ||
|
|
3e76b36c49 | ||
|
|
bb4a1e9e58 | ||
|
|
18647ceb31 | ||
|
|
226e977e85 | ||
|
|
19232b92e5 | ||
|
|
54e6654078 | ||
|
|
39b089805c | ||
|
|
170e8c4a3b | ||
|
|
b91c393aaf | ||
|
|
db2ad29b52 |
No files matched your search
@@ -0,0 +1,19 @@
|
|||||||
|
# This is the universal Text Editor Configuration
|
||||||
|
# for all GTNewHorizons projects
|
||||||
|
# See: https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{bat,ini}]
|
||||||
|
end_of_line = crlf
|
||||||
|
|
||||||
|
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||||
|
indent_size = 2
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Ignore spotlessApply reformat
|
||||||
|
69a5c0e6ee71fe714eabe24002f9e39aae3b97be
|
||||||
+44
-2
@@ -1,2 +1,44 @@
|
|||||||
# Auto detect text files and perform LF normalization
|
* text eol=lf
|
||||||
* text=auto
|
|
||||||
|
*.[jJ][aA][rR] binary
|
||||||
|
|
||||||
|
*.[pP][nN][gG] binary
|
||||||
|
*.[jJ][pP][gG] binary
|
||||||
|
*.[jJ][pP][eE][gG] binary
|
||||||
|
*.[gG][iI][fF] binary
|
||||||
|
*.[tT][iI][fF] binary
|
||||||
|
*.[tT][iI][fF][fF] binary
|
||||||
|
*.[iI][cC][oO] binary
|
||||||
|
*.[sS][vV][gG] text
|
||||||
|
*.[eE][pP][sS] binary
|
||||||
|
*.[xX][cC][fF] binary
|
||||||
|
|
||||||
|
*.[kK][aA][rR] binary
|
||||||
|
*.[mM]4[aA] binary
|
||||||
|
*.[mM][iI][dD] binary
|
||||||
|
*.[mM][iI][dD][iI] binary
|
||||||
|
*.[mM][pP]3 binary
|
||||||
|
*.[oO][gG][gG] binary
|
||||||
|
*.[rR][aA] binary
|
||||||
|
|
||||||
|
*.7[zZ] binary
|
||||||
|
*.[gG][zZ] binary
|
||||||
|
*.[tT][aA][rR] binary
|
||||||
|
*.[tT][gG][zZ] binary
|
||||||
|
*.[zZ][iI][pP] binary
|
||||||
|
|
||||||
|
*.[tT][cC][nN] binary
|
||||||
|
*.[sS][oO] binary
|
||||||
|
*.[dD][lL][lL] binary
|
||||||
|
*.[dD][yY][lL][iI][bB] binary
|
||||||
|
*.[pP][sS][dD] binary
|
||||||
|
*.[tT][tT][fF] binary
|
||||||
|
*.[oO][tT][fF] binary
|
||||||
|
|
||||||
|
*.[pP][aA][tT][cC][hH] -text
|
||||||
|
|
||||||
|
*.[bB][aA][tT] text eol=crlf
|
||||||
|
*.[cC][mM][dD] text eol=crlf
|
||||||
|
*.[pP][sS]1 text eol=crlf
|
||||||
|
|
||||||
|
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
name: Build and test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, main ]
|
||||||
|
push:
|
||||||
|
branches: [ master, main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-test:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||||
|
secrets: inherit
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
name: Release tagged build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ '*' ]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release-tags:
|
||||||
|
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||||
|
secrets: inherit
|
||||||
+33
-19
@@ -1,24 +1,38 @@
|
|||||||
# eclipse
|
.gradle
|
||||||
bin
|
|
||||||
*.launch
|
|
||||||
.settings
|
.settings
|
||||||
.metadata
|
/.idea/
|
||||||
|
/.vscode/
|
||||||
|
/run/
|
||||||
|
/build/
|
||||||
|
/eclipse/
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
|
/bin/
|
||||||
# idea
|
/config/
|
||||||
out
|
/crash-reports/
|
||||||
|
/logs/
|
||||||
|
options.txt
|
||||||
|
/saves/
|
||||||
|
usernamecache.json
|
||||||
|
banned-ips.json
|
||||||
|
banned-players.json
|
||||||
|
eula.txt
|
||||||
|
ops.json
|
||||||
|
server.properties
|
||||||
|
servers.dat
|
||||||
|
usercache.json
|
||||||
|
whitelist.json
|
||||||
|
/out/
|
||||||
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
src/main/resources/mixins.*([!.]).json
|
||||||
/.idea
|
*.bat
|
||||||
|
*.DS_Store
|
||||||
# gradle
|
!gradlew.bat
|
||||||
build
|
.factorypath
|
||||||
.gradle
|
addon.local.gradle
|
||||||
|
addon.local.gradle.kts
|
||||||
# other
|
addon.late.local.gradle
|
||||||
/run
|
addon.late.local.gradle.kts
|
||||||
classes
|
layout.json
|
||||||
logs/debug.log
|
|
||||||
logs/latest.log
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
Port with permission from phantamanta44.
|
||||||
|
|
||||||
|
# AE2 Fluid Crafting Rework
|
||||||
|
|
||||||
|
[](https://www.curseforge.com/minecraft/mc-mods/ae2-fluid-crafting-rework) 
|
||||||
|
|
||||||
|
Put fluids in the pattern!
|
||||||
|
|
||||||
|
AE2 autocrafting is amazing and everyone loves it, but it is always becoming painful when dealing with fluids. You have to put fluids in a container or use a dummy item to write patterns with fluids.
|
||||||
|
|
||||||
|
That's because AE2 doesn't support fluid as valid crafting ingredients before 1.16, so it can't handle fluids directly.
|
||||||
|
|
||||||
|
However, it is changed now! With **AE2 Fluid Crafting** you can write patterns with fluids freely. Your AE system can output and accept fluids like items without worrying about how to handle these fluid cells.
|
||||||
|
|
||||||
|
This is a rework and ported version of [ae2-fluid-crafting](https://github.com/phantamanta44/ae2-fluid-crafting)
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- You can code fluid patterns on fluid terminal directly.
|
||||||
|
- Mult/Div/Add/Sub Button also works on fluid.
|
||||||
|
- An extended fluid terminal with 16 inputs and 4 outputs.
|
||||||
|
- You can add or decrease fluid's amount by clicking with container.
|
||||||
|
- Fluid Pattern can display its contents when put on pattern terminal.
|
||||||
|
- [1.12.2] Fix the fluid amount display error when removing fluid.
|
||||||
|
- [1.12.2] Upgrade cards can be inserted in Dual Interface.
|
||||||
|
- [1.12.2] Fluid pattern is searchable in interface terminal.
|
||||||
|
- [1.12.2] Fix crash when using block mode, fluid will also be considered as blockable.
|
||||||
|
- [1.12.2] Fluid export bus supports crafting card.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### 1.7.10
|
||||||
|
Any version of AE2(Both Official AE2 and GTNH edition AE2 works).
|
||||||
|
|
||||||
|
**Extra Cells isn't needed**
|
||||||
|
|
||||||
|
### 1.12.2
|
||||||
|
Unofficial AE2([PAE2](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life)).
|
||||||
|
|
||||||
|
Official AE2 isn't supported, you can use origin [AE2FC](https://github.com/phantamanta44/ae2-fluid-crafting) if you are playing with Official AE2.
|
||||||
|
|
||||||
|
## How to Use It
|
||||||
|
https://github.com/GlodBlock/AE2FluidCraft-Rework/wiki
|
||||||
|
|
||||||
|
## Credited Works
|
||||||
|
|
||||||
|
E. Geng(@phantamanta44) and KilaBash (@Yefancy) - Their amazing origin work in 1.12.
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
|
|
||||||
Port with permission from phantamanta44.
|
|
||||||
|
|
||||||
# AE2 Fluid Crafting Rework
|
|
||||||
|
|
||||||
[](https://www.curseforge.com/minecraft/mc-mods/ae2-fluid-crafting-rework) 
|
|
||||||
|
|
||||||
Put fluids in the pattern!
|
|
||||||
|
|
||||||
AE2 autocrafting is amazing and everyone loves it, but it is always becoming painful when dealing with fluids. You have to put fluids in a container or use a dummy item to write patterns with fluids.
|
|
||||||
|
|
||||||
That's because AE2 doesn't support fluid as valid crafting ingredients before 1.16, so it can't handle fluids directly.
|
|
||||||
|
|
||||||
However, it is changed now! With **AE2 Fluid Crafting** you can write patterns with fluids freely. Your AE system can output and accept fluids like items without worrying about how to handle these fluid cells.
|
|
||||||
|
|
||||||
This is a rework and ported version of [ae2-fluid-crafting](https://github.com/phantamanta44/ae2-fluid-crafting)
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- You can code fluid patterns on fluid terminal directly.
|
|
||||||
- Mult/Div/Add/Sub Button also works on fluid.
|
|
||||||
- An extended fluid terminal with 16 inputs and 4 outputs.
|
|
||||||
- You can add or decrease fluid's amount by clicking with container.
|
|
||||||
- Fluid Pattern can display its contents when put on pattern terminal.
|
|
||||||
- [1.12.2] Fix the fluid amount display error when removing fluid.
|
|
||||||
- [1.12.2] Upgrade cards can be inserted in Dual Interface.
|
|
||||||
- [1.12.2] Fluid pattern is searchable in interface terminal.
|
|
||||||
- [1.12.2] Fix crash when using block mode, fluid will also be considered as blockable.
|
|
||||||
- [1.12.2] Fluid export bus supports crafting card.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### 1.7.10
|
|
||||||
Any version of AE2(Both Official AE2 and GTNH edition AE2 works).
|
|
||||||
|
|
||||||
**Extra Cells isn't needed**
|
|
||||||
|
|
||||||
### 1.12.2
|
|
||||||
Unofficial AE2([PAE2](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life)).
|
|
||||||
|
|
||||||
You can directly upgrade origin AE2FC2 in your old save.
|
|
||||||
|
|
||||||
Official AE2 isn't supported, you can use origin [AE2FC](https://github.com/phantamanta44/ae2-fluid-crafting) if you are playing with Official AE2.
|
|
||||||
|
|
||||||
## Basic Devices
|
|
||||||
|
|
||||||
### Fluid Discretizer
|
|
||||||
The **Fluid Discretizer** is a device that, when attached to ME network, exposes the contents of its fluid storage grid as items, which take the form of "fluid drops".
|
|
||||||
It does this by functioning as a sort of storage bus: when fluid drops are removed from its storage via the item grid, it extracts the corresponding fluid from the fluid grid.
|
|
||||||
Conversely, when fluid drops inserted into its storage via the item grid, it injects the corresponding fluid into the fluid grid.
|
|
||||||
Each fluid drop is equivalent to one mB of its respective fluid, which means a full stack of them is equivalent to 64 mB.
|
|
||||||
Fluid drops have an important property: when an ME interface attempts to export fluid drops to a machine, it will attempt to convert them to fluid.
|
|
||||||
This means an interface exporting drops of gelid cryotheum into a fluid transposer will successfully fill the transposer's internal tank rather than inserting the drops as items.
|
|
||||||
This is the central mechanic that makes fluid autocrafting possible.
|
|
||||||
Note that the only way to convert between fluids and fluid drops is a discretizer attached to an ME network.
|
|
||||||
While you could theoretically use this as a very convoluted method of transporting fluids, it is not recomomended to do so.
|
|
||||||
|
|
||||||
### Fluid Pattern Encoder
|
|
||||||
Most crafting recipes involving fluids require far more than 64 mB of a particular fluid, and so the standard pattern terminal will not do for encoding such recipes into patterns.
|
|
||||||
This problem is solved by the **Fluid Pattern Encoder**, a utility that functions similarly to a pattern terminal.
|
|
||||||
When a fluid-handling item (e.g. a bucket or tank) is inserted into the crafting ingredient slots, they will be converted into an equivalent stack of the corresponding fluid drops.
|
|
||||||
Using this, patterns for recipes that require more than a stack of fluid drops can easily be encoded.
|
|
||||||
AE2 Fluid Crafting also comes with a handy JEI integration module that allows the fluid pattern encoder to encode any JEI recipe involving fluids.
|
|
||||||
This is the recommended way to play with the mod, since encoding patterns by hand is a little cumbersome.
|
|
||||||
|
|
||||||
### Fluid Pattern Terminal
|
|
||||||
|
|
||||||
Encoding recipes in a big and bulky workbench separate from the rest of your AE2 equipment can be a little inconvenient.
|
|
||||||
Luckily, we have the **Fluid Pattern Terminal**, which combines the functionality of the standard pattern terminal and the fluid pattern encoder.
|
|
||||||
Now, you can encode your fluid recipes using the same familiar interface you know and love!
|
|
||||||
|
|
||||||
### Fluid Pattern Interface
|
|
||||||
|
|
||||||
The standard ME interface lets you emit items and fluid packets with AE2FC, but it will only accept items, as in vanilla AE2.
|
|
||||||
This is a little inconvenient when you want to build compact setups for autocrafting with fluid outputs, where you would need to use both an item interface for inputs, and a separate fluid interface for outputs.
|
|
||||||
To make things easier, we have the **Fluid Pattern Interface**, which functions as a combination of an item interface and a fluid interface!
|
|
||||||
Its GUI is the same as normal ME interface, but it can emit fluids directly instead of fluid packets! It also accepts fluid and item inputs.
|
|
||||||
Automating fluid crafting machines has never been this quick and painless!
|
|
||||||
|
|
||||||
### Fluid Packets
|
|
||||||
|
|
||||||
When putting fluid pattern in a normal ME interface, it will emit fluid packets as fluid.
|
|
||||||
So if you prefer to deal with item instead of fluids, you can transport these packets and turn them back to fluid with **ME Fluid Packet Decoder**.
|
|
||||||
Simply connect the decoder to your ME network and insert the fluid packet; the decoder will, if possible, inject the fluid into your fluid storage grid.
|
|
||||||
|
|
||||||
## Credited Works
|
|
||||||
|
|
||||||
E. Geng(@phantamanta44) and KilaBash (@Yefancy) - Their amazing origin work in 1.12.
|
|
||||||
+4
-85
@@ -1,86 +1,5 @@
|
|||||||
buildscript {
|
//version: 1707058017
|
||||||
repositories {
|
|
||||||
maven {
|
plugins {
|
||||||
url 'https://maven.minecraftforge.net/'
|
id 'com.gtnewhorizons.gtnhconvention'
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'sonatype'
|
|
||||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'Scala CI dependencies'
|
|
||||||
url 'https://repo1.maven.org/maven2/'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name 'jitpack'
|
|
||||||
url 'https://jitpack.io'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name "forge"
|
|
||||||
url "http://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
version = "2.3.0-r"
|
|
||||||
group = "ae2fc"
|
|
||||||
archivesBaseName = "Fluid Craft for AE2"
|
|
||||||
|
|
||||||
sourceCompatibility = targetCompatibility = '1.8'
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = targetCompatibility = '1.8'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url 'https://dvs1.progwml6.com/files/maven/' }
|
|
||||||
maven { url 'https://jitpack.io/' }
|
|
||||||
maven { url 'https://cursemaven.com/' }
|
|
||||||
maven { url "https://minecraft.curseforge.com/api/maven/" }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile 'com.github.phantamanta44:jsr305:1.0.1'
|
|
||||||
deobfCompile 'mezz.jei:jei_1.12.2:4.15.0.293' //jei
|
|
||||||
deobfCompile "curse.maven:ae2-extended-life-570458:3785381" // pae2
|
|
||||||
deobfCompile "curse.maven:packagedauto-308380:2977147" // 1.0.3.14
|
|
||||||
deobfCompile "curse.maven:modular-machinery-270790:2761302" // 1.11.1
|
|
||||||
deobfCompile "curse.maven:codechicken-lib-1-8-242818:2779848" //ccl
|
|
||||||
deobfCompile "curse.maven:gregtech-ce-unofficial-557242:3784798" // gt
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
version = "1.12.2-14.23.5.2847"
|
|
||||||
runDir = "run"
|
|
||||||
mappings = "stable_39"
|
|
||||||
useDepAts = true
|
|
||||||
makeObfSourceJar = false
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
manifest {
|
|
||||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
|
||||||
attributes 'FMLCorePlugin' : 'com.glodblock.github.coremod.FCCoreMod'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
inputs.property "version", project.version
|
|
||||||
inputs.property "mcversion", project.minecraft.version
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
include 'mcmod.info'
|
|
||||||
|
|
||||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Add your dependencies here. Supported configurations:
|
||||||
|
* - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod
|
||||||
|
* Available at runtime and compiletime for mods depending on this mod
|
||||||
|
* - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API
|
||||||
|
* Available at runtime but not compiletime for mods depending on this mod
|
||||||
|
* - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods
|
||||||
|
* Not available at all for mods depending on this mod, only visible at compiletime for this mod
|
||||||
|
* - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod
|
||||||
|
* Available at compiletime but not runtime for mods depending on this mod
|
||||||
|
* - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency
|
||||||
|
* Not available at all for mods depending on this mod, only visible at runtime for this mod
|
||||||
|
* - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime,
|
||||||
|
* but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing
|
||||||
|
* - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime
|
||||||
|
* Available at runtime for mods depending on this mod
|
||||||
|
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
|
||||||
|
* - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main
|
||||||
|
*
|
||||||
|
* - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name
|
||||||
|
* Requires you to enable usesShadowedDependencies in gradle.properties
|
||||||
|
*
|
||||||
|
* - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient)
|
||||||
|
*
|
||||||
|
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed,
|
||||||
|
* but use this sparingly as it can break using your mod as another mod's dependency if you're not careful.
|
||||||
|
*
|
||||||
|
* To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven,
|
||||||
|
* or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file.
|
||||||
|
*
|
||||||
|
* Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not.
|
||||||
|
* The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published.
|
||||||
|
*
|
||||||
|
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||||
|
*/
|
||||||
|
dependencies {
|
||||||
|
api('com.github.GTNewHorizons:NotEnoughItems:2.5.25-GTNH:dev')
|
||||||
|
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-344-GTNH:dev')
|
||||||
|
api('curse.maven:cofh-core-69162:2388751')
|
||||||
|
api('com.github.GTNewHorizons:waila:1.7.1:dev')
|
||||||
|
|
||||||
|
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.1:dev")
|
||||||
|
|
||||||
|
compileOnly("com.github.GTNewHorizons:GTNHLib:0.2.10:dev") { transitive = false }
|
||||||
|
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev')
|
||||||
|
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
|
||||||
|
compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.7:dev')
|
||||||
|
compileOnly('com.github.GTNewHorizons:EnderIO:2.7.1:dev')
|
||||||
|
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.121:dev') {
|
||||||
|
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||||
|
}
|
||||||
|
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||||
|
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||||
|
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.7-GTNH:dev') { transitive = false }
|
||||||
|
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.4-GTNH:dev') { transitive = false }
|
||||||
|
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.40:dev") { transitive = false }
|
||||||
|
|
||||||
|
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.2.2:dev")
|
||||||
|
}
|
||||||
+192
-4
@@ -1,4 +1,192 @@
|
|||||||
systemProp.http.proxyHost=127.0.0.1
|
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||||
systemProp.http.proxyPort=7890
|
# LOCAL to test local config updates.
|
||||||
systemProp.https.proxyHost=127.0.0.1
|
gtnh.settings.blowdryerTag = 0.2.0
|
||||||
systemProp.https.proxyPort=7890
|
|
||||||
|
# Human-readable mod name, available for mcmod.info population.
|
||||||
|
modName = Fluid Craft For AE2
|
||||||
|
|
||||||
|
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||||
|
# Conventionally lowercase.
|
||||||
|
modId = ae2fc
|
||||||
|
|
||||||
|
# Root package of the mod, used to find various classes in other properties,
|
||||||
|
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||||
|
modGroup = com.glodblock.github
|
||||||
|
|
||||||
|
# Whether to use modGroup as the maven publishing group.
|
||||||
|
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||||
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
|
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||||
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
|
# Version of Minecraft to target
|
||||||
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
|
# Version of Minecraft Forge to target
|
||||||
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
|
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||||
|
channel = stable
|
||||||
|
|
||||||
|
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
|
mappingsVersion = 12
|
||||||
|
|
||||||
|
# Defines other MCP mappings for dependency deobfuscation.
|
||||||
|
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
|
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||||
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
|
enableModernJavaSyntax = true
|
||||||
|
|
||||||
|
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||||
|
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||||
|
enableGenericInjection = false
|
||||||
|
|
||||||
|
# Generate a class with a String field for the mod version named as defined below.
|
||||||
|
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||||
|
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||||
|
generateGradleTokenClass =
|
||||||
|
|
||||||
|
# Name of the token containing the project's current version to generate/replace.
|
||||||
|
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod ID replacement token.
|
||||||
|
gradleTokenModId = GRADLETOKEN_MODID
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod name replacement token.
|
||||||
|
gradleTokenModName = GRADLETOKEN_MODNAME
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
|
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
||||||
|
|
||||||
|
# [DEPRECATED]
|
||||||
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
|
# version in @Mod([...], version = VERSION, [...]).
|
||||||
|
# Leave these properties empty to skip individual token replacements.
|
||||||
|
replaceGradleTokenInFile = FluidCraft.java
|
||||||
|
|
||||||
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
|
# leave this property empty.
|
||||||
|
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||||
|
apiPackage = api
|
||||||
|
|
||||||
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
|
# There can be multiple files in a space-separated list.
|
||||||
|
# Example value: mymodid_at.cfg nei_at.cfg
|
||||||
|
accessTransformersFile = ae2fc_at.cfg
|
||||||
|
|
||||||
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
|
usesMixins = false
|
||||||
|
|
||||||
|
# Adds some debug arguments like verbose output and class export.
|
||||||
|
usesMixinDebug = false
|
||||||
|
|
||||||
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
|
mixinPlugin =
|
||||||
|
|
||||||
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
|
mixinsPackage =
|
||||||
|
|
||||||
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
|
# This parameter is for legacy compatibility only
|
||||||
|
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||||
|
coreModClass = coremod.FluidCraftCore
|
||||||
|
|
||||||
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
|
containsMixinsAndOrCoreModOnly = false
|
||||||
|
|
||||||
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
|
forceEnableMixins = false
|
||||||
|
|
||||||
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||||
|
# responsibility to check the license and request permission for distribution if required.
|
||||||
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
|
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||||
|
# their own classes, making the minimization unreliable.
|
||||||
|
minimizeShadowedDependencies = true
|
||||||
|
|
||||||
|
# If disabled, won't rename the shadowed classes.
|
||||||
|
relocateShadowedDependencies = true
|
||||||
|
|
||||||
|
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
|
||||||
|
includeWellKnownRepositories = true
|
||||||
|
|
||||||
|
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||||
|
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||||
|
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||||
|
usesMavenPublishing = true
|
||||||
|
|
||||||
|
# Maven repository to publish the mod to.
|
||||||
|
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||||
|
|
||||||
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
|
#
|
||||||
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
|
# Leave this empty if you don't want to publish to Modrinth.
|
||||||
|
modrinthProjectId =
|
||||||
|
|
||||||
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
|
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||||
|
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||||
|
# type can be one of [project, version],
|
||||||
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
|
modrinthRelations =
|
||||||
|
|
||||||
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
#
|
||||||
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
|
curseForgeProjectId =
|
||||||
|
|
||||||
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
|
# Syntax: type1:name1;type2:name2;...
|
||||||
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
|
curseForgeRelations =
|
||||||
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||||
|
# projects. New projects should not use this parameter.
|
||||||
|
# customArchiveBaseName =
|
||||||
|
|
||||||
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
|
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||||
|
# The check is ONLY performed if the version is a git tag.
|
||||||
|
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||||
|
# versionPattern =
|
||||||
|
|
||||||
|
# Uncomment to prevent the source code from being published.
|
||||||
|
# noPublishedSources = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Spotless checks.
|
||||||
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
|
# disableSpotless = true
|
||||||
|
|
||||||
|
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||||
|
# disableCheckstyle = true
|
||||||
|
|
||||||
|
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||||
|
# (force use delegated build).
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||||
|
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||||
|
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||||
|
# ideaOverrideBuildType = idea
|
||||||
|
|
||||||
|
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||||
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
Vendored
BIN
Binary file not shown.
+4
-3
@@ -1,6 +1,7 @@
|
|||||||
#Sun May 24 18:34:45 CEST 2020
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,78 +1,127 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS=""
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD=maximum
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -81,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD="java"
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+42
-34
@@ -1,4 +1,20 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@@ -9,25 +25,29 @@
|
|||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -35,48 +55,36 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// RetroFuturaGradle
|
||||||
|
name "GTNH Maven"
|
||||||
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
|
mavenContent {
|
||||||
|
includeGroup("com.gtnewhorizons")
|
||||||
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gradlePluginPortal()
|
||||||
|
mavenCentral()
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package yalter.mousetweaks.api;
|
|
||||||
|
|
||||||
import net.minecraft.inventory.Container;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
|
|
||||||
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
|
|
||||||
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
|
|
||||||
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
|
|
||||||
* or the MouseTweaksDisableWheelTweak annotations.
|
|
||||||
*/
|
|
||||||
public interface IMTModGuiContainer2 {
|
|
||||||
/**
|
|
||||||
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
|
||||||
*
|
|
||||||
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
|
||||||
*/
|
|
||||||
boolean MT_isMouseTweaksDisabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
|
||||||
*
|
|
||||||
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
|
||||||
*/
|
|
||||||
boolean MT_isWheelTweakDisabled();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the Container.
|
|
||||||
*
|
|
||||||
* @return Container that is currently in use.
|
|
||||||
*/
|
|
||||||
Container MT_getContainer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
|
||||||
*
|
|
||||||
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
|
||||||
*/
|
|
||||||
Slot MT_getSlotUnderMouse();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
|
||||||
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
|
|
||||||
*
|
|
||||||
* @param slot the slot to check
|
|
||||||
* @return True if slot is a crafting output slot.
|
|
||||||
*/
|
|
||||||
boolean MT_isCraftingOutput(Slot slot);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
|
|
||||||
* slots and the Destroy Item slot in the vanilla creative inventory.
|
|
||||||
*
|
|
||||||
* @param slot the slot to check
|
|
||||||
* @return Tru if slot should be ignored by Mouse Tweaks.
|
|
||||||
*/
|
|
||||||
boolean MT_isIgnored(Slot slot);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
|
||||||
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
|
|
||||||
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
|
||||||
* render tick).<br><br>
|
|
||||||
*
|
|
||||||
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
|
||||||
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
|
|
||||||
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
|
||||||
*
|
|
||||||
* For vanilla containers this method looks like this:
|
|
||||||
* <pre>
|
|
||||||
* this.ignoreMouseUp = true;
|
|
||||||
*
|
|
||||||
* if (this.dragSplitting) {
|
|
||||||
* if (this.dragSplittingButton == 1) {
|
|
||||||
* this.dragSplitting = false;
|
|
||||||
* return true;
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* return false;
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
|
||||||
*/
|
|
||||||
boolean MT_disableRMBDraggingFunctionality();
|
|
||||||
}
|
|
||||||
@@ -1,59 +1,116 @@
|
|||||||
package com.glodblock.github;
|
package com.glodblock.github;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import appeng.api.config.Upgrades;
|
|
||||||
import com.glodblock.github.loader.FCBlocks;
|
import com.glodblock.github.common.Config;
|
||||||
import com.glodblock.github.loader.FCItems;
|
import com.glodblock.github.common.storage.FluidCellHandler;
|
||||||
|
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||||
|
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
|
||||||
|
import com.glodblock.github.crossmod.waila.WailaInit;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.loader.CalculatorV2PluginLoader;
|
||||||
|
import com.glodblock.github.loader.ChannelLoader;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.loader.RecipeLoader;
|
||||||
|
import com.glodblock.github.loader.filter.FluidFilter;
|
||||||
|
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||||
import com.glodblock.github.proxy.CommonProxy;
|
import com.glodblock.github.proxy.CommonProxy;
|
||||||
import com.glodblock.github.util.ModAndClassUtil;
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import appeng.api.AEApi;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, useMetadata = true)
|
@Mod(
|
||||||
|
modid = FluidCraft.MODID,
|
||||||
|
version = FluidCraft.VERSION,
|
||||||
|
name = FluidCraft.MODNAME,
|
||||||
|
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;required-after:Baubles;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||||
public class FluidCraft {
|
public class FluidCraft {
|
||||||
|
|
||||||
public static final String MODID = "ae2fc";
|
public static final String MODID = "GRADLETOKEN_MODID";
|
||||||
public static final String VERSION = "2.3.0-r";
|
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
public static final String MODNAME = "GRADLETOKEN_MODNAME";
|
||||||
|
|
||||||
@Mod.Instance(MODID)
|
@Mod.Instance(MODID)
|
||||||
public static FluidCraft INSTANCE;
|
public static FluidCraft INSTANCE;
|
||||||
|
|
||||||
@SidedProxy(clientSide = "com.glodblock.github.proxy.ClientProxy", serverSide = "com.glodblock.github.proxy.CommonProxy")
|
@SidedProxy(
|
||||||
|
clientSide = "com.glodblock.github.proxy.ClientProxy",
|
||||||
|
serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
public static Logger log;
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onPreInit(FMLPreInitializationEvent event) {
|
public static void preInit(FMLPreInitializationEvent event) {
|
||||||
log = event.getModLog();
|
Config.run();
|
||||||
ModAndClassUtil.init();
|
ChannelLoader.INSTANCE.run();
|
||||||
proxy.preInit(event);
|
proxy.preInit(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onInit(FMLInitializationEvent event) {
|
public static void init(FMLInitializationEvent event) {
|
||||||
|
if (ModAndClassUtil.OC) {
|
||||||
|
OCDriverInit.run();
|
||||||
|
}
|
||||||
|
if (ModAndClassUtil.WAILA) {
|
||||||
|
WailaInit.run();
|
||||||
|
}
|
||||||
proxy.init(event);
|
proxy.init(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onPostInit(FMLPostInitializationEvent event) {
|
public static void postInit(FMLPostInitializationEvent event) {
|
||||||
Upgrades.PATTERN_EXPANSION.registerItem(new ItemStack(FCBlocks.DUAL_INTERFACE), 3 );
|
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
|
||||||
Upgrades.CRAFTING.registerItem(new ItemStack(FCBlocks.DUAL_INTERFACE), 1 );
|
|
||||||
Upgrades.PATTERN_EXPANSION.registerItem(new ItemStack(FCItems.PART_DUAL_INTERFACE), 3 );
|
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
|
||||||
Upgrades.CRAFTING.registerItem(new ItemStack(FCItems.PART_DUAL_INTERFACE), 1 );
|
ItemAndBlockHolder.loadSetting();
|
||||||
Upgrades.CRAFTING.registerItem( AEApi.instance().definitions().parts().fluidExportBus(), 1 );
|
|
||||||
|
if (!Config.removeRecipe) {
|
||||||
|
RecipeLoader.INSTANCE.run();
|
||||||
|
}
|
||||||
|
RecipeLoader.runTerminalRecipe();
|
||||||
|
|
||||||
|
if (ModAndClassUtil.isV2) {
|
||||||
|
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||||
|
}
|
||||||
|
if (ModAndClassUtil.isTypeFilter) {
|
||||||
|
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
|
||||||
|
}
|
||||||
|
|
||||||
proxy.postInit(event);
|
proxy.postInit(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
||||||
|
proxy.onLoadComplete(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void onServerStart(FMLServerStartingEvent event) {
|
||||||
|
SPacketMEUpdateBuffer.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void onServerStop(FMLServerStoppedEvent event) {
|
||||||
|
SPacketMEUpdateBuffer.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void missingMappings(FMLMissingMappingsEvent event) {
|
||||||
|
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||||
|
EC2Replacer.replaceExtraCells(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static ResourceLocation resource(String path) {
|
public static ResourceLocation resource(String path) {
|
||||||
return new ResourceLocation(MODID, path);
|
return new ResourceLocation(MODID, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.glodblock.github.api;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
|
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||||
|
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||||
|
|
||||||
|
public final class FluidCraftAPI implements IFluidCraftAPI {
|
||||||
|
|
||||||
|
private static final FluidCraftAPI API = new FluidCraftAPI();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These fluids will not be allowed to be stored in fluid storage cells.
|
||||||
|
*/
|
||||||
|
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These fluids will not be displayed in a fluid terminal.
|
||||||
|
*/
|
||||||
|
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
|
||||||
|
|
||||||
|
public static FluidCraftAPI instance() {
|
||||||
|
return API;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
|
||||||
|
blacklistedFluids.add(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
|
||||||
|
blacklistedDispFluids.add(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
|
||||||
|
return blacklistedFluids.contains(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
|
||||||
|
return blacklistedDispFluids.contains(fluid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ILevelTerminalRegistry levelTerminalRegistry() {
|
||||||
|
return LevelTerminalRegistry.instance();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.glodblock.github.api;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
|
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface IFluidCraftAPI {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blacklisted fluids will not be allowed to be added to a storage cell.
|
||||||
|
*/
|
||||||
|
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blacklisted fluids will not be displayed in fluid terminals.
|
||||||
|
*/
|
||||||
|
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
|
||||||
|
*/
|
||||||
|
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
|
||||||
|
*/
|
||||||
|
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get instance of `ILevelTerminalRegistry` to add new supported machines into terminal
|
||||||
|
*/
|
||||||
|
ILevelTerminalRegistry levelTerminalRegistry();
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.glodblock.github.api;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
public interface ISide {
|
||||||
|
|
||||||
|
ForgeDirection getSide();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.glodblock.github.api.registries;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
|
||||||
|
public interface ILevelTerminalRegistry {
|
||||||
|
|
||||||
|
void register(Class<? extends ILevelViewable> clazz);
|
||||||
|
|
||||||
|
void register(Class<? extends IGridHost> aeClass, ILevelViewableAdapter adapter);
|
||||||
|
|
||||||
|
Set<Class<? extends ILevelViewable>> getSupportedClasses();
|
||||||
|
|
||||||
|
boolean isAdopted(Class<? extends ILevelViewable> clazz);
|
||||||
|
|
||||||
|
Class<? extends IGridHost> getAdopted(Class<? extends ILevelViewable> clazz);
|
||||||
|
|
||||||
|
ILevelViewableAdapter getAdapter(Class<? extends ILevelViewable> clazz);
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.glodblock.github.api.registries;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import com.glodblock.github.api.ISide;
|
||||||
|
|
||||||
|
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.api.util.DimensionalCoord;
|
||||||
|
import appeng.helpers.ICustomNameObject;
|
||||||
|
|
||||||
|
public interface ILevelViewable extends IGridHost, ISide, ISegmentedInventory, ICustomNameObject {
|
||||||
|
|
||||||
|
DimensionalCoord getLocation();
|
||||||
|
|
||||||
|
TileEntity getTile();
|
||||||
|
|
||||||
|
default long getSortValue() {
|
||||||
|
TileEntity te = getTile();
|
||||||
|
return ((long) te.zCoord << 24) ^ ((long) te.xCoord << 8) ^ te.yCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
default boolean shouldDisplay() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of rows to expect. This is used with {@link #rowSize()} to determine how to render the slots.
|
||||||
|
*/
|
||||||
|
default int rows() {
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of slots per row.
|
||||||
|
*/
|
||||||
|
default int rowSize() {
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
default ItemStack getSelfItemStack() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* "Target" Display representation
|
||||||
|
*/
|
||||||
|
default ItemStack getDisplayItemStack() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.glodblock.github.api.registries;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
|
||||||
|
public interface ILevelViewableAdapter extends ILevelViewable {
|
||||||
|
|
||||||
|
ILevelViewable adapt(IGridHost gridHost);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.glodblock.github.client;
|
||||||
|
|
||||||
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
public class ClientHelper {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void updateTextureSheet(final TextureStitchEvent.Pre ev) {
|
||||||
|
if (ev.map.getTextureType() == 0) {
|
||||||
|
for (final FCPartsTexture cb : FCPartsTexture.values()) {
|
||||||
|
cb.registerIcon(ev.map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
ClientHelper handler = new ClientHelper();
|
||||||
|
MinecraftForge.EVENT_BUS.register(handler);
|
||||||
|
FMLCommonHandler.instance().bus().register(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.client.gui.AEBaseGui;
|
|
||||||
import appeng.client.gui.widgets.GuiNumberBox;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
|
||||||
import com.glodblock.github.client.container.ContainerBurette;
|
|
||||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
|
||||||
import com.glodblock.github.common.tile.TileBurette;
|
|
||||||
import com.glodblock.github.handler.ButtonMouseHandler;
|
|
||||||
import com.glodblock.github.handler.TankMouseHandler;
|
|
||||||
import com.glodblock.github.network.CPacketTransposeFluid;
|
|
||||||
import com.glodblock.github.util.MouseRegionManager;
|
|
||||||
import com.glodblock.github.util.NameConst;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiBurette extends AEBaseGui {
|
|
||||||
|
|
||||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/burette.png");
|
|
||||||
private static final int TANK_X = 52, TANK_Y = 17;
|
|
||||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 32;
|
|
||||||
|
|
||||||
private final ContainerBurette cont;
|
|
||||||
private GuiNumberBox amountField;
|
|
||||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
|
||||||
|
|
||||||
public GuiBurette(InventoryPlayer ipl, TileBurette tile) {
|
|
||||||
super(new ContainerBurette(ipl, tile));
|
|
||||||
this.cont = (ContainerBurette)inventorySlots;
|
|
||||||
|
|
||||||
mouseRegions.addRegion(TANK_X, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
|
||||||
new TankMouseHandler(cont.getTile().getFluidInventory(), 0));
|
|
||||||
mouseRegions.addRegion(70, 16, 7, 7, ButtonMouseHandler.dumpTank(cont, 0));
|
|
||||||
mouseRegions.addRegion(73, 42, 8, 16, createTransposeButton(true));
|
|
||||||
mouseRegions.addRegion(81, 42, 8, 16, createTransposeButton(false));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
amountField = new GuiNumberBox(fontRenderer, guiLeft + 95, guiTop + 46, 28, fontRenderer.FONT_HEIGHT, Integer.class);
|
|
||||||
amountField.setEnableBackgroundDrawing(false);
|
|
||||||
amountField.setMaxStringLength(4);
|
|
||||||
amountField.setTextColor(0xffffff);
|
|
||||||
amountField.setVisible(true);
|
|
||||||
amountField.setFocused(true);
|
|
||||||
amountField.setText("1000");
|
|
||||||
}
|
|
||||||
|
|
||||||
private ButtonMouseHandler createTransposeButton(boolean into) {
|
|
||||||
return new ButtonMouseHandler(into ? NameConst.TT_TRANSPOSE_IN : NameConst.TT_TRANSPOSE_OUT, () -> {
|
|
||||||
try {
|
|
||||||
int amount = Integer.parseInt(amountField.getText());
|
|
||||||
if (cont.canTranferFluid(into)) {
|
|
||||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketTransposeFluid(amount, into));
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
// NO-OP
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
|
||||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
|
||||||
amountField.mouseClicked(xCoord, yCoord, btn);
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void keyTyped(final char character, final int key) throws IOException {
|
|
||||||
if (!checkHotbarKeys(key)) {
|
|
||||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
|
|
||||||
&& amountField.textboxKeyTyped(character, key)) {
|
|
||||||
try {
|
|
||||||
int amount = Integer.parseInt(amountField.getText());
|
|
||||||
if (amount < 0) {
|
|
||||||
amountField.setText("1");
|
|
||||||
} else {
|
|
||||||
amountField.setText(Long.toString(amount));
|
|
||||||
}
|
|
||||||
} catch (final NumberFormatException e) {
|
|
||||||
// NO-OP
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
super.keyTyped(character, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
mc.getTextureManager().bindTexture(TEX_BG);
|
|
||||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
|
||||||
amountField.drawTextBox();
|
|
||||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_BURETTE)), 8, 6, 0x404040);
|
|
||||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
|
||||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
|
||||||
|
|
||||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
|
||||||
FluidRenderUtils.renderFluidIntoGuiCleanly(TANK_X, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
|
||||||
fluidInv.getFluidInSlot(0), fluidInv.getTankProperties()[0].getCapacity());
|
|
||||||
|
|
||||||
mouseRegions.render(mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
import appeng.client.gui.implementations.GuiExpandedProcessingPatternTerm;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import appeng.client.render.StackSizeRenderer;
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
|
|
||||||
public class GuiExtendedFluidPatternTerminal extends GuiExpandedProcessingPatternTerm {
|
|
||||||
|
|
||||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
|
||||||
private GuiTabButton craftingStatusBtn;
|
|
||||||
|
|
||||||
public GuiExtendedFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
|
||||||
super(inventoryPlayer, te);
|
|
||||||
ContainerExtendedFluidPatternTerminal container = new ContainerExtendedFluidPatternTerminal(inventoryPlayer, te);
|
|
||||||
container.setGui(this);
|
|
||||||
this.inventorySlots = container;
|
|
||||||
Ae2ReflectClient.setGuiExContainer(this, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawSlot(Slot slot) {
|
|
||||||
if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot(
|
|
||||||
slot, slot.getStack(), stackSizeRenderer, fontRenderer))) {
|
|
||||||
super.drawSlot(slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) {
|
|
||||||
if (btn == craftingStatusBtn) {
|
|
||||||
InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.client.gui.implementations.GuiPriority;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import com.glodblock.github.interfaces.FCPriorityHost;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiFCPriority extends GuiPriority {
|
|
||||||
|
|
||||||
private final GuiType originalGui;
|
|
||||||
private GuiTabButton originalGuiBtn;
|
|
||||||
|
|
||||||
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final FCPriorityHost te) {
|
|
||||||
super(inventoryPlayer, te);
|
|
||||||
this.originalGui = te.getGuiType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
|
||||||
if (btn == originalGuiBtn) {
|
|
||||||
InventoryHandler.switchGui(originalGui);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getBackground() {
|
|
||||||
return "guis/priority.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import appeng.fluids.client.gui.GuiFluidInterface;
|
|
||||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiFluidDualInterface extends GuiFluidInterface {
|
|
||||||
|
|
||||||
private GuiTabButton switchInterface;
|
|
||||||
private GuiTabButton priorityBtn;
|
|
||||||
|
|
||||||
public GuiFluidDualInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
|
||||||
super(ip, te);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
ItemStack icon = AEApi.instance().definitions().blocks().iface().maybeStack(1).orElse(ItemStack.EMPTY);
|
|
||||||
switchInterface = new GuiTabButton(guiLeft + 133, guiTop, icon, icon.getDisplayName(), itemRender);
|
|
||||||
buttonList.add(switchInterface);
|
|
||||||
priorityBtn = Ae2ReflectClient.getPriorityButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
|
||||||
if (btn == switchInterface) {
|
|
||||||
InventoryHandler.switchGui(GuiType.DUAL_ITEM_INTERFACE);
|
|
||||||
} else if (btn == priorityBtn) {
|
|
||||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean drawUpgrades() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
|
||||||
import appeng.fluids.client.gui.widgets.GuiOptionalFluidSlot;
|
|
||||||
import appeng.fluids.container.ContainerFluidIO;
|
|
||||||
import appeng.fluids.parts.PartSharedFluidBus;
|
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
|
||||||
import com.glodblock.github.client.container.ContainerFluidExportBus;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
|
|
||||||
public class GuiFluidExportBus extends GuiUpgradeable {
|
|
||||||
|
|
||||||
private final PartSharedFluidBus bus;
|
|
||||||
|
|
||||||
public GuiFluidExportBus(InventoryPlayer inventoryPlayer, PartSharedFluidBus te) {
|
|
||||||
super(new ContainerFluidExportBus(inventoryPlayer, te));
|
|
||||||
this.bus = te;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
ContainerFluidIO container = (ContainerFluidIO)this.inventorySlots;
|
|
||||||
IAEFluidTank inv = this.bus.getConfig();
|
|
||||||
this.guiSlots.add(new GuiFluidSlot(inv, 0, 0, 80, 40));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 1, 1, 1, 80, 40, -1, 0));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 2, 2, 1, 80, 40, 1, 0));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 3, 3, 1, 80, 40, 0, -1));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 4, 4, 1, 80, 40, 0, 1));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 5, 5, 2, 80, 40, -1, -1));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 6, 6, 2, 80, 40, 1, -1));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 7, 7, 2, 80, 40, -1, 1));
|
|
||||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 8, 8, 2, 80, 40, 1, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected GuiText getName() {
|
|
||||||
return GuiText.ExportBusFluids;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,174 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.client.gui.AEBaseGui;
|
|
||||||
import appeng.client.gui.widgets.GuiNumberBox;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
|
||||||
import com.glodblock.github.client.container.ContainerFluidLevelMaintainer;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidLevelMaintainer;
|
|
||||||
import com.glodblock.github.network.CPacketUpdateFluidLevel;
|
|
||||||
import com.glodblock.github.util.NameConst;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiFluidLevelMaintainer extends AEBaseGui {
|
|
||||||
|
|
||||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_level_maintainer.png");
|
|
||||||
|
|
||||||
private final ContainerFluidLevelMaintainer cont;
|
|
||||||
private final GuiNumberBox[] maintain = new GuiNumberBox[TileFluidLevelMaintainer.MAX_FLUID];
|
|
||||||
private final GuiNumberBox[] request = new GuiNumberBox[TileFluidLevelMaintainer.MAX_FLUID];
|
|
||||||
|
|
||||||
public GuiFluidLevelMaintainer(InventoryPlayer ipl, TileFluidLevelMaintainer tile) {
|
|
||||||
super(new ContainerFluidLevelMaintainer(ipl, tile));
|
|
||||||
this.cont = (ContainerFluidLevelMaintainer) inventorySlots;
|
|
||||||
this.ySize = 223;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaintainNumber(int id, int size) {
|
|
||||||
if (id < 0 || id >= TileFluidLevelMaintainer.MAX_FLUID || size < 0)
|
|
||||||
return;
|
|
||||||
this.maintain[id].setText(String.valueOf(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void renderHoveredToolTip(int x, int y) {
|
|
||||||
if (this.mc.player.inventory.getItemStack().isEmpty() && this.getSlotUnderMouse() != null
|
|
||||||
&& this.getSlotUnderMouse().getHasStack() && this.getSlotUnderMouse() instanceof ContainerFluidLevelMaintainer.DisplayFluidSlot)
|
|
||||||
{
|
|
||||||
ItemStack packet = this.getSlotUnderMouse().getStack();
|
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(packet);
|
|
||||||
this.renderToolTip(ItemFluidPacket.newDisplayStack(fluid), x, y);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
super.renderHoveredToolTip(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void keyTyped(char character, int key) throws IOException {
|
|
||||||
|
|
||||||
if (!this.checkHotbarKeys(key)) {
|
|
||||||
GuiNumberBox focus = null;
|
|
||||||
int id = 0;
|
|
||||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
|
||||||
if (maintain[i].isFocused()) {
|
|
||||||
focus = maintain[i];
|
|
||||||
id = i;
|
|
||||||
}
|
|
||||||
if (request[i].isFocused()) {
|
|
||||||
focus = request[i];
|
|
||||||
id = i + 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (focus != null && key != 1) {
|
|
||||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && focus.textboxKeyTyped(character, key)) {
|
|
||||||
try {
|
|
||||||
String out = focus.getText();
|
|
||||||
|
|
||||||
boolean fixed;
|
|
||||||
for(fixed = false; out.startsWith("0") && out.length() > 1; fixed = true) {
|
|
||||||
out = out.substring(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fixed) {
|
|
||||||
focus.setText(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (out.isEmpty()) {
|
|
||||||
out = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
long result = Long.parseLong(out);
|
|
||||||
if (result < 0L) {
|
|
||||||
focus.setText("1");
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result > Integer.MAX_VALUE) {
|
|
||||||
result = Integer.MAX_VALUE;
|
|
||||||
focus.setText(String.valueOf(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id >= 10 || result != 0)
|
|
||||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketUpdateFluidLevel(id, (int) result));
|
|
||||||
|
|
||||||
} catch (NumberFormatException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
super.keyTyped(character, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
|
||||||
maintain[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 39, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
|
||||||
request[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 102, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
|
||||||
maintain[i].setTextColor(16777215);
|
|
||||||
request[i].setTextColor(16777215);
|
|
||||||
maintain[i].setEnableBackgroundDrawing(false);
|
|
||||||
request[i].setEnableBackgroundDrawing(false);
|
|
||||||
maintain[i].setMaxStringLength(10);
|
|
||||||
request[i].setMaxStringLength(10);
|
|
||||||
}
|
|
||||||
TileFluidLevelMaintainer tile = this.cont.getTile();
|
|
||||||
IItemHandler inv = tile.getInventoryHandler();
|
|
||||||
for (int i = 0; i < inv.getSlots(); i ++) {
|
|
||||||
if (!inv.getStackInSlot(i).isEmpty()) {
|
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(inv.getStackInSlot(i));
|
|
||||||
this.maintain[i].setText(String.valueOf(fluid == null ? "0" : fluid.amount));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.maintain[i].setText("0");
|
|
||||||
}
|
|
||||||
this.request[i].setText(String.valueOf(tile.getRequest()[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
|
||||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
|
||||||
this.configNumberBar(request[i], xCoord, yCoord, btn);
|
|
||||||
this.configNumberBar(maintain[i], xCoord, yCoord, btn);
|
|
||||||
}
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void configNumberBar(GuiNumberBox bar, int xCoord, int yCoord, int btn) {
|
|
||||||
bar.mouseClicked(xCoord, yCoord, btn);
|
|
||||||
if (btn == 1 && bar.isFocused()) {
|
|
||||||
bar.setText("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
|
||||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
|
||||||
fontRenderer.drawString(I18n.format(NameConst.MISC_THRESHOLD), 39, 19, 0x404040);
|
|
||||||
fontRenderer.drawString(I18n.format(NameConst.MISC_REQ), 102, 19, 0x404040);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
mc.getTextureManager().bindTexture(TEX_BG);
|
|
||||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
|
||||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID ; i ++) {
|
|
||||||
this.maintain[i].drawTextBox();
|
|
||||||
this.request[i].drawTextBox();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import appeng.client.render.StackSizeRenderer;
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
import com.glodblock.github.client.container.ContainerFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
|
|
||||||
public class GuiFluidPatternTerminal extends GuiPatternTerm {
|
|
||||||
|
|
||||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
|
||||||
private GuiTabButton craftingStatusBtn;
|
|
||||||
|
|
||||||
public GuiFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
|
||||||
super(inventoryPlayer, te);
|
|
||||||
ContainerFluidPatternTerminal container = new ContainerFluidPatternTerminal(inventoryPlayer, te);
|
|
||||||
container.setGui(this);
|
|
||||||
this.inventorySlots = container;
|
|
||||||
Ae2ReflectClient.setGuiContainer(this, container);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawSlot(Slot slot) {
|
|
||||||
if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot(
|
|
||||||
slot, slot.getStack(), stackSizeRenderer, fontRenderer))) {
|
|
||||||
super.drawSlot(slot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) {
|
|
||||||
if (btn == craftingStatusBtn) {
|
|
||||||
InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
import appeng.client.gui.implementations.GuiCraftingStatus;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.common.part.PartFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
|
|
||||||
|
|
||||||
private GuiTabButton originalGuiBtn;
|
|
||||||
private final ITerminalHost part;
|
|
||||||
|
|
||||||
public GuiFluidPatternTerminalCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
|
||||||
super(inventoryPlayer, te);
|
|
||||||
this.part = te;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initGui() {
|
|
||||||
super.initGui();
|
|
||||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
|
||||||
if (btn == originalGuiBtn) {
|
|
||||||
if (part instanceof PartFluidPatternTerminal)
|
|
||||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
|
||||||
else if (part instanceof PartExtendedFluidPatternTerminal)
|
|
||||||
InventoryHandler.switchGui(GuiType.FLUID_EXTENDED_PATTERN_TERMINAL);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.client.gui.AEBaseGui;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
|
||||||
import com.glodblock.github.client.container.ContainerIngredientBuffer;
|
|
||||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
|
||||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
|
||||||
import com.glodblock.github.handler.ButtonMouseHandler;
|
|
||||||
import com.glodblock.github.handler.TankMouseHandler;
|
|
||||||
import com.glodblock.github.util.MouseRegionManager;
|
|
||||||
import com.glodblock.github.util.NameConst;
|
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiIngredientBuffer extends AEBaseGui {
|
|
||||||
|
|
||||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
|
|
||||||
private static final int TANK_X = 47, TANK_X_OFF = 22, TANK_Y = 18;
|
|
||||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 74;
|
|
||||||
|
|
||||||
private final ContainerIngredientBuffer cont;
|
|
||||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
|
||||||
|
|
||||||
public GuiIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
|
||||||
super(new ContainerIngredientBuffer(ipl, tile));
|
|
||||||
this.cont = (ContainerIngredientBuffer) inventorySlots;
|
|
||||||
this.ySize = 222;
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
|
||||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
|
||||||
mouseRegions.addRegion(TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7,
|
|
||||||
ButtonMouseHandler.dumpTank(cont, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
|
||||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
mc.getTextureManager().bindTexture(TEX_BG);
|
|
||||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
|
||||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
|
||||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
|
||||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
|
||||||
|
|
||||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
|
||||||
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
|
||||||
Tessellator tess = Tessellator.getInstance();
|
|
||||||
BufferBuilder buf = tess.getBuffer();
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
FluidRenderUtils.renderFluidIntoGui(tess, buf, TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
|
||||||
fluidInv.getFluidInSlot(i), fluidInv.getTankProperties()[i].getCapacity());
|
|
||||||
}
|
|
||||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
|
||||||
|
|
||||||
mouseRegions.render(mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
package com.glodblock.github.client;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.client.gui.implementations.GuiInterface;
|
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
|
||||||
import appeng.helpers.IInterfaceHost;
|
|
||||||
import com.glodblock.github.inventory.GuiType;
|
|
||||||
import com.glodblock.github.inventory.InventoryHandler;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class GuiItemDualInterface extends GuiInterface {
|
|
||||||
|
|
||||||
private GuiTabButton switchInterface;
|
|
||||||
private GuiTabButton priorityBtn;
|
|
||||||
|
|
||||||
public GuiItemDualInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) {
|
|
||||||
super(inventoryPlayer, te);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addButtons() {
|
|
||||||
super.addButtons();
|
|
||||||
ItemStack icon = AEApi.instance().definitions().blocks().fluidIface().maybeStack(1).orElse(ItemStack.EMPTY);
|
|
||||||
switchInterface = new GuiTabButton(guiLeft + 133, guiTop, icon, icon.getDisplayName(), itemRender);
|
|
||||||
buttonList.add(switchInterface);
|
|
||||||
priorityBtn = Ae2ReflectClient.getPriorityButton(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected String getBackground() {
|
|
||||||
return "guis/interface.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
|
||||||
if (btn == switchInterface) {
|
|
||||||
InventoryHandler.switchGui(GuiType.DUAL_FLUID_INTERFACE);
|
|
||||||
} else if (btn == priorityBtn) {
|
|
||||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
|
||||||
} else {
|
|
||||||
super.actionPerformed(btn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.slot.SlotNormal;
|
|
||||||
import appeng.fluids.container.IFluidSyncContainer;
|
|
||||||
import appeng.fluids.helper.FluidSyncHelper;
|
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
|
||||||
import appeng.util.Platform;
|
|
||||||
import com.glodblock.github.common.tile.TileBurette;
|
|
||||||
import com.glodblock.github.interfaces.TankDumpable;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.IContainerListener;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ContainerBurette extends AEBaseContainer implements IFluidSyncContainer, TankDumpable {
|
|
||||||
|
|
||||||
private final TileBurette tile;
|
|
||||||
private final FluidSyncHelper fluidSync;
|
|
||||||
|
|
||||||
public ContainerBurette(InventoryPlayer ipl, TileBurette tile) {
|
|
||||||
super(ipl, tile);
|
|
||||||
this.tile = tile;
|
|
||||||
this.fluidSync = new FluidSyncHelper(tile.getFluidInventory(), 0);
|
|
||||||
addSlotToContainer(new SlotNormal(tile.getInternalInventory(), 0, 52, 53));
|
|
||||||
bindPlayerInventory(ipl, 0, 84);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileBurette getTile() {
|
|
||||||
return tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canTranferFluid(boolean into) {
|
|
||||||
IAEFluidTank tileTank = tile.getFluidInventory();
|
|
||||||
IFluidTankProperties tileTankInfo = tileTank.getTankProperties()[0];
|
|
||||||
IAEFluidStack tileFluid = tileTank.getFluidInSlot(0);
|
|
||||||
if (into) {
|
|
||||||
if (tileFluid != null && tileFluid.getStackSize() >= tileTankInfo.getCapacity()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (tileFluid == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ItemStack stack = tile.getInternalInventory().getStackInSlot(0);
|
|
||||||
if (stack.isEmpty() || !stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
IFluidHandlerItem itemTank = Objects.requireNonNull(
|
|
||||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null));
|
|
||||||
for (IFluidTankProperties itemTankInfo : itemTank.getTankProperties()) {
|
|
||||||
if (into) {
|
|
||||||
if (itemTankInfo.canDrain() && tileTankInfo.canFillFluidType(itemTankInfo.getContents())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (itemTankInfo.canFillFluidType(tileFluid.getFluidStack())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tryTransferFluid(int amount, boolean into) {
|
|
||||||
ItemStack stack = tile.getInternalInventory().getStackInSlot(0);
|
|
||||||
if (stack.isEmpty() || !stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
IAEFluidTank tileTank = tile.getFluidInventory();
|
|
||||||
IFluidHandlerItem itemTank = Objects.requireNonNull(
|
|
||||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null));
|
|
||||||
if (into) {
|
|
||||||
transferFluidBetween(itemTank, tileTank, amount);
|
|
||||||
} else {
|
|
||||||
transferFluidBetween(tileTank, itemTank, amount);
|
|
||||||
}
|
|
||||||
tile.getInternalInventory().setStackInSlot(0, itemTank.getContainer());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void transferFluidBetween(IFluidHandler from, IFluidHandler to, int amount) {
|
|
||||||
// simulated pass to figure out the real amount we can transfer
|
|
||||||
FluidStack fluid = from.drain(amount, false);
|
|
||||||
if (fluid == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
amount = Math.min(amount, to.fill(fluid, false));
|
|
||||||
// actually do the transfer
|
|
||||||
fluid = from.drain(amount, true);
|
|
||||||
if (fluid != null) {
|
|
||||||
fluid.amount -= to.fill(fluid, true);
|
|
||||||
if (fluid.amount > 0) { // just in case the tanks don't behave exactly as simulated
|
|
||||||
from.fill(fluid, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void detectAndSendChanges() {
|
|
||||||
super.detectAndSendChanges();
|
|
||||||
if (Platform.isServer()) {
|
|
||||||
fluidSync.sendDiff(listeners);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addListener(@Nonnull IContainerListener listener) {
|
|
||||||
super.addListener(listener);
|
|
||||||
fluidSync.sendFull(Collections.singleton(listener));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receiveFluidSlots(Map<Integer, IAEFluidStack> fluids) {
|
|
||||||
fluidSync.readPacket(fluids);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDumpTank(int index) {
|
|
||||||
return tile.getFluidInventory().getFluidInSlot(0) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dumpTank(int index) {
|
|
||||||
tile.getFluidInventory().setFluidInSlot(0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-436
@@ -1,436 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.container.implementations.ContainerExpandedProcessingPatternTerm;
|
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
|
||||||
import appeng.container.slot.SlotPatternOutputs;
|
|
||||||
import appeng.helpers.InventoryAction;
|
|
||||||
import appeng.util.item.AEItemStack;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.interfaces.PatternConsumer;
|
|
||||||
import com.glodblock.github.loader.FCItems;
|
|
||||||
import com.glodblock.github.util.Ae2Reflect;
|
|
||||||
import com.glodblock.github.util.FluidPatternDetails;
|
|
||||||
import com.glodblock.github.util.Util;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ContainerExtendedFluidPatternTerminal extends ContainerExpandedProcessingPatternTerm implements PatternConsumer {
|
|
||||||
|
|
||||||
private final Slot[] craftingSlots;
|
|
||||||
private final Slot[] outputSlots;
|
|
||||||
private final Slot patternSlotIN;
|
|
||||||
private final Slot patternSlotOUT;
|
|
||||||
public final ITerminalHost part;
|
|
||||||
|
|
||||||
public ContainerExtendedFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
|
||||||
super(ip, monitorable);
|
|
||||||
craftingSlots = Ae2Reflect.getExCraftingSlots(this);
|
|
||||||
outputSlots = Ae2Reflect.getExOutputSlots(this);
|
|
||||||
patternSlotIN = Ae2Reflect.getExPatternSlotIn(this);
|
|
||||||
patternSlotOUT = Ae2Reflect.getExPatternSlotOut(this);
|
|
||||||
part = monitorable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void encode() {
|
|
||||||
if (!checkHasFluidPattern()) {
|
|
||||||
super.encode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemStack stack = this.patternSlotOUT.getStack();
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
stack = this.patternSlotIN.getStack();
|
|
||||||
if (stack.isEmpty() || !isPattern(stack)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (stack.getCount() == 1) {
|
|
||||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
|
||||||
} else {
|
|
||||||
stack.shrink(1);
|
|
||||||
}
|
|
||||||
encodeFluidPattern();
|
|
||||||
} else if (isPattern(stack)) {
|
|
||||||
encodeFluidPattern();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final IDefinitions defs = AEApi.instance().definitions();
|
|
||||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkHasFluidPattern() {
|
|
||||||
boolean hasFluid = false, search = false;
|
|
||||||
for (Slot craftingSlot : this.craftingSlots) {
|
|
||||||
final ItemStack crafting = craftingSlot.getStack();
|
|
||||||
if (crafting.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
search = true;
|
|
||||||
if (crafting.getItem() instanceof ItemFluidPacket) {
|
|
||||||
hasFluid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!search) { // search=false -> inputs were empty
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// `search` should be true at this point
|
|
||||||
for (Slot outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (out.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
search = false;
|
|
||||||
if (hasFluid) {
|
|
||||||
break;
|
|
||||||
} else if (out.getItem() instanceof ItemFluidPacket) {
|
|
||||||
hasFluid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasFluid && !search; // search=true -> outputs were empty
|
|
||||||
}
|
|
||||||
|
|
||||||
private void encodeFluidPattern() {
|
|
||||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
|
||||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
|
||||||
pattern.setInputs(collectInventory(craftingSlots));
|
|
||||||
pattern.setOutputs(collectInventory(outputSlots));
|
|
||||||
patternSlotOUT.putStack(pattern.writeToStack());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
|
||||||
// see note at top of DensePatternDetails
|
|
||||||
List<IAEItemStack> acc = new ArrayList<>();
|
|
||||||
for (Slot slot : slots) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
|
||||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
|
||||||
if (dropStack != null) {
|
|
||||||
acc.add(dropStack);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IAEItemStack aeStack = AEItemStack.fromItemStack(stack);
|
|
||||||
if (aeStack == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
acc.add(aeStack);
|
|
||||||
}
|
|
||||||
return acc.toArray(new IAEItemStack[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
|
||||||
if (slotId < 0 || slotId >= this.inventorySlots.size()) {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Slot slot = getSlot(slotId);
|
|
||||||
ItemStack stack = player.inventory.getItemStack();
|
|
||||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && !stack.isEmpty()
|
|
||||||
&& stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null) && Util.getFluidFromItem(stack) != null) {
|
|
||||||
FluidStack fluid = null;
|
|
||||||
switch (action) {
|
|
||||||
case PICKUP_OR_SET_DOWN:
|
|
||||||
fluid = Util.getFluidFromItem(stack);
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
break;
|
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
|
||||||
fluid = Util.getFluidFromItem(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
|
||||||
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
|
|
||||||
if (fluid != null && fluid.equals(origin)) {
|
|
||||||
fluid.amount += origin.amount;
|
|
||||||
if (fluid.amount <= 0) fluid = null;
|
|
||||||
}
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (fluid == null) {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
|
||||||
if (stack.isEmpty() && !slot.getStack().isEmpty() && slot.getStack().getItem() instanceof ItemFluidPacket) {
|
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(slot.getStack());
|
|
||||||
if (fluid != null && fluid.amount - 1000 >= 1) {
|
|
||||||
fluid.amount -= 1000;
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt * multiple > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt * multiple > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount *= multiple;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount *= multiple;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void divide(int divide) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount /= divide;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount /= divide;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void increase(int increase) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount += increase * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount += increase * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt - decrease * 1000 < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt - decrease < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt - decrease * 1000 < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt - decrease < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount -= decrease * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount -= decrease * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
|
||||||
if (part instanceof PartExtendedFluidPatternTerminal) {
|
|
||||||
((PartExtendedFluidPatternTerminal) part).onChangeCrafting(inputs, outputs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.api.config.Settings;
|
|
||||||
import appeng.api.config.YesNo;
|
|
||||||
import appeng.api.util.IConfigManager;
|
|
||||||
import appeng.fluids.container.ContainerFluidIO;
|
|
||||||
import appeng.fluids.parts.PartSharedFluidBus;
|
|
||||||
import com.glodblock.github.common.part.PartFluidExportBus;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
|
|
||||||
public class ContainerFluidExportBus extends ContainerFluidIO {
|
|
||||||
|
|
||||||
public ContainerFluidExportBus(InventoryPlayer ip, PartSharedFluidBus te) {
|
|
||||||
super(ip, te);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
|
||||||
super.loadSettingsFromHost(cm);
|
|
||||||
if (this.getUpgradeable() instanceof PartFluidExportBus) {
|
|
||||||
this.setCraftingMode((YesNo)cm.getSetting(Settings.CRAFT_ONLY));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-99
@@ -1,99 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
import appeng.helpers.InventoryAction;
|
|
||||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidLevelMaintainer;
|
|
||||||
import com.glodblock.github.network.SPacketSetFluidLevel;
|
|
||||||
import com.glodblock.github.util.Util;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ContainerFluidLevelMaintainer extends AEBaseContainer {
|
|
||||||
|
|
||||||
private final TileFluidLevelMaintainer tile;
|
|
||||||
|
|
||||||
public ContainerFluidLevelMaintainer(InventoryPlayer ip, TileFluidLevelMaintainer tile) {
|
|
||||||
super(ip, tile);
|
|
||||||
this.tile = tile;
|
|
||||||
IItemHandler inv = tile.getInventoryHandler();
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
addSlotToContainer(new DisplayFluidSlot(inv, i, 17, 28 + i * 20));
|
|
||||||
}
|
|
||||||
bindPlayerInventory(ip, 0, 141);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileFluidLevelMaintainer getTile() {
|
|
||||||
return tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
|
||||||
Slot slot = getSlot(slotId);
|
|
||||||
if (slot instanceof DisplayFluidSlot) {
|
|
||||||
final ItemStack stack = player.inventory.getItemStack();
|
|
||||||
FluidStack fluid = Util.getFluidFromItem(stack);
|
|
||||||
FluidCraft.proxy.netHandler.sendTo(new SPacketSetFluidLevel(slotId, fluid == null ? 0 : fluid.amount), player);
|
|
||||||
slot.putStack(stack.isEmpty() ? stack : stack.copy());
|
|
||||||
} else {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DisplayFluidSlot extends SlotFake {
|
|
||||||
|
|
||||||
final AppEngInternalAEInventory handler;
|
|
||||||
|
|
||||||
public DisplayFluidSlot(IItemHandler inv, int idx, int x, int y) {
|
|
||||||
super(inv, idx, x, y);
|
|
||||||
this.handler = (AppEngInternalAEInventory) inv;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putStack(ItemStack is) {
|
|
||||||
if (is.isEmpty()) {
|
|
||||||
super.putStack(is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (is.getItem() instanceof ItemFluidPacket) {
|
|
||||||
super.putStack(is);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (is.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
|
||||||
IFluidTankProperties[] tanks = Objects.requireNonNull(
|
|
||||||
is.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null))
|
|
||||||
.getTankProperties();
|
|
||||||
for (IFluidTankProperties tank : tanks) {
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(tank.getContents());
|
|
||||||
super.putStack(packet);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.putStack(ItemStack.EMPTY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSlotStackLimit() {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemStackLimit(@Nonnull ItemStack stack) {
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
-441
@@ -1,441 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.storage.ITerminalHost;
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.container.implementations.ContainerPatternTerm;
|
|
||||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
|
||||||
import appeng.container.slot.SlotPatternOutputs;
|
|
||||||
import appeng.helpers.InventoryAction;
|
|
||||||
import appeng.util.item.AEItemStack;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.part.PartFluidPatternTerminal;
|
|
||||||
import com.glodblock.github.interfaces.PatternConsumer;
|
|
||||||
import com.glodblock.github.loader.FCItems;
|
|
||||||
import com.glodblock.github.util.Ae2Reflect;
|
|
||||||
import com.glodblock.github.util.FluidPatternDetails;
|
|
||||||
import com.glodblock.github.util.Util;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
public class ContainerFluidPatternTerminal extends ContainerPatternTerm implements PatternConsumer {
|
|
||||||
|
|
||||||
private final Slot[] craftingSlots;
|
|
||||||
private final Slot[] outputSlots;
|
|
||||||
private final Slot patternSlotIN;
|
|
||||||
private final Slot patternSlotOUT;
|
|
||||||
|
|
||||||
public ContainerFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
|
||||||
super(ip, monitorable);
|
|
||||||
craftingSlots = Ae2Reflect.getCraftingSlots(this);
|
|
||||||
outputSlots = Ae2Reflect.getOutputSlots(this);
|
|
||||||
patternSlotIN = Ae2Reflect.getPatternSlotIn(this);
|
|
||||||
patternSlotOUT = Ae2Reflect.getPatternSlotOut(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void encode() {
|
|
||||||
if (!checkHasFluidPattern()) {
|
|
||||||
super.encode();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemStack stack = this.patternSlotOUT.getStack();
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
stack = this.patternSlotIN.getStack();
|
|
||||||
if (stack.isEmpty() || !isPattern(stack)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (stack.getCount() == 1) {
|
|
||||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
|
||||||
} else {
|
|
||||||
stack.shrink(1);
|
|
||||||
}
|
|
||||||
encodeFluidPattern();
|
|
||||||
} else if (isPattern(stack)) {
|
|
||||||
encodeFluidPattern();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isPattern(final ItemStack output) {
|
|
||||||
if (output.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final IDefinitions defs = AEApi.instance().definitions();
|
|
||||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkHasFluidPattern() {
|
|
||||||
if (this.craftingMode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean hasFluid = false, search = false;
|
|
||||||
for (Slot craftingSlot : this.craftingSlots) {
|
|
||||||
final ItemStack crafting = craftingSlot.getStack();
|
|
||||||
if (crafting.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
search = true;
|
|
||||||
if (crafting.getItem() instanceof ItemFluidPacket) {
|
|
||||||
hasFluid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!search) { // search=false -> inputs were empty
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// `search` should be true at this point
|
|
||||||
for (Slot outputSlot : this.outputSlots) {
|
|
||||||
final ItemStack out = outputSlot.getStack();
|
|
||||||
if (out.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
search = false;
|
|
||||||
if (hasFluid) {
|
|
||||||
break;
|
|
||||||
} else if (out.getItem() instanceof ItemFluidPacket) {
|
|
||||||
hasFluid = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasFluid && !search; // search=true -> outputs were empty
|
|
||||||
}
|
|
||||||
|
|
||||||
private void encodeFluidPattern() {
|
|
||||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
|
||||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
|
||||||
pattern.setInputs(collectInventory(craftingSlots));
|
|
||||||
pattern.setOutputs(collectInventory(outputSlots));
|
|
||||||
patternSlotOUT.putStack(pattern.writeToStack());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
|
||||||
// see note at top of DensePatternDetails
|
|
||||||
List<IAEItemStack> acc = new ArrayList<>();
|
|
||||||
for (Slot slot : slots) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
|
||||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
|
||||||
if (dropStack != null) {
|
|
||||||
acc.add(dropStack);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IAEItemStack aeStack = AEItemStack.fromItemStack(stack);
|
|
||||||
if (aeStack == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
acc.add(aeStack);
|
|
||||||
}
|
|
||||||
return acc.toArray(new IAEItemStack[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
|
||||||
if (getPatternTerminal() instanceof PartFluidPatternTerminal) {
|
|
||||||
((PartFluidPatternTerminal)getPatternTerminal()).onChangeCrafting(inputs, outputs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
|
||||||
if (this.isCraftingMode()) {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (slotId < 0 || slotId >= this.inventorySlots.size()) {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Slot slot = getSlot(slotId);
|
|
||||||
ItemStack stack = player.inventory.getItemStack();
|
|
||||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && !stack.isEmpty()
|
|
||||||
&& stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null) && Util.getFluidFromItem(stack) != null) {
|
|
||||||
FluidStack fluid = null;
|
|
||||||
switch (action) {
|
|
||||||
case PICKUP_OR_SET_DOWN:
|
|
||||||
fluid = Util.getFluidFromItem(stack);
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
break;
|
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
|
||||||
fluid = Util.getFluidFromItem(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
|
||||||
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
|
|
||||||
if (fluid != null && fluid.equals(origin)) {
|
|
||||||
fluid.amount += origin.amount;
|
|
||||||
if (fluid.amount <= 0) fluid = null;
|
|
||||||
}
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (fluid == null) {
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
|
||||||
if (stack.isEmpty() && !slot.getStack().isEmpty() && slot.getStack().getItem() instanceof ItemFluidPacket) {
|
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(slot.getStack());
|
|
||||||
if (fluid != null && fluid.amount - 1000 >= 1) {
|
|
||||||
fluid.amount -= 1000;
|
|
||||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.doAction(player, action, slotId, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void multiply(int multiple) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt * multiple > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt * multiple > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount *= multiple;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount *= multiple;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() * multiple);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void divide(int divide) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt % divide != 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount /= divide;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount /= divide;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() / divide);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void increase(int increase) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount += increase * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount += increase * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() + increase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void decrease(int decrease) {
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt - decrease * 1000 < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt - decrease < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
|
||||||
if (amt - decrease * 1000 < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
long amt = slot.getStack().getCount();
|
|
||||||
if (amt - decrease < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.craftingSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount -= decrease * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Slot slot : this.outputSlots) {
|
|
||||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
|
||||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
|
||||||
fluid.amount -= decrease * 1000;
|
|
||||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
|
||||||
slot.putStack(packet);
|
|
||||||
}
|
|
||||||
else if (!slot.getStack().isEmpty()) {
|
|
||||||
ItemStack stack = slot.getStack();
|
|
||||||
stack.setCount(stack.getCount() - decrease);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package com.glodblock.github.client.container;
|
|
||||||
|
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.slot.SlotNormal;
|
|
||||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
|
||||||
import com.glodblock.github.interfaces.TankDumpable;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
public class ContainerIngredientBuffer extends AEBaseContainer implements TankDumpable {
|
|
||||||
|
|
||||||
private final TileIngredientBuffer tile;
|
|
||||||
|
|
||||||
public ContainerIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
|
||||||
super(ipl, tile);
|
|
||||||
this.tile = tile;
|
|
||||||
IItemHandler inv = tile.getInternalInventory();
|
|
||||||
for (int i = 0; i < 9; i++) {
|
|
||||||
addSlotToContainer(new SlotNormal(inv, i, 8 + 18 * i, 108));
|
|
||||||
}
|
|
||||||
bindPlayerInventory(ipl, 0, 140);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileIngredientBuffer getTile() {
|
|
||||||
return tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canDumpTank(int index) {
|
|
||||||
return tile.getFluidInventory().getFluidInSlot(index) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dumpTank(int index) {
|
|
||||||
if (index >= 0 && index < tile.getFluidInventory().getSlots()) {
|
|
||||||
tile.getFluidInventory().setFluidInSlot(index, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
|
||||||
|
public class FCGuiLineField extends FCGuiTextField {
|
||||||
|
|
||||||
|
private final int _xPos;
|
||||||
|
private final int _yPos;
|
||||||
|
private final int _width;
|
||||||
|
private final FontRenderer _fontRender;
|
||||||
|
|
||||||
|
public FCGuiLineField(FontRenderer fontRenderer, int xPos, int yPos, int width) {
|
||||||
|
this(fontRenderer, xPos, yPos, width, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FCGuiLineField(FontRenderer fontRenderer, int xPos, int yPos, int width, int height) {
|
||||||
|
super(fontRenderer, xPos, yPos, width, height);
|
||||||
|
this._xPos = xPos;
|
||||||
|
this._yPos = yPos;
|
||||||
|
this._width = width;
|
||||||
|
this._fontRender = fontRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawTextBox() {
|
||||||
|
if (this.getVisible()) {
|
||||||
|
drawRect(this._xPos, this._yPos, this.xPosition + this.width, this.yPosition + this.height, getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
|
|
||||||
|
public class FCGuiTextField extends GuiTextField {
|
||||||
|
|
||||||
|
private static final int PADDING = 2;
|
||||||
|
private final FontRenderer _fontRender;
|
||||||
|
private String tooltip;
|
||||||
|
|
||||||
|
private final int _xPos;
|
||||||
|
private final int _yPos;
|
||||||
|
private final int _width;
|
||||||
|
private final int _height;
|
||||||
|
private int _border;
|
||||||
|
private int _color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the values to instantiate a padded version of a text field. Pays attention to the '_' caret.
|
||||||
|
*
|
||||||
|
* @param fontRenderer renderer for the strings
|
||||||
|
* @param xPos absolute left position
|
||||||
|
* @param yPos absolute top position
|
||||||
|
* @param width absolute width
|
||||||
|
* @param height absolute height
|
||||||
|
*/
|
||||||
|
public FCGuiTextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width,
|
||||||
|
final int height) {
|
||||||
|
super(
|
||||||
|
fontRenderer,
|
||||||
|
xPos + PADDING,
|
||||||
|
yPos + PADDING,
|
||||||
|
width - 2 * PADDING - fontRenderer.getCharWidth('_'),
|
||||||
|
height - 2 * PADDING);
|
||||||
|
|
||||||
|
this._xPos = xPos;
|
||||||
|
this._yPos = yPos;
|
||||||
|
this._width = width;
|
||||||
|
this._height = height;
|
||||||
|
this._fontRender = fontRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawTextBox() {
|
||||||
|
super.drawTextBox();
|
||||||
|
if (this.getBorder() > 0 && this.getVisible()) {
|
||||||
|
drawRect(
|
||||||
|
this._xPos - getBorder(),
|
||||||
|
this._yPos - getBorder(),
|
||||||
|
this.xPosition + this.width + getBorder(),
|
||||||
|
this.yPosition + this.height + getBorder(),
|
||||||
|
this.getColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui) {
|
||||||
|
this.handleTooltip(mouseX, mouseY, gui, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui, int offsetY) {
|
||||||
|
if (isMouseIn(mouseX, mouseY) && this.tooltip != null && !"".equals(this.tooltip)) {
|
||||||
|
int length = 0;
|
||||||
|
for (String s : this.getMessage().split("\n")) {
|
||||||
|
length = Math.max(this._fontRender.getStringWidth(s), length);
|
||||||
|
}
|
||||||
|
if (mouseY < 15) {
|
||||||
|
mouseY = 15;
|
||||||
|
}
|
||||||
|
if (mouseX + length + 20 >= gui.width) {
|
||||||
|
gui.drawTooltip(mouseX - length - 20, mouseY + 4 + offsetY, 0, this.getMessage());
|
||||||
|
} else {
|
||||||
|
gui.drawTooltip(mouseX, mouseY + 4 + offsetY, 0, this.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getBorder() {
|
||||||
|
return this._border;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorder(int border) {
|
||||||
|
this._border = border;
|
||||||
|
this._color = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorder(int border, int color) {
|
||||||
|
this._border = border;
|
||||||
|
this._color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBorder() {
|
||||||
|
this._border = 0;
|
||||||
|
this._color = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return this._color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(int color) {
|
||||||
|
this._color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(final int xPos, final int yPos, final int button) {
|
||||||
|
super.mouseClicked(xPos, yPos, button);
|
||||||
|
|
||||||
|
final boolean requiresFocus = this.isMouseIn(xPos, yPos);
|
||||||
|
|
||||||
|
this.setFocused(requiresFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the mouse is within the element
|
||||||
|
*
|
||||||
|
* @param xCoord current x coord of the mouse
|
||||||
|
* @param yCoord current y coord of the mouse
|
||||||
|
* @return true if mouse position is within the text field area
|
||||||
|
*/
|
||||||
|
public boolean isMouseIn(final int xCoord, final int yCoord) {
|
||||||
|
final boolean withinXRange = this._xPos <= xCoord && xCoord < this._xPos + this._width;
|
||||||
|
final boolean withinYRange = this._yPos <= yCoord && yCoord < this._yPos + this._height;
|
||||||
|
|
||||||
|
return withinXRange && withinYRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String t) {
|
||||||
|
tooltip = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TooltipProvider implements ITooltip {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int xPos() {
|
||||||
|
return _xPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int yPos() {
|
||||||
|
return _yPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return _height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth() {
|
||||||
|
return _width;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return getVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessFluidTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.util.Ae2ReflectClient;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
|
||||||
|
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
|
||||||
|
|
||||||
|
private GuiTabButton originalGuiBtn;
|
||||||
|
private final ITerminalHost host;
|
||||||
|
|
||||||
|
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
host = te;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
if (host instanceof PartFluidPatternTerminal)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL.stack());
|
||||||
|
else if (host instanceof PartFluidPatternTerminalEx)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL_EX.stack());
|
||||||
|
else if (host instanceof PartFluidTerminal)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERM.stack());
|
||||||
|
else if (host instanceof PartLevelTerminal)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.LEVEL_TERMINAL.stack());
|
||||||
|
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack());
|
||||||
|
else if (host instanceof WirelessFluidTerminalInventory)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_FLUID_TERM.stack());
|
||||||
|
else if (host instanceof WirelessPatternTerminalInventory)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack());
|
||||||
|
else if (host instanceof WirelessInterfaceTerminalInventory)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack());
|
||||||
|
else if (host instanceof WirelessLevelTerminalInventory)
|
||||||
|
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack());
|
||||||
|
super.initGui();
|
||||||
|
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == originalGuiBtn) {
|
||||||
|
if (host instanceof PartFluidPatternTerminal) InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
||||||
|
else if (host instanceof PartFluidPatternTerminalEx)
|
||||||
|
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
|
||||||
|
else if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
|
||||||
|
else if (host instanceof PartLevelTerminal) InventoryHandler.switchGui(GuiType.LEVEL_TERMINAL);
|
||||||
|
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
|
||||||
|
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(terminal.getItemStack()));
|
||||||
|
else if (host instanceof WirelessFluidTerminalInventory)
|
||||||
|
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
|
||||||
|
else if (host instanceof WirelessPatternTerminalInventory)
|
||||||
|
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||||
|
else if (host instanceof WirelessInterfaceTerminalInventory)
|
||||||
|
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||||
|
else if (host instanceof WirelessLevelTerminalInventory)
|
||||||
|
InventoryHandler.switchGui(GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerDualInterface;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||||
|
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.AdvancedBlockingMode;
|
||||||
|
import appeng.api.config.InsertionMode;
|
||||||
|
import appeng.api.config.LockCraftingMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SidelessMode;
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiSimpleImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.client.gui.widgets.GuiToggleButton;
|
||||||
|
import appeng.container.implementations.ContainerInterface;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.localization.ButtonToolTips;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketConfigButton;
|
||||||
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.helpers.IInterfaceHost;
|
||||||
|
|
||||||
|
public class GuiDualInterface extends GuiUpgradeable {
|
||||||
|
|
||||||
|
private GuiTabButton priority;
|
||||||
|
private GuiTabButton switcher;
|
||||||
|
private GuiImgButton BlockMode;
|
||||||
|
private GuiToggleButton interfaceMode;
|
||||||
|
private GuiImgButton insertionMode;
|
||||||
|
private GuiImgButton sidelessMode;
|
||||||
|
private GuiSimpleImgButton doublePatterns;
|
||||||
|
private GuiToggleButton patternOptimization;
|
||||||
|
private GuiImgButton advancedBlockingMode;
|
||||||
|
private GuiImgButton lockCraftingMode;
|
||||||
|
private final IInterfaceHost host;
|
||||||
|
|
||||||
|
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
|
||||||
|
super(new ContainerDualInterface(inventoryPlayer, te));
|
||||||
|
this.host = te;
|
||||||
|
this.ySize = 211;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void addButtons() {
|
||||||
|
this.priority = new GuiTabButton(
|
||||||
|
this.guiLeft + 154,
|
||||||
|
this.guiTop,
|
||||||
|
2 + 4 * 16,
|
||||||
|
GuiText.Priority.getLocal(),
|
||||||
|
itemRender);
|
||||||
|
this.buttonList.add(this.priority);
|
||||||
|
|
||||||
|
this.switcher = new GuiTabButton(
|
||||||
|
this.guiLeft + 132,
|
||||||
|
this.guiTop,
|
||||||
|
host instanceof PartFluidInterface ? ItemAndBlockHolder.FLUID_INTERFACE.stack()
|
||||||
|
: ItemAndBlockHolder.INTERFACE.stack(),
|
||||||
|
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||||
|
itemRender);
|
||||||
|
this.buttonList.add(this.switcher);
|
||||||
|
|
||||||
|
int offset = 8;
|
||||||
|
|
||||||
|
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + offset, Settings.BLOCK, YesNo.NO);
|
||||||
|
this.buttonList.add(this.BlockMode);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
this.interfaceMode = new GuiToggleButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
84,
|
||||||
|
85,
|
||||||
|
GuiText.InterfaceTerminal.getLocal(),
|
||||||
|
GuiText.InterfaceTerminalHint.getLocal());
|
||||||
|
this.buttonList.add(this.interfaceMode);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
this.insertionMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
Settings.INSERTION_MODE,
|
||||||
|
InsertionMode.DEFAULT);
|
||||||
|
this.buttonList.add(this.insertionMode);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
this.doublePatterns = new GuiSimpleImgButton(this.guiLeft - 18, this.guiTop + offset, 71, "");
|
||||||
|
this.doublePatterns.enabled = false;
|
||||||
|
this.buttonList.add(this.doublePatterns);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
this.patternOptimization = new GuiToggleButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
178,
|
||||||
|
194,
|
||||||
|
GuiText.PatternOptimization.getLocal(),
|
||||||
|
GuiText.PatternOptimizationHint.getLocal());
|
||||||
|
this.buttonList.add(this.patternOptimization);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
this.advancedBlockingMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
Settings.ADVANCED_BLOCKING_MODE,
|
||||||
|
AdvancedBlockingMode.DEFAULT);
|
||||||
|
this.buttonList.add(this.advancedBlockingMode);
|
||||||
|
this.advancedBlockingMode.visible = this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0;
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
|
||||||
|
if (isTile()) {
|
||||||
|
this.sidelessMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
Settings.SIDELESS_MODE,
|
||||||
|
SidelessMode.SIDELESS);
|
||||||
|
this.buttonList.add(this.sidelessMode);
|
||||||
|
|
||||||
|
offset += 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lockCraftingMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + offset,
|
||||||
|
Settings.LOCK_CRAFTING_MODE,
|
||||||
|
LockCraftingMode.NONE);
|
||||||
|
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
|
||||||
|
this.buttonList.add(lockCraftingMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
if (this.BlockMode != null) {
|
||||||
|
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.interfaceMode != null) {
|
||||||
|
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
|
||||||
|
}
|
||||||
|
if (this.insertionMode != null) {
|
||||||
|
this.insertionMode.set(((ContainerInterface) this.cvb).getInsertionMode());
|
||||||
|
}
|
||||||
|
if (this.doublePatterns != null) {
|
||||||
|
this.doublePatterns.enabled = ((ContainerInterface) this.cvb).isAllowedToMultiplyPatterns;
|
||||||
|
if (this.doublePatterns.enabled) this.doublePatterns.setTooltip(
|
||||||
|
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.DoublePatternsHint.getLocal());
|
||||||
|
else this.doublePatterns.setTooltip(
|
||||||
|
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.OptimizePatternsNoReq.getLocal());
|
||||||
|
}
|
||||||
|
if (this.patternOptimization != null) {
|
||||||
|
this.patternOptimization.setState(((ContainerInterface) this.cvb).getPatternOptimization() == YesNo.YES);
|
||||||
|
}
|
||||||
|
if (this.sidelessMode != null) {
|
||||||
|
this.sidelessMode.set(((ContainerDualInterface) this.cvb).getSidelessMode());
|
||||||
|
}
|
||||||
|
if (this.advancedBlockingMode != null) {
|
||||||
|
this.advancedBlockingMode.set(((ContainerDualInterface) this.cvb).getAdvancedBlockingMode());
|
||||||
|
}
|
||||||
|
if (this.lockCraftingMode != null) {
|
||||||
|
this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode());
|
||||||
|
}
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
|
||||||
|
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
|
||||||
|
case -1 -> "guis/interfacenone.png";
|
||||||
|
case 1 -> "guis/interface2.png";
|
||||||
|
case 2 -> "guis/interface3.png";
|
||||||
|
case 3 -> "guis/interface4.png";
|
||||||
|
default -> "guis/interface.png";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
if (btn == this.priority) {
|
||||||
|
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||||
|
} else if (btn == this.switcher) {
|
||||||
|
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE_FLUID);
|
||||||
|
} else if (btn == this.interfaceMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
|
||||||
|
} else if (btn == this.BlockMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
|
||||||
|
} else if (btn == this.insertionMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
|
||||||
|
} else if (btn == this.doublePatterns) {
|
||||||
|
try {
|
||||||
|
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
|
||||||
|
if (backwards) val |= 0b10;
|
||||||
|
NetworkHandler.instance
|
||||||
|
.sendToServer(new PacketValueConfig("Interface.DoublePatterns", String.valueOf(val)));
|
||||||
|
} catch (final Throwable e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
} else if (btn == this.patternOptimization) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.PATTERN_OPTIMIZATION, backwards));
|
||||||
|
} else if (btn == this.sidelessMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
|
||||||
|
} else if (btn == this.advancedBlockingMode) {
|
||||||
|
NetworkHandler.instance
|
||||||
|
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
|
||||||
|
} else if (btn == this.lockCraftingMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPart() {
|
||||||
|
return this.host instanceof PartFluidInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTile() {
|
||||||
|
return this.host instanceof TileFluidInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleButtonVisibility() {
|
||||||
|
super.handleButtonVisibility();
|
||||||
|
if (this.advancedBlockingMode != null) {
|
||||||
|
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
|
||||||
|
}
|
||||||
|
if (this.lockCraftingMode != null) {
|
||||||
|
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerEssentiaMonitor;
|
||||||
|
import com.glodblock.github.client.me.EssentiaRepo;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||||
|
import com.glodblock.github.crossmod.thaumcraft.AspectRender;
|
||||||
|
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.me.SlotME;
|
||||||
|
|
||||||
|
public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||||
|
|
||||||
|
protected EntityPlayer player;
|
||||||
|
|
||||||
|
public GuiEssentiaTerminal(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerEssentiaMonitor(inventoryPlayer, te));
|
||||||
|
this.repo = new EssentiaRepo(getScrollBar(), this);
|
||||||
|
this.player = inventoryPlayer.player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||||
|
if (AspectUtil.getAspectFromJar(stack) != null) {
|
||||||
|
setSearchString(Objects.requireNonNull(AspectUtil.getAspectFromJar(stack)).getName(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_146977_a(final Slot s) {
|
||||||
|
if (drawSlot0(s)) super.func_146977_a(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean drawSlot0(Slot slot) {
|
||||||
|
if (slot instanceof SlotME) {
|
||||||
|
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||||
|
if (stack == null) return true;
|
||||||
|
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||||
|
AspectRender.drawAspect(
|
||||||
|
this.player,
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition,
|
||||||
|
this.zLevel,
|
||||||
|
AspectUtil.getAspectFromGas(fluidStack),
|
||||||
|
fluidStack.amount);
|
||||||
|
IAEItemStack gas = stack.copy().setStackSize(stack.getStackSize() / AspectUtil.R);
|
||||||
|
aeRenderItem.setAeStack(gas);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||||
|
aeRenderItem.renderItemOverlayIntoGUI(
|
||||||
|
fontRendererObj,
|
||||||
|
mc.getTextureManager(),
|
||||||
|
gas.getItemStack(),
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
|
if (slot instanceof SlotME && AspectUtil.isEssentiaContainer(player.inventory.getItemStack())) {
|
||||||
|
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||||
|
}
|
||||||
|
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == craftingStatusBtn) {
|
||||||
|
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(ItemStack itemStack) {
|
||||||
|
this.player.inventory.setItemStack(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,334 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
|
|
||||||
|
public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||||
|
|
||||||
|
private static final Pattern COMPILE = Pattern.compile("%s");
|
||||||
|
private static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
|
||||||
|
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||||
|
private final String buttonSetting;
|
||||||
|
private boolean halfSize = false;
|
||||||
|
private String fillVar;
|
||||||
|
private String currentValue;
|
||||||
|
private final boolean background;
|
||||||
|
private static final String prefix = NameConst.TT_KEY;
|
||||||
|
|
||||||
|
public GuiFCImgButton(final int x, final int y, final String idx, final String val) {
|
||||||
|
this(x, y, idx, val, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiFCImgButton(final int x, final int y, final String idx, final String val, boolean background) {
|
||||||
|
super(0, 0, 16, "");
|
||||||
|
this.background = background;
|
||||||
|
this.buttonSetting = idx;
|
||||||
|
this.currentValue = val;
|
||||||
|
this.xPosition = x;
|
||||||
|
this.yPosition = y;
|
||||||
|
this.width = 16;
|
||||||
|
this.height = 16;
|
||||||
|
|
||||||
|
if (appearances == null) {
|
||||||
|
appearances = new HashMap<>();
|
||||||
|
this.registerApp(0, "NOT_COMBINE", "DONT_COMBINE", "not_combine");
|
||||||
|
this.registerApp(1, "FORCE_COMBINE", "DO_COMBINE", "combine");
|
||||||
|
this.registerApp(2, "FORCE_PRIO", "DO_PRIO", "prio");
|
||||||
|
this.registerApp(3, "NOT_PRIO", "DONT_PRIO", "not_prio");
|
||||||
|
this.registerApp(4, "SUBMIT", "SUBMIT", "submit");
|
||||||
|
this.registerApp(5, "EDIT", "YES", "edit");
|
||||||
|
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||||
|
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||||
|
this.registerApp(10, "FLUID_TEM", "YES", "fluid_terminal_w");
|
||||||
|
this.registerApp(11, "CRAFT_TEM", "YES", "craft_terminal_w");
|
||||||
|
this.registerApp(12, "PATTERN_TEM", "YES", "pattern_terminal_w");
|
||||||
|
this.registerApp(13, "ESSENTIA_TEM", "YES", "essentia_terminal_w");
|
||||||
|
this.registerApp(14, "INTERFACE_TEM", "YES", "interface_terminal_w");
|
||||||
|
this.registerApp(15, "PATTERN_EX_TEM", "YES", "pattern_terminal_ex_w");
|
||||||
|
this.registerApp(16, "FILL_PATTERN", "DO_FILL", "fill_pattern");
|
||||||
|
this.registerApp(17, "NOT_FILL_PATTERN", "DONT_FILL", "not_fill_pattern");
|
||||||
|
this.registerApp(20, "LEVEL_TEM", "YES", "level_terminal_w");
|
||||||
|
this.registerApp(21, "SWITCH", "ON", "edit");
|
||||||
|
this.registerApp(22, "SWITCH", "OFF", "view");
|
||||||
|
this.registerApp(21, "SWITCH", "ENABLE", "enable");
|
||||||
|
this.registerApp(22, "SWITCH", "DISABLE", "disable");
|
||||||
|
this.registerApp(23, "CONFIG", "YES", "open_configuration");
|
||||||
|
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registerApp(final int iconIndex, final String setting, final String val, final String title) {
|
||||||
|
final ButtonAppearance a = new ButtonAppearance();
|
||||||
|
a.displayName = StatCollector.translateToLocal(prefix + title);
|
||||||
|
if (StatCollector.translateToLocal(prefix + title + ".hint").equals(prefix + title + ".hint")) {
|
||||||
|
a.displayValue = null;
|
||||||
|
} else {
|
||||||
|
a.displayValue = StatCollector.translateToLocal(prefix + title + ".hint");
|
||||||
|
}
|
||||||
|
a.index = iconIndex % 10;
|
||||||
|
a.page = iconIndex / 10;
|
||||||
|
appearances.put(new EnumPair(setting, val), a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisibility(final boolean vis) {
|
||||||
|
this.visible = vis;
|
||||||
|
this.enabled = vis;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIconIndex() {
|
||||||
|
if (this.buttonSetting != null && this.currentValue != null) {
|
||||||
|
final ButtonAppearance app = appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||||
|
if (app == null) {
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
return app.index;
|
||||||
|
}
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getIconPage() {
|
||||||
|
if (this.buttonSetting != null && this.currentValue != null) {
|
||||||
|
final ButtonAppearance app = appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||||
|
if (app == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return app.page;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSetting() {
|
||||||
|
return this.buttonSetting;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentValue() {
|
||||||
|
return this.currentValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getMouseIn() {
|
||||||
|
return this.field_146123_n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(final String e) {
|
||||||
|
if (!this.currentValue.equals(e)) {
|
||||||
|
this.currentValue = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHalfSize() {
|
||||||
|
return this.halfSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHalfSize(final boolean halfSize) {
|
||||||
|
this.halfSize = halfSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFillVar() {
|
||||||
|
return this.fillVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFillVar(final String fillVar) {
|
||||||
|
this.fillVar = fillVar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int xPos() {
|
||||||
|
return this.xPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int yPos() {
|
||||||
|
return this.yPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth() {
|
||||||
|
return this.halfSize ? 8 : 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight() {
|
||||||
|
return this.halfSize ? 8 : 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible() {
|
||||||
|
return this.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
String displayName = null;
|
||||||
|
String displayValue = null;
|
||||||
|
|
||||||
|
if (this.buttonSetting != null && this.currentValue != null) {
|
||||||
|
final ButtonAppearance buttonAppearance = appearances
|
||||||
|
.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||||
|
if (buttonAppearance == null) {
|
||||||
|
return "No Such Message";
|
||||||
|
}
|
||||||
|
displayName = buttonAppearance.displayName;
|
||||||
|
displayValue = buttonAppearance.displayValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayName != null) {
|
||||||
|
String name = StatCollector.translateToLocal(displayName);
|
||||||
|
if (name == null || name.isEmpty()) {
|
||||||
|
name = displayName;
|
||||||
|
}
|
||||||
|
if (displayValue != null) {
|
||||||
|
String value = StatCollector.translateToLocal(displayValue);
|
||||||
|
|
||||||
|
if (this.fillVar != null) {
|
||||||
|
value = COMPILE.matcher(value).replaceFirst(this.fillVar);
|
||||||
|
}
|
||||||
|
|
||||||
|
value = PATTERN_NEW_LINE.matcher(value).replaceAll("\n");
|
||||||
|
final StringBuilder sb = new StringBuilder(value);
|
||||||
|
|
||||||
|
int i = sb.lastIndexOf("\n");
|
||||||
|
if (i <= 0) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
while (i + 30 < sb.length() && (i = sb.lastIndexOf(" ", i + 30)) != -1) {
|
||||||
|
sb.replace(i, i + 1, "\n");
|
||||||
|
}
|
||||||
|
return name + '\n' + sb;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3) {
|
||||||
|
if (this.visible) {
|
||||||
|
final int iconIndex = this.getIconIndex();
|
||||||
|
final int iconPage = this.getIconPage();
|
||||||
|
|
||||||
|
if (this.halfSize) {
|
||||||
|
this.width = 8;
|
||||||
|
this.height = 8;
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||||
|
GL11.glScalef(0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3);
|
||||||
|
|
||||||
|
if (this.enabled) {
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
} else {
|
||||||
|
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||||
|
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||||
|
&& par2 < this.xPosition + this.width
|
||||||
|
&& par3 < this.yPosition + this.height;
|
||||||
|
|
||||||
|
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||||
|
final int uv_x = iconIndex - uv_y * 3;
|
||||||
|
if (this.background) {
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Math.round(32F * 16F / 3F),
|
||||||
|
Math.round(32F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F));
|
||||||
|
}
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Math.round(uv_x * 16F * 16F / 3F),
|
||||||
|
Math.round(uv_y * 16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||||
|
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
|
||||||
|
if (this.enabled) {
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
} else {
|
||||||
|
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||||
|
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||||
|
&& par2 < this.xPosition + this.width
|
||||||
|
&& par3 < this.yPosition + this.height;
|
||||||
|
|
||||||
|
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||||
|
final int uv_x = iconIndex - uv_y * 3;
|
||||||
|
if (this.background) {
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Math.round(32F * 16F / 3F),
|
||||||
|
Math.round(32F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F));
|
||||||
|
}
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Math.round(uv_x * 16F * 16F / 3F),
|
||||||
|
Math.round(uv_y * 16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F),
|
||||||
|
Math.round(16F * 16F / 3F));
|
||||||
|
}
|
||||||
|
this.mouseDragged(par1Minecraft, par2, par3);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class EnumPair {
|
||||||
|
|
||||||
|
final String setting;
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
EnumPair(final String a, final String b) {
|
||||||
|
this.setting = a;
|
||||||
|
this.value = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return this.setting.hashCode() ^ this.value.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final EnumPair other = (EnumPair) obj;
|
||||||
|
return other.setting.equals(this.setting) && other.value.equals(this.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ButtonAppearance {
|
||||||
|
|
||||||
|
public int index;
|
||||||
|
public int page;
|
||||||
|
public String displayName;
|
||||||
|
public String displayValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiAmount;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||||
|
import com.glodblock.github.inventory.IDualHost;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
|
||||||
|
import appeng.container.implementations.ContainerPriority;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.helpers.IPriorityHost;
|
||||||
|
import appeng.util.calculators.ArithHelper;
|
||||||
|
import appeng.util.calculators.Calculator;
|
||||||
|
|
||||||
|
public class GuiFCPriority extends FCGuiAmount {
|
||||||
|
|
||||||
|
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final IPriorityHost te) {
|
||||||
|
super(new ContainerPriority(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.submit.enabled = false;
|
||||||
|
this.submit.visible = false;
|
||||||
|
this.buttonList.remove(this.submit);
|
||||||
|
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getIncrementQuantity(int i) {
|
||||||
|
return AEConfig.instance.priorityByStacksAmounts(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.amountBox.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addQty(final int i) {
|
||||||
|
try {
|
||||||
|
this.amountBox.setText(Long.toString(getAmount() + i));
|
||||||
|
} catch (final NumberFormatException ignore) {}
|
||||||
|
try {
|
||||||
|
NetworkHandler.instance
|
||||||
|
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
|
||||||
|
} catch (IOException e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setOriginGUI(Object target) {
|
||||||
|
if (target instanceof IDualHost) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.INTERFACE.stack();
|
||||||
|
this.originalGui = GuiType.DUAL_INTERFACE;
|
||||||
|
} else if (target instanceof PartFluidStorageBus) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_STORAGE_BUS.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_STORAGE_BUS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
try {
|
||||||
|
NetworkHandler.instance
|
||||||
|
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
|
||||||
|
} catch (IOException e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getAmount() {
|
||||||
|
try {
|
||||||
|
String out = this.amountBox.getText();
|
||||||
|
double result = Calculator.conversion(out);
|
||||||
|
if (Double.isNaN(result)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return (int) ArithHelper.round(result, 0);
|
||||||
|
}
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/priority.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidAutoFiller;
|
||||||
|
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseMEGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidAutoFiller extends AEBaseMEGui {
|
||||||
|
|
||||||
|
protected EntityPlayer player;
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_auto_filler.png");
|
||||||
|
|
||||||
|
public GuiFluidAutoFiller(InventoryPlayer ipl, TileFluidAutoFiller tile) {
|
||||||
|
super(new ContainerFluidAutoFiller(ipl, tile));
|
||||||
|
this.player = ipl.player;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_AUTO_FILLER)), 8, 6, 0x404040);
|
||||||
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiAmount;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.network.CPacketCraftRequest;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.implementations.ContainerCraftAmount;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidCraftAmount extends FCGuiAmount {
|
||||||
|
|
||||||
|
public GuiFluidCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(new ContainerCraftAmount(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.amountBox.setText("1");
|
||||||
|
this.amountBox.setSelectionPos(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.submit.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
|
||||||
|
try {
|
||||||
|
this.submit.enabled = getAmount() > 0;
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.submit.enabled = false;
|
||||||
|
}
|
||||||
|
this.amountBox.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
try {
|
||||||
|
if (btn == this.submit && this.submit.enabled) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketCraftRequest(getAmount(), isShiftKeyDown()));
|
||||||
|
}
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.amountBox.setText("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setOriginGUI(Object target) {
|
||||||
|
if (target instanceof PartFluidPatternTerminal) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
} else if (target instanceof PartFluidTerminal) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (target instanceof PartLevelTerminal) {
|
||||||
|
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||||
|
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||||
|
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/craftAmt.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||||
|
|
||||||
|
public class GuiFluidCraftConfirm extends GuiCraftConfirm {
|
||||||
|
|
||||||
|
private GuiType originalGui;
|
||||||
|
|
||||||
|
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
if (te instanceof PartFluidPatternTerminal) {
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
} else if (te instanceof PartFluidPatternTerminalEx) {
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
} else if (te instanceof PartLevelTerminal) {
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
|
||||||
|
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (te instanceof WirelessPatternTerminalInventory) {
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (te instanceof WirelessLevelTerminalInventory) {
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void switchToOriginalGUI() {
|
||||||
|
InventoryHandler.switchGui(originalGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.core.localization.GuiColors;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
|
||||||
|
public class GuiFluidCraftingWireless extends GuiItemMonitor {
|
||||||
|
|
||||||
|
private GuiImgButton clearBtn;
|
||||||
|
|
||||||
|
public GuiFluidCraftingWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerCraftingWireless(inventoryPlayer, te));
|
||||||
|
this.setReservedSpace(73);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == craftingStatusBtn) {
|
||||||
|
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
if (this.clearBtn == btn) {
|
||||||
|
Slot s = null;
|
||||||
|
final Container c = this.inventorySlots;
|
||||||
|
for (final Object j : c.inventorySlots) {
|
||||||
|
if (j instanceof SlotCraftingMatrix) {
|
||||||
|
s = (Slot) j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s != null) {
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(
|
||||||
|
InventoryAction.MOVE_REGION,
|
||||||
|
s.slotNumber,
|
||||||
|
0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.buttonList.add(
|
||||||
|
this.clearBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 92,
|
||||||
|
this.guiTop + this.ySize - 156,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.STASH));
|
||||||
|
this.clearBtn.setHalfSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
GuiText.CraftingTerminal.getLocal(),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 1 - this.getReservedSpace(),
|
||||||
|
GuiColors.CraftingTerminalTitle.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "gui/crafting.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidIO;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidImportBus;
|
||||||
|
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidIO extends GuiUpgradeable {
|
||||||
|
|
||||||
|
private final FCSharedFluidBus bus;
|
||||||
|
|
||||||
|
public GuiFluidIO(InventoryPlayer inventoryPlayer, FCSharedFluidBus te) {
|
||||||
|
super(new ContainerFluidIO(inventoryPlayer, te));
|
||||||
|
this.bus = te;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GuiText getName() {
|
||||||
|
return this.bus instanceof PartFluidImportBus ? GuiText.ImportBus : GuiText.ExportBus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int id, IAEFluidStack stack) {
|
||||||
|
((ContainerFluidIO) this.cvb).getBus().setFluidInSlot(id, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
this.getGuiDisplayName(
|
||||||
|
I18n.format(
|
||||||
|
this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT
|
||||||
|
: NameConst.GUI_FLUID_EXPORT)),
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
4210752);
|
||||||
|
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||||
|
|
||||||
|
if (this.redstoneMode != null) {
|
||||||
|
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fuzzyMode != null) {
|
||||||
|
this.fuzzyMode.set(this.cvb.getFuzzyMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.craftMode != null) {
|
||||||
|
this.craftMode.set(this.cvb.getCraftingMode());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.schedulingMode != null) {
|
||||||
|
this.schedulingMode.set(this.cvb.getSchedulingMode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleButtonVisibility() {
|
||||||
|
super.handleButtonVisibility();
|
||||||
|
if (this.schedulingMode != null) {
|
||||||
|
this.schedulingMode.setVisibility(
|
||||||
|
this.bc.getInstalledUpgrades(Upgrades.CAPACITY) > 0 && this.bc instanceof PartFluidExportBus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||||
|
import com.glodblock.github.inventory.IAEFluidTank;
|
||||||
|
import com.glodblock.github.inventory.IDualHost;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||||
|
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
import com.glodblock.github.util.RenderUtil;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidInterface extends AEBaseGui {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/interface_fluid.png");
|
||||||
|
private static final int TANK_X = 35, TANK_X_OFF = 18, TANK_Y = 53;
|
||||||
|
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 68;
|
||||||
|
private final ContainerFluidInterface cont;
|
||||||
|
|
||||||
|
private GuiTabButton switcher;
|
||||||
|
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||||
|
|
||||||
|
public GuiFluidInterface(InventoryPlayer ipl, IDualHost tile) {
|
||||||
|
super(new ContainerFluidInterface(ipl, tile));
|
||||||
|
this.cont = (ContainerFluidInterface) inventorySlots;
|
||||||
|
this.ySize = 231;
|
||||||
|
this.addMouseRegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addMouseRegin() {
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
mouseRegions.addRegion(
|
||||||
|
TANK_X + TANK_X_OFF * i,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_146977_a(final Slot s) {
|
||||||
|
try {
|
||||||
|
GuiContainer.class.getDeclaredMethod("func_146977_a_original", Slot.class).invoke(this, s);
|
||||||
|
} catch (final Exception ignore) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.switcher = new GuiTabButton(
|
||||||
|
this.guiLeft + 154,
|
||||||
|
this.guiTop,
|
||||||
|
isPart() ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(),
|
||||||
|
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||||
|
itemRender);
|
||||||
|
this.buttonList.add(this.switcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 0x404040);
|
||||||
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
|
||||||
|
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||||
|
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
if (!isPart()) {
|
||||||
|
fontRendererObj.drawString(dirName(i), TANK_X + i * TANK_X_OFF + 5, 22, 0x404040);
|
||||||
|
}
|
||||||
|
RenderUtil.renderFluidIntoGui(
|
||||||
|
this,
|
||||||
|
TANK_X + i * TANK_X_OFF,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
fluidInv.getFluidInSlot(i),
|
||||||
|
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||||
|
}
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
mouseRegions.render(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String dirName(int face) {
|
||||||
|
return I18n.format(NameConst.GUI_FLUID_INTERFACE + "." + face);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
if (btn == this.switcher) {
|
||||||
|
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int id, IAEFluidStack stack) {
|
||||||
|
if (id >= 100) {
|
||||||
|
cont.getTile().setConfig(id - 100, stack);
|
||||||
|
} else {
|
||||||
|
cont.getTile().setFluidInv(id, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isPart() {
|
||||||
|
return this.cont.getTile() instanceof PartFluidInterface;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||||
|
import com.glodblock.github.network.CPacketValueConfig;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.RedstoneMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiNumberBox;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.localization.GuiColors;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||||
|
|
||||||
|
private GuiNumberBox level;
|
||||||
|
private GuiButton plus1;
|
||||||
|
private GuiButton plus10;
|
||||||
|
private GuiButton plus100;
|
||||||
|
private GuiButton plus1000;
|
||||||
|
private GuiButton minus1;
|
||||||
|
private GuiButton minus10;
|
||||||
|
private GuiButton minus100;
|
||||||
|
private GuiButton minus1000;
|
||||||
|
private boolean isMul = false;
|
||||||
|
|
||||||
|
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
|
||||||
|
super(new ContainerFluidLevelEmitter(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
this.level = new GuiNumberBox(this.fontRendererObj, 24, 43, 79, this.fontRendererObj.FONT_HEIGHT, Long.class);
|
||||||
|
this.level.setEnableBackgroundDrawing(false);
|
||||||
|
this.level.setMaxStringLength(16);
|
||||||
|
this.level.setTextColor(GuiColors.LevelEmitterValue.getColor());
|
||||||
|
this.level.setVisible(true);
|
||||||
|
this.level.setFocused(true);
|
||||||
|
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addButtons() {
|
||||||
|
this.redstoneMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + 8,
|
||||||
|
Settings.REDSTONE_EMITTER,
|
||||||
|
RedstoneMode.LOW_SIGNAL);
|
||||||
|
|
||||||
|
final int a = AEConfig.instance.levelByStackAmounts(0);
|
||||||
|
final int b = AEConfig.instance.levelByStackAmounts(1);
|
||||||
|
final int c = AEConfig.instance.levelByStackAmounts(2);
|
||||||
|
final int d = AEConfig.instance.levelByStackAmounts(3);
|
||||||
|
|
||||||
|
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a));
|
||||||
|
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b));
|
||||||
|
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c));
|
||||||
|
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d));
|
||||||
|
|
||||||
|
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a));
|
||||||
|
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b));
|
||||||
|
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c));
|
||||||
|
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d));
|
||||||
|
|
||||||
|
this.buttonList.add(this.redstoneMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
getGuiDisplayName(NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER)),
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
GuiColors.UpgradableTitle.getColor());
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
GuiText.inventory.getLocal(),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 3,
|
||||||
|
GuiColors.UpgradableInventory.getColor());
|
||||||
|
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||||
|
this.level.drawTextBox();
|
||||||
|
if (isShiftKeyDown() && !isMul) {
|
||||||
|
for (Object btn : this.buttonList) {
|
||||||
|
if (btn instanceof GuiButton) {
|
||||||
|
((GuiButton) btn).displayString += "000";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isMul = true;
|
||||||
|
} else if (!isShiftKeyDown() && isMul) {
|
||||||
|
for (Object btn : this.buttonList) {
|
||||||
|
if (btn instanceof GuiButton) {
|
||||||
|
((GuiButton) btn).displayString = ((GuiButton) btn).displayString
|
||||||
|
.substring(0, ((GuiButton) btn).displayString.lastIndexOf("000"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isMul = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleButtonVisibility() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/lvlemitter.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||||
|
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|
||||||
|
|| btn == this.minus100
|
||||||
|
|| btn == this.minus1000;
|
||||||
|
|
||||||
|
if (isPlus || isMinus) {
|
||||||
|
this.addQty(this.getQty(btn));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addQty(final long i) {
|
||||||
|
try {
|
||||||
|
String Out = this.level.getText();
|
||||||
|
|
||||||
|
boolean Fixed = false;
|
||||||
|
while (Out.startsWith("0") && Out.length() > 1) {
|
||||||
|
Out = Out.substring(1);
|
||||||
|
Fixed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Fixed) {
|
||||||
|
this.level.setText(Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Out.isEmpty()) {
|
||||||
|
Out = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
long result = Long.parseLong(Out);
|
||||||
|
result += i;
|
||||||
|
if (result < 0) {
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.level.setText(Out = Long.toString(result));
|
||||||
|
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.level.setText("0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (!this.checkHotbarKeys(key)) {
|
||||||
|
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
|
||||||
|
&& this.level.textboxKeyTyped(character, key)) {
|
||||||
|
try {
|
||||||
|
String Out = this.level.getText();
|
||||||
|
|
||||||
|
boolean Fixed = false;
|
||||||
|
while (Out.startsWith("0") && Out.length() > 1) {
|
||||||
|
Out = Out.substring(1);
|
||||||
|
Fixed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Fixed) {
|
||||||
|
this.level.setText(Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Out.isEmpty()) {
|
||||||
|
Out = "0";
|
||||||
|
}
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(Long.parseLong(Out), 0));
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean drawUpgrades() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(Integer key, IAEFluidStack value) {
|
||||||
|
((ContainerFluidLevelEmitter) this.cvb).getBus().setFluidInSlot(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
|
||||||
|
import com.glodblock.github.client.me.FluidRepo;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
|
||||||
|
|
||||||
|
public GuiFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||||
|
final ContainerFluidMonitor c) {
|
||||||
|
super(inventoryPlayer, te, c);
|
||||||
|
this.repo = new FluidRepo(getScrollBar(), this);
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postUpdate(final List<IAEFluidStack> list, boolean resort) {
|
||||||
|
for (final IAEFluidStack is : list) {
|
||||||
|
IAEItemStack stack = AEItemStack.create(ItemFluidDrop.newDisplayStack(is.getFluidStack()));
|
||||||
|
stack.setStackSize(is.getStackSize());
|
||||||
|
this.repo.postUpdate(stack);
|
||||||
|
}
|
||||||
|
if (resort) {
|
||||||
|
this.repo.updateView();
|
||||||
|
}
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
|
||||||
|
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected IAEItemStack transformItem(IAEItemStack stack) {
|
||||||
|
if (stack.getItem() instanceof ItemFluidDrop) {
|
||||||
|
return ItemFluidDrop.newAeStack(ItemFluidDrop.getAeFluidStack(stack));
|
||||||
|
}
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||||
|
final FluidStack fluid = Util.getFluidFromItem(stack);
|
||||||
|
if (fluid != null) {
|
||||||
|
setSearchString(fluid.getLocalizedName(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.implementations.GuiOptimizePatterns;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidOptimizePatterns extends GuiOptimizePatterns {
|
||||||
|
|
||||||
|
private GuiType originalGui;
|
||||||
|
|
||||||
|
public GuiFluidOptimizePatterns(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
if (te instanceof PartFluidPatternTerminal) {
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
} else if (te instanceof PartFluidPatternTerminalEx) {
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
} else if (te instanceof PartLevelTerminal) {
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
|
||||||
|
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (te instanceof WirelessPatternTerminalInventory) {
|
||||||
|
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||||
|
} else if (te instanceof WirelessLevelTerminalInventory) {
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton btn) {
|
||||||
|
if (btn.displayString.equals(GuiText.Cancel.getLocal())) {
|
||||||
|
InventoryHandler.switchGui(originalGui);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
-11
@@ -1,15 +1,17 @@
|
|||||||
package com.glodblock.github.client;
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
import appeng.client.gui.AEBaseGui;
|
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
|
||||||
import com.glodblock.github.client.container.ContainerFluidPacketDecoder;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
|
||||||
import com.glodblock.github.util.NameConst;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
|
||||||
|
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
public class GuiFluidPacketDecoder extends AEBaseGui {
|
public class GuiFluidPacketDecoder extends AEBaseGui {
|
||||||
|
|
||||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_packet_decoder.png");
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_packet_decoder.png");
|
||||||
@@ -26,8 +28,7 @@ public class GuiFluidPacketDecoder extends AEBaseGui {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
||||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
+70
-40
@@ -1,33 +1,33 @@
|
|||||||
package com.glodblock.github.client;
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import java.util.Arrays;
|
||||||
import appeng.client.gui.AEBaseGui;
|
import java.util.Collections;
|
||||||
import appeng.client.render.StackSizeRenderer;
|
import java.util.List;
|
||||||
import appeng.core.localization.GuiText;
|
|
||||||
import com.glodblock.github.FluidCraft;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import com.glodblock.github.client.container.ContainerFluidPatternEncoder;
|
|
||||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
|
||||||
import com.glodblock.github.interfaces.SlotFluid;
|
|
||||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
|
||||||
import com.glodblock.github.network.CPacketEncodePattern;
|
|
||||||
import com.glodblock.github.util.Ae2ReflectClient;
|
|
||||||
import com.glodblock.github.util.MouseRegionManager;
|
|
||||||
import com.glodblock.github.util.NameConst;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import org.lwjgl.opengl.GL11;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import com.glodblock.github.FluidCraft;
|
||||||
import java.util.Collections;
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
|
||||||
import java.util.List;
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||||
|
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||||
|
import com.glodblock.github.inventory.slot.ISlotFluid;
|
||||||
|
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||||
|
import com.glodblock.github.network.CPacketEncodePattern;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
public class GuiFluidPatternEncoder extends AEBaseGui {
|
public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||||
|
|
||||||
@@ -35,12 +35,12 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
|||||||
|
|
||||||
private final ContainerFluidPatternEncoder cont;
|
private final ContainerFluidPatternEncoder cont;
|
||||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
|
||||||
|
|
||||||
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
|
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
|
||||||
super(new ContainerFluidPatternEncoder(ipl, tile));
|
super(new ContainerFluidPatternEncoder(ipl, tile));
|
||||||
this.cont = (ContainerFluidPatternEncoder)inventorySlots;
|
this.cont = (ContainerFluidPatternEncoder) inventorySlots;
|
||||||
mouseRegions.addRegion(141, 38, 10, 10, new MouseRegionManager.Handler() {
|
mouseRegions.addRegion(141, 38, 10, 10, new MouseRegionManager.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getTooltip() {
|
public List<String> getTooltip() {
|
||||||
return Collections.singletonList(I18n.format(NameConst.TT_ENCODE_PATTERN));
|
return Collections.singletonList(I18n.format(NameConst.TT_ENCODE_PATTERN));
|
||||||
@@ -60,7 +60,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||||
super.mouseClicked(xCoord, yCoord, btn);
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
}
|
}
|
||||||
@@ -74,35 +74,65 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)), 8, 6, 0x404040);
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)), 8, 6, 0x404040);
|
||||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
mouseRegions.render(mouseX, mouseY);
|
mouseRegions.render(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSlot(Slot slot) {
|
public void func_146977_a(final Slot s) {
|
||||||
if (slot instanceof SlotFluid) {
|
this.drawSlot0(s);
|
||||||
IAEItemStack stack = ((SlotFluid)slot).getAeStack();
|
}
|
||||||
if (FluidRenderUtils.renderFluidPacketIntoGuiSlot(slot, stack, stackSizeRenderer, fontRenderer)) {
|
|
||||||
return;
|
public void drawSlot0(Slot slot) {
|
||||||
|
if (slot instanceof ISlotFluid) {
|
||||||
|
IAEItemStack stack = ((ISlotFluid) slot).getAeStack();
|
||||||
|
super.func_146977_a(new SlotSingleItem(slot));
|
||||||
|
if (stack == null) return;
|
||||||
|
IAEItemStack fake = stack.copy();
|
||||||
|
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||||
|
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||||
|
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||||
}
|
}
|
||||||
super.drawSlot(new SlotSingleItem(slot));
|
aeRenderItem.setAeStack(fake);
|
||||||
stackSizeRenderer.renderStackSize(fontRenderer, stack, slot.xPos, slot.yPos);
|
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||||
|
aeRenderItem.renderItemOverlayIntoGUI(
|
||||||
|
fontRendererObj,
|
||||||
|
mc.getTextureManager(),
|
||||||
|
stack.getItemStack(),
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||||
} else {
|
} else {
|
||||||
super.drawSlot(slot);
|
super.func_146977_a(slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public List<String> getItemToolTip(ItemStack stack) {
|
public void renderToolTip(ItemStack stack, int x, int y) {
|
||||||
|
List list;
|
||||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||||
if (fluid != null) {
|
if (fluid != null) {
|
||||||
return Arrays.asList(fluid.getLocalizedName(), String.format(TextFormatting.GRAY + "%,d mB", fluid.amount));
|
list = Arrays.asList(
|
||||||
|
fluid.getLocalizedName(),
|
||||||
|
String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
|
||||||
|
} else {
|
||||||
|
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k = 0; k < list.size(); ++k) {
|
||||||
|
if (k == 0) {
|
||||||
|
list.set(k, stack.getRarity().rarityColor + (String) list.get(k));
|
||||||
|
} else {
|
||||||
|
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getItemToolTip(stack);
|
FontRenderer font = stack.getItem().getFontRenderer(stack);
|
||||||
|
drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotDisabled;
|
||||||
|
|
||||||
|
public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx {
|
||||||
|
|
||||||
|
public GuiFluidPatternExWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
} else {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.ItemSubstitution;
|
||||||
|
import appeng.api.config.PatternBeSubstitution;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
||||||
|
|
||||||
|
public GuiFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidPatternTerminal(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidPatternWireless(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.tabCraftButton = new GuiTabButton(
|
||||||
|
this.guiLeft + 173,
|
||||||
|
this.guiTop + this.ySize - 177,
|
||||||
|
new ItemStack(Blocks.crafting_table),
|
||||||
|
GuiText.CraftingPattern.getLocal(),
|
||||||
|
itemRender);
|
||||||
|
this.buttonList.add(this.tabCraftButton);
|
||||||
|
|
||||||
|
this.tabProcessButton = new GuiTabButton(
|
||||||
|
this.guiLeft + 173,
|
||||||
|
this.guiTop + this.ySize - 177,
|
||||||
|
new ItemStack(Blocks.furnace),
|
||||||
|
GuiText.ProcessingPattern.getLocal(),
|
||||||
|
itemRender);
|
||||||
|
this.buttonList.add(this.tabProcessButton);
|
||||||
|
|
||||||
|
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 84,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ItemSubstitution.ENABLED);
|
||||||
|
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||||
|
|
||||||
|
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 84,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ItemSubstitution.DISABLED);
|
||||||
|
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||||
|
|
||||||
|
this.clearBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 74,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.CLOSE);
|
||||||
|
this.clearBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.clearBtn);
|
||||||
|
|
||||||
|
this.encodeBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 147,
|
||||||
|
this.guiTop + this.ySize - 142,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.ENCODE);
|
||||||
|
this.buttonList.add(this.encodeBtn);
|
||||||
|
|
||||||
|
int combineLeft = 74;
|
||||||
|
int combineTop = 153;
|
||||||
|
if (ModAndClassUtil.isDoubleButton) {
|
||||||
|
this.doubleBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 74,
|
||||||
|
this.guiTop + this.ySize - 153,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.DOUBLE);
|
||||||
|
this.doubleBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.doubleBtn);
|
||||||
|
combineLeft = 84;
|
||||||
|
}
|
||||||
|
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||||
|
combineLeft = 74;
|
||||||
|
combineTop -= 11;
|
||||||
|
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 84,
|
||||||
|
this.guiTop + this.ySize - 153,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
PatternBeSubstitution.ENABLED);
|
||||||
|
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||||
|
|
||||||
|
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 84,
|
||||||
|
this.guiTop + this.ySize - 153,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
PatternBeSubstitution.DISABLED);
|
||||||
|
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||||
|
}
|
||||||
|
this.combineEnableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + combineLeft,
|
||||||
|
this.guiTop + this.ySize - combineTop,
|
||||||
|
"FORCE_COMBINE",
|
||||||
|
"DO_COMBINE");
|
||||||
|
this.combineEnableBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.combineEnableBtn);
|
||||||
|
|
||||||
|
this.combineDisableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + combineLeft,
|
||||||
|
this.guiTop + this.ySize - combineTop,
|
||||||
|
"NOT_COMBINE",
|
||||||
|
"DONT_COMBINE");
|
||||||
|
this.combineDisableBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.combineDisableBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 2 - getReservedSpace(),
|
||||||
|
4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
|
if (mouseButton == 3) {
|
||||||
|
if (this.container.isCraftingMode()
|
||||||
|
&& (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix
|
||||||
|
|| slot instanceof SlotPatternTerm)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
if (this.container.isCraftingMode()) {
|
||||||
|
return "gui/pattern.png";
|
||||||
|
}
|
||||||
|
return "gui/pattern2.png";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,226 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.ItemSubstitution;
|
||||||
|
import appeng.api.config.PatternBeSubstitution;
|
||||||
|
import appeng.api.config.PatternSlotConfig;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
|
||||||
|
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
||||||
|
|
||||||
|
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidPatternTerminalEx(inventoryPlayer, te));
|
||||||
|
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||||
|
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidPatternExWireless(inventoryPlayer, te));
|
||||||
|
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||||
|
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 97,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ItemSubstitution.ENABLED);
|
||||||
|
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||||
|
|
||||||
|
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 97,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ItemSubstitution.DISABLED);
|
||||||
|
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||||
|
|
||||||
|
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + 97,
|
||||||
|
this.guiTop + this.ySize - 114,
|
||||||
|
"FORCE_PRIO",
|
||||||
|
"DO_PRIO");
|
||||||
|
this.fluidPrioritizedEnabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.fluidPrioritizedEnabledBtn);
|
||||||
|
|
||||||
|
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + 97,
|
||||||
|
this.guiTop + this.ySize - 114,
|
||||||
|
"NOT_PRIO",
|
||||||
|
"DONT_PRIO");
|
||||||
|
this.fluidPrioritizedDisabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.fluidPrioritizedDisabledBtn);
|
||||||
|
|
||||||
|
invertBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 153,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
|
||||||
|
invertBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.invertBtn);
|
||||||
|
|
||||||
|
this.clearBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 163,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.CLOSE);
|
||||||
|
this.clearBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.clearBtn);
|
||||||
|
|
||||||
|
this.encodeBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 147,
|
||||||
|
this.guiTop + this.ySize - 142,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.ENCODE);
|
||||||
|
this.buttonList.add(this.encodeBtn);
|
||||||
|
|
||||||
|
if (ModAndClassUtil.isDoubleButton) {
|
||||||
|
this.doubleBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 97,
|
||||||
|
this.guiTop + this.ySize - 153,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
ActionItems.DOUBLE);
|
||||||
|
this.doubleBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.doubleBtn);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.combineEnableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 114,
|
||||||
|
"FORCE_COMBINE",
|
||||||
|
"DO_COMBINE");
|
||||||
|
this.combineEnableBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.combineEnableBtn);
|
||||||
|
|
||||||
|
this.combineDisableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 114,
|
||||||
|
"NOT_COMBINE",
|
||||||
|
"DONT_COMBINE");
|
||||||
|
this.combineDisableBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.combineDisableBtn);
|
||||||
|
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||||
|
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 103,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
PatternBeSubstitution.ENABLED);
|
||||||
|
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||||
|
|
||||||
|
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||||
|
this.guiLeft + 87,
|
||||||
|
this.guiTop + this.ySize - 103,
|
||||||
|
Settings.ACTIONS,
|
||||||
|
PatternBeSubstitution.DISABLED);
|
||||||
|
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||||
|
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||||
|
}
|
||||||
|
processingScrollBar.setTop(this.ySize - 164);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 2 - getReservedSpace(),
|
||||||
|
4210752);
|
||||||
|
this.processingScrollBar.draw(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return container.inverted ? "gui/pattern4.png" : "gui/pattern3.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||||
|
final int offset = container.inverted ? 18 * -3 : 0;
|
||||||
|
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
beSubstitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
beSubstitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||||
|
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||||
|
invertBtn.xPosition = this.guiLeft + 87 + offset;
|
||||||
|
combineEnableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||||
|
combineDisableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||||
|
processingScrollBar.setCurrentScroll(container.activePage);
|
||||||
|
super.drawScreen(mouseX, mouseY, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||||
|
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
|
||||||
|
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||||
|
changeActivePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClickMove(final int x, final int y, final int c, final long d) {
|
||||||
|
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||||
|
this.processingScrollBar.click(this, x - this.guiLeft, y - this.guiTop);
|
||||||
|
super.mouseClickMove(x, y, c, d);
|
||||||
|
|
||||||
|
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||||
|
changeActivePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMouseInput() {
|
||||||
|
super.handleMouseInput();
|
||||||
|
final int wheel = Mouse.getEventDWheel();
|
||||||
|
|
||||||
|
if (wheel != 0) {
|
||||||
|
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||||
|
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||||
|
|
||||||
|
if (this.processingScrollBar.contains(x - this.guiLeft, y - this.guiTop)) {
|
||||||
|
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||||
|
this.processingScrollBar.wheel(wheel);
|
||||||
|
|
||||||
|
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||||
|
changeActivePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeActivePage() {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.ActivePage",
|
||||||
|
String.valueOf(this.processingScrollBar.getCurrentScroll())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotDisabled;
|
||||||
|
|
||||||
|
public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
|
||||||
|
|
||||||
|
public GuiFluidPatternWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
} else {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidPortableCell;
|
||||||
|
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
|
||||||
|
public class GuiFluidPortableCell extends GuiFluidTerminal {
|
||||||
|
|
||||||
|
public GuiFluidPortableCell(final InventoryPlayer inventoryPlayer, final IFluidPortableCell te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidPortableCell(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getMaxRows() {
|
||||||
|
if (this.container.getHost() instanceof IWirelessTerminal) {
|
||||||
|
return super.getMaxRows();
|
||||||
|
} else {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidStorageBus;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.ActionItems;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.core.localization.GuiColors;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketConfigButton;
|
||||||
|
|
||||||
|
public class GuiFluidStorageBus extends GuiUpgradeable {
|
||||||
|
|
||||||
|
private GuiImgButton rwMode;
|
||||||
|
private GuiTabButton priority;
|
||||||
|
private GuiImgButton partition;
|
||||||
|
private GuiImgButton clear;
|
||||||
|
|
||||||
|
public GuiFluidStorageBus(InventoryPlayer inventoryPlayer, PartFluidStorageBus te) {
|
||||||
|
super(new ContainerFluidStorageBus(inventoryPlayer, te));
|
||||||
|
this.ySize = 251;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void addButtons() {
|
||||||
|
this.clear = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE);
|
||||||
|
this.partition = new GuiImgButton(this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH);
|
||||||
|
this.rwMode = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.guiTop + 48,
|
||||||
|
Settings.ACCESS,
|
||||||
|
AccessRestriction.READ_WRITE);
|
||||||
|
this.priority = new GuiTabButton(
|
||||||
|
this.guiLeft + 154,
|
||||||
|
this.guiTop,
|
||||||
|
2 + 4 * 16,
|
||||||
|
GuiText.Priority.getLocal(),
|
||||||
|
itemRender);
|
||||||
|
|
||||||
|
this.buttonList.add(this.priority);
|
||||||
|
this.buttonList.add(this.rwMode);
|
||||||
|
this.buttonList.add(this.partition);
|
||||||
|
this.buttonList.add(this.clear);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_STORAGE_BUS)),
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
GuiColors.StorageBusTitle.getColor());
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
GuiText.inventory.getLocal(),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 3,
|
||||||
|
GuiColors.StorageBusInventory.getColor());
|
||||||
|
|
||||||
|
if (this.rwMode != null) {
|
||||||
|
this.rwMode.set(((ContainerFluidStorageBus) this.cvb).getReadWriteMode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/storagebus.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
if (btn == this.partition) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Partition"));
|
||||||
|
} else if (btn == this.clear) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Clear"));
|
||||||
|
} else if (btn == this.priority) {
|
||||||
|
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||||
|
} else if (btn == this.rwMode) {
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.rwMode.getSetting(), backwards));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int id, IAEFluidStack stack) {
|
||||||
|
((ContainerFluidStorageBus) this.cvb).bus.setFluidInSlot(id, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.me.SlotME;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
|
||||||
|
public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||||
|
|
||||||
|
protected EntityPlayer player;
|
||||||
|
public ContainerFluidMonitor container;
|
||||||
|
|
||||||
|
public GuiFluidTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||||
|
super(inventoryPlayer, te, new ContainerFluidMonitor(inventoryPlayer, te));
|
||||||
|
this.container = new ContainerFluidMonitor(inventoryPlayer, te);
|
||||||
|
this.player = inventoryPlayer.player;
|
||||||
|
this.showViewBtn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GuiFluidTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||||
|
final ContainerFluidMonitor c) {
|
||||||
|
super(inventoryPlayer, te, c);
|
||||||
|
this.container = c;
|
||||||
|
this.player = inventoryPlayer.player;
|
||||||
|
this.showViewBtn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
if (s.isPlayerSide()) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
} else {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == craftingStatusBtn) {
|
||||||
|
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_146977_a(final Slot s) {
|
||||||
|
if (drawSlot0(s)) super.func_146977_a(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean drawSlot0(Slot slot) {
|
||||||
|
if (slot instanceof SlotME) {
|
||||||
|
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||||
|
if (stack == null) return true;
|
||||||
|
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||||
|
this.drawWidget(slot.xDisplayPosition, slot.yDisplayPosition, fluidStack.getFluid());
|
||||||
|
aeRenderItem.setAeStack(stack);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||||
|
aeRenderItem.renderItemOverlayIntoGUI(
|
||||||
|
fontRendererObj,
|
||||||
|
mc.getTextureManager(),
|
||||||
|
stack.getItemStack(),
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawWidget(int posX, int posY, Fluid fluid) {
|
||||||
|
if (fluid == null) return;
|
||||||
|
IIcon icon = fluid.getIcon();
|
||||||
|
if (icon == null) return;
|
||||||
|
|
||||||
|
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||||
|
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
GL11.glColor3f(
|
||||||
|
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||||
|
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||||
|
(fluid.getColor() & 0xFF) / 255.0F);
|
||||||
|
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glColor3f(1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
|
if (slot instanceof SlotME && Util.FluidUtil.isFluidContainer(player.inventory.getItemStack())) {
|
||||||
|
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||||
|
}
|
||||||
|
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(ItemStack itemStack) {
|
||||||
|
this.player.inventory.setItemStack(itemStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerIngredientBuffer;
|
||||||
|
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
||||||
|
import com.glodblock.github.inventory.IAEFluidTank;
|
||||||
|
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||||
|
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
import com.glodblock.github.util.RenderUtil;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiIngredientBuffer extends AEBaseGui {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
|
||||||
|
private static final int TANK_X = 47, TANK_X_OFF = 22, TANK_Y = 18;
|
||||||
|
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 74;
|
||||||
|
|
||||||
|
private final ContainerIngredientBuffer cont;
|
||||||
|
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||||
|
|
||||||
|
public GuiIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
||||||
|
super(new ContainerIngredientBuffer(ipl, tile));
|
||||||
|
this.cont = (ContainerIngredientBuffer) inventorySlots;
|
||||||
|
this.ySize = 222;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
mouseRegions.addRegion(
|
||||||
|
TANK_X + TANK_X_OFF * i,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||||
|
mouseRegions.addRegion(
|
||||||
|
TANK_X + 10 + 22 * i,
|
||||||
|
TANK_Y + TANK_HEIGHT + 2,
|
||||||
|
7,
|
||||||
|
7,
|
||||||
|
ButtonMouseHandler.dumpTank(cont, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||||
|
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||||
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
|
||||||
|
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||||
|
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
RenderUtil.renderFluidIntoGui(
|
||||||
|
this,
|
||||||
|
TANK_X + i * TANK_X_OFF,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
fluidInv.getFluidInSlot(i),
|
||||||
|
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||||
|
}
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
mouseRegions.render(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||||
|
cont.getTile().getInternalFluid().setFluidInSlot(slot, aeFluidStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,53 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.me.ItemRepo;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
|
||||||
|
|
||||||
|
public GuiItemMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerItemMonitor c) {
|
||||||
|
super(inventoryPlayer, te, c);
|
||||||
|
this.repo = new ItemRepo(getScrollBar(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postUpdate(final List<IAEItemStack> list, boolean resort) {
|
||||||
|
for (final IAEItemStack is : list) {
|
||||||
|
this.repo.postUpdate(is);
|
||||||
|
}
|
||||||
|
if (resort) {
|
||||||
|
this.repo.updateView();
|
||||||
|
}
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
|
||||||
|
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||||
|
super.drawScreen(mouseX, mouseY, btn);
|
||||||
|
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||||
|
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||||
|
setSearchString(displayName, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
|
||||||
|
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
|
||||||
|
import com.glodblock.github.inventory.IAEFluidTank;
|
||||||
|
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||||
|
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
import com.glodblock.github.util.RenderUtil;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/large_ingredient_buffer.png");
|
||||||
|
private static final int TANK_X = 13, TANK_X_OFF = 22, TANK_Y = 18;
|
||||||
|
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 37;
|
||||||
|
|
||||||
|
private final ContainerLargeIngredientBuffer cont;
|
||||||
|
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||||
|
|
||||||
|
public GuiLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
|
||||||
|
super(new ContainerLargeIngredientBuffer(ipl, tile));
|
||||||
|
this.cont = (ContainerLargeIngredientBuffer) inventorySlots;
|
||||||
|
this.ySize = 222;
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
mouseRegions.addRegion(
|
||||||
|
TANK_X + TANK_X_OFF * i,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||||
|
mouseRegions.addRegion(
|
||||||
|
TANK_X + 10 + 22 * i,
|
||||||
|
TANK_Y + TANK_HEIGHT + 2,
|
||||||
|
7,
|
||||||
|
7,
|
||||||
|
ButtonMouseHandler.dumpTank(cont, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||||
|
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj
|
||||||
|
.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||||
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
|
||||||
|
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||||
|
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
RenderUtil.renderFluidIntoGui(
|
||||||
|
this,
|
||||||
|
TANK_X + i * TANK_X_OFF,
|
||||||
|
TANK_Y,
|
||||||
|
TANK_WIDTH,
|
||||||
|
TANK_HEIGHT,
|
||||||
|
fluidInv.getFluidInSlot(i),
|
||||||
|
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||||
|
}
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
mouseRegions.render(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||||
|
cont.getTile().getInternalFluid().setFluidInSlot(slot, aeFluidStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,575 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||||
|
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
|
||||||
|
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
|
||||||
|
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.network.CPacketLevelMaintainer;
|
||||||
|
import com.glodblock.github.network.CPacketLevelMaintainer.Action;
|
||||||
|
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||||
|
import com.glodblock.github.util.FCGuiColors;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
import com.gtnewhorizon.gtnhlib.util.parsing.MathExpressionParser;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.util.DimensionalCoord;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.features.AEFeature;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketNEIDragClick;
|
||||||
|
import codechicken.nei.VisiblityData;
|
||||||
|
import codechicken.nei.api.INEIGuiHandler;
|
||||||
|
import codechicken.nei.api.TaggedInventoryArea;
|
||||||
|
import cofh.core.render.CoFHFontRenderer;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
|
||||||
|
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
|
||||||
|
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_maintainer.png");
|
||||||
|
private final ContainerLevelMaintainer cont;
|
||||||
|
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
|
||||||
|
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||||
|
private FCGuiTextField input;
|
||||||
|
private int lastWorkingTick;
|
||||||
|
private int refreshTick;
|
||||||
|
private final CoFHFontRenderer render;
|
||||||
|
protected ItemStack icon = null;
|
||||||
|
|
||||||
|
protected GuiType originalGui;
|
||||||
|
protected Util.DimensionalCoordSide originalBlockPos;
|
||||||
|
protected GuiTabButton originalGuiBtn;
|
||||||
|
|
||||||
|
protected static final boolean isGTNHLibLoaded = Loader.isModLoaded("gtnhlib");
|
||||||
|
protected static final Pattern numberPattern = isGTNHLibLoaded ? MathExpressionParser.EXPRESSION_PATTERN
|
||||||
|
: Pattern.compile("^[0-9]+");
|
||||||
|
|
||||||
|
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||||
|
super(new ContainerLevelMaintainer(ipl, tile));
|
||||||
|
this.cont = (ContainerLevelMaintainer) inventorySlots;
|
||||||
|
this.xSize = 195;
|
||||||
|
this.ySize = 214;
|
||||||
|
this.render = new CoFHFontRenderer(
|
||||||
|
Minecraft.getMinecraft().gameSettings,
|
||||||
|
TEX_BG,
|
||||||
|
Minecraft.getMinecraft().getTextureManager(),
|
||||||
|
true);
|
||||||
|
this.refreshTick = 0;
|
||||||
|
if (ipl.player.openContainer instanceof AEBaseContainer container) {
|
||||||
|
var target = container.getTarget();
|
||||||
|
if (target instanceof PartLevelTerminal terminal) {
|
||||||
|
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
DimensionalCoord blockPos = new DimensionalCoord(terminal.getTile());
|
||||||
|
originalBlockPos = new Util.DimensionalCoordSide(
|
||||||
|
blockPos.x,
|
||||||
|
blockPos.y,
|
||||||
|
blockPos.z,
|
||||||
|
blockPos.getDimension(),
|
||||||
|
terminal.getSide(),
|
||||||
|
"");
|
||||||
|
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||||
|
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||||
|
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
originalBlockPos = new Util.DimensionalCoordSide(
|
||||||
|
terminal.getInventorySlot(),
|
||||||
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
|
0,
|
||||||
|
ipl.player.worldObj.provider.dimensionId,
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
"");
|
||||||
|
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
|
||||||
|
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
originalBlockPos = new Util.DimensionalCoordSide(
|
||||||
|
terminal.getInventorySlot(),
|
||||||
|
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||||
|
0,
|
||||||
|
ipl.player.worldObj.provider.dimensionId,
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
"");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate(List<IAEItemStack> list) {
|
||||||
|
for (Slot slot : this.cont.getRequestSlots()) {
|
||||||
|
if (!slot.getHasStack()) {
|
||||||
|
component[slot.getSlotIndex()].setState(State.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (IAEItemStack is : list) {
|
||||||
|
NBTTagCompound data = is.getItemStack().getTagCompound();
|
||||||
|
if (data == null) {
|
||||||
|
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
|
||||||
|
AELog.info("Received empty configuration: ", is);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||||
|
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||||
|
int idx = data.getInteger(TLMTags.Index.tagName);
|
||||||
|
boolean isEnable = data.getBoolean(TLMTags.Enable.tagName);
|
||||||
|
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
|
||||||
|
component[idx].getQty().textField.setText(String.valueOf(quantity));
|
||||||
|
component[idx].getBatch().textField.setText(String.valueOf(batch));
|
||||||
|
component[idx].setEnable(isEnable);
|
||||||
|
component[idx].setState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.lastWorkingTick = this.refreshTick;
|
||||||
|
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||||
|
component[i] = new Component(
|
||||||
|
new Widget(
|
||||||
|
new FCGuiTextField(this.fontRendererObj, guiLeft + 46, guiTop + 19 + 19 * i, 52, 14),
|
||||||
|
NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE,
|
||||||
|
i,
|
||||||
|
Action.Quantity),
|
||||||
|
new Widget(
|
||||||
|
new FCGuiTextField(this.fontRendererObj, guiLeft + 100, guiTop + 19 + 19 * i, 52, 14),
|
||||||
|
NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE,
|
||||||
|
i,
|
||||||
|
Action.Batch),
|
||||||
|
new GuiFCImgButton(guiLeft + 105 + 47, guiTop + 17 + 19 * i, "SUBMIT", "SUBMIT", false),
|
||||||
|
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "ENABLE", "ENABLE", false),
|
||||||
|
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "DISABLE", "DISABLE", false),
|
||||||
|
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 125),
|
||||||
|
this.buttonList);
|
||||||
|
}
|
||||||
|
if (this.icon != null) {
|
||||||
|
this.originalGuiBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 151,
|
||||||
|
this.guiTop - 4,
|
||||||
|
this.icon,
|
||||||
|
this.icon.getDisplayName(),
|
||||||
|
itemRender);
|
||||||
|
this.originalGuiBtn.setHideEdge(13);
|
||||||
|
this.buttonList.add(originalGuiBtn);
|
||||||
|
}
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||||
|
this.refreshTick++;
|
||||||
|
super.drawScreen(mouseX, mouseY, btn);
|
||||||
|
for (Component com : this.component) {
|
||||||
|
com.getQty().textField.handleTooltip(mouseX, mouseY, this);
|
||||||
|
com.getBatch().textField.handleTooltip(mouseX, mouseY, this);
|
||||||
|
com.getLine().handleTooltip(mouseX, mouseY, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
int tick = this.refreshTick;
|
||||||
|
int interval = 20;
|
||||||
|
if (tick > lastWorkingTick + interval && this.input == null) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||||
|
lastWorkingTick = this.refreshTick;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||||
|
this.component[i].draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||||
|
mouseRegions.render(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_146977_a(final Slot s) {
|
||||||
|
if (drawSlot0(s)) super.func_146977_a(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean drawSlot0(Slot slot) {
|
||||||
|
if (slot instanceof SlotFake) {
|
||||||
|
IAEItemStack stack = ((SlotFluidConvertingFake) slot).getAeStack();
|
||||||
|
super.func_146977_a(new SlotSingleItem(slot));
|
||||||
|
if (stack == null) return true;
|
||||||
|
IAEItemStack fake = stack.copy();
|
||||||
|
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
|
||||||
|
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
|
||||||
|
} else {
|
||||||
|
fake.setStackSize(0);
|
||||||
|
}
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||||
|
aeRenderItem.setAeStack(fake);
|
||||||
|
aeRenderItem.renderItemOverlayIntoGUI(
|
||||||
|
fontRendererObj,
|
||||||
|
mc.getTextureManager(),
|
||||||
|
fake.getItemStack(),
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
if (btn == 0) {
|
||||||
|
if (input != null) {
|
||||||
|
input.setFocused(false);
|
||||||
|
}
|
||||||
|
for (Component com : this.component) {
|
||||||
|
FCGuiTextField textField = com.isMouseIn(xCoord, yCoord);
|
||||||
|
if (textField != null) {
|
||||||
|
textField.setFocused(true);
|
||||||
|
this.input = textField;
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.input = null;
|
||||||
|
}
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (this.input == null) {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.checkHotbarKeys(key)) {
|
||||||
|
if (!((character == ' ') && this.input.getText().isEmpty())) {
|
||||||
|
this.input.textboxKeyTyped(character, key);
|
||||||
|
}
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
if (!numberPattern.matcher(this.input.getText()).matches()) {
|
||||||
|
this.input.setTextColor(0xFF0000);
|
||||||
|
} else {
|
||||||
|
this.input.setTextColor(0xFFFFFF);
|
||||||
|
}
|
||||||
|
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||||
|
this.input.setFocused(false);
|
||||||
|
this.input = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
|
if (slot instanceof SlotFluidConvertingFake && this.cont.getPlayerInv().getItemStack() != null) {
|
||||||
|
this.component[slot.getSlotIndex()].getQty().textField
|
||||||
|
.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAmount(int idx, int stackSize) {
|
||||||
|
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == originalGuiBtn) {
|
||||||
|
switchGui();
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
for (Component com : this.component) {
|
||||||
|
if (com.sendToServer(btn)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchGui() {
|
||||||
|
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
|
||||||
|
CPacketLevelTerminalCommands.Action.BACK,
|
||||||
|
originalBlockPos.x,
|
||||||
|
originalBlockPos.y,
|
||||||
|
originalBlockPos.z,
|
||||||
|
originalBlockPos.getDimension(),
|
||||||
|
originalBlockPos.getSide());
|
||||||
|
if (originalGui != null) {
|
||||||
|
message.setOriginalGui(originalGui.ordinal());
|
||||||
|
}
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
|
||||||
|
return currentVisibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Rectangle getSlotArea(SlotFake slot) {
|
||||||
|
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||||
|
if (draggedStack != null) {
|
||||||
|
draggedStack.stackSize = 0;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < this.cont.getRequestSlots().length; i++) {
|
||||||
|
SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i];
|
||||||
|
if (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) {
|
||||||
|
ItemStack itemStack = createLevelValues(draggedStack.copy());
|
||||||
|
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
|
||||||
|
slot.putStack(itemStack);
|
||||||
|
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(itemStack, slot.getSlotIndex()));
|
||||||
|
this.updateAmount(slot.getSlotIndex(), itemStack.stackSize);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Component {
|
||||||
|
|
||||||
|
public boolean isEnable = true;
|
||||||
|
private final Widget qty;
|
||||||
|
private final Widget batch;
|
||||||
|
private final GuiFCImgButton disable;
|
||||||
|
private final GuiFCImgButton enable;
|
||||||
|
private final GuiFCImgButton submit;
|
||||||
|
private final FCGuiLineField line;
|
||||||
|
private State state;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
|
||||||
|
GuiFCImgButton disableBtn, FCGuiLineField line, List buttonList) {
|
||||||
|
this.qty = qtyInput;
|
||||||
|
this.batch = batchInput;
|
||||||
|
this.enable = enableBtn;
|
||||||
|
this.disable = disableBtn;
|
||||||
|
this.submit = submitBtn;
|
||||||
|
this.line = line;
|
||||||
|
this.state = State.None;
|
||||||
|
buttonList.add(this.submit);
|
||||||
|
buttonList.add(this.enable);
|
||||||
|
buttonList.add(this.disable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex() {
|
||||||
|
return this.qty.idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnable(boolean enable) {
|
||||||
|
this.isEnable = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean send(Widget widget) {
|
||||||
|
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
|
||||||
|
if (isGTNHLibLoaded) {
|
||||||
|
long value = (long) MathExpressionParser.parse(widget.textField.getText());
|
||||||
|
widget.textField.setText(String.valueOf(value));
|
||||||
|
}
|
||||||
|
if (!widget.textField.getText().isEmpty()
|
||||||
|
&& numberPattern.matcher(widget.textField.getText()).matches()) {
|
||||||
|
String str = widget.textField.getText().replaceAll("^(0+)", "");
|
||||||
|
widget.textField.setText(str.isEmpty() ? "0" : str);
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
|
||||||
|
widget.textField.setTextColor(0xFFFFFF);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
widget.textField.setTextColor(0xFF0000);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean sendToServer(GuiButton btn) {
|
||||||
|
boolean didSomething = false;
|
||||||
|
if (this.submit == btn) {
|
||||||
|
if (this.send(this.getQty())) this.send(this.getBatch());
|
||||||
|
didSomething = true;
|
||||||
|
} else if (this.enable == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
|
||||||
|
didSomething = true;
|
||||||
|
} else if (this.disable == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Disable, this.getIndex()));
|
||||||
|
didSomething = true;
|
||||||
|
}
|
||||||
|
return didSomething;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
|
||||||
|
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
|
||||||
|
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Widget getQty() {
|
||||||
|
return this.qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Widget getBatch() {
|
||||||
|
return this.batch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FCGuiLineField getLine() {
|
||||||
|
return this.line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
this.qty.draw();
|
||||||
|
this.batch.draw();
|
||||||
|
ArrayList<String> message = new ArrayList<>();
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
|
||||||
|
switch (this.state) {
|
||||||
|
case Idle -> {
|
||||||
|
this.line.setColor(FCGuiColors.StateIdle.getColor());
|
||||||
|
message.add(
|
||||||
|
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||||
|
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
|
||||||
|
}
|
||||||
|
case Craft -> {
|
||||||
|
this.line.setColor(FCGuiColors.StateCraft.getColor());
|
||||||
|
message.add(
|
||||||
|
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||||
|
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
|
||||||
|
}
|
||||||
|
case Export -> {
|
||||||
|
this.line.setColor(FCGuiColors.StateExport.getColor());
|
||||||
|
message.add(
|
||||||
|
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||||
|
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
|
||||||
|
}
|
||||||
|
case Error -> {
|
||||||
|
this.line.setColor(FCGuiColors.StateError.getColor());
|
||||||
|
message.add(
|
||||||
|
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||||
|
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
this.line.setColor(FCGuiColors.StateNone.getColor());
|
||||||
|
message.add(
|
||||||
|
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||||
|
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
message.add("");
|
||||||
|
if (isShiftKeyDown()) {
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE_DESC) + "\n");
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK_DESC) + "\n");
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC) + "\n");
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR_DESC));
|
||||||
|
} else {
|
||||||
|
message.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||||
|
}
|
||||||
|
this.line.setMessage(
|
||||||
|
render.wrapFormattedStringToWidth(String.join("\n", message), (int) Math.floor(xSize * 0.8)));
|
||||||
|
this.line.drawTextBox();
|
||||||
|
if (this.isEnable) {
|
||||||
|
this.enable.visible = true;
|
||||||
|
this.disable.visible = false;
|
||||||
|
} else {
|
||||||
|
this.enable.visible = false;
|
||||||
|
this.disable.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(State state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Widget {
|
||||||
|
|
||||||
|
public final int idx;
|
||||||
|
public final Action action;
|
||||||
|
private final FCGuiTextField textField;
|
||||||
|
private final String tooltip;
|
||||||
|
|
||||||
|
public Widget(FCGuiTextField textField, String tooltip, int idx, Action action) {
|
||||||
|
this.textField = textField;
|
||||||
|
this.textField.setEnableBackgroundDrawing(false);
|
||||||
|
this.textField.setText("0");
|
||||||
|
this.textField.setMaxStringLength(16); // this length is enough to be useful
|
||||||
|
this.idx = idx;
|
||||||
|
this.action = action;
|
||||||
|
this.tooltip = tooltip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw() {
|
||||||
|
if (isShiftKeyDown()) {
|
||||||
|
this.setTooltip(render.wrapFormattedStringToWidth(NameConst.i18n(this.tooltip), xSize / 2));
|
||||||
|
} else {
|
||||||
|
this.setTooltip(
|
||||||
|
render.wrapFormattedStringToWidth(
|
||||||
|
NameConst.i18n(this.tooltip, "\n", false) + "\n"
|
||||||
|
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
|
||||||
|
(int) Math.floor(xSize * 0.8)));
|
||||||
|
}
|
||||||
|
this.textField.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTooltip(String message) {
|
||||||
|
this.textField.setMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
|
||||||
|
public class GuiLevelWireless extends GuiLevelTerminal {
|
||||||
|
|
||||||
|
public GuiLevelWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||||
|
super(inventoryPlayer, new ContainerLevelWireless(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlots() {
|
||||||
|
for (final Object obj : this.inventorySlots.inventorySlots) {
|
||||||
|
if (obj instanceof final AppEngSlot slot) {
|
||||||
|
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
||||||
|
import com.glodblock.github.common.tile.TileOCPatternEditor;
|
||||||
|
import com.glodblock.github.util.NameConst;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiOCPatternEditor extends AEBaseGui {
|
||||||
|
|
||||||
|
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/oc_pattern_editor.png");
|
||||||
|
|
||||||
|
public GuiOCPatternEditor(InventoryPlayer ipl, TileOCPatternEditor tile) {
|
||||||
|
super(new ContainerOCPatternEditor(ipl, tile));
|
||||||
|
this.ySize = 186;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
mc.getTextureManager().bindTexture(TEX_BG);
|
||||||
|
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_OC_PATTERN_EDITOR)), 8, 6, 0x404040);
|
||||||
|
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.base.FCGuiAmount;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.network.CPacketPatternValueSet;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiPatternValueAmount extends FCGuiAmount {
|
||||||
|
|
||||||
|
public GuiPatternValueAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||||
|
super(new ContainerPatternValueAmount(inventoryPlayer, te));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.submit.displayString = GuiText.Set.getLocal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
try {
|
||||||
|
int result = getAmount();
|
||||||
|
this.submit.enabled = result > 0;
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.submit.enabled = false;
|
||||||
|
}
|
||||||
|
this.amountBox.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
try {
|
||||||
|
if (btn == this.submit && btn.enabled) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketPatternValueSet(
|
||||||
|
originalGui.ordinal(),
|
||||||
|
getAmount(),
|
||||||
|
((ContainerPatternValueAmount) this.inventorySlots).getValueIndex()));
|
||||||
|
}
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
this.amountBox.setText("1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setOriginGUI(Object target) {
|
||||||
|
if (target instanceof PartFluidPatternTerminal) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||||
|
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||||
|
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||||
|
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||||
|
this.originalGui = GuiType.WIRELESS_FLUID_PATTERN_TERMINAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackground() {
|
||||||
|
return "guis/craftAmt.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAmount(int amount) {
|
||||||
|
this.amountBox.setText(String.valueOf(amount));
|
||||||
|
this.amountBox.setSelectionPos(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.ContainerRenamer;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
|
||||||
|
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.network.CPacketRenamer;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.client.gui.widgets.IDropToFillTextField;
|
||||||
|
import appeng.client.gui.widgets.MEGuiTextField;
|
||||||
|
import appeng.core.localization.GuiColors;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
|
||||||
|
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||||
|
|
||||||
|
protected final MEGuiTextField textField;
|
||||||
|
|
||||||
|
protected final ITerminalHost host;
|
||||||
|
protected GuiTabButton originalGuiBtn;
|
||||||
|
|
||||||
|
protected ItemStack icon = null;
|
||||||
|
|
||||||
|
protected GuiType originalGui;
|
||||||
|
|
||||||
|
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||||
|
super(new ContainerRenamer(ip, monitorable));
|
||||||
|
this.host = monitorable;
|
||||||
|
this.xSize = 256;
|
||||||
|
|
||||||
|
this.textField = new MEGuiTextField(230, 12);
|
||||||
|
this.textField.setMaxStringLength(32);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
|
||||||
|
if (host instanceof PartLevelTerminal) {
|
||||||
|
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
} else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host)) {
|
||||||
|
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||||
|
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||||
|
} else if (host instanceof WirelessLevelTerminalInventory) {
|
||||||
|
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||||
|
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||||
|
} else if (host instanceof WirelessInterfaceTerminalInventory) {
|
||||||
|
icon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
|
||||||
|
originalGui = GuiType.WIRELESS_INTERFACE_TERMINAL;
|
||||||
|
}
|
||||||
|
if (this.icon != null) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.originalGuiBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 231,
|
||||||
|
this.guiTop - 4,
|
||||||
|
this.icon,
|
||||||
|
this.icon.getDisplayName(),
|
||||||
|
itemRender));
|
||||||
|
this.originalGuiBtn.setHideEdge(13);
|
||||||
|
}
|
||||||
|
this.textField.x = this.guiLeft + 12;
|
||||||
|
this.textField.y = this.guiTop + 35;
|
||||||
|
this.textField.setFocused(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
this.fontRendererObj.drawString(GuiText.Renamer.getLocal(), 12, 8, GuiColors.RenamerTitle.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||||
|
this.bindTexture("guis/renamer.png");
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||||
|
this.textField.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
this.textField.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(this.textField.getText()));
|
||||||
|
} else if (!this.textField.textboxKeyTyped(character, key)) {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOverTextField(final int mousex, final int mousey) {
|
||||||
|
return textField.isMouseIn(mousex, mousey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button) {
|
||||||
|
if (button == originalGuiBtn) {
|
||||||
|
switchGui();
|
||||||
|
} else {
|
||||||
|
super.actionPerformed(button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void switchGui() {
|
||||||
|
if (originalGui != null) {
|
||||||
|
InventoryHandler.switchGui(originalGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
|
||||||
|
textField.setText(displayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate(String text) {
|
||||||
|
this.textField.setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.glodblock.github.client.gui;
|
||||||
|
|
||||||
|
public interface ITankDump {
|
||||||
|
|
||||||
|
boolean canDumpTank(int index);
|
||||||
|
|
||||||
|
void dumpTank(int index);
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
package com.glodblock.github.client.gui.base;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.GuiEssentiaTerminal;
|
||||||
|
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||||
|
import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
|
||||||
|
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
|
||||||
|
import com.glodblock.github.client.gui.GuiFluidPatternWireless;
|
||||||
|
import com.glodblock.github.client.gui.GuiFluidPortableCell;
|
||||||
|
import com.glodblock.github.client.gui.GuiInterfaceWireless;
|
||||||
|
import com.glodblock.github.client.gui.GuiLevelWireless;
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||||
|
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseMEGui;
|
||||||
|
|
||||||
|
public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||||
|
|
||||||
|
protected GuiFCImgButton FluidTerminal;
|
||||||
|
protected GuiFCImgButton CraftingTerminal;
|
||||||
|
protected GuiFCImgButton PatternTerminal;
|
||||||
|
protected GuiFCImgButton EssentiaTerminal;
|
||||||
|
protected GuiFCImgButton InterfaceTerminal;
|
||||||
|
protected GuiFCImgButton LevelTerminal;
|
||||||
|
protected GuiFCImgButton PatternTerminalEx;
|
||||||
|
protected List<GuiFCImgButton> termBtns = new ArrayList<>();
|
||||||
|
protected boolean drawSwitchGuiBtn;
|
||||||
|
|
||||||
|
public FCBaseMEGui(final InventoryPlayer inventoryPlayer, Container container) {
|
||||||
|
super(container);
|
||||||
|
if (container instanceof FCBaseContainer) {
|
||||||
|
Object target = ((FCBaseContainer) container).getTarget();
|
||||||
|
if (target instanceof IWirelessTerminal
|
||||||
|
&& ((IWirelessTerminal) target).getItemStack().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||||
|
this.drawSwitchGuiBtn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
super.onGuiClosed();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initGuiDone() {
|
||||||
|
if (drawSwitchGuiBtn) {
|
||||||
|
drawSwitchGuiBtns();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract int getOffsetY();
|
||||||
|
|
||||||
|
public abstract void setOffsetY(int y);
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void drawSwitchGuiBtns() {
|
||||||
|
if (!drawSwitchGuiBtn) return;
|
||||||
|
if (!termBtns.isEmpty()) {
|
||||||
|
this.termBtns.clear();
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiFluidCraftingWireless)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.CraftingTerminal = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.getOffsetY(),
|
||||||
|
"CRAFT_TEM",
|
||||||
|
"YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.CraftingTerminal);
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiFluidPatternWireless)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.PatternTerminal = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.getOffsetY(),
|
||||||
|
"PATTERN_TEM",
|
||||||
|
"YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.PatternTerminal);
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiFluidPatternExWireless)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.PatternTerminalEx = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.getOffsetY(),
|
||||||
|
"PATTERN_EX_TEM",
|
||||||
|
"YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.PatternTerminalEx);
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiFluidPortableCell)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "FLUID_TEM", "YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.FluidTerminal);
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiInterfaceWireless)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.InterfaceTerminal = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.getOffsetY(),
|
||||||
|
"INTERFACE_TEM",
|
||||||
|
"YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.InterfaceTerminal);
|
||||||
|
}
|
||||||
|
if (!(this instanceof GuiLevelWireless)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.LevelTerminal);
|
||||||
|
}
|
||||||
|
if (ModAndClassUtil.ThE && !(this instanceof GuiEssentiaTerminal)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.EssentiaTerminal = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.getOffsetY(),
|
||||||
|
"ESSENTIA_TEM",
|
||||||
|
"YES"));
|
||||||
|
this.setOffsetY(this.getOffsetY() + 20);
|
||||||
|
termBtns.add(this.EssentiaTerminal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
protected void addSwitchGuiBtns() {
|
||||||
|
if (!drawSwitchGuiBtn) return;
|
||||||
|
this.buttonList.addAll(termBtns);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn instanceof GuiFCImgButton) {
|
||||||
|
if (btn == this.FluidTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_TERMINAL);
|
||||||
|
} else if (btn == this.CraftingTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_CRAFTING_TERMINAL);
|
||||||
|
} else if (btn == this.EssentiaTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_ESSENTIA_TERMINAL);
|
||||||
|
} else if (btn == this.PatternTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||||
|
} else if (btn == this.InterfaceTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||||
|
} else if (btn == this.LevelTerminal) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||||
|
} else if (btn == this.PatternTerminalEx) {
|
||||||
|
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package com.glodblock.github.client.gui.base;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
|
||||||
|
import appeng.client.gui.AEBaseGui;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.util.calculators.ArithHelper;
|
||||||
|
import appeng.util.calculators.Calculator;
|
||||||
|
|
||||||
|
public abstract class FCGuiAmount extends AEBaseGui {
|
||||||
|
|
||||||
|
protected GuiTextField amountBox;
|
||||||
|
protected GuiTabButton originalGuiBtn;
|
||||||
|
protected GuiButton submit;
|
||||||
|
protected GuiButton plus1;
|
||||||
|
protected GuiButton plus10;
|
||||||
|
protected GuiButton plus100;
|
||||||
|
protected GuiButton plus1000;
|
||||||
|
protected GuiButton minus1;
|
||||||
|
protected GuiButton minus10;
|
||||||
|
protected GuiButton minus100;
|
||||||
|
protected GuiButton minus1000;
|
||||||
|
protected GuiType originalGui;
|
||||||
|
protected ItemStack myIcon;
|
||||||
|
|
||||||
|
public FCGuiAmount(Container container) {
|
||||||
|
super(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
final int a = getIncrementQuantity(0);
|
||||||
|
final int b = getIncrementQuantity(1);
|
||||||
|
final int c = getIncrementQuantity(2);
|
||||||
|
final int d = getIncrementQuantity(3);
|
||||||
|
|
||||||
|
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
|
||||||
|
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
|
||||||
|
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c));
|
||||||
|
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d));
|
||||||
|
|
||||||
|
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a));
|
||||||
|
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b));
|
||||||
|
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
|
||||||
|
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.submit = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||||
|
|
||||||
|
setOriginGUI(((AEBaseContainer) this.inventorySlots).getTarget());
|
||||||
|
if (this.originalGui != null && this.myIcon != null) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.originalGuiBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 151,
|
||||||
|
this.guiTop - 4,
|
||||||
|
this.myIcon,
|
||||||
|
this.myIcon.getDisplayName(),
|
||||||
|
itemRender));
|
||||||
|
this.originalGuiBtn.setHideEdge(13);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.amountBox = new GuiTextField(
|
||||||
|
this.fontRendererObj,
|
||||||
|
this.guiLeft + 62,
|
||||||
|
this.guiTop + 57,
|
||||||
|
59,
|
||||||
|
this.fontRendererObj.FONT_HEIGHT);
|
||||||
|
this.amountBox.setEnableBackgroundDrawing(false);
|
||||||
|
this.amountBox.setMaxStringLength(16);
|
||||||
|
this.amountBox.setTextColor(0xFFFFFF);
|
||||||
|
this.amountBox.setVisible(true);
|
||||||
|
this.amountBox.setFocused(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getIncrementQuantity(int i) {
|
||||||
|
return AEConfig.instance.craftItemsByStackAmounts(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.bindTexture(getBackground());
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (!this.checkHotbarKeys(key)) {
|
||||||
|
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||||
|
this.actionPerformed(this.submit);
|
||||||
|
}
|
||||||
|
this.amountBox.textboxKeyTyped(character, key);
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
if (btn == this.originalGuiBtn) {
|
||||||
|
InventoryHandler.switchGui(originalGui);
|
||||||
|
}
|
||||||
|
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||||
|
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|
||||||
|
|| btn == this.minus100
|
||||||
|
|| btn == this.minus1000;
|
||||||
|
|
||||||
|
if (isPlus || isMinus) {
|
||||||
|
this.addQty(this.getQty(btn));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addQty(final int i) {
|
||||||
|
try {
|
||||||
|
long resultI = getAmount();
|
||||||
|
if (resultI == 1 && i > 1) {
|
||||||
|
resultI = 0;
|
||||||
|
}
|
||||||
|
resultI += i;
|
||||||
|
if (resultI < 1) {
|
||||||
|
resultI = 1;
|
||||||
|
}
|
||||||
|
String out = Long.toString(resultI);
|
||||||
|
this.amountBox.setText(out);
|
||||||
|
} catch (final NumberFormatException ignore) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void setOriginGUI(Object target);
|
||||||
|
|
||||||
|
protected abstract String getBackground();
|
||||||
|
|
||||||
|
protected int getAmount() {
|
||||||
|
try {
|
||||||
|
String out = this.amountBox.getText();
|
||||||
|
double result = Calculator.conversion(out);
|
||||||
|
if (result <= 0 || Double.isNaN(result)) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return (int) ArithHelper.round(result, 0);
|
||||||
|
}
|
||||||
|
} catch (final NumberFormatException e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.glodblock.github.client.gui.base;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||||
|
import com.glodblock.github.client.gui.GuiItemMonitor;
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||||
|
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||||
|
|
||||||
|
private static final String SUBSTITUTION_DISABLE = "0";
|
||||||
|
private static final String SUBSTITUTION_ENABLE = "1";
|
||||||
|
private static final String PRIORITY_DISABLE = "0";
|
||||||
|
private static final String PRIORITY_ENABLE = "1";
|
||||||
|
private static final String MODE_CRAFTING = "1";
|
||||||
|
private static final String MODE_PROCESSING = "0";
|
||||||
|
public FCContainerEncodeTerminal container;
|
||||||
|
protected GuiTabButton tabCraftButton;
|
||||||
|
protected GuiTabButton tabProcessButton;
|
||||||
|
protected GuiImgButton substitutionsEnabledBtn;
|
||||||
|
protected GuiImgButton substitutionsDisabledBtn;
|
||||||
|
protected GuiFCImgButton fluidPrioritizedEnabledBtn;
|
||||||
|
protected GuiFCImgButton fluidPrioritizedDisabledBtn;
|
||||||
|
protected GuiImgButton encodeBtn;
|
||||||
|
protected GuiImgButton invertBtn;
|
||||||
|
protected GuiImgButton clearBtn;
|
||||||
|
protected GuiImgButton doubleBtn;
|
||||||
|
protected GuiImgButton beSubstitutionsEnabledBtn;
|
||||||
|
protected GuiImgButton beSubstitutionsDisabledBtn;
|
||||||
|
protected GuiFCImgButton combineEnableBtn;
|
||||||
|
protected GuiFCImgButton combineDisableBtn;
|
||||||
|
protected GuiFCImgButton autoFillPatternEnableBtn;
|
||||||
|
protected GuiFCImgButton autoFillPatternDisableBtn;
|
||||||
|
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
|
||||||
|
|
||||||
|
public FCGuiEncodeTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||||
|
final FCContainerEncodeTerminal c) {
|
||||||
|
super(inventoryPlayer, te, c);
|
||||||
|
this.container = (FCContainerEncodeTerminal) this.inventorySlots;
|
||||||
|
c.setGui(this);
|
||||||
|
setReservedSpace(81);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
super.initGui();
|
||||||
|
this.buttonList.add(
|
||||||
|
this.autoFillPatternEnableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
"FILL_PATTERN",
|
||||||
|
"DO_FILL"));
|
||||||
|
this.buttonList.add(
|
||||||
|
this.autoFillPatternDisableBtn = new GuiFCImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
"NOT_FILL_PATTERN",
|
||||||
|
"DONT_FILL"));
|
||||||
|
this.offsetY += 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
if (btn == craftingStatusBtn) {
|
||||||
|
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||||
|
} else if (this.tabCraftButton == btn || this.tabProcessButton == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.CraftMode",
|
||||||
|
this.tabProcessButton == btn ? MODE_CRAFTING : MODE_PROCESSING));
|
||||||
|
} else if (this.encodeBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.Encode",
|
||||||
|
(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
|
||||||
|
} else if (this.clearBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Clear", "1"));
|
||||||
|
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.Substitute",
|
||||||
|
this.substitutionsEnabledBtn == btn ? SUBSTITUTION_DISABLE : SUBSTITUTION_ENABLE));
|
||||||
|
} else if (this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.Prioritize",
|
||||||
|
isShiftKeyDown() ? "2" : (container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE)));
|
||||||
|
} else if (this.invertBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns("PatternTerminal.Invert", container.inverted ? "0" : "1"));
|
||||||
|
} else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.Combine",
|
||||||
|
this.combineDisableBtn == btn ? "1" : "0"));
|
||||||
|
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.Double",
|
||||||
|
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||||
|
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler
|
||||||
|
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||||
|
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler
|
||||||
|
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||||
|
} else if (this.autoFillPatternDisableBtn == btn || this.autoFillPatternEnableBtn == btn) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketFluidPatternTermBtns(
|
||||||
|
"PatternTerminal.AutoFillerPattern",
|
||||||
|
this.autoFillPatternDisableBtn == btn ? "1" : "0"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
updateButton(this.tabCraftButton, this.container.isCraftingMode());
|
||||||
|
updateButton(this.tabProcessButton, !this.container.isCraftingMode());
|
||||||
|
updateButton(this.doubleBtn, !this.container.isCraftingMode());
|
||||||
|
updateButton(this.substitutionsEnabledBtn, this.container.substitute);
|
||||||
|
updateButton(this.substitutionsDisabledBtn, !this.container.substitute);
|
||||||
|
updateButton(this.combineEnableBtn, !this.container.isCraftingMode() && this.container.combine);
|
||||||
|
updateButton(this.combineDisableBtn, !this.container.isCraftingMode() && !this.container.combine);
|
||||||
|
updateButton(this.beSubstitutionsEnabledBtn, this.container.beSubstitute);
|
||||||
|
updateButton(this.beSubstitutionsDisabledBtn, !this.container.beSubstitute);
|
||||||
|
updateButton(this.fluidPrioritizedEnabledBtn, this.container.prioritize);
|
||||||
|
updateButton(this.fluidPrioritizedDisabledBtn, !this.container.prioritize);
|
||||||
|
updateButton(this.autoFillPatternEnableBtn, this.container.autoFillPattern);
|
||||||
|
updateButton(this.autoFillPatternDisableBtn, !this.container.autoFillPattern);
|
||||||
|
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateButton(GuiButton button, boolean vis) {
|
||||||
|
if (button != null) {
|
||||||
|
button.visible = vis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
if (s.isPlayerSide()) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
} else {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void func_146977_a(final Slot s) {
|
||||||
|
if (drawSlot0(s)) super.func_146977_a(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean drawSlot0(Slot slot) {
|
||||||
|
if (slot instanceof SlotFake && !this.container.isCraftingMode()) {
|
||||||
|
AEItemStack stack = AEItemStack.create(slot.getStack());
|
||||||
|
super.func_146977_a(new SlotSingleItem(slot));
|
||||||
|
if (stack == null) return true;
|
||||||
|
IAEItemStack fake = stack.copy();
|
||||||
|
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||||
|
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||||
|
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||||
|
} else return true;
|
||||||
|
aeRenderItem.setAeStack(fake);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||||
|
aeRenderItem.renderItemOverlayIntoGUI(
|
||||||
|
fontRendererObj,
|
||||||
|
mc.getTextureManager(),
|
||||||
|
stack.getItemStack(),
|
||||||
|
slot.xDisplayPosition,
|
||||||
|
slot.yDisplayPosition);
|
||||||
|
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,791 @@
|
|||||||
|
package com.glodblock.github.client.gui.base;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.FCGuiTextField;
|
||||||
|
import com.glodblock.github.client.gui.GuiItemMonitor;
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.network.CPacketInventoryAction;
|
||||||
|
import com.glodblock.github.util.Ae2ReflectClient;
|
||||||
|
import com.glodblock.github.util.ModAndClassUtil;
|
||||||
|
|
||||||
|
import appeng.api.config.CraftingStatus;
|
||||||
|
import appeng.api.config.SearchBoxMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.TerminalStyle;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import appeng.api.storage.data.IDisplayRepo;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.api.util.IConfigurableObject;
|
||||||
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
|
import appeng.client.gui.widgets.IDropToFillTextField;
|
||||||
|
import appeng.client.gui.widgets.ISortSource;
|
||||||
|
import appeng.client.me.InternalSlotME;
|
||||||
|
import appeng.client.me.SlotDisconnected;
|
||||||
|
import appeng.client.me.SlotME;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.AppEngSlot;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
|
import appeng.container.slot.SlotDisabled;
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.core.localization.ButtonToolTips;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.integration.IntegrationRegistry;
|
||||||
|
import appeng.integration.IntegrationType;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
import codechicken.nei.LayoutManager;
|
||||||
|
import codechicken.nei.util.TextHistory;
|
||||||
|
|
||||||
|
public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||||
|
implements ISortSource, IConfigManagerHost, IDropToFillTextField {
|
||||||
|
|
||||||
|
public static int craftingGridOffsetX;
|
||||||
|
public static int craftingGridOffsetY;
|
||||||
|
protected static String memoryText = "";
|
||||||
|
protected final int offsetX = 9;
|
||||||
|
protected final int lowerTextureOffset = 0;
|
||||||
|
public IConfigManager configSrc;
|
||||||
|
protected final boolean viewCell;
|
||||||
|
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
|
||||||
|
public FCContainerMonitor<T> monitorableContainer;
|
||||||
|
public GuiTabButton craftingStatusBtn;
|
||||||
|
protected IDisplayRepo repo;
|
||||||
|
protected GuiImgButton craftingStatusImgBtn;
|
||||||
|
protected FCGuiTextField searchField;
|
||||||
|
protected int perRow = 9;
|
||||||
|
protected int reservedSpace = 0;
|
||||||
|
protected boolean customSortOrder = true;
|
||||||
|
protected boolean showViewBtn = true;
|
||||||
|
protected int rows = 0;
|
||||||
|
protected int maxRows = Integer.MAX_VALUE;
|
||||||
|
protected int standardSize;
|
||||||
|
protected int offsetY;
|
||||||
|
protected GuiImgButton ViewBox;
|
||||||
|
protected GuiImgButton SortByBox;
|
||||||
|
protected GuiImgButton SortDirBox;
|
||||||
|
protected GuiImgButton searchBoxSettings;
|
||||||
|
protected GuiImgButton terminalStyleBox;
|
||||||
|
protected GuiImgButton searchStringSave;
|
||||||
|
protected GuiImgButton typeFilter;
|
||||||
|
protected boolean hasShiftKeyDown = false;
|
||||||
|
private boolean reInitializationRequested = false;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||||
|
super(inventoryPlayer, c);
|
||||||
|
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||||
|
this.setScrollBar(scrollbar);
|
||||||
|
this.xSize = 195;
|
||||||
|
this.ySize = 204;
|
||||||
|
this.standardSize = this.xSize;
|
||||||
|
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
|
||||||
|
(this.monitorableContainer = (FCContainerMonitor<T>) this.inventorySlots).setGui(this);
|
||||||
|
this.viewCell = te instanceof IViewCellStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOffsetY() {
|
||||||
|
return offsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOffsetY(int y) {
|
||||||
|
offsetY = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void postUpdate(final List<T> list, boolean resort);
|
||||||
|
|
||||||
|
protected void setScrollBar() {
|
||||||
|
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
|
||||||
|
this.getScrollBar().setRange(
|
||||||
|
0,
|
||||||
|
(this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
|
||||||
|
Math.max(1, this.rows / 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(final GuiButton btn) {
|
||||||
|
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
|
||||||
|
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||||
|
}
|
||||||
|
if (btn instanceof final GuiImgButton iBtn) {
|
||||||
|
final boolean backwards = Mouse.isButtonDown(1);
|
||||||
|
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||||
|
final Enum<?> cv = iBtn.getCurrentValue();
|
||||||
|
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||||
|
if (btn == this.terminalStyleBox) {
|
||||||
|
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||||
|
} else if (btn == this.searchBoxSettings) {
|
||||||
|
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||||
|
} else if (ModAndClassUtil.isSaveText && btn == this.searchStringSave) {
|
||||||
|
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
NetworkHandler.instance
|
||||||
|
.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||||
|
} catch (final IOException e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iBtn.set(next);
|
||||||
|
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||||
|
this.reInitalize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.actionPerformed(btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void reInitalize() {
|
||||||
|
reInitializationRequested = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void initGui() {
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
|
||||||
|
this.maxRows = this.getMaxRows();
|
||||||
|
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9
|
||||||
|
: 9 + ((this.width - this.standardSize) / 18);
|
||||||
|
|
||||||
|
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||||
|
|
||||||
|
final int NEI = hasNEI ? 1 : 0;
|
||||||
|
int top = hasNEI ? 22 : 0;
|
||||||
|
|
||||||
|
final int magicNumber = 114 + 1;
|
||||||
|
final int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
|
||||||
|
|
||||||
|
this.rows = (int) Math.floor(extraSpace / 18.0);
|
||||||
|
if (this.rows > this.maxRows) {
|
||||||
|
this.rows = this.maxRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasNEI) {
|
||||||
|
this.rows--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.rows < 3) {
|
||||||
|
this.rows = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getMeSlots().clear();
|
||||||
|
for (int y = 0; y < this.rows; y++) {
|
||||||
|
for (int x = 0; x < this.perRow; x++) {
|
||||||
|
this.getMeSlots()
|
||||||
|
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL) {
|
||||||
|
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
|
||||||
|
} else {
|
||||||
|
this.xSize = this.standardSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initGui();
|
||||||
|
// full size : 204
|
||||||
|
// extra slots : 72
|
||||||
|
// slot 18
|
||||||
|
|
||||||
|
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
||||||
|
final int unusedSpace = this.height - this.ySize;
|
||||||
|
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||||
|
|
||||||
|
this.offsetY = this.guiTop + 8;
|
||||||
|
|
||||||
|
if (this.customSortOrder) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.SortByBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.SORT_BY,
|
||||||
|
this.configSrc.getSetting(Settings.SORT_BY)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
}
|
||||||
|
if (this.showViewBtn) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.ViewBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.VIEW_MODE,
|
||||||
|
this.configSrc.getSetting(Settings.VIEW_MODE)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
}
|
||||||
|
if (ModAndClassUtil.isTypeFilter && this instanceof GuiItemMonitor) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.typeFilter = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.TYPE_FILTER,
|
||||||
|
this.configSrc.getSetting(Settings.TYPE_FILTER)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.SortDirBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.SORT_DIRECTION,
|
||||||
|
this.configSrc.getSetting(Settings.SORT_DIRECTION)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.searchBoxSettings = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.SEARCH_MODE,
|
||||||
|
AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
|
||||||
|
if (ModAndClassUtil.isSaveText) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.searchStringSave = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.SAVE_SEARCH,
|
||||||
|
AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO));
|
||||||
|
this.offsetY += 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.buttonList.add(
|
||||||
|
this.terminalStyleBox = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.TERMINAL_STYLE,
|
||||||
|
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
|
||||||
|
// Right now 80 > offsetX, but that can be changed later.
|
||||||
|
// noinspection DataFlowIssue
|
||||||
|
this.searchField = new FCGuiTextField(
|
||||||
|
this.fontRendererObj,
|
||||||
|
this.guiLeft + Math.max(80, this.offsetX),
|
||||||
|
this.guiTop + 4,
|
||||||
|
90,
|
||||||
|
12);
|
||||||
|
this.searchField.setEnableBackgroundDrawing(false);
|
||||||
|
this.searchField.setMaxStringLength(25);
|
||||||
|
this.searchField.setTextColor(0xFFFFFF);
|
||||||
|
this.searchField.setVisible(true);
|
||||||
|
if (ModAndClassUtil.isSearchStringTooltip)
|
||||||
|
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
|
||||||
|
|
||||||
|
if (this.viewCell) {
|
||||||
|
if (ModAndClassUtil.isCraftStatus && AEConfig.instance.getConfigManager()
|
||||||
|
.getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.craftingStatusImgBtn = new GuiImgButton(
|
||||||
|
this.guiLeft - 18,
|
||||||
|
this.offsetY,
|
||||||
|
Settings.CRAFTING_STATUS,
|
||||||
|
AEConfig.instance.settings.getSetting(Settings.CRAFTING_STATUS)));
|
||||||
|
this.offsetY += 20;
|
||||||
|
} else {
|
||||||
|
this.buttonList.add(
|
||||||
|
this.craftingStatusBtn = new GuiTabButton(
|
||||||
|
this.guiLeft + 170,
|
||||||
|
this.guiTop - 4,
|
||||||
|
2 + 11 * 16,
|
||||||
|
GuiText.CraftingStatus.getLocal(),
|
||||||
|
itemRender));
|
||||||
|
this.craftingStatusBtn.setHideEdge(13); // GuiTabButton implementation //
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum<?> setting = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||||
|
this.searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
|
||||||
|
|
||||||
|
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui())) {
|
||||||
|
setSearchString(memoryText, false);
|
||||||
|
}
|
||||||
|
if (this.isSubGui()) {
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||||
|
craftingGridOffsetY = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
for (final Object s : this.inventorySlots.inventorySlots) {
|
||||||
|
if (s instanceof AppEngSlot) {
|
||||||
|
if (((Slot) s).xDisplayPosition < 195 || s instanceof SlotDisabled) {
|
||||||
|
this.repositionSlot((AppEngSlot) s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix) {
|
||||||
|
final Slot g = (Slot) s;
|
||||||
|
if (g.xDisplayPosition > 0 && g.yDisplayPosition > 0) {
|
||||||
|
craftingGridOffsetX = Math.min(craftingGridOffsetX, g.xDisplayPosition);
|
||||||
|
craftingGridOffsetY = Math.min(craftingGridOffsetY, g.yDisplayPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
craftingGridOffsetX -= 25;
|
||||||
|
craftingGridOffsetY -= 6;
|
||||||
|
initGuiDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchString(String memoryText, boolean updateView) {
|
||||||
|
this.searchField.setText(memoryText);
|
||||||
|
this.repo.setSearchString(memoryText);
|
||||||
|
if (updateView) {
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||||
|
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||||
|
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
|
||||||
|
this.searchField.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||||
|
setSearchString("", true);
|
||||||
|
}
|
||||||
|
super.mouseClicked(xCoord, yCoord, btn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMouseInput() {
|
||||||
|
final int wheel = Mouse.getEventDWheel();
|
||||||
|
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||||
|
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||||
|
|
||||||
|
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
|
||||||
|
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||||
|
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
|
||||||
|
try {
|
||||||
|
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
|
||||||
|
cls.setAccessible(true);
|
||||||
|
TextHistory history = ((TextHistory) cls.get("get"));
|
||||||
|
TextHistory.Direction direction;
|
||||||
|
if (wheel > 0) {
|
||||||
|
direction = TextHistory.Direction.PREVIOUS;
|
||||||
|
} else {
|
||||||
|
direction = TextHistory.Direction.NEXT;
|
||||||
|
}
|
||||||
|
history.get(direction, this.searchField.getText()).map(newText -> {
|
||||||
|
setSearchString(newText, true);
|
||||||
|
return true;
|
||||||
|
}).orElse(false);
|
||||||
|
return;
|
||||||
|
} catch (NoSuchFieldException | IllegalAccessException ignore) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.handleMouseInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||||
|
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||||
|
if (mouseButton == 3) {
|
||||||
|
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||||
|
if (slot.getHasStack()) {
|
||||||
|
InventoryAction action = InventoryAction.SET_PATTERN_VALUE;
|
||||||
|
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||||
|
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||||
|
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||||
|
if (slot.equals(this.inventorySlots.inventorySlots.get(i))) {
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, i, 0, stack));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot instanceof SlotFake) {
|
||||||
|
InventoryAction action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE
|
||||||
|
: InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU)) {
|
||||||
|
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
||||||
|
action = InventoryAction.MOVE_REGION;
|
||||||
|
} else {
|
||||||
|
action = InventoryAction.PICKUP_SINGLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot instanceof SlotPatternTerm) {
|
||||||
|
if (mouseButton == 6) {
|
||||||
|
return; // prevents weird double clicks
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
|
||||||
|
} catch (final IOException e) {
|
||||||
|
AELog.debug(e);
|
||||||
|
}
|
||||||
|
} else if (slot instanceof SlotCraftingTerm) {
|
||||||
|
if (mouseButton == 6) {
|
||||||
|
return; // prevents weird double clicks
|
||||||
|
}
|
||||||
|
InventoryAction action;
|
||||||
|
if (isShiftKeyDown()) {
|
||||||
|
action = InventoryAction.CRAFT_SHIFT;
|
||||||
|
} else {
|
||||||
|
// Craft a stack on right-click, craft a single one on left-click
|
||||||
|
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||||
|
}
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
|
||||||
|
if (this.enableSpaceClicking() && !(slot instanceof SlotPatternTerm)) {
|
||||||
|
IAEItemStack stack = null;
|
||||||
|
if (slot instanceof SlotME) {
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
}
|
||||||
|
int slotNum = Ae2ReflectClient.getInventorySlots(this).size();
|
||||||
|
if (!(slot instanceof SlotME) && slot != null) {
|
||||||
|
slotNum = slot.slotNumber;
|
||||||
|
}
|
||||||
|
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, slotNum, 0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot instanceof SlotDisconnected) {
|
||||||
|
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InventoryAction action = null;
|
||||||
|
switch (mouseButton) {
|
||||||
|
case 0: // pickup / set-down.
|
||||||
|
{
|
||||||
|
ItemStack heldStack = player.inventory.getItemStack();
|
||||||
|
if (slot.getStack() == null && heldStack != null) action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
|
||||||
|
else if (slot.getStack() != null && (heldStack == null || heldStack.stackSize <= 1))
|
||||||
|
action = InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||||
|
break;
|
||||||
|
case 3: // creative dupe:
|
||||||
|
if (player.capabilities.isCreativeMode) {
|
||||||
|
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case 4: // drop item:
|
||||||
|
case 6:
|
||||||
|
}
|
||||||
|
if (action != null) {
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(
|
||||||
|
action,
|
||||||
|
slot.getSlotIndex(),
|
||||||
|
((SlotDisconnected) slot).getSlot().getId());
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (slot instanceof SlotME) {
|
||||||
|
InventoryAction action = null;
|
||||||
|
IAEItemStack stack = null;
|
||||||
|
switch (mouseButton) {
|
||||||
|
case 0: // pickup / set-down.
|
||||||
|
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||||
|
&& stack.getStackSize() == 0
|
||||||
|
&& player.inventory.getItemStack() == null) {
|
||||||
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
break;
|
||||||
|
case 3: // creative dupe:
|
||||||
|
stack = ((SlotME) slot).getAEStack();
|
||||||
|
stack = transformItem(stack); // for fluid terminal
|
||||||
|
if (stack != null && stack.isCraftable()) {
|
||||||
|
action = InventoryAction.AUTO_CRAFT;
|
||||||
|
} else if (player.capabilities.isCreativeMode) {
|
||||||
|
final IAEItemStack slotItem = ((SlotME) slot).getAEStack();
|
||||||
|
if (slotItem != null) {
|
||||||
|
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case 4: // drop item:
|
||||||
|
case 6:
|
||||||
|
}
|
||||||
|
if (action == InventoryAction.AUTO_CRAFT) {
|
||||||
|
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(
|
||||||
|
new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
|
||||||
|
} else if (action != null) {
|
||||||
|
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||||
|
final PacketInventoryAction p = new PacketInventoryAction(
|
||||||
|
action,
|
||||||
|
Ae2ReflectClient.getInventorySlots(this).size(),
|
||||||
|
0);
|
||||||
|
NetworkHandler.instance.sendToServer(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IAEItemStack transformItem(IAEItemStack stack) {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
super.onGuiClosed();
|
||||||
|
Keyboard.enableRepeatEvents(false);
|
||||||
|
memoryText = this.searchField.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindTextureBack(final String file) {
|
||||||
|
final ResourceLocation loc = new ResourceLocation(FluidCraft.MODID, "textures/" + file);
|
||||||
|
this.mc.getTextureManager().bindTexture(loc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||||
|
this.bindTextureBack(this.getBackground());
|
||||||
|
final int x_width = 195;
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
||||||
|
if (this.viewCell) {
|
||||||
|
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 46, 128);
|
||||||
|
}
|
||||||
|
for (int x = 0; x < this.rows; x++) {
|
||||||
|
this.drawTexturedModalRect(offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
|
||||||
|
}
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
offsetX,
|
||||||
|
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
|
||||||
|
0,
|
||||||
|
106 - 18 - 18,
|
||||||
|
x_width,
|
||||||
|
99 + this.reservedSpace - this.lowerTextureOffset);
|
||||||
|
if (this.viewCell) {
|
||||||
|
boolean update = false;
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
if (this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot(i).getStack()) {
|
||||||
|
update = true;
|
||||||
|
this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (update) {
|
||||||
|
this.repo.setViewCell(this.myCurrentViewCells);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.searchField != null) {
|
||||||
|
this.searchField.drawTextBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getBackground() {
|
||||||
|
return "gui/terminal.png";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isPowered() {
|
||||||
|
return this.repo.hasPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getMaxRows() {
|
||||||
|
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6
|
||||||
|
: Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void repositionSlot(final AppEngSlot s) {
|
||||||
|
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(final char character, final int key) {
|
||||||
|
if (!this.checkHotbarKeys(key)) {
|
||||||
|
if (character == ' ' && this.searchField.getText().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||||
|
this.repo.setSearchString(this.searchField.getText());
|
||||||
|
this.repo.updateView();
|
||||||
|
this.setScrollBar();
|
||||||
|
} else {
|
||||||
|
super.keyTyped(character, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen() {
|
||||||
|
if (reInitializationRequested) {
|
||||||
|
reInitializationRequested = false;
|
||||||
|
this.buttonList.clear();
|
||||||
|
this.initGui();
|
||||||
|
}
|
||||||
|
this.repo.setPowered(this.monitorableContainer.isPowered());
|
||||||
|
super.updateScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enum<?> getSortBy() {
|
||||||
|
return this.configSrc.getSetting(Settings.SORT_BY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enum<?> getSortDir() {
|
||||||
|
return this.configSrc.getSetting(Settings.SORT_DIRECTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enum<?> getSortDisplay() {
|
||||||
|
return this.configSrc.getSetting(Settings.VIEW_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enum getTypeFilter() {
|
||||||
|
return this.configSrc.getSetting(Settings.TYPE_FILTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||||
|
if (this.SortByBox != null) {
|
||||||
|
this.SortByBox.set(this.configSrc.getSetting(Settings.SORT_BY));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.SortDirBox != null) {
|
||||||
|
this.SortDirBox.set(this.configSrc.getSetting(Settings.SORT_DIRECTION));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.ViewBox != null) {
|
||||||
|
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||||
|
}
|
||||||
|
if (this.typeFilter != null) {
|
||||||
|
this.typeFilter.set(this.configSrc.getSetting(Settings.TYPE_FILTER));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.repo.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getReservedSpace() {
|
||||||
|
return this.reservedSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservedSpace(final int reservedSpace) {
|
||||||
|
this.reservedSpace = reservedSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCustomSortOrder() {
|
||||||
|
return this.customSortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomSortOrder(final boolean customSortOrder) {
|
||||||
|
this.customSortOrder = customSortOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStandardSize() {
|
||||||
|
return this.standardSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandardSize(final int standardSize) {
|
||||||
|
this.standardSize = standardSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||||
|
super.drawScreen(mouseX, mouseY, btn);
|
||||||
|
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||||
|
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isOverSearchField(int x, int y) {
|
||||||
|
return searchField.isMouseIn(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hideItemPanelSlot(int tx, int ty, int tw, int th) {
|
||||||
|
if (this.viewCell) {
|
||||||
|
int rw = 33;
|
||||||
|
int rh = 14 + myCurrentViewCells.length * 18;
|
||||||
|
|
||||||
|
if (tw <= 0 || th <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rx = this.guiLeft + this.xSize;
|
||||||
|
int ry = this.guiTop;
|
||||||
|
|
||||||
|
rw += rx;
|
||||||
|
rh += ry;
|
||||||
|
tw += tx;
|
||||||
|
th += ty;
|
||||||
|
|
||||||
|
// overflow || intersect
|
||||||
|
return (rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOverTextField(int mousex, int mousey) {
|
||||||
|
return searchField.isMouseIn(mousex, mousey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleKeyboardInput() {
|
||||||
|
super.handleKeyboardInput();
|
||||||
|
hasShiftKeyDown |= isShiftKeyDown();
|
||||||
|
if (hasShiftKeyDown && !Keyboard.getEventKeyState()) { // keyup
|
||||||
|
this.repo.updateView();
|
||||||
|
hasShiftKeyDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessCraftTerminal;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
import appeng.container.ContainerNull;
|
||||||
|
import appeng.container.slot.SlotCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
|
import appeng.helpers.IContainerCraftingPacket;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.tile.inventory.IAEAppEngInventory;
|
||||||
|
import appeng.tile.inventory.InvOperation;
|
||||||
|
|
||||||
|
public class ContainerCraftingWireless extends ContainerItemMonitor
|
||||||
|
implements IAEAppEngInventory, IContainerCraftingPacket {
|
||||||
|
|
||||||
|
private final IWirelessCraftTerminal it;
|
||||||
|
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
||||||
|
private final SlotCraftingTerm outputSlot;
|
||||||
|
|
||||||
|
public ContainerCraftingWireless(final InventoryPlayer ip, final IWirelessTerminal monitorable) {
|
||||||
|
super(ip, monitorable, false);
|
||||||
|
this.it = (IWirelessCraftTerminal) monitorable;
|
||||||
|
final IInventory crafting = this.it.getInventoryByName("crafting");
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.craftingSlots[x + y * 3] = new SlotCraftingMatrix(
|
||||||
|
this,
|
||||||
|
crafting,
|
||||||
|
x + y * 3,
|
||||||
|
37 + x * 18,
|
||||||
|
-72 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.outputSlot = new SlotCraftingTerm(
|
||||||
|
this.getPlayerInv().player,
|
||||||
|
this.getActionSource(),
|
||||||
|
this.getPowerSource(),
|
||||||
|
monitorable,
|
||||||
|
crafting,
|
||||||
|
crafting,
|
||||||
|
output,
|
||||||
|
131,
|
||||||
|
-72 + 18,
|
||||||
|
this));
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
this.onCraftMatrixChanged(crafting);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isWirelessTerminal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCraftMatrixChanged(final IInventory par1IInventory) {
|
||||||
|
final ContainerNull cn = new ContainerNull();
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(cn, 3, 3);
|
||||||
|
for (int x = 0; x < 9; x++) {
|
||||||
|
ic.setInventorySlotContents(x, this.craftingSlots[x].getStack());
|
||||||
|
}
|
||||||
|
this.outputSlot
|
||||||
|
.putStack(CraftingManager.getInstance().findMatchingRecipe(ic, this.getPlayerInv().player.worldObj));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges() {
|
||||||
|
// NO-OP
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
|
||||||
|
final ItemStack removedStack, final ItemStack newStack) {
|
||||||
|
// NO-OP
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IInventory getInventoryByName(final String name) {
|
||||||
|
if (name.equals("player")) {
|
||||||
|
return this.getInventoryPlayer();
|
||||||
|
}
|
||||||
|
return this.it.getInventoryByName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useRealItems() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||||
|
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SidelessMode;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.implementations.ContainerInterface;
|
||||||
|
import appeng.helpers.IInterfaceHost;
|
||||||
|
|
||||||
|
public class ContainerDualInterface extends ContainerInterface {
|
||||||
|
|
||||||
|
@GuiSync(11)
|
||||||
|
public SidelessMode sidelessMode;
|
||||||
|
|
||||||
|
private final boolean isTile;
|
||||||
|
|
||||||
|
public ContainerDualInterface(InventoryPlayer ip, IInterfaceHost te) {
|
||||||
|
super(ip, te);
|
||||||
|
this.sidelessMode = SidelessMode.SIDELESS;
|
||||||
|
this.isTile = te instanceof TileFluidInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SidelessMode getSidelessMode() {
|
||||||
|
return this.sidelessMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||||
|
super.loadSettingsFromHost(cm);
|
||||||
|
this.sidelessMode = this.isTile ? (SidelessMode) cm.getSetting(Settings.SIDELESS_MODE) : SidelessMode.SIDELESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||||
|
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
|
||||||
|
|
||||||
|
public ContainerEssentiaMonitor(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||||
|
if (Platform.isClient()) {
|
||||||
|
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||||
|
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||||
|
&& AspectUtil.isEssentiaContainer(clickSlot.getStack())) {
|
||||||
|
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.transferStackInSlot(p, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postChange(IAEFluidStack clientSelectedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||||
|
ItemStack targetStack;
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
targetStack = player.inventory.getItemStack();
|
||||||
|
} else {
|
||||||
|
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||||
|
}
|
||||||
|
final int containersRequested = shift ? targetStack.stackSize : 1;
|
||||||
|
|
||||||
|
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(clientSelectedFluid);
|
||||||
|
ItemStack out = targetStack.copy();
|
||||||
|
out.stackSize = 1;
|
||||||
|
if (AspectUtil.isEmptyEssentiaContainer(targetStack) && AspectUtil.isEssentiaGas(storedFluid)) {
|
||||||
|
// add essentia to jars
|
||||||
|
if (storedFluid.getStackSize() / AspectUtil.R <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final IAEFluidStack toExtract = storedFluid.copy();
|
||||||
|
MutablePair<Integer, ItemStack> fillStack = AspectUtil.fillEssentiaFromGas(out, toExtract.getFluidStack());
|
||||||
|
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
toExtract.setStackSize((long) fillStack.left * containersRequested);
|
||||||
|
IAEFluidStack tmp = this.host.getFluidInventory()
|
||||||
|
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||||
|
if (tmp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||||
|
this.dropItem(fillStack.right);
|
||||||
|
out.stackSize = fillStack.right.stackSize;
|
||||||
|
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
|
||||||
|
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||||
|
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
|
||||||
|
this.dropItem(
|
||||||
|
AspectUtil.setAspectAmount(
|
||||||
|
fillStack.right,
|
||||||
|
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
|
||||||
|
AspectUtil.getAspectFromGas(toExtract)),
|
||||||
|
1);
|
||||||
|
out.stackSize++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!AspectUtil.isEmptyEssentiaContainer(targetStack)) {
|
||||||
|
// add essentia to ae network
|
||||||
|
ItemStack containerStack = targetStack.copy();
|
||||||
|
containerStack.stackSize = containersRequested;
|
||||||
|
IAEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(containerStack);
|
||||||
|
if (fluidStack == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final IAEFluidStack aeFluidStack = fluidStack.copy();
|
||||||
|
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
|
||||||
|
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||||
|
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||||
|
MutablePair<Integer, ItemStack> drainStack = AspectUtil
|
||||||
|
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
|
||||||
|
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
|
||||||
|
if (fluidStack.getStackSize() == notInserted.getStackSize()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||||
|
|
||||||
|
if (drainStack.left > aeFluidStack.getStackSize() && AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||||
|
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||||
|
this.host.getFluidInventory()
|
||||||
|
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// drop empty item
|
||||||
|
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
|
||||||
|
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
|
||||||
|
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||||
|
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||||
|
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
|
||||||
|
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
|
||||||
|
this.dropItem(drainStack.right, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (slotIndex == -1) out.stackSize = targetStack.stackSize - out.stackSize;
|
||||||
|
} else if (drainStack != null) {
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
out.stackSize = targetStack.stackSize;
|
||||||
|
} else {
|
||||||
|
out.stackSize = (int) (targetStack.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
|
||||||
|
}
|
||||||
|
this.dropItem(drainStack.right, targetStack.stackSize); // drop empty item
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
|
||||||
|
if (player.inventory.getItemStack().stackSize > 0) {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(
|
||||||
|
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||||
|
(EntityPlayerMP) player);
|
||||||
|
} else {
|
||||||
|
player.inventory.setItemStack(null);
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isEssentiaMode() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.MutablePair;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.SlotFake;
|
||||||
|
|
||||||
|
public class ContainerFluidAutoFiller extends AEBaseContainer {
|
||||||
|
|
||||||
|
public static class FakeSlot extends SlotFake {
|
||||||
|
|
||||||
|
public FakeSlot(IInventory inv, int idx, int x, int y) {
|
||||||
|
super(inv, idx, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStack(ItemStack is) {
|
||||||
|
MutablePair<Boolean, ItemStack> result = ContainerFluidAutoFiller.isItemValid(is);
|
||||||
|
if (result.left) {
|
||||||
|
if (super.getHasStack()) super.clearStack();
|
||||||
|
hasChange = true;
|
||||||
|
super.putStack(result.right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final TileFluidAutoFiller tile;
|
||||||
|
private static boolean hasChange;
|
||||||
|
|
||||||
|
public ContainerFluidAutoFiller(InventoryPlayer ipl, TileFluidAutoFiller tile) {
|
||||||
|
super(ipl, tile);
|
||||||
|
this.tile = tile;
|
||||||
|
addSlotToContainer(new FakeSlot(tile.getInventory(), 0, 80, 35));
|
||||||
|
bindPlayerInventory(ipl, 0, 84);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MutablePair<Boolean, ItemStack> isItemValid(ItemStack itemStack) {
|
||||||
|
boolean result = Util.FluidUtil.isFluidContainer(itemStack);
|
||||||
|
if (!result) return new MutablePair<>(false, null);
|
||||||
|
ItemStack tank = itemStack.copy();
|
||||||
|
tank.stackSize = 1;
|
||||||
|
if (Util.FluidUtil.isFilled(tank)) {
|
||||||
|
return new MutablePair<>(true, Util.FluidUtil.clearFluid(tank));
|
||||||
|
} else {
|
||||||
|
return new MutablePair<>(true, tank);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
if (hasChange) {
|
||||||
|
tile.updatePattern();
|
||||||
|
hasChange = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.util.Ae2Reflect;
|
||||||
|
import com.glodblock.github.util.BlockPos;
|
||||||
|
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.crafting.ICraftingJob;
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.implementations.ContainerCraftConfirm;
|
||||||
|
import appeng.container.implementations.ContainerOptimizePatterns;
|
||||||
|
import appeng.crafting.v2.CraftingJobV2;
|
||||||
|
import appeng.tile.misc.TilePatternOptimizationMatrix;
|
||||||
|
|
||||||
|
public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
|
||||||
|
|
||||||
|
public ContainerFluidCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||||
|
super(ip, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void switchToOriginalGUI() {
|
||||||
|
GuiType originalGui = null;
|
||||||
|
|
||||||
|
final IActionHost ah = this.getActionHost();
|
||||||
|
if (ah instanceof PartFluidPatternTerminal) {
|
||||||
|
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
}
|
||||||
|
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||||
|
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
}
|
||||||
|
if (ah instanceof PartLevelTerminal) {
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
if (ah instanceof IWirelessTerminal) {
|
||||||
|
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
|
||||||
|
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||||
|
originalGui = ((ItemBaseWirelessTerminal) terminal.getItem()).guiGuiType(terminal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ah instanceof IWirelessTerminal) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
originalGui);
|
||||||
|
} else if (this.getOpenContext() != null) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(this.getOpenContext().getTile()),
|
||||||
|
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||||
|
originalGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void optimizePatterns() {
|
||||||
|
// only V2 supported
|
||||||
|
IGrid grid = Ae2Reflect.getGrid(this);
|
||||||
|
ICraftingJob result = Ae2Reflect.getResult(this);
|
||||||
|
if (result instanceof CraftingJobV2 && !this.isSimulation()
|
||||||
|
&& grid != null
|
||||||
|
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
|
||||||
|
final IActionHost ah = this.getActionHost();
|
||||||
|
if (ah instanceof IWirelessTerminal) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
GuiType.FLUID_OPTIMIZE_PATTERNS_ITEM);
|
||||||
|
} else if (this.getOpenContext() != null) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(this.getOpenContext().getTile()),
|
||||||
|
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||||
|
GuiType.FLUID_OPTIMIZE_PATTERNS);
|
||||||
|
}
|
||||||
|
if (this.getPlayerInv().player.openContainer instanceof ContainerOptimizePatterns cop) {
|
||||||
|
cop.setResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||||
|
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||||
|
import com.glodblock.github.util.Ae2Reflect;
|
||||||
|
|
||||||
|
import appeng.api.config.SchedulingMode;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
|
|
||||||
|
public class ContainerFluidIO extends FCContainerFluidConfigurable {
|
||||||
|
|
||||||
|
private final FCSharedFluidBus bus;
|
||||||
|
|
||||||
|
public ContainerFluidIO(InventoryPlayer ip, FCSharedFluidBus te) {
|
||||||
|
super(ip, te);
|
||||||
|
this.bus = te;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FCSharedFluidBus getBus() {
|
||||||
|
return this.bus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||||
|
return (AppEngInternalAEInventory) this.bus.getInventoryByName("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||||
|
super.loadSettingsFromHost(cm);
|
||||||
|
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
|
||||||
|
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
|
||||||
|
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSchedulingMode(final SchedulingMode schedulingMode) {
|
||||||
|
this.schedulingMode = schedulingMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.inventory.IDualHost;
|
||||||
|
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||||
|
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.util.item.AEFluidStack;
|
||||||
|
|
||||||
|
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
|
||||||
|
|
||||||
|
private final IDualHost tile;
|
||||||
|
|
||||||
|
public ContainerFluidInterface(InventoryPlayer ipl, IDualHost tile) {
|
||||||
|
super(ipl, tile);
|
||||||
|
this.tile = tile;
|
||||||
|
IInventory inv = tile.getConfig();
|
||||||
|
final int y = 35;
|
||||||
|
final int x = 35;
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
addSlotToContainer(
|
||||||
|
new OptionalFluidSlotFakeTypeOnly(inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||||
|
}
|
||||||
|
bindPlayerInventory(ipl, 0, 149);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDualHost getTile() {
|
||||||
|
return tile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(int idx) {
|
||||||
|
return idx >= 0 && idx < 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||||
|
for (int i = 0; i < tile.getInternalFluid().getSlots(); i++) {
|
||||||
|
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
|
||||||
|
}
|
||||||
|
for (int i = 0; i < tile.getConfig().getSizeInventory(); i++) {
|
||||||
|
tmp.put(i + 100, AEFluidStack.create(ItemFluidPacket.getFluidStack(tile.getConfig().getStackInSlot(i))));
|
||||||
|
}
|
||||||
|
for (final Object g : this.crafters) {
|
||||||
|
if (g instanceof EntityPlayer) {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||||
|
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||||
|
import com.glodblock.github.util.Ae2Reflect;
|
||||||
|
|
||||||
|
import appeng.api.config.RedstoneMode;
|
||||||
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.implementations.IUpgradeableHost;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
|
||||||
|
|
||||||
|
private final PartFluidLevelEmitter lvlEmitter;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private GuiTextField textField;
|
||||||
|
|
||||||
|
@GuiSync(2)
|
||||||
|
public long EmitterValue = -1;
|
||||||
|
|
||||||
|
public ContainerFluidLevelEmitter(final InventoryPlayer ip, final PartFluidLevelEmitter te) {
|
||||||
|
super(ip, te);
|
||||||
|
this.lvlEmitter = te;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PartFluidLevelEmitter getBus() {
|
||||||
|
return this.lvlEmitter;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IUpgradeableHost getUpgradeable() {
|
||||||
|
return Ae2Reflect.getUpgradeableHost(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||||
|
return (AppEngInternalAEInventory) this.lvlEmitter.getInventoryByName("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupConfig() {
|
||||||
|
final IInventory inv = this.getUpgradeable().getInventoryByName("config");
|
||||||
|
final int y = 40;
|
||||||
|
final int x = 80 + 44;
|
||||||
|
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void setTextField(final GuiTextField level) {
|
||||||
|
this.textField = level;
|
||||||
|
this.textField.setText(String.valueOf(this.EmitterValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(final long l, final EntityPlayer player) {
|
||||||
|
this.lvlEmitter.setReportingValue(l);
|
||||||
|
this.EmitterValue = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean supportCapacity() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int availableUpgrades() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRedStoneMode(final RedstoneMode rsMode) {
|
||||||
|
this.rsMode = rsMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||||
|
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
this.EmitterValue = this.lvlEmitter.getReportingValue();
|
||||||
|
this.setRedStoneMode(
|
||||||
|
(RedstoneMode) Ae2Reflect.getUpgradeableHost(this).getConfigManager()
|
||||||
|
.getSetting(Settings.REDSTONE_EMITTER));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.standardDetectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||||
|
if (field.equals("EmitterValue")) {
|
||||||
|
if (this.textField != null) {
|
||||||
|
this.textField.setText(String.valueOf(this.EmitterValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,549 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||||
|
|
||||||
|
import com.glodblock.github.FluidCraft;
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||||
|
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||||
|
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||||
|
import appeng.api.networking.IGrid;
|
||||||
|
import appeng.api.networking.IGridHost;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.networking.storage.IBaseMonitor;
|
||||||
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.container.slot.SlotPlayerHotBar;
|
||||||
|
import appeng.container.slot.SlotPlayerInv;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.me.helpers.ChannelPowerSrc;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEFluidStack;
|
||||||
|
|
||||||
|
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||||
|
|
||||||
|
protected final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
|
||||||
|
/**
|
||||||
|
* Index of tuple which indicates remaining tanks that are remaining (not emptied/filled)
|
||||||
|
*/
|
||||||
|
protected static final int REM_IDX = 0;
|
||||||
|
/**
|
||||||
|
* Index of tuple which indicates remaining tanks that are acted upon (emptied/filled)
|
||||||
|
*/
|
||||||
|
protected static final int ACT_IDX = 1;
|
||||||
|
/**
|
||||||
|
* Index of tuple which indicates tanks that are partially emptied/filled
|
||||||
|
*/
|
||||||
|
protected static final int PARTIAL_IDX = 2;
|
||||||
|
|
||||||
|
public ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||||
|
this(ip, monitorable, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
|
||||||
|
final boolean bindInventory) {
|
||||||
|
super(ip, monitorable, bindInventory);
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
this.serverCM = monitorable.getConfigManager();
|
||||||
|
if (monitorable instanceof IGridHost) {
|
||||||
|
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||||
|
if (node != null) {
|
||||||
|
this.networkNode = node;
|
||||||
|
final IGrid g = node.getGrid();
|
||||||
|
if (g != null) {
|
||||||
|
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||||
|
IStorageGrid storageGrid = g.getCache(IStorageGrid.class);
|
||||||
|
this.monitor = storageGrid.getFluidInventory();
|
||||||
|
if (this.monitor == null) {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
} else {
|
||||||
|
this.monitor.addListener(this, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.setValidContainer(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.monitor = monitorable.getFluidInventory();
|
||||||
|
this.monitor.addListener(this, null);
|
||||||
|
this.setPowerSource((IEnergySource) monitorable);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.monitor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.canAccessViewCells = false;
|
||||||
|
if (monitorable instanceof IViewCellStorage) {
|
||||||
|
for (int y = 0; y < 5; y++) {
|
||||||
|
this.cellView[y] = new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.VIEW_CELL,
|
||||||
|
((IViewCellStorage) monitorable).getViewCellStorage(),
|
||||||
|
y,
|
||||||
|
206,
|
||||||
|
y * 18 + 8,
|
||||||
|
this.getInventoryPlayer());
|
||||||
|
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||||
|
this.addSlotToContainer(this.cellView[y]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bindInventory) {
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||||
|
if (Platform.isClient() && !isEssentiaMode()) {
|
||||||
|
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||||
|
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||||
|
&& Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
|
||||||
|
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||||
|
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.transferStackInSlot(p, idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void processItemList() {
|
||||||
|
if (!this.fluids.isEmpty()) {
|
||||||
|
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||||
|
List<IAEFluidStack> toSend = new ArrayList<>();
|
||||||
|
for (final IAEFluidStack is : this.fluids) {
|
||||||
|
final IAEFluidStack send = monitorCache.findPrecise(is);
|
||||||
|
if (send != null) {
|
||||||
|
toSend.add(send);
|
||||||
|
} else {
|
||||||
|
is.setStackSize(0);
|
||||||
|
toSend.add(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final Object c : this.crafters) {
|
||||||
|
if (c instanceof EntityPlayerMP) {
|
||||||
|
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.fluids.resetStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void queueInventory(final ICrafting c) {
|
||||||
|
if (Platform.isServer() && c instanceof EntityPlayerMP && this.monitor != null) {
|
||||||
|
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||||
|
List<IAEFluidStack> toSend = new ArrayList<>();
|
||||||
|
for (final IAEFluidStack is : monitorCache) {
|
||||||
|
toSend.add(is);
|
||||||
|
}
|
||||||
|
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change,
|
||||||
|
BaseActionSource actionSource) {
|
||||||
|
for (final IAEFluidStack is : change) {
|
||||||
|
this.fluids.add(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dropItem(ItemStack is) {
|
||||||
|
if (is == null || is.stackSize <= 0) return;
|
||||||
|
ItemStack itemStack = is.copy();
|
||||||
|
int i = itemStack.getMaxStackSize();
|
||||||
|
while (itemStack.stackSize > 0) {
|
||||||
|
if (i > itemStack.stackSize) {
|
||||||
|
if (!getPlayerInv().addItemStackToInventory(itemStack.copy())) {
|
||||||
|
getPlayerInv().player.entityDropItem(itemStack.copy(), 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
itemStack.stackSize -= i;
|
||||||
|
ItemStack item = itemStack.copy();
|
||||||
|
item.stackSize = i;
|
||||||
|
if (!getPlayerInv().addItemStackToInventory(item)) {
|
||||||
|
getPlayerInv().player.entityDropItem(item, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void dropItem(ItemStack itemStack, int stackSize) {
|
||||||
|
if (itemStack == null || itemStack.stackSize <= 0) return;
|
||||||
|
ItemStack is = itemStack.copy();
|
||||||
|
is.stackSize = stackSize;
|
||||||
|
this.dropItem(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Two operations, insert and extract.
|
||||||
|
*
|
||||||
|
* @param slotIndex The slot. If index == -1, the cursor held itemstack. Else, slotIndex indicates which slot was
|
||||||
|
* shift clicked on.
|
||||||
|
*/
|
||||||
|
public void postChange(IAEFluidStack fluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||||
|
ItemStack targetStack;
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
targetStack = player.inventory.getItemStack();
|
||||||
|
} else {
|
||||||
|
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||||
|
}
|
||||||
|
// The primary output itemstack
|
||||||
|
if (Util.FluidUtil.isEmpty(targetStack) && fluid != null) {
|
||||||
|
// Situation 1.a: Empty fluid container, and nonnull slot
|
||||||
|
extractFluid(fluid, player, slotIndex, shift);
|
||||||
|
} else if (!Util.FluidUtil.isEmpty(targetStack)) {
|
||||||
|
// Situation 2.a: We are holding a non-empty container.
|
||||||
|
insertFluid(player, slotIndex, shift);
|
||||||
|
// End of situation 2.a
|
||||||
|
}
|
||||||
|
// No op (Any other situation)
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The insert operation. For input, we have a filled container stack. For outputs, we have the following:
|
||||||
|
* <ol>
|
||||||
|
* <li>Leftover filled container stack</li>
|
||||||
|
* <li>Empty containers</li>
|
||||||
|
* <li>Partially filled container x1</li>
|
||||||
|
* </ol>
|
||||||
|
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||||
|
*/
|
||||||
|
private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
|
||||||
|
final ItemStack targetStack;
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
targetStack = player.inventory.getItemStack();
|
||||||
|
} else {
|
||||||
|
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||||
|
}
|
||||||
|
final int containersRequestedToInsert = shift ? targetStack.stackSize : 1;
|
||||||
|
|
||||||
|
// Step 1: Determine container characteristics and verify fluid to be extractable
|
||||||
|
final int fluidPerContainer;
|
||||||
|
final FluidStack fluidStackPerContainer;
|
||||||
|
final boolean partialInsertSupported;
|
||||||
|
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||||
|
ItemStack test = targetStack.copy();
|
||||||
|
test.stackSize = 1;
|
||||||
|
fluidStackPerContainer = fcItem.drain(test, Integer.MAX_VALUE, false);
|
||||||
|
if (fluidStackPerContainer == null || fluidStackPerContainer.amount == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluidPerContainer = fluidStackPerContainer.amount;
|
||||||
|
partialInsertSupported = true;
|
||||||
|
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||||
|
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||||
|
if (emptyTank == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluidStackPerContainer = FluidContainerRegistry.getFluidForFilledItem(targetStack);
|
||||||
|
fluidPerContainer = fluidStackPerContainer.amount;
|
||||||
|
partialInsertSupported = false;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: determine network capacity
|
||||||
|
final IAEFluidStack totalFluid = AEFluidStack.create(fluidStackPerContainer);
|
||||||
|
totalFluid.setStackSize((long) fluidPerContainer * containersRequestedToInsert);
|
||||||
|
|
||||||
|
final IAEFluidStack notInsertable = this.host.getFluidInventory()
|
||||||
|
.injectItems(totalFluid, Actionable.SIMULATE, this.getActionSource());
|
||||||
|
|
||||||
|
final long insertableFluid;
|
||||||
|
if (notInsertable == null || notInsertable.getStackSize() == 0) {
|
||||||
|
insertableFluid = totalFluid.getStackSize();
|
||||||
|
} else {
|
||||||
|
long insertable = totalFluid.getStackSize() - notInsertable.getStackSize();
|
||||||
|
if (partialInsertSupported) {
|
||||||
|
insertableFluid = insertable;
|
||||||
|
} else {
|
||||||
|
// avoid remainder
|
||||||
|
insertableFluid = insertable - (insertable % fluidPerContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
totalFluid.setStackSize(insertableFluid);
|
||||||
|
|
||||||
|
// Step 3: perform insert
|
||||||
|
final long totalInserted;
|
||||||
|
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||||
|
.injectItems(totalFluid, Actionable.MODULATE, this.getActionSource());
|
||||||
|
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||||
|
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage bus.
|
||||||
|
long total = totalFluid.getStackSize() - notInserted.getStackSize();
|
||||||
|
if (partialInsertSupported) {
|
||||||
|
totalInserted = total;
|
||||||
|
} else {
|
||||||
|
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||||
|
long overflowAmount = fluidPerContainer - (total % fluidPerContainer);
|
||||||
|
IAEFluidStack overflow = AEFluidStack.create(fluidStackPerContainer);
|
||||||
|
overflow.setStackSize(overflowAmount);
|
||||||
|
dropItem(ItemFluidPacket.newStack(overflow));
|
||||||
|
totalInserted = total + overflowAmount;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
totalInserted = totalFluid.getStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 4: calculate outputs
|
||||||
|
final int emptiedTanks = (int) (totalInserted / fluidPerContainer);
|
||||||
|
final int partialDrain = (int) (totalInserted % fluidPerContainer);
|
||||||
|
final int partialTanks = partialDrain > 0 && partialInsertSupported ? 1 : 0;
|
||||||
|
final int usedTanks = emptiedTanks + partialTanks;
|
||||||
|
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||||
|
|
||||||
|
final ItemStack emptiedTanksStack;
|
||||||
|
final ItemStack partialTanksStack;
|
||||||
|
|
||||||
|
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||||
|
if (emptiedTanks > 0) {
|
||||||
|
emptiedTanksStack = targetStack.copy();
|
||||||
|
emptiedTanksStack.stackSize = 1;
|
||||||
|
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
|
||||||
|
emptiedTanksStack.stackSize = emptiedTanks;
|
||||||
|
} else {
|
||||||
|
emptiedTanksStack = null;
|
||||||
|
}
|
||||||
|
if (partialTanks > 0) {
|
||||||
|
partialTanksStack = targetStack.copy();
|
||||||
|
partialTanksStack.stackSize = 1;
|
||||||
|
fcItem.drain(partialTanksStack, partialDrain, true);
|
||||||
|
} else {
|
||||||
|
partialTanksStack = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (emptiedTanks > 0) {
|
||||||
|
emptiedTanksStack = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||||
|
emptiedTanksStack.stackSize = emptiedTanks;
|
||||||
|
} else {
|
||||||
|
emptiedTanksStack = null;
|
||||||
|
}
|
||||||
|
// Not possible > see Step 2 and Step 3
|
||||||
|
partialTanksStack = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done. Put the output in the inventory or ground, and update stack size.
|
||||||
|
boolean shouldSendStack = true;
|
||||||
|
if (slotIndex == -1) {
|
||||||
|
// Item is in mouse hand
|
||||||
|
if (untouchedTanks > 0) {
|
||||||
|
targetStack.stackSize = untouchedTanks;
|
||||||
|
adjustStack(targetStack);
|
||||||
|
dropItem(emptiedTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (emptiedTanksStack != null) {
|
||||||
|
adjustStack(emptiedTanksStack);
|
||||||
|
player.inventory.setItemStack(emptiedTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (partialTanksStack != null) {
|
||||||
|
player.inventory.setItemStack(partialTanksStack);
|
||||||
|
} else {
|
||||||
|
player.inventory.setItemStack(null);
|
||||||
|
shouldSendStack = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Shift clicked in
|
||||||
|
if (untouchedTanks > 0) {
|
||||||
|
targetStack.stackSize = untouchedTanks;
|
||||||
|
adjustStack(targetStack);
|
||||||
|
dropItem(emptiedTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (emptiedTanksStack != null) {
|
||||||
|
adjustStack(emptiedTanksStack);
|
||||||
|
player.inventory.setInventorySlotContents(slotIndex, emptiedTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (partialTanksStack != null) {
|
||||||
|
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
|
||||||
|
} else {
|
||||||
|
player.inventory.setItemStack(null);
|
||||||
|
shouldSendStack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldSendStack) {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(
|
||||||
|
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||||
|
(EntityPlayerMP) player);
|
||||||
|
} else {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The extract operation. For input, we have an empty container stack. For outputs, we have the following:
|
||||||
|
* <ol>
|
||||||
|
* <li>Leftover empty container stack</li>
|
||||||
|
* <li>Filled containers (full)</li>
|
||||||
|
* <li>Partially filled container x1</li>
|
||||||
|
* </ol>
|
||||||
|
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||||
|
*/
|
||||||
|
private void extractFluid(IAEFluidStack clientRequestedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||||
|
if (slotIndex != -1) {
|
||||||
|
// shift-click from inventory cant fill fluids
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final ItemStack targetStack = player.inventory.getItemStack();
|
||||||
|
final int containersRequestedToExtract = shift ? targetStack.stackSize : 1;
|
||||||
|
|
||||||
|
final FluidStack clientRequestedFluidStack = clientRequestedFluid.getFluidStack();
|
||||||
|
clientRequestedFluidStack.amount = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
// Step 1: Determine container characteristics and verify fluid to be insertable
|
||||||
|
final int fluidPerContainer;
|
||||||
|
final boolean partialInsertSupported;
|
||||||
|
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||||
|
ItemStack testStack = targetStack.copy();
|
||||||
|
testStack.stackSize = 1;
|
||||||
|
fluidPerContainer = fcItem.fill(testStack, clientRequestedFluidStack, false);
|
||||||
|
if (fluidPerContainer == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
partialInsertSupported = true;
|
||||||
|
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||||
|
fluidPerContainer = FluidContainerRegistry.getContainerCapacity(clientRequestedFluidStack, targetStack);
|
||||||
|
partialInsertSupported = false;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2: determine fluid in network
|
||||||
|
final IAEFluidStack totalRequestedFluid = clientRequestedFluid.copy();
|
||||||
|
totalRequestedFluid.setStackSize((long) fluidPerContainer * containersRequestedToExtract);
|
||||||
|
|
||||||
|
final IAEFluidStack availableFluid = this.host.getFluidInventory()
|
||||||
|
.extractItems(totalRequestedFluid, Actionable.SIMULATE, this.getActionSource());
|
||||||
|
if (availableFluid == null || availableFluid.getStackSize() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (availableFluid.getStackSize() != totalRequestedFluid.getStackSize() && !partialInsertSupported) {
|
||||||
|
availableFluid.decStackSize(availableFluid.getStackSize() % fluidPerContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 3: perform extract
|
||||||
|
final IAEFluidStack extracted = this.host.getFluidInventory()
|
||||||
|
.extractItems(availableFluid, Actionable.MODULATE, this.getActionSource());
|
||||||
|
final long totalExtracted = extracted != null ? extracted.getStackSize() : 0;
|
||||||
|
|
||||||
|
// Step 4: calculate outputs
|
||||||
|
final int filledTanks = (int) (totalExtracted / fluidPerContainer);
|
||||||
|
final int partialFill = (int) (totalExtracted % fluidPerContainer);
|
||||||
|
final int partialTanks = partialFill > 0 && partialInsertSupported ? 1 : 0;
|
||||||
|
final int usedTanks = filledTanks + partialTanks;
|
||||||
|
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||||
|
|
||||||
|
final ItemStack filledTanksStack;
|
||||||
|
final ItemStack partialTanksStack;
|
||||||
|
|
||||||
|
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||||
|
if (filledTanks > 0) {
|
||||||
|
filledTanksStack = targetStack.copy();
|
||||||
|
filledTanksStack.stackSize = 1;
|
||||||
|
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||||
|
toInsert.amount = fluidPerContainer;
|
||||||
|
fcItem.fill(filledTanksStack, toInsert, true);
|
||||||
|
filledTanksStack.stackSize = filledTanks;
|
||||||
|
} else {
|
||||||
|
filledTanksStack = null;
|
||||||
|
}
|
||||||
|
if (partialTanks > 0) {
|
||||||
|
partialTanksStack = targetStack.copy();
|
||||||
|
partialTanksStack.stackSize = 1;
|
||||||
|
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||||
|
toInsert.amount = partialFill;
|
||||||
|
fcItem.fill(partialTanksStack, toInsert, true);
|
||||||
|
} else {
|
||||||
|
partialTanksStack = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (filledTanks > 0) {
|
||||||
|
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||||
|
toInsert.amount = fluidPerContainer;
|
||||||
|
filledTanksStack = FluidContainerRegistry.fillFluidContainer(toInsert, targetStack);
|
||||||
|
filledTanksStack.stackSize = filledTanks;
|
||||||
|
} else {
|
||||||
|
filledTanksStack = null;
|
||||||
|
}
|
||||||
|
if (partialFill > 0) {
|
||||||
|
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage
|
||||||
|
// bus.
|
||||||
|
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||||
|
IAEFluidStack overflow = extracted.copy();
|
||||||
|
overflow.setStackSize(partialFill);
|
||||||
|
dropItem(ItemFluidPacket.newStack(overflow));
|
||||||
|
}
|
||||||
|
partialTanksStack = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Done. Put the output in the inventory or ground, and update stack size.
|
||||||
|
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
|
||||||
|
boolean shouldSendStack = true;
|
||||||
|
if (untouchedTanks > 0) {
|
||||||
|
ItemStack emptyStack = player.inventory.getItemStack();
|
||||||
|
emptyStack.stackSize = untouchedTanks;
|
||||||
|
adjustStack(emptyStack);
|
||||||
|
dropItem(filledTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (filledTanksStack != null) {
|
||||||
|
adjustStack(filledTanksStack);
|
||||||
|
player.inventory.setItemStack(filledTanksStack);
|
||||||
|
dropItem(partialTanksStack);
|
||||||
|
} else if (partialTanksStack != null) {
|
||||||
|
player.inventory.setItemStack(partialTanksStack);
|
||||||
|
} else {
|
||||||
|
player.inventory.setItemStack(null);
|
||||||
|
shouldSendStack = false;
|
||||||
|
}
|
||||||
|
if (shouldSendStack) {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(
|
||||||
|
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||||
|
(EntityPlayerMP) player);
|
||||||
|
} else {
|
||||||
|
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void adjustStack(ItemStack stack) {
|
||||||
|
if (stack != null && stack.stackSize > stack.getMaxStackSize()) {
|
||||||
|
dropItem(stack, stack.stackSize - stack.getMaxStackSize());
|
||||||
|
stack.stackSize = stack.getMaxStackSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isEssentiaMode() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isWirelessTerminal() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||||
|
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||||
|
import com.glodblock.github.inventory.InventoryHandler;
|
||||||
|
import com.glodblock.github.inventory.gui.GuiType;
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
import com.glodblock.github.util.BlockPos;
|
||||||
|
|
||||||
|
import appeng.api.networking.security.IActionHost;
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.implementations.ContainerOptimizePatterns;
|
||||||
|
|
||||||
|
public class ContainerFluidOptimizePatterns extends ContainerOptimizePatterns {
|
||||||
|
|
||||||
|
public ContainerFluidOptimizePatterns(InventoryPlayer ip, ITerminalHost te) {
|
||||||
|
super(ip, te);
|
||||||
|
}
|
||||||
|
|
||||||
|
public World getWorld() {
|
||||||
|
return this.getPlayerInv().player.worldObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void switchToOriginalGUI() {
|
||||||
|
GuiType originalGui = null;
|
||||||
|
|
||||||
|
final IActionHost ah = this.getActionHost();
|
||||||
|
if (ah instanceof PartFluidPatternTerminal) {
|
||||||
|
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||||
|
}
|
||||||
|
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||||
|
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||||
|
}
|
||||||
|
if (ah instanceof PartLevelTerminal) {
|
||||||
|
originalGui = GuiType.LEVEL_TERMINAL;
|
||||||
|
}
|
||||||
|
if (ah instanceof IWirelessTerminal) {
|
||||||
|
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
|
||||||
|
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||||
|
originalGui = ((ItemBaseWirelessTerminal) terminal.getItem()).guiGuiType(terminal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ah instanceof IWirelessTerminal) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||||
|
ForgeDirection.UNKNOWN,
|
||||||
|
originalGui);
|
||||||
|
} else if (this.getOpenContext() != null) {
|
||||||
|
InventoryHandler.openGui(
|
||||||
|
this.getInventoryPlayer().player,
|
||||||
|
getWorld(),
|
||||||
|
new BlockPos(this.getOpenContext().getTile()),
|
||||||
|
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||||
|
originalGui);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-7
@@ -1,16 +1,19 @@
|
|||||||
package com.glodblock.github.client.container;
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||||
|
import com.glodblock.github.inventory.slot.FCSlotRestrictedInput;
|
||||||
|
|
||||||
import appeng.container.AEBaseContainer;
|
import appeng.container.AEBaseContainer;
|
||||||
import appeng.container.slot.SlotNormal;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
|
|
||||||
public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||||
|
|
||||||
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
||||||
super(ipl, tile);
|
super(ipl, tile);
|
||||||
addSlotToContainer(new SlotNormal(tile.getInventory(), 0, 80, 35));
|
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||||
bindPlayerInventory(ipl, 0, 84);
|
bindPlayerInventory(ipl, 0, 84);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
+81
-111
@@ -1,36 +1,33 @@
|
|||||||
package com.glodblock.github.client.container;
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.slot.SlotFake;
|
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
|
||||||
import appeng.helpers.InventoryAction;
|
|
||||||
import appeng.util.item.AEItemStack;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
|
||||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
|
||||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
|
||||||
import com.glodblock.github.handler.AeItemStackHandler;
|
|
||||||
import com.glodblock.github.interfaces.AeStackInventory;
|
|
||||||
import com.glodblock.github.interfaces.PatternConsumer;
|
|
||||||
import com.glodblock.github.interfaces.SlotFluid;
|
|
||||||
import com.glodblock.github.loader.FCItems;
|
|
||||||
import com.glodblock.github.util.FluidPatternDetails;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
|
||||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ContainerFluidPatternEncoder extends AEBaseContainer implements PatternConsumer {
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||||
|
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||||
|
import com.glodblock.github.inventory.AeStackInventory;
|
||||||
|
import com.glodblock.github.inventory.IPatternConsumer;
|
||||||
|
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
|
||||||
|
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||||
|
import com.glodblock.github.util.FluidPatternDetails;
|
||||||
|
import com.glodblock.github.util.Util;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.container.AEBaseContainer;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
|
||||||
|
public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPatternConsumer {
|
||||||
|
|
||||||
private final TileFluidPatternEncoder tile;
|
private final TileFluidPatternEncoder tile;
|
||||||
|
|
||||||
@@ -45,10 +42,22 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
|||||||
}
|
}
|
||||||
addSlotToContainer(new SlotFluidConvertingFake(output, y, 113, 17 + y * 18));
|
addSlotToContainer(new SlotFluidConvertingFake(output, y, 113, 17 + y * 18));
|
||||||
}
|
}
|
||||||
addSlotToContainer(new SlotRestrictedInput(
|
addSlotToContainer(
|
||||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, tile.getInventory(), 0, 138, 20, ipl));
|
new SlotRestrictedInput(
|
||||||
addSlotToContainer(new SlotRestrictedInput(
|
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
|
||||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, tile.getInventory(), 1, 138, 50, ipl));
|
tile.getInventory(),
|
||||||
|
0,
|
||||||
|
138,
|
||||||
|
20,
|
||||||
|
ipl));
|
||||||
|
addSlotToContainer(
|
||||||
|
new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
|
||||||
|
tile.getInventory(),
|
||||||
|
1,
|
||||||
|
138,
|
||||||
|
50,
|
||||||
|
ipl));
|
||||||
bindPlayerInventory(ipl, 0, 84);
|
bindPlayerInventory(ipl, 0, 84);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,12 +65,17 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
|||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isNotPattern(ItemStack stack) {
|
||||||
|
return stack == null || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
||||||
|
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canEncodePattern() {
|
public boolean canEncodePattern() {
|
||||||
if (isNotPattern(tile.getInventory().getStackInSlot(0)) && isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
if (isNotPattern(tile.getInventory().getStackInSlot(0))
|
||||||
|
&& isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
find_input:
|
find_input: {
|
||||||
{
|
|
||||||
for (IAEItemStack stack : tile.getCraftingSlots()) {
|
for (IAEItemStack stack : tile.getCraftingSlots()) {
|
||||||
if (stack != null && stack.getStackSize() > 0) {
|
if (stack != null && stack.getStackSize() > 0) {
|
||||||
break find_input;
|
break find_input;
|
||||||
@@ -77,27 +91,25 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isNotPattern(ItemStack stack) {
|
|
||||||
return stack.isEmpty() || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
|
||||||
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void encodePattern() {
|
public void encodePattern() {
|
||||||
if (canEncodePattern()) {
|
if (canEncodePattern()) {
|
||||||
// if there is an encoded pattern, overwrite it; otherwise, consume a blank
|
// if there is an encoded pattern, overwrite it; otherwise, consume a blank
|
||||||
if (tile.getInventory().getStackInSlot(1).isEmpty()) {
|
if (tile.getInventory().getStackInSlot(1) == null) {
|
||||||
tile.getInventory().extractItem(0, 1, false); // this better work
|
tile.getInventory().decrStackSize(0, 1); // this better work
|
||||||
}
|
}
|
||||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
|
||||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||||
pattern.setInputs(collectAeInventory(tile.getCraftingSlots()));
|
pattern.setInputs(collectAeInventory(tile.getCraftingSlots()));
|
||||||
pattern.setOutputs(collectAeInventory(tile.getOutputSlots()));
|
pattern.setOutputs(collectAeInventory(tile.getOutputSlots()));
|
||||||
tile.getInventory().setStackInSlot(1, pattern.writeToStack());
|
tile.getInventory().setInventorySlotContents(1, pattern.writeToStack());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
|
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
|
||||||
// see note at top of DensePatternDetails
|
/*
|
||||||
|
* AE2 API documentation says the input/output arrays can contain nulls, but their use of the API directly
|
||||||
|
* contradicts that, so we just go by behaviour and filter out nulls.
|
||||||
|
*/
|
||||||
List<IAEItemStack> acc = new ArrayList<>();
|
List<IAEItemStack> acc = new ArrayList<>();
|
||||||
for (IAEItemStack stack : inv) {
|
for (IAEItemStack stack : inv) {
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
@@ -121,33 +133,38 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
|||||||
if (slot instanceof SlotFluidConvertingFake) {
|
if (slot instanceof SlotFluidConvertingFake) {
|
||||||
final ItemStack stack = player.inventory.getItemStack();
|
final ItemStack stack = player.inventory.getItemStack();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PICKUP_OR_SET_DOWN:
|
case PICKUP_OR_SET_DOWN -> {
|
||||||
if (stack.isEmpty()) {
|
if (stack == null) {
|
||||||
slot.putStack(ItemStack.EMPTY);
|
slot.putStack(null);
|
||||||
} else {
|
} else {
|
||||||
((SlotFluidConvertingFake)slot).putConvertedStack(stack.copy());
|
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case PLACE_SINGLE:
|
case PLACE_SINGLE -> {
|
||||||
if (!stack.isEmpty()) {
|
if (stack != null) {
|
||||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
((SlotFluidConvertingFake) slot)
|
||||||
|
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case SPLIT_OR_PLACE_SINGLE:
|
case SPLIT_OR_PLACE_SINGLE -> {
|
||||||
ItemStack inSlot = slot.getStack();
|
ItemStack inSlot = slot.getStack();
|
||||||
if (!inSlot.isEmpty()) {
|
if (inSlot != null) {
|
||||||
if (stack.isEmpty()) {
|
if (stack == null) {
|
||||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(inSlot, Math.max(1, inSlot.getCount() - 1)));
|
slot.putStack(Util.copyStackWithSize(inSlot, Math.max(1, inSlot.stackSize - 1)));
|
||||||
} else if (stack.isItemEqual(inSlot)) {
|
} else if (stack.isItemEqual(inSlot)) {
|
||||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(inSlot,
|
slot.putStack(
|
||||||
Math.min(inSlot.getMaxStackSize(), inSlot.getCount() + 1)));
|
Util.copyStackWithSize(
|
||||||
|
inSlot,
|
||||||
|
Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
|
||||||
} else {
|
} else {
|
||||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
((SlotFluidConvertingFake) slot)
|
||||||
|
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||||
}
|
}
|
||||||
} else if (!stack.isEmpty()) {
|
} else if (stack != null) {
|
||||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
((SlotFluidConvertingFake) slot)
|
||||||
|
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.doAction(player, action, slotId, id);
|
super.doAction(player, action, slotId, id);
|
||||||
@@ -166,51 +183,4 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat
|
|||||||
dest.setStack(i, src[i]);
|
dest.setStack(i, src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SlotFluidConvertingFake extends SlotFake implements SlotFluid {
|
|
||||||
|
|
||||||
private final AeStackInventory<IAEItemStack> inv;
|
|
||||||
|
|
||||||
public SlotFluidConvertingFake(AeItemStackHandler inv, int idx, int x, int y) {
|
|
||||||
super(inv, idx, x, y);
|
|
||||||
this.inv = inv.getAeInventory();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putStack(ItemStack stack) {
|
|
||||||
inv.setStack(getSlotIndex(), AEItemStack.fromItemStack(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAeStack(@Nullable IAEItemStack stack, boolean sync) {
|
|
||||||
inv.setStack(getSlotIndex(), stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void putConvertedStack(ItemStack stack) {
|
|
||||||
if (stack.isEmpty()) {
|
|
||||||
setAeStack(null, false);
|
|
||||||
return;
|
|
||||||
} else if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
|
||||||
IFluidTankProperties[] tanks = Objects.requireNonNull(
|
|
||||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null))
|
|
||||||
.getTankProperties();
|
|
||||||
for (IFluidTankProperties tank : tanks) {
|
|
||||||
IAEItemStack aeStack = ItemFluidPacket.newAeStack(tank.getContents());
|
|
||||||
if (aeStack != null) {
|
|
||||||
setAeStack(aeStack, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
putStack(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public IAEItemStack getAeStack() {
|
|
||||||
return inv.getStack(getSlotIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
public class ContainerFluidPatternExWireless extends ContainerFluidPatternTerminalEx {
|
||||||
|
|
||||||
|
public ContainerFluidPatternExWireless(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isWirelessTerminal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+161
@@ -0,0 +1,161 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||||
|
import appeng.container.slot.SlotPatternOutputs;
|
||||||
|
import appeng.container.slot.SlotPatternTerm;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
|
||||||
|
|
||||||
|
public ContainerFluidPatternTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
final IInventory output = this.patternTerminal.getInventoryByName("output");
|
||||||
|
final IInventory patternInv = this.patternTerminal.getInventoryByName("pattern");
|
||||||
|
this.craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||||
|
this.outputSlots = new OptionalSlotFake[3];
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix(
|
||||||
|
this.crafting,
|
||||||
|
x + y * 3,
|
||||||
|
18 + x * 18,
|
||||||
|
-76 + y * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.craftSlot = new SlotPatternTerm(
|
||||||
|
ip.player,
|
||||||
|
this.getActionSource(),
|
||||||
|
this.getPowerSource(),
|
||||||
|
monitorable,
|
||||||
|
this.crafting,
|
||||||
|
patternInv,
|
||||||
|
this.cOut,
|
||||||
|
110,
|
||||||
|
-76 + 18,
|
||||||
|
this,
|
||||||
|
2,
|
||||||
|
this));
|
||||||
|
this.craftSlot.setIIcon(-1);
|
||||||
|
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||||
|
this.outputSlots[y].setRenderDisabled(false);
|
||||||
|
}
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateOrderOfOutputSlots() {
|
||||||
|
if (!this.isCraftingMode()) {
|
||||||
|
this.craftSlot.xDisplayPosition = -9000;
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.craftSlot.xDisplayPosition = this.craftSlot.getX();
|
||||||
|
for (int y = 0; y < 3; y++) {
|
||||||
|
this.outputSlots[y].xDisplayPosition = -9000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean validPatternSlot(Slot slot) {
|
||||||
|
return slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStackInSlot(final int par1, final ItemStack par2ItemStack) {
|
||||||
|
super.putStackInSlot(par1, par2ItemStack);
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStacksInSlots(final ItemStack[] par1ArrayOfItemStack) {
|
||||||
|
super.putStacksInSlots(par1ArrayOfItemStack);
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getAndUpdateOutput() {
|
||||||
|
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
||||||
|
|
||||||
|
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||||
|
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||||
|
}
|
||||||
|
|
||||||
|
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe(ic, this.getPlayerInv().player.worldObj);
|
||||||
|
this.cOut.setInventorySlotContents(0, is);
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ItemStack[] getOutputs() {
|
||||||
|
if (this.isCraftingMode()) {
|
||||||
|
final ItemStack out = this.getAndUpdateOutput();
|
||||||
|
if (out != null && out.stackSize > 0) {
|
||||||
|
return new ItemStack[] { out };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.getOutputs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(final int idx) {
|
||||||
|
if (idx == 1) {
|
||||||
|
return Platform.isServer() ? !this.patternTerminal.isCraftingRecipe() : !this.isCraftingMode();
|
||||||
|
} else if (idx == 2) {
|
||||||
|
return Platform.isServer() ? this.patternTerminal.isCraftingRecipe() : this.isCraftingMode();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
if (this.isCraftingMode() != this.patternTerminal.isCraftingRecipe()) {
|
||||||
|
this.setCraftingMode(this.patternTerminal.isCraftingRecipe());
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||||
|
super.onUpdate(field, oldValue, newValue);
|
||||||
|
if (field.equals("craftingMode")) {
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
this.updateOrderOfOutputSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
this.getAndUpdateOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCraftingMode(final boolean craftingMode) {
|
||||||
|
this.craftingMode = craftingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doubleStacks(boolean isShift) {
|
||||||
|
if (!isCraftingMode()) {
|
||||||
|
super.doubleStacks(isShift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+153
@@ -0,0 +1,153 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||||
|
|
||||||
|
import appeng.api.storage.ITerminalHost;
|
||||||
|
import appeng.container.slot.IOptionalSlotHost;
|
||||||
|
import appeng.container.slot.OptionalSlotFake;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
|
||||||
|
|
||||||
|
private static final int CRAFTING_GRID_PAGES = 2;
|
||||||
|
private static final int CRAFTING_GRID_WIDTH = 4;
|
||||||
|
private static final int CRAFTING_GRID_HEIGHT = 4;
|
||||||
|
private static final int CRAFTING_GRID_SLOTS = CRAFTING_GRID_WIDTH * CRAFTING_GRID_HEIGHT;
|
||||||
|
|
||||||
|
public ContainerFluidPatternTerminalEx(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
this.craftingSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||||
|
this.outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||||
|
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
|
||||||
|
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||||
|
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||||
|
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH
|
||||||
|
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
|
||||||
|
crafting,
|
||||||
|
this,
|
||||||
|
x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS,
|
||||||
|
15,
|
||||||
|
-83,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
x + 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||||
|
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y
|
||||||
|
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
|
||||||
|
output,
|
||||||
|
this,
|
||||||
|
x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS,
|
||||||
|
112,
|
||||||
|
-83,
|
||||||
|
-x,
|
||||||
|
y,
|
||||||
|
x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.craftingMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(final int idx) {
|
||||||
|
if (idx < 4) // outputs
|
||||||
|
{
|
||||||
|
return inverted || idx == 0;
|
||||||
|
} else {
|
||||||
|
return !inverted || idx == 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean validPatternSlot(Slot slot) {
|
||||||
|
return slot instanceof ProcessingSlotFake;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||||
|
inverted = patternTerminal.isInverted();
|
||||||
|
activePage = patternTerminal.getActivePage();
|
||||||
|
offsetSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void offsetSlots() {
|
||||||
|
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||||
|
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||||
|
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||||
|
((ProcessingSlotFake) this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS])
|
||||||
|
.setHidden(page != activePage || x > 0 && inverted);
|
||||||
|
((ProcessingSlotFake) this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS])
|
||||||
|
.setHidden(page != activePage || x > 0 && !inverted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(String field, Object oldValue, Object newValue) {
|
||||||
|
super.onUpdate(field, oldValue, newValue);
|
||||||
|
if (field.equals("inverted") || field.equals("activePage")) {
|
||||||
|
offsetSlots();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSlotChange(final Slot s) {
|
||||||
|
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||||
|
inverted = patternTerminal.isInverted();
|
||||||
|
}
|
||||||
|
super.onSlotChange(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||||
|
this.craftingMode = false;
|
||||||
|
super.doAction(player, action, slotId, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void encode() {
|
||||||
|
this.craftingMode = false;
|
||||||
|
super.encode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCraftingMode() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ProcessingSlotFake extends OptionalSlotFake {
|
||||||
|
|
||||||
|
private static final int POSITION_SHIFT = 9000;
|
||||||
|
private boolean hidden = false;
|
||||||
|
|
||||||
|
public ProcessingSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX,
|
||||||
|
int offY, int groupNum) {
|
||||||
|
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||||
|
this.setRenderDisabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHidden(boolean hide) {
|
||||||
|
if (this.hidden != hide) {
|
||||||
|
this.hidden = hide;
|
||||||
|
this.xDisplayPosition += (hide ? -1 : 1) * POSITION_SHIFT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||||
|
|
||||||
|
public class ContainerFluidPatternWireless extends ContainerFluidPatternTerminal {
|
||||||
|
|
||||||
|
public ContainerFluidPatternWireless(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||||
|
super(ip, monitorable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isWirelessTerminal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||||
|
|
||||||
|
public class ContainerFluidPortableCell extends ContainerFluidMonitor {
|
||||||
|
|
||||||
|
public ContainerFluidPortableCell(final InventoryPlayer ip, final IFluidPortableCell monitorable) {
|
||||||
|
super(ip, monitorable, false);
|
||||||
|
this.bindPlayerInventory(ip, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isWirelessTerminal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+193
@@ -0,0 +1,193 @@
|
|||||||
|
package com.glodblock.github.client.gui.container;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
|
||||||
|
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||||
|
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||||
|
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||||
|
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||||
|
import com.glodblock.github.util.Ae2Reflect;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.AccessRestriction;
|
||||||
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.StorageFilter;
|
||||||
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.storage.IMEInventory;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.iterators.NullIterator;
|
||||||
|
|
||||||
|
public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
|
||||||
|
|
||||||
|
public final PartFluidStorageBus bus;
|
||||||
|
|
||||||
|
@GuiSync(3)
|
||||||
|
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;
|
||||||
|
|
||||||
|
@GuiSync(4)
|
||||||
|
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||||
|
|
||||||
|
public ContainerFluidStorageBus(InventoryPlayer ip, PartFluidStorageBus te) {
|
||||||
|
super(ip, te);
|
||||||
|
this.bus = te;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getHeight() {
|
||||||
|
return 251;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupConfig() {
|
||||||
|
final int xo = 8;
|
||||||
|
final int yo = 23 + 6;
|
||||||
|
final IInventory upgrades = Ae2Reflect.getUpgradeList(this).getInventoryByName("upgrades");
|
||||||
|
final IInventory config = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
|
||||||
|
for (int y = 0; y < 7; y++) {
|
||||||
|
for (int x = 0; x < 9; x++) {
|
||||||
|
this.addSlotToContainer(
|
||||||
|
new OptionalFluidSlotFakeTypeOnly(config, null, this, y * 9 + x, xo, yo, x, y, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addSlotToContainer(
|
||||||
|
(new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||||
|
upgrades,
|
||||||
|
0,
|
||||||
|
187,
|
||||||
|
8,
|
||||||
|
this.getInventoryPlayer())).setNotDraggable());
|
||||||
|
this.addSlotToContainer(
|
||||||
|
(new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||||
|
upgrades,
|
||||||
|
1,
|
||||||
|
187,
|
||||||
|
8 + 18,
|
||||||
|
this.getInventoryPlayer())).setNotDraggable());
|
||||||
|
this.addSlotToContainer(
|
||||||
|
(new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||||
|
upgrades,
|
||||||
|
2,
|
||||||
|
187,
|
||||||
|
8 + 18 * 2,
|
||||||
|
this.getInventoryPlayer())).setNotDraggable());
|
||||||
|
this.addSlotToContainer(
|
||||||
|
(new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||||
|
upgrades,
|
||||||
|
3,
|
||||||
|
187,
|
||||||
|
8 + 18 * 3,
|
||||||
|
this.getInventoryPlayer())).setNotDraggable());
|
||||||
|
this.addSlotToContainer(
|
||||||
|
(new SlotRestrictedInput(
|
||||||
|
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||||
|
upgrades,
|
||||||
|
4,
|
||||||
|
187,
|
||||||
|
8 + 18 * 4,
|
||||||
|
this.getInventoryPlayer())).setNotDraggable());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
|
||||||
|
if (this.supportCapacity()) {
|
||||||
|
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||||
|
final int y = slot / 9;
|
||||||
|
return y < upgrades + 2;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean supportCapacity() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int availableUpgrades() {
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detectAndSendChanges() {
|
||||||
|
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||||
|
|
||||||
|
if (Platform.isServer()) {
|
||||||
|
this.setReadWriteMode(
|
||||||
|
(AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
|
||||||
|
this.setStorageFilter(
|
||||||
|
(StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager()
|
||||||
|
.getSetting(Settings.STORAGE_FILTER));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.standardDetectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSlotEnabled(final int idx) {
|
||||||
|
if (Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
|
||||||
|
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||||
|
return upgrades > (idx - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
AppEngInternalAEInventory h = this.bus.getConfig();
|
||||||
|
for (int i = 0; i < h.getSizeInventory(); ++i) {
|
||||||
|
h.setInventorySlotContents(i, null);
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void partition() {
|
||||||
|
AppEngInternalAEInventory h = this.bus.getConfig();
|
||||||
|
final IMEInventory<IAEFluidStack> cellInv = this.bus.getInternalHandler();
|
||||||
|
Iterator<IAEFluidStack> i = new NullIterator<>();
|
||||||
|
if (cellInv != null) {
|
||||||
|
final IItemList<IAEFluidStack> list = cellInv
|
||||||
|
.getAvailableItems(AEApi.instance().storage().createFluidList());
|
||||||
|
i = list.iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int x = 0; x < h.getSizeInventory(); x++) {
|
||||||
|
if (i.hasNext() && this.isSlotEnabled((x / 9) - 2)) {
|
||||||
|
h.setInventorySlotContents(x, ItemFluidPacket.newStack(i.next()));
|
||||||
|
} else {
|
||||||
|
h.setInventorySlotContents(x, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.detectAndSendChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AccessRestriction getReadWriteMode() {
|
||||||
|
return this.rwMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StorageFilter getStorageFilter() {
|
||||||
|
return this.storageFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||||
|
return (AppEngInternalAEInventory) this.bus.getInventoryByName("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setReadWriteMode(final AccessRestriction rwMode) {
|
||||||
|
this.rwMode = rwMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setStorageFilter(final StorageFilter storageFilter) {
|
||||||
|
this.storageFilter = storageFilter;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loaded 100 of 591 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user