1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
|
package tectech.thing.metaTileEntity.multi;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static gregtech.api.enums.Mods.Avaritia;
import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import static gregtech.api.util.GTModHandler.getModItem;
import static gregtech.api.util.GTRecipeBuilder.SECONDS;
import static gregtech.api.util.GTUtility.formatNumbers;
import static java.lang.Math.floor;
import static java.lang.Math.log;
import static java.lang.Math.max;
import static net.minecraft.util.StatCollector.translateToLocal;
import static tectech.loader.recipe.Godforge.godforgeUpgradeMats;
import static tectech.thing.casing.TTCasingsContainer.GodforgeCasings;
import static tectech.thing.casing.TTCasingsContainer.forgeOfGodsRenderBlock;
import static tectech.util.GodforgeMath.allowModuleConnection;
import static tectech.util.GodforgeMath.calculateEnergyDiscountForModules;
import static tectech.util.GodforgeMath.calculateFuelConsumption;
import static tectech.util.GodforgeMath.calculateMaxFuelFactor;
import static tectech.util.GodforgeMath.calculateMaxHeatForModules;
import static tectech.util.GodforgeMath.calculateMaxParallelForModules;
import static tectech.util.GodforgeMath.calculateProcessingVoltageForModules;
import static tectech.util.GodforgeMath.calculateSpeedBonusForModules;
import static tectech.util.GodforgeMath.calculateStartupFuelConsumption;
import static tectech.util.GodforgeMath.queryMilestoneStats;
import static tectech.util.GodforgeMath.setMiscModuleParameters;
import static tectech.util.TTUtility.toExponentForm;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import com.google.common.collect.ImmutableList;
import com.google.common.math.LongMath;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.drawable.UITexture;
import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable;
import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Color;
import com.gtnewhorizons.modularui.api.math.MainAxisAlignment;
import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.math.Size;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder;
import com.gtnewhorizons.modularui.api.widget.Widget;
import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn;
import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow;
import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.FluidNameHolderWidget;
import com.gtnewhorizons.modularui.common.widget.MultiChildWidget;
import com.gtnewhorizons.modularui.common.widget.ProgressBar;
import com.gtnewhorizons.modularui.common.widget.Scrollable;
import com.gtnewhorizons.modularui.common.widget.SlotGroup;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Materials;
import gregtech.api.enums.MaterialsUEVplus;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IHatchElement;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatchInput;
import gregtech.api.metatileentity.implementations.MTEHatchInputBus;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTOreDictUnificator;
import gregtech.api.util.HatchElementBuilder;
import gregtech.api.util.IGTHatchAdder;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.common.tileentities.machines.MTEHatchInputBusME;
import gregtech.common.tileentities.machines.MTEHatchInputME;
import gregtech.common.tileentities.machines.MTEHatchOutputBusME;
import tectech.TecTech;
import tectech.loader.TecTechConfig;
import tectech.thing.block.BlockGodforgeGlass;
import tectech.thing.block.TileEntityForgeOfGods;
import tectech.thing.gui.TecTechUITextures;
import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase;
import tectech.thing.metaTileEntity.multi.godforge_modules.MTEBaseModule;
import tectech.thing.metaTileEntity.multi.godforge_modules.MTEExoticModule;
import tectech.thing.metaTileEntity.multi.godforge_modules.MTEMoltenModule;
import tectech.thing.metaTileEntity.multi.godforge_modules.MTEPlasmaModule;
import tectech.thing.metaTileEntity.multi.godforge_modules.MTESmeltingModule;
import tectech.util.CommonValues;
public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, ISurvivalConstructable {
private static Textures.BlockIcons.CustomIcon ScreenON;
private int fuelConsumptionFactor = 1;
private int selectedFuelType = 0;
private int internalBattery = 0;
private int maxBatteryCharge = 100;
private int gravitonShardsAvailable = 0;
private int gravitonShardsSpent = 0;
private int ringAmount = 1;
private int stellarFuelAmount = 0;
private int neededStartupFuel = 0;
private long fuelConsumption = 0;
private long totalRecipesProcessed = 0;
private long totalFuelConsumed = 0;
private float totalExtensionsBuilt = 0;
private float powerMilestonePercentage = 0;
private float recipeMilestonePercentage = 0;
private float fuelMilestonePercentage = 0;
private float structureMilestonePercentage = 0;
private float invertedPowerMilestonePercentage = 0;
private float invertedRecipeMilestonePercentage = 0;
private float invertedFuelMilestonePercentage = 0;
private float invertedStructureMilestonePercentage = 0;
private BigInteger totalPowerConsumed = BigInteger.ZERO;
private boolean batteryCharging = false;
private boolean inversion = false;
private boolean gravitonShardEjection = false;
private boolean noFormatting = false;
private boolean isRenderActive = false;
public ArrayList<MTEBaseModule> moduleHatches = new ArrayList<>();
protected ItemStackHandler inputSlotHandler = new ItemStackHandler(16);
private static final int FUEL_CONFIG_WINDOW_ID = 9;
private static final int UPGRADE_TREE_WINDOW_ID = 10;
private static final int INDIVIDUAL_UPGRADE_WINDOW_ID = 11;
private static final int BATTERY_CONFIG_WINDOW_ID = 12;
private static final int MILESTONE_WINDOW_ID = 13;
private static final int INDIVIDUAL_MILESTONE_WINDOW_ID = 14;
private static final int MANUAL_INSERTION_WINDOW_ID = 15;
private static final int GENERAL_INFO_WINDOW_ID = 16;
private static final int SPECIAL_THANKS_WINDOW_ID = 17;
private static final int TEXTURE_INDEX = 960;
private static final int[] FIRST_SPLIT_UPGRADES = new int[] { 12, 13, 14 };
private static final Integer[] UPGRADE_MATERIAL_ID_CONVERSION = { 0, 5, 7, 11, 26, 29, 30 };
private static final long POWER_MILESTONE_CONSTANT = LongMath.pow(10, 15);
private static final long RECIPE_MILESTONE_CONSTANT = LongMath.pow(10, 7);
private static final long FUEL_MILESTONE_CONSTANT = 10_000;
private static final long RECIPE_MILESTONE_T7_CONSTANT = RECIPE_MILESTONE_CONSTANT * LongMath.pow(6, 6);
private static final long FUEL_MILESTONE_T7_CONSTANT = FUEL_MILESTONE_CONSTANT * LongMath.pow(3, 6);
private static final BigInteger POWER_MILESTONE_T7_CONSTANT = BigInteger.valueOf(POWER_MILESTONE_CONSTANT)
.multiply(BigInteger.valueOf(LongMath.pow(9, 6)));
private static final double POWER_LOG_CONSTANT = Math.log(9);
private static final double RECIPE_LOG_CONSTANT = Math.log(6);
private static final double FUEL_LOG_CONSTANT = Math.log(3);
protected static final String STRUCTURE_PIECE_MAIN = "main";
protected static final String STRUCTURE_PIECE_SHAFT = "beam_shaft";
protected static final String STRUCTURE_PIECE_FIRST_RING = "first_ring";
protected static final String STRUCTURE_PIECE_FIRST_RING_AIR = "first_ring_air";
protected static final String STRUCTURE_PIECE_SECOND_RING = "second_ring";
protected static final String STRUCTURE_PIECE_SECOND_RING_AIR = "second_ring_air";
protected static final String STRUCTURE_PIECE_THIRD_RING = "third_ring";
protected static final String STRUCTURE_PIECE_THIRD_RING_AIR = "third_ring_air";
private static final String SCANNER_INFO_BAR = EnumChatFormatting.BLUE
+ "--------------------------------------------";
private static final String TOOLTIP_BAR = EnumChatFormatting.AQUA
+ "--------------------------------------------------------------------------";
private static final ItemStack STELLAR_FUEL = Avaritia.isModLoaded() ? getModItem(Avaritia.ID, "Resource", 1, 8)
: GTOreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 1);
private final boolean debugMode = TecTechConfig.DEBUG_MODE;
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
int realBudget = elementBudget >= 1000 ? elementBudget : Math.min(1000, elementBudget * 5);
// 1000 blocks max per placement.
int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 63, 14, 1, realBudget, env, false, true);
if (stackSize.stackSize > 1) {
built += survivialBuildPiece(
STRUCTURE_PIECE_SECOND_RING,
stackSize,
55,
11,
-67,
realBudget,
env,
false,
true);
}
if (stackSize.stackSize > 2) {
built += survivialBuildPiece(
STRUCTURE_PIECE_THIRD_RING,
stackSize,
47,
13,
-76,
realBudget,
env,
false,
true);
}
return built;
}
@Override
public IStructureDefinition<MTEForgeOfGods> getStructure_EM() {
return STRUCTURE_DEFINITION;
}
public static final IStructureDefinition<MTEForgeOfGods> STRUCTURE_DEFINITION = IStructureDefinition
.<MTEForgeOfGods>builder()
.addShape(STRUCTURE_PIECE_MAIN, ForgeOfGodsStructureString.MAIN_STRUCTURE)
.addShape(STRUCTURE_PIECE_SHAFT, ForgeOfGodsStructureString.BEAM_SHAFT)
.addShape(STRUCTURE_PIECE_FIRST_RING, ForgeOfGodsStructureString.FIRST_RING)
.addShape(STRUCTURE_PIECE_FIRST_RING_AIR, ForgeOfGodsStructureString.FIRST_RING_AIR)
.addShape(STRUCTURE_PIECE_SECOND_RING, ForgeOfGodsRingsStructureString.SECOND_RING)
.addShape(STRUCTURE_PIECE_SECOND_RING_AIR, ForgeOfGodsRingsStructureString.SECOND_RING_AIR)
.addShape(STRUCTURE_PIECE_THIRD_RING, ForgeOfGodsRingsStructureString.THIRD_RING)
.addShape(STRUCTURE_PIECE_THIRD_RING_AIR, ForgeOfGodsRingsStructureString.THIRD_RING_AIR)
.addElement('A', classicHatches(TEXTURE_INDEX + 3, 1, GodforgeCasings, 3))
.addElement('B', ofBlock(GodforgeCasings, 0))
.addElement('C', ofBlock(GodforgeCasings, 1))
.addElement('D', ofBlock(GodforgeCasings, 2))
.addElement('E', ofBlock(GodforgeCasings, 3))
.addElement('F', ofBlock(GodforgeCasings, 4))
.addElement('G', ofBlock(GodforgeCasings, 5))
.addElement('H', ofBlock(BlockGodforgeGlass.INSTANCE, 0))
.addElement('I', ofBlock(GodforgeCasings, 7))
.addElement(
'J',
HatchElementBuilder.<MTEForgeOfGods>builder()
.atLeast(moduleElement.Module)
.casingIndex(TEXTURE_INDEX)
.dot(2)
.buildAndChain(GodforgeCasings, 0))
.addElement('K', ofBlock(GodforgeCasings, 6))
.addElement('L', ofBlock(Blocks.air, 0))
.build();
public MTEForgeOfGods(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
public MTEForgeOfGods(String aName) {
super(aName);
}
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEForgeOfGods(mName);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aBlockIconRegister) {
ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/GODFORGE_CONTROLLER");
super.registerIcons(aBlockIconRegister);
}
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
int colorIndex, boolean aActive, boolean aRedstone) {
if (side == facing) {
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TEXTURE_INDEX + 1),
TextureFactory.builder()
.addIcon(ScreenON)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(ScreenON)
.extFacing()
.glow()
.build() };
}
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(TEXTURE_INDEX + 1) };
}
@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
structureBuild_EM(STRUCTURE_PIECE_MAIN, 63, 14, 1, stackSize, hintsOnly);
if (stackSize.stackSize > 1) {
buildPiece(STRUCTURE_PIECE_SECOND_RING, stackSize, hintsOnly, 55, 11, -67);
}
if (stackSize.stackSize > 2) {
buildPiece(STRUCTURE_PIECE_THIRD_RING, stackSize, hintsOnly, 47, 13, -76);
}
}
private final ArrayList<FluidStack> validFuelList = new ArrayList<>() {
{
add(MaterialsUEVplus.DimensionallyTranscendentResidue.getFluid(1));
add(MaterialsUEVplus.RawStarMatter.getFluid(1));
add(MaterialsUEVplus.MagnetohydrodynamicallyConstrainedStarMatter.getMolten(1));
}
};
@Override
public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) {
moduleHatches.clear();
// Check structure of multi
if (isRenderActive) {
if (!structureCheck_EM(STRUCTURE_PIECE_SHAFT, 63, 14, 1)
|| !structureCheck_EM(STRUCTURE_PIECE_FIRST_RING_AIR, 63, 14, -59)) {
destroyRenderer();
return false;
}
} else if (!structureCheck_EM(STRUCTURE_PIECE_MAIN, 63, 14, 1)) {
return false;
}
if (internalBattery != 0 && !isRenderActive) {
createRenderer();
}
// Check there is 1 input bus
if (mInputBusses.size() != 1) {
return false;
}
// Check there is 1 me output bus
{
if (mOutputBusses.size() != 1) {
return false;
}
if (!(mOutputBusses.get(0) instanceof MTEHatchOutputBusME)) {
return false;
}
}
// Make sure there are no energy hatches
{
if (mEnergyHatches.size() > 0) {
return false;
}
if (mExoticEnergyHatches.size() > 0) {
return false;
}
}
// Make sure there is 1 input hatch
if (mInputHatches.size() != 1) {
return false;
}
if (isUpgradeActive(26)) {
if (checkPiece(STRUCTURE_PIECE_SECOND_RING, 55, 11, -67)) {
ringAmount = 2;
destroySecondRing();
UpdateRenderer();
}
if (isRenderActive && ringAmount >= 2 && !checkPiece(STRUCTURE_PIECE_SECOND_RING_AIR, 55, 11, -67)) {
destroyRenderer();
}
} else {
if (ringAmount == 3) {
buildThirdRing();
}
if (ringAmount >= 2) {
ringAmount = 1;
UpdateRenderer();
buildSecondRing();
}
}
if (isUpgradeActive(29)) {
if (checkPiece(STRUCTURE_PIECE_THIRD_RING, 47, 13, -76)) {
ringAmount = 3;
destroyThirdRing();
UpdateRenderer();
}
if (isRenderActive && ringAmount == 3 && !checkPiece(STRUCTURE_PIECE_THIRD_RING_AIR, 47, 13, -76)) {
destroyRenderer();
}
} else {
if (ringAmount == 3) {
ringAmount = 2;
UpdateRenderer();
buildThirdRing();
}
}
return true;
}
int ticker = 0;
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPostTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isServerSide()) {
ticker++;
// Check and drain fuel
if (ticker % (5 * SECONDS) == 0) {
ticker = 0;
startRecipeProcessing();
FluidStack[] fluidInHatch = null;
boolean fuelDrained = false;
if (mInputHatches != null && mInputHatches.size() != 0) {
fluidInHatch = this.getStoredFluids()
.toArray(new FluidStack[0]);
}
int maxModuleCount = 8;
if (upgrades[26]) {
maxModuleCount += 4;
}
if (upgrades[29]) {
maxModuleCount += 4;
}
if (mInputBusses.size() != 0) {
if (internalBattery == 0) {
MTEHatchInputBus inputBus = mInputBusses.get(0);
ItemStack[] inputBusInventory = inputBus.getRealInventory();
if (inputBusInventory != null) {
for (int i = 0; i < inputBusInventory.length; i++) {
ItemStack itemStack = inputBusInventory[i];
if (itemStack != null && itemStack.isItemEqual(STELLAR_FUEL)) {
int stacksize = itemStack.stackSize;
if (inputBus instanceof MTEHatchInputBusME meBus) {
ItemStack realItem = meBus.getRealInventory()[i + 16];
if (realItem == null) {
break;
}
stacksize = realItem.stackSize;
}
inputBus.decrStackSize(i, stacksize);
stellarFuelAmount += stacksize;
inputBus.updateSlots();
}
}
}
neededStartupFuel = calculateStartupFuelConsumption(this);
if (stellarFuelAmount >= neededStartupFuel) {
stellarFuelAmount -= neededStartupFuel;
increaseBattery(neededStartupFuel);
createRenderer();
}
} else {
fuelConsumption = (long) calculateFuelConsumption(this) * 5 * (batteryCharging ? 2 : 1);
if (fluidInHatch != null && fuelConsumption < Integer.MAX_VALUE) {
for (FluidStack fluid : fluidInHatch) {
if (fluid.isFluidEqual(validFuelList.get(selectedFuelType))) {
FluidStack fluidNeeded = new FluidStack(
validFuelList.get(selectedFuelType),
(int) fuelConsumption);
FluidStack fluidReal;
if (mInputHatches.get(0) instanceof MTEHatchInputME meHatch) {
fluidReal = meHatch.drain(ForgeDirection.UNKNOWN, fluidNeeded, true);
} else {
fluidReal = mInputHatches.get(0)
.drain(fluidNeeded.amount, true);
}
if (fluidReal == null || fluidReal.amount < fluidNeeded.amount) {
reduceBattery(fuelConsumptionFactor);
} else {
totalFuelConsumed += getFuelFactor();
if (batteryCharging) {
increaseBattery(fuelConsumptionFactor);
}
}
fuelDrained = true;
}
}
if (!fuelDrained) {
reduceBattery(fuelConsumptionFactor);
}
} else {
reduceBattery(fuelConsumptionFactor);
}
}
}
determineCompositionMilestoneLevel();
checkInversionStatus();
determineMilestoneProgress();
if (!debugMode) {
determineGravitonShardAmount();
}
if (upgrades[30] && gravitonShardEjection) {
ejectGravitonShards();
}
// Do module calculations and checks
if (moduleHatches.size() > 0 && internalBattery > 0 && moduleHatches.size() <= maxModuleCount) {
for (MTEBaseModule module : moduleHatches) {
if (allowModuleConnection(module, this)) {
module.connect();
calculateMaxHeatForModules(module, this);
calculateSpeedBonusForModules(module, this);
calculateMaxParallelForModules(module, this);
calculateEnergyDiscountForModules(module, this);
setMiscModuleParameters(module, this);
queryMilestoneStats(module, this);
if (!upgrades[28]) {
calculateProcessingVoltageForModules(module, this);
}
} else {
module.disconnect();
}
}
} else if (moduleHatches.size() > maxModuleCount) {
for (MTEBaseModule module : moduleHatches) {
module.disconnect();
}
}
if (mEfficiency < 0) mEfficiency = 0;
endRecipeProcessing();
}
}
}
public boolean addModuleToMachineList(IGregTechTileEntity tileEntity, int baseCasingIndex) {
if (tileEntity == null) {
return false;
}
IMetaTileEntity metaTileEntity = tileEntity.getMetaTileEntity();
if (metaTileEntity == null) {
return false;
}
if (metaTileEntity instanceof MTEBaseModule) {
return moduleHatches.add((MTEBaseModule) metaTileEntity);
}
return false;
}
public enum moduleElement implements IHatchElement<MTEForgeOfGods> {
Module(MTEForgeOfGods::addModuleToMachineList, MTEBaseModule.class) {
@Override
public long count(MTEForgeOfGods tileEntity) {
return tileEntity.moduleHatches.size();
}
};
private final List<Class<? extends IMetaTileEntity>> mteClasses;
private final IGTHatchAdder<MTEForgeOfGods> adder;
@SafeVarargs
moduleElement(IGTHatchAdder<MTEForgeOfGods> adder, Class<? extends IMetaTileEntity>... mteClasses) {
this.mteClasses = Collections.unmodifiableList(Arrays.asList(mteClasses));
this.adder = adder;
}
@Override
public List<? extends Class<? extends IMetaTileEntity>> mteClasses() {
return mteClasses;
}
public IGTHatchAdder<? super MTEForgeOfGods> adder() {
return adder;
}
}
private TileEntityForgeOfGods getRenderer() {
IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity();
int x = gregTechTileEntity.getXCoord();
int y = gregTechTileEntity.getYCoord();
int z = gregTechTileEntity.getZCoord();
double xOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetX;
double zOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
double yOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetY;
TileEntity tile = this.getBaseMetaTileEntity()
.getWorld()
.getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset));
if (tile instanceof TileEntityForgeOfGods forgeTile) {
return forgeTile;
}
return null;
}
private void UpdateRenderer() {
TileEntityForgeOfGods tile = getRenderer();
if (tile == null) return;
tile.setRingCount(ringAmount);
tile.setStarRadius(20);
tile.setRotationSpeed(5);
tile.updateToClient();
}
private void createRenderer() {
IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity();
int x = gregTechTileEntity.getXCoord();
int y = gregTechTileEntity.getYCoord();
int z = gregTechTileEntity.getZCoord();
double xOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetX;
double zOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
double yOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetY;
this.getBaseMetaTileEntity()
.getWorld()
.setBlock((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset), Blocks.air);
this.getBaseMetaTileEntity()
.getWorld()
.setBlock((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset), forgeOfGodsRenderBlock);
TileEntityForgeOfGods rendererTileEntity = (TileEntityForgeOfGods) this.getBaseMetaTileEntity()
.getWorld()
.getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset));
switch (ringAmount) {
case 2 -> {
destroyFirstRing();
destroySecondRing();
}
case 3 -> {
destroyFirstRing();
destroySecondRing();
destroyThirdRing();
}
default -> {
destroyFirstRing();
}
}
rendererTileEntity.setRenderRotation(getRotation(), getDirection());
UpdateRenderer();
isRenderActive = true;
}
private void destroyRenderer() {
IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity();
int x = gregTechTileEntity.getXCoord();
int y = gregTechTileEntity.getYCoord();
int z = gregTechTileEntity.getZCoord();
double xOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetX;
double zOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetZ;
double yOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetY;
this.getBaseMetaTileEntity()
.getWorld()
.setBlock((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset), Blocks.air);
switch (ringAmount) {
case 2 -> {
buildFirstRing();
buildSecondRing();
}
case 3 -> {
buildFirstRing();
buildSecondRing();
buildThirdRing();
}
default -> {
buildFirstRing();
}
}
isRenderActive = false;
}
private void destroyFirstRing() {
buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59);
}
private void destroySecondRing() {
buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67);
}
private void destroyThirdRing() {
buildPiece(STRUCTURE_PIECE_THIRD_RING_AIR, null, false, 47, 13, -76);
}
private void buildFirstRing() {
buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59);
}
private void buildSecondRing() {
buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67);
}
private void buildThirdRing() {
buildPiece(STRUCTURE_PIECE_THIRD_RING, null, false, 47, 13, -76);
}
@Override
public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (!debugMode) return;
if (isRenderActive) {
destroyRenderer();
isRenderActive = false;
} else {
ringAmount = 3;
createRenderer();
isRenderActive = true;
}
}
@Override
public void onBlockDestroyed() {
super.onBlockDestroyed();
if (isRenderActive) {
destroyRenderer();
}
}
@Override
public String[] getInfoData() {
ArrayList<String> str = new ArrayList<>(Arrays.asList(super.getInfoData()));
str.add(SCANNER_INFO_BAR);
str.add("Number of Rings: " + EnumChatFormatting.GOLD + ringAmount);
str.add("Total Upgrades Unlocked: " + EnumChatFormatting.GOLD + getTotalActiveUpgrades());
str.add("Connected Modules: " + EnumChatFormatting.GOLD + moduleHatches.size());
str.add(SCANNER_INFO_BAR);
return str.toArray(new String[0]);
}
@Override
public void onRemoval() {
if (moduleHatches != null && moduleHatches.size() > 0) {
for (MTEBaseModule module : moduleHatches) {
module.disconnect();
}
}
super.onRemoval();
}
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
if (doesBindPlayerInventory()) {
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE)
.setPos(4, 4)
.setSize(190, 85));
} else {
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE_NO_INVENTORY)
.setPos(4, 4)
.setSize(190, 171));
}
buildContext.addSyncedWindow(UPGRADE_TREE_WINDOW_ID, this::createUpgradeTreeWindow);
buildContext.addSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID, this::createIndividualUpgradeWindow);
buildContext.addSyncedWindow(FUEL_CONFIG_WINDOW_ID, this::createFuelConfigWindow);
buildContext.addSyncedWindow(BATTERY_CONFIG_WINDOW_ID, this::createBatteryWindow);
buildContext.addSyncedWindow(MILESTONE_WINDOW_ID, this::createMilestoneWindow);
buildContext.addSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID, this::createIndividualMilestoneWindow);
buildContext.addSyncedWindow(MANUAL_INSERTION_WINDOW_ID, this::createManualInsertionWindow);
buildContext.addSyncedWindow(GENERAL_INFO_WINDOW_ID, this::createGeneralInfoWindow);
buildContext.addSyncedWindow(SPECIAL_THANKS_WINDOW_ID, this::createSpecialThanksWindow);
builder.widget(
new ButtonWidget().setOnClick(
(clickData, widget) -> {
if (!widget.isClient()) widget.getContext()
.openSyncedWindow(UPGRADE_TREE_WINDOW_ID);
})
.setSize(16, 16)
.setBackground(() -> {
List<UITexture> button = new ArrayList<>();
button.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
button.add(TecTechUITextures.OVERLAY_BUTTON_ARROW_BLUE_UP);
return button.toArray(new IDrawable[0]);
})
.addTooltip("Path of Celestial Transcendence")
.setPos(174, 167)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_HEAT_SINK_SMALL)
.setPos(174, 183)
.setSize(16, 6))
.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient()) {
widget.getContext()
.openSyncedWindow(FUEL_CONFIG_WINDOW_ID);
}
})
.setSize(16, 16)
.setBackground(() -> {
List<UITexture> button = new ArrayList<>();
button.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
button.add(TecTechUITextures.OVERLAY_BUTTON_HEAT_ON);
return button.toArray(new IDrawable[0]);
})
.addTooltip(translateToLocal("fog.button.fuelconfig.tooltip"))
.setPos(174, 110)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.widget(
TextWidget.dynamicText(this::storedFuel)
.setDefaultColor(EnumChatFormatting.WHITE)
.setPos(6, 8)
.setSize(74, 34))
.widget(createPowerSwitchButton())
.widget(createBatteryButton(builder))
.widget(createEjectionSwitch(builder))
.widget(new FakeSyncWidget.BooleanSyncer(() -> getBaseMetaTileEntity().isAllowedToWork(), val -> {
if (val) {
getBaseMetaTileEntity().enableWorking();
} else {
getBaseMetaTileEntity().disableWorking();
}
}))
.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient()) {
checkMachine_EM(this.getBaseMetaTileEntity(), null);
}
})
.setSize(16, 16)
.setBackground(() -> {
List<UITexture> button = new ArrayList<>();
button.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
button.add(TecTechUITextures.OVERLAY_CYCLIC_BLUE);
return button.toArray(new IDrawable[0]);
})
.addTooltip(translateToLocal("fog.button.structurecheck.tooltip"))
.setPos(8, 91)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient()) {
widget.getContext()
.openSyncedWindow(MILESTONE_WINDOW_ID);
}
})
.setSize(16, 16)
.setBackground(() -> {
List<UITexture> button = new ArrayList<>();
button.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
button.add(TecTechUITextures.OVERLAY_BUTTON_FLAG);
return button.toArray(new IDrawable[0]);
})
.addTooltip(translateToLocal("fog.button.milestones.tooltip"))
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(174, 91))
.widget(
new ButtonWidget().setOnClick(
(clickData, widget) -> {
if (!widget.isClient()) widget.getContext()
.openSyncedWindow(GENERAL_INFO_WINDOW_ID);
})
.setSize(18, 18)
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.clickhere"))
.setPos(172, 67)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.widget(
new ButtonWidget().setOnClick(
(clickData, widget) -> {
if (!widget.isClient()) widget.getContext()
.openSyncedWindow(SPECIAL_THANKS_WINDOW_ID);
})
.setSize(16, 16)
.addTooltip(translateToLocal("fog.button.thanks.tooltip"))
.setBackground(TecTechUITextures.OVERLAY_BUTTON_HEART)
.setPos(8, 69)
.setTooltipShowUpDelay(TOOLTIP_DELAY));
}
@Override
public void addGregTechLogo(ModularWindow.Builder builder) {
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_GODFORGE_LOGO)
.setSize(18, 18)
.setPos(172, 67));
}
@Override
protected ButtonWidget createPowerSwitchButton() {
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
if (getBaseMetaTileEntity().isAllowedToWork()) {
getBaseMetaTileEntity().disableWorking();
} else {
getBaseMetaTileEntity().enableWorking();
}
})
.setPlayClickSound(false)
.setBackground(() -> {
List<UITexture> ret = new ArrayList<>();
ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
if (getBaseMetaTileEntity().isAllowedToWork()) {
ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_ON);
} else {
ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_DISABLED);
}
return ret.toArray(new IDrawable[0]);
})
.setPos(174, doesBindPlayerInventory() ? 148 : 172)
.setSize(16, 16);
button.addTooltip("Power Switch")
.setTooltipShowUpDelay(TOOLTIP_DELAY);
return (ButtonWidget) button;
}
protected ButtonWidget createEjectionSwitch(IWidgetBuilder<?> builder) {
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {
if (upgrades[30]) {
gravitonShardEjection = !gravitonShardEjection;
}
})
.setPlayClickSound(upgrades[30])
.setBackground(() -> {
List<UITexture> ret = new ArrayList<>();
if (!upgrades[30]) {
return ret.toArray(new IDrawable[0]);
}
if (gravitonShardEjection) {
ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
ret.add(TecTechUITextures.OVERLAY_EJECTION_ON);
} else {
ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
ret.add(TecTechUITextures.OVERLAY_EJECTION_LOCKED);
}
return ret.toArray(new IDrawable[0]);
})
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(() -> gravitonShardEjection, val -> gravitonShardEjection = val),
builder)
.setPos(26, 91)
.setSize(16, 16)
.attachSyncer(new FakeSyncWidget.BooleanSyncer(() -> upgrades[30], val -> upgrades[30] = val), builder);
if (upgrades[30]) {
button.addTooltip(translateToLocal("fog.button.ejection.tooltip"));
button.setTooltipShowUpDelay(TOOLTIP_DELAY);
}
return (ButtonWidget) button;
}
protected Widget createBatteryButton(IWidgetBuilder<?> builder) {
Widget button = new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
if (clickData.mouseButton == 0) {
batteryCharging = !batteryCharging;
} else if (clickData.mouseButton == 1 && !widget.isClient() && upgrades[8]) {
widget.getContext()
.openSyncedWindow(BATTERY_CONFIG_WINDOW_ID);
}
})
.setPlayClickSound(false)
.setBackground(() -> {
List<UITexture> ret = new ArrayList<>();
ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32);
if (batteryCharging) {
ret.add(TecTechUITextures.OVERLAY_BUTTON_BATTERY_ON);
} else {
ret.add(TecTechUITextures.OVERLAY_BUTTON_BATTERY_OFF);
}
return ret.toArray(new IDrawable[0]);
})
.setPos(174, 129)
.setSize(16, 16);
button.addTooltip(translateToLocal("fog.button.battery.tooltip.01"))
.addTooltip(EnumChatFormatting.GRAY + translateToLocal("fog.button.battery.tooltip.02"))
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(() -> batteryCharging, val -> batteryCharging = val),
builder);
return button;
}
protected ModularWindow createBatteryWindow(final EntityPlayer player) {
final int WIDTH = 78;
final int HEIGHT = 52;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT);
builder.setGuiTint(getGUIColorization());
builder.setDraggable(true);
builder.setPos(
(size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT))
.add(
Alignment.BottomRight.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT))
.add(WIDTH - 3, 0)
.subtract(0, 10)));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.batteryinfo")
.setPos(3, 4)
.setSize(74, 20))
.widget(
new NumericWidget().setSetter(val -> maxBatteryCharge = (int) val)
.setGetter(() -> maxBatteryCharge)
.setBounds(1, Integer.MAX_VALUE)
.setDefaultValue(100)
.setScrollValues(1, 4, 64)
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(4, 25)
.setBackground(GTUITextures.BACKGROUND_TEXT_FIELD));
return builder.build();
}
protected ModularWindow createFuelConfigWindow(final EntityPlayer player) {
final int WIDTH = 78;
final int HEIGHT = 130;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT);
builder.setGuiTint(getGUIColorization());
builder.setDraggable(true);
builder.setPos(
(size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT))
.add(
Alignment.TopRight.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT))
.add(WIDTH - 3, 0)));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.fuelconsumption")
.setPos(3, 2)
.setSize(74, 34))
.widget(
new NumericWidget().setSetter(val -> fuelConsumptionFactor = (int) val)
.setGetter(() -> fuelConsumptionFactor)
.setBounds(1, calculateMaxFuelFactor(this))
.setDefaultValue(1)
.setScrollValues(1, 4, 64)
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(70, 18)
.setPos(4, 35)
.setBackground(GTUITextures.BACKGROUND_TEXT_FIELD))
.widget(
new DrawableWidget().setDrawable(ModularUITextures.ICON_INFO)
.setPos(64, 24)
.setSize(10, 10)
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.0"))
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.1"))
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.2"))
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.3"))
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.4"))
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfo.5"))
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.fueltype")
.setPos(3, 57)
.setSize(74, 24))
.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.fuelusage")
.setPos(3, 100)
.setSize(74, 20))
.widget(
TextWidget.dynamicText(this::fuelUsage)
.setPos(3, 115)
.setSize(74, 15))
.widget(
new MultiChildWidget().addChild(
new FluidNameHolderWidget(
() -> MaterialsUEVplus.DimensionallyTranscendentResidue.getFluid(1)
.getUnlocalizedName()
.substring(6),
(String) -> MaterialsUEVplus.DimensionallyTranscendentResidue.getFluid(1)
.getUnlocalizedName()) {
@Override
public void buildTooltip(List<Text> tooltip) {
FluidStack fluid = createFluidStack();
addFluidNameInfo(tooltip, fluid);
addAdditionalFluidInfo(tooltip, fluid);
}
}.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(1, 1)
.setSize(16, 16))
.addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
selectedFuelType = 0;
})
.setBackground(() -> {
if (selectedFuelType == 0) {
return new IDrawable[] { TecTechUITextures.SLOT_OUTLINE_GREEN };
} else {
return new IDrawable[] {};
}
})
.setSize(18, 18)
.attachSyncer(new FakeSyncWidget.IntegerSyncer(this::getFuelType, this::setFuelType), builder))
.setPos(6, 82)
.setSize(18, 18))
.widget(
new MultiChildWidget().addChild(
new FluidNameHolderWidget(
() -> MaterialsUEVplus.RawStarMatter.getFluid(1)
.getUnlocalizedName()
.substring(6),
(String) -> MaterialsUEVplus.RawStarMatter.getFluid(1)
.getUnlocalizedName()) {
@Override
public void buildTooltip(List<Text> tooltip) {
FluidStack fluid = createFluidStack();
addFluidNameInfo(tooltip, fluid);
addAdditionalFluidInfo(tooltip, fluid);
}
}.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(1, 1)
.setSize(16, 16))
.addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
selectedFuelType = 1;
})
.setBackground(() -> {
if (selectedFuelType == 1) {
return new IDrawable[] { TecTechUITextures.SLOT_OUTLINE_GREEN };
} else {
return new IDrawable[] {};
}
})
.setSize(18, 18))
.setPos(29, 82)
.setSize(18, 18)
.attachSyncer(new FakeSyncWidget.IntegerSyncer(this::getFuelType, this::setFuelType), builder))
.widget(
new MultiChildWidget().addChild(
new FluidNameHolderWidget(
() -> MaterialsUEVplus.MagnetohydrodynamicallyConstrainedStarMatter.getMolten(1)
.getUnlocalizedName()
.substring(6),
(String) -> MaterialsUEVplus.MagnetohydrodynamicallyConstrainedStarMatter.getMolten(1)
.getUnlocalizedName()) {
@Override
public void buildTooltip(List<Text> tooltip) {
FluidStack fluid = createFluidStack();
addFluidNameInfo(tooltip, fluid);
addAdditionalFluidInfo(tooltip, fluid);
}
}.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(1, 1)
.setSize(16, 16))
.addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
selectedFuelType = 2;
})
.setBackground(() -> {
if (selectedFuelType == 2) {
return new IDrawable[] { TecTechUITextures.SLOT_OUTLINE_GREEN };
} else {
return new IDrawable[] {};
}
})
.setSize(18, 18))
.setPos(52, 82)
.setSize(18, 18)
.attachSyncer(new FakeSyncWidget.IntegerSyncer(this::getFuelType, this::setFuelType), builder));
return builder.build();
}
private final int[] milestoneProgress = new int[] { 0, 0, 0, 0 };
protected ModularWindow createMilestoneWindow(final EntityPlayer player) {
final int WIDTH = 400;
final int HEIGHT = 300;
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(TecTechUITextures.BACKGROUND_SPACE);
builder.setGuiTint(getGUIColorization());
builder.setDraggable(true);
builder.widget(createMilestoneButton(0, 80, 100, new Pos2d(62, 24)));
builder.widget(createMilestoneButton(1, 70, 98, new Pos2d(263, 25)));
builder.widget(createMilestoneButton(2, 100, 100, new Pos2d(52, 169)));
builder.widget(createMilestoneButton(3, 100, 100, new Pos2d(248, 169)));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.powermilestone")
.setDefaultColor(EnumChatFormatting.GOLD)
.setPos(77, 45)
.setSize(50, 30));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.recipemilestone")
.setDefaultColor(EnumChatFormatting.GOLD)
.setPos(268, 45)
.setSize(60, 30));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.fuelmilestone")
.setDefaultColor(EnumChatFormatting.GOLD)
.setPos(77, 190)
.setSize(50, 30));
builder.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG.purchasablemilestone")
.setDefaultColor(EnumChatFormatting.GOLD)
.setPos(268, 190)
.setSize(60, 30));
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BACKGROUND)
.setPos(37, 70)
.setSize(130, 7))
.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BACKGROUND)
.setPos(233, 70)
.setSize(130, 7))
.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BACKGROUND)
.setPos(37, 215)
.setSize(130, 7))
.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BACKGROUND)
.setPos(233, 215)
.setSize(130, 7));
builder.widget(
new ProgressBar().setProgress(() -> powerMilestonePercentage)
.setDirection(ProgressBar.Direction.RIGHT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_RED, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(37, 70))
.widget(
new ProgressBar().setProgress(() -> recipeMilestonePercentage)
.setDirection(ProgressBar.Direction.RIGHT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_PURPLE, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(233, 70))
.widget(
new ProgressBar().setProgress(() -> fuelMilestonePercentage)
.setDirection(ProgressBar.Direction.RIGHT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BLUE, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(37, 215))
.widget(
new ProgressBar().setProgress(() -> structureMilestonePercentage)
.setDirection(ProgressBar.Direction.RIGHT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_RAINBOW, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(233, 215))
.widget(
new ProgressBar().setProgress(() -> invertedPowerMilestonePercentage)
.setDirection(ProgressBar.Direction.LEFT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_RED_INVERTED, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(37, 70))
.widget(
new ProgressBar().setProgress(() -> invertedRecipeMilestonePercentage)
.setDirection(ProgressBar.Direction.LEFT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_PURPLE_INVERTED, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(233, 70))
.widget(
new ProgressBar().setProgress(() -> invertedFuelMilestonePercentage)
.setDirection(ProgressBar.Direction.LEFT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_BLUE_INVERTED, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(37, 215))
.widget(
new ProgressBar().setProgress(() -> invertedStructureMilestonePercentage)
.setDirection(ProgressBar.Direction.LEFT)
.setTexture(TecTechUITextures.PROGRESSBAR_GODFORGE_MILESTONE_RAINBOW_INVERTED, 130)
.setSynced(true, false)
.setSize(130, 7)
.setPos(233, 215))
.widget(
ButtonWidget.closeWindowButton(true)
.setPos(382, 6));
return builder.build();
}
protected ModularWindow createIndividualMilestoneWindow(final EntityPlayer player) {
final int WIDTH = 150;
final int HEIGHT = 150;
int symbol_width;
int symbol_height;
String milestoneType;
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
UITexture symbol;
switch (currentMilestoneID) {
case 1 -> {
symbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CONVERSION;
symbol_width = 54;
symbol_height = 75;
milestoneType = "recipe";
}
case 2 -> {
symbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CATALYST;
symbol_width = 75;
symbol_height = 75;
milestoneType = "fuel";
}
case 3 -> {
symbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_COMPOSITION;
symbol_width = 75;
symbol_height = 75;
milestoneType = "purchasable";
}
default -> {
symbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CHARGE;
symbol_width = 60;
symbol_height = 75;
milestoneType = "power";
}
}
builder.setBackground(TecTechUITextures.BACKGROUND_GLOW_WHITE);
builder.setDraggable(true);
builder.widget(
ButtonWidget.closeWindowButton(true)
.setPos(134, 4))
.widget(
new DrawableWidget().setDrawable(symbol)
.setSize(symbol_width, symbol_height)
.setPos((WIDTH - symbol_width) / 2, (HEIGHT - symbol_height) / 2))
.widget(
TextWidget.localised("gt.blockmachines.multimachine.FOG." + milestoneType + "milestone")
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.Center)
.setPos(0, 8)
.setSize(150, 15))
.widget(
TextWidget.dynamicText(this::inversionStatusText)
.setDefaultColor(EnumChatFormatting.AQUA)
.setTextAlignment(Alignment.Center)
.setScale(0.8f)
.setPos(0, 120)
.setSize(150, 15))
.widget(
TextWidget.dynamicText(() -> totalMilestoneProgress(currentMilestoneID))
.setScale(0.7f)
.setDefaultColor(EnumChatFormatting.WHITE)
.setTextAlignment(Alignment.Center)
.setPos(5, 30)
.setSize(140, 30))
.widget(
TextWidget.dynamicText(() -> currentMilestone(currentMilestoneID))
.setScale(0.7f)
.setDefaultColor(EnumChatFormatting.WHITE)
.setTextAlignment(Alignment.Center)
.setPos(5, 50)
.setSize(140, 30))
.widget(
TextWidget.dynamicText(() -> milestoneProgressText(currentMilestoneID, true))
.setScale(0.7f)
.setDefaultColor(EnumChatFormatting.WHITE)
.setSize(140, 30)
.setPos(5, 70))
.widget(
TextWidget.dynamicText(() -> gravitonShardAmountText(currentMilestoneID))
.setScale(0.7f)
.setDefaultColor(EnumChatFormatting.WHITE)
.setSize(140, 30)
.setPos(5, 90))
.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
if (clickData.mouseButton == 0) {
noFormatting = !noFormatting;
}
})
.setSize(10, 10)
.addTooltip(translateToLocal("fog.button.formatting.tooltip"))
.setBackground(TecTechUITextures.OVERLAY_CYCLIC_BLUE)
.setPos(5, 135)
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(() -> noFormatting, val -> noFormatting = val),
builder));
return builder.build();
}
private int currentMilestoneID = 0;
private Widget createMilestoneButton(int milestoneID, int width, int height, Pos2d pos) {
return new ButtonWidget().setOnClick((clickData, widget) -> {
currentMilestoneID = milestoneID;
if (!widget.isClient()) {
if (widget.getContext()
.isWindowOpen(INDIVIDUAL_MILESTONE_WINDOW_ID)) {
widget.getContext()
.closeWindow(INDIVIDUAL_MILESTONE_WINDOW_ID);
}
widget.getContext()
.openSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID);
}
})
.setSize(width, height)
.setBackground(() -> switch (milestoneID) {
case 1 -> new IDrawable[] { TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CONVERSION_GLOW };
case 2 -> new IDrawable[] { TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CATALYST_GLOW };
case 3 -> new IDrawable[] { TecTechUITextures.PICTURE_GODFORGE_MILESTONE_COMPOSITION_GLOW };
default -> new IDrawable[] { TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CHARGE_GLOW };
})
.addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.milestoneinfo"))
.setPos(pos)
.setTooltipShowUpDelay(TOOLTIP_DELAY);
}
private int currentUpgradeID = 0;
private int currentColorCode = 0;
private int currentMilestoneBG = 0;
private int gravitonShardCost = 0;
private int[][] prereqUpgrades = new int[31][];
private int[] followupUpgrades = new int[] {};
private boolean isUpradeSplitStart = false;
private boolean doesCurrentUpgradeRequireExtraMats = false;
private boolean[] allPrereqRequired = new boolean[31];
private boolean[] upgrades = new boolean[31];
private boolean[] materialPaidUpgrades = new boolean[7];
protected ModularWindow createUpgradeTreeWindow(final EntityPlayer player) {
final Scrollable scrollable = new Scrollable().setVerticalScroll();
final int PARENT_WIDTH = 300;
final int PARENT_HEIGHT = 300;
ModularWindow.Builder builder = ModularWindow.builder(PARENT_WIDTH, PARENT_HEIGHT);
scrollable.widget(createUpgradeConnectorLine(new Pos2d(143, 71), 45, 0, 0, 0, 1))
.widget(createUpgradeConnectorLine(new Pos2d(124, 124), 60, 27, 0, 1, 2))
.widget(createUpgradeConnectorLine(new Pos2d(162, 124), 60, 333, 0, 1, 3))
.widget(createUpgradeConnectorLine(new Pos2d(94, 184), 60, 27, 0, 2, 4))
.widget(createUpgradeConnectorLine(new Pos2d(130, 184), 60, 336, 0, 2, 5))
.widget(createUpgradeConnectorLine(new Pos2d(156, 184), 60, 24, 0, 3, 5))
.widget(createUpgradeConnectorLine(new Pos2d(192, 184), 60, 333, 0, 3, 6))
.widget(createUpgradeConnectorLine(new Pos2d(143, 251), 45, 0, 0, 5, 7))
.widget(createUpgradeConnectorLine(new Pos2d(143, 311), 45, 0, 0, 7, 9))
.widget(createUpgradeConnectorLine(new Pos2d(78, 250), 110, 5, 4, 4, 8))
.widget(createUpgradeConnectorLine(new Pos2d(110, 290), 80, 40, 4, 7, 8))
.widget(createUpgradeConnectorLine(new Pos2d(208, 250), 110, 355, 4, 6, 10))
.widget(createUpgradeConnectorLine(new Pos2d(176, 290), 80, 320, 4, 7, 10))
.widget(createUpgradeConnectorLine(new Pos2d(100, 355), 80, 313, 0, 8, 11))
.widget(createUpgradeConnectorLine(new Pos2d(186, 355), 80, 47, 0, 10, 11))
.widget(createUpgradeConnectorLine(new Pos2d(143, 430), 48, 0, 2, 11, 13))
.widget(createUpgradeConnectorLine(new Pos2d(143, 490), 48, 0, 2, 13, 18))
.widget(createUpgradeConnectorLine(new Pos2d(143, 550), 48, 0, 2, 18, 21))
.widget(createUpgradeConnectorLine(new Pos2d(143, 610), 48, 0, 2, 21, 23))
.widget(createUpgradeConnectorLine(new Pos2d(110, 410), 80, 40, 1, 11, 12))
.widget(createUpgradeConnectorLine(new Pos2d(83, 490), 48, 0, 1, 12, 17))
.widget(createUpgradeConnectorLine(new Pos2d(83, 550), 48, 0, 1, 17, 20))
.widget(createUpgradeConnectorLine(new Pos2d(101, 590), 80, 320, 1, 20, 23))
.widget(createUpgradeConnectorLine(new Pos2d(53, 536), 35, 45, 1, 17, 16))
.widget(createUpgradeConnectorLine(new Pos2d(176, 410), 80, 320, 3, 11, 14))
.widget(createUpgradeConnectorLine(new Pos2d(203, 490), 48, 0, 3, 14, 19))
.widget(createUpgradeConnectorLine(new Pos2d(203, 550), 48, 0, 3, 19, 22))
.widget(createUpgradeConnectorLine(new Pos2d(185, 590), 80, 40, 3, 22, 23))
.widget(createUpgradeConnectorLine(new Pos2d(233, 476), 35, 315, 3, 14, 15))
.widget(createUpgradeConnectorLine(new Pos2d(143, 670), 48, 0, 0, 23, 24))
.widget(createUpgradeConnectorLine(new Pos2d(101, 707), 75, 62.3f, 0, 24, 25))
.widget(createUpgradeConnectorLine(new Pos2d(53, 772), 78, 0, 0, 25, 26))
.widget(createUpgradeConnectorLine(new Pos2d(95, 837), 75, 297.7f, 0, 26, 27))
.widget(createUpgradeConnectorLine(new Pos2d(191, 837), 75, 62.3f, 0, 27, 28))
.widget(createUpgradeConnectorLine(new Pos2d(233, 772), 78, 0, 0, 28, 29))
.widget(createUpgradeConnectorLine(new Pos2d(191, 747), 75, 62.3f, 0, 29, 30));
scrollable
.widget(
createUpgradeBox(
0,
0,
3,
new int[] {},
false,
new int[] { 1 },
false,
true,
0,
new Pos2d(126, 56),
scrollable))
.widget(
createUpgradeBox(
1,
0,
1,
new int[] { 0 },
false,
new int[] { 2, 3 },
false,
false,
1,
new Pos2d(126, 116),
scrollable))
.widget(
createUpgradeBox(
2,
0,
2,
new int[] { 1 },
false,
new int[] { 4, 5 },
false,
false,
1,
new Pos2d(96, 176),
scrollable))
.widget(
createUpgradeBox(
3,
0,
2,
new int[] { 1 },
false,
new int[] { 5, 6 },
false,
false,
1,
new Pos2d(156, 176),
scrollable))
.widget(
createUpgradeBox(
4,
0,
0,
new int[] { 2 },
false,
new int[] { 8 },
false,
false,
1,
new Pos2d(66, 236),
scrollable))
.widget(
createUpgradeBox(
5,
0,
3,
new int[] { 2, 3 },
false,
new int[] { 7 },
false,
true,
1,
new Pos2d(126, 236),
scrollable))
.widget(
createUpgradeBox(
6,
0,
1,
new int[] { 3 },
false,
new int[] { 10 },
false,
false,
1,
new Pos2d(186, 236),
scrollable))
.widget(
createUpgradeBox(
7,
0,
3,
new int[] { 5 },
false,
new int[] { 8, 9, 10 },
false,
true,
2,
new Pos2d(126, 296),
scrollable))
.widget(
createUpgradeBox(
8,
0,
0,
new int[] { 4, 7 },
true,
new int[] { 11 },
false,
false,
2,
new Pos2d(56, 356),
scrollable))
.widget(
createUpgradeBox(
9,
0,
2,
new int[] { 7 },
false,
new int[] {},
false,
false,
2,
new Pos2d(126, 356),
scrollable))
.widget(
createUpgradeBox(
10,
0,
1,
new int[] { 6, 7 },
true,
new int[] { 11 },
false,
false,
2,
new Pos2d(196, 356),
scrollable))
.widget(
createUpgradeBox(
11,
0,
3,
new int[] { 8, 10 },
false,
new int[] { 12, 13, 14 },
false,
true,
2,
new Pos2d(126, 416),
scrollable))
.widget(
createUpgradeBox(
12,
1,
2,
new int[] { 11 },
false,
new int[] { 17 },
true,
false,
3,
new Pos2d(66, 476),
scrollable))
.widget(
createUpgradeBox(
13,
2,
1,
new int[] { 11 },
false,
new int[] { 18 },
true,
false,
3,
new Pos2d(126, 476),
scrollable))
.widget(
createUpgradeBox(
14,
3,
0,
new int[] { 11 },
false,
new int[] { 15, 19 },
true,
false,
3,
new Pos2d(186, 476),
scrollable))
.widget(
createUpgradeBox(
15,
3,
1,
new int[] { 14 },
false,
new int[] {},
false,
false,
4,
new Pos2d(246, 496),
scrollable))
.widget(
createUpgradeBox(
16,
1,
1,
new int[] { 17 },
false,
new int[] {},
false,
false,
4,
new Pos2d(6, 556),
scrollable))
.widget(
createUpgradeBox(
17,
1,
0,
new int[] { 12 },
false,
new int[] { 16, 20 },
false,
false,
3,
new Pos2d(66, 536),
scrollable))
.widget(
createUpgradeBox(
18,
2,
1,
new int[] { 13 },
false,
new int[] { 21 },
false,
false,
3,
new Pos2d(126, 536),
scrollable))
.widget(
createUpgradeBox(
19,
3,
0,
new int[] { 14 },
false,
new int[] { 22 },
false,
false,
3,
new Pos2d(186, 536),
scrollable))
.widget(
createUpgradeBox(
20,
1,
0,
new int[] { 17 },
false,
new int[] { 23 },
false,
false,
3,
new Pos2d(66, 596),
scrollable))
.widget(
createUpgradeBox(
21,
2,
1,
new int[] { 18 },
false,
new int[] { 23 },
false,
false,
3,
new Pos2d(126, 596),
scrollable))
.widget(
createUpgradeBox(
22,
3,
1,
new int[] { 19 },
false,
new int[] { 23 },
false,
false,
3,
new Pos2d(186, 596),
scrollable))
.widget(
createUpgradeBox(
23,
0,
0,
new int[] { 20, 21, 22 },
false,
new int[] { 24 },
false,
false,
4,
new Pos2d(126, 656),
scrollable))
.widget(
createUpgradeBox(
24,
0,
1,
new int[] { 23 },
false,
new int[] { 25 },
false,
false,
5,
new Pos2d(126, 718),
scrollable))
.widget(
createUpgradeBox(
25,
0,
1,
new int[] { 24 },
false,
new int[] { 26 },
false,
false,
6,
new Pos2d(36, 758),
scrollable))
.widget(
createUpgradeBox(
26,
0,
3,
new int[] { 25 },
false,
new int[] { 27 },
false,
true,
7,
new Pos2d(36, 848),
scrollable))
.widget(
createUpgradeBox(
27,
0,
2,
new int[] { 26 },
false,
new int[] { 28 },
false,
false,
8,
new Pos2d(126, 888),
scrollable))
.widget(
createUpgradeBox(
28,
0,
0,
new int[] { 27 },
false,
new int[] { 29 },
false,
false,
9,
new Pos2d(216, 848),
scrollable))
.widget(
createUpgradeBox(
29,
0,
3,
new int[] { 28 },
false,
new int[] { 30 },
false,
true,
10,
new Pos2d(216, 758),
scrollable))
.widget(
createUpgradeBox(
30,
0,
3,
new int[] { 29 },
false,
new int[] {},
false,
true,
12,
new Pos2d(126, 798),
scrollable))
.widget(new TextWidget("").setPos(0, 945));
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.BACKGROUND_STAR)
.setPos(0, 0)
.setSize(300, 300))
.widget(
scrollable.setSize(292, 292)
.setPos(4, 4))
.widget(
ButtonWidget.closeWindowButton(true)
.setOnClick((data, widget) -> {
if (!widget.isClient()) {
widget.getWindow()
.closeWindow();
widget.getContext()
.closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
}
})
.setPos(282, 4));
if (debugMode) {
builder.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
upgrades = new boolean[31];
materialPaidUpgrades = new boolean[7];
})
.setSize(40, 15)
.setBackground(GTUITextures.BUTTON_STANDARD)
.addTooltip(translateToLocal("fog.debug.resetbutton.tooltip"))
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.addChild(
new TextWidget(translateToLocal("fog.debug.resetbutton.text")).setTextAlignment(Alignment.Center)
.setScale(0.57f)
.setMaxWidth(36)
.setPos(3, 3))
.addChild(
new NumericWidget().setSetter(val -> gravitonShardsAvailable = (int) val)
.setGetter(() -> gravitonShardsAvailable)
.setBounds(0, 112)
.setDefaultValue(0)
.setScrollValues(1, 4, 64)
.setTextAlignment(Alignment.Center)
.setTextColor(Color.WHITE.normal)
.setSize(25, 18)
.setPos(4, 16)
.addTooltip(translateToLocal("fog.debug.gravitonshardsetter.tooltip"))
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setBackground(GTUITextures.BACKGROUND_TEXT_FIELD))
.addChild(
new ButtonWidget().setOnClick((clickData, widget) -> Arrays.fill(upgrades, true))
.setSize(40, 15)
.setBackground(GTUITextures.BUTTON_STANDARD)
.addTooltip(translateToLocal("fog.debug.unlockall.text"))
.setTooltipShowUpDelay(TOOLTIP_DELAY)
.setPos(0, 35))
.addChild(
new TextWidget(translateToLocal("fog.debug.unlockall.text")).setTextAlignment(Alignment.Center)
.setScale(0.57f)
.setMaxWidth(36)
.setPos(3, 38))
.setPos(4, 4));
}
return builder.build();
}
protected ModularWindow createIndividualUpgradeWindow(final EntityPlayer player) {
UITexture background;
UITexture overlay;
UITexture milestoneSymbol;
float widthRatio;
switch (currentColorCode) {
case 1 -> {
background = TecTechUITextures.BACKGROUND_GLOW_PURPLE;
overlay = TecTechUITextures.PICTURE_OVERLAY_PURPLE;
}
case 2 -> {
background = TecTechUITextures.BACKGROUND_GLOW_ORANGE;
overlay = TecTechUITextures.PICTURE_OVERLAY_ORANGE;
}
case 3 -> {
background = TecTechUITextures.BACKGROUND_GLOW_GREEN;
overlay = TecTechUITextures.PICTURE_OVERLAY_GREEN;
}
default -> {
background = TecTechUITextures.BACKGROUND_GLOW_BLUE;
overlay = TecTechUITextures.PICTURE_OVERLAY_BLUE;
}
}
switch (currentMilestoneBG) {
case 1 -> {
milestoneSymbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CONVERSION;
widthRatio = 0.72f;
}
case 2 -> {
milestoneSymbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CATALYST;
widthRatio = 1f;
}
case 3 -> {
milestoneSymbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_COMPOSITION;
widthRatio = 1f;
}
default -> {
milestoneSymbol = TecTechUITextures.PICTURE_GODFORGE_MILESTONE_CHARGE;
widthRatio = 0.8f;
}
}
int WIDTH = 250;
int HEIGHT = 250;
int LORE_POS = 110;
if (currentUpgradeID == 0 || currentUpgradeID == 30) {
WIDTH = 300;
HEIGHT = 300;
LORE_POS = 85;
}
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT)
.setBackground(background)
.widget(
ButtonWidget.closeWindowButton(true)
.setPos(WIDTH - 15, 3))
.widget(
new DrawableWidget().setDrawable(milestoneSymbol)
.setPos((int) ((1 - widthRatio / 2) * WIDTH / 2), HEIGHT / 4)
.setSize((int) (WIDTH / 2 * widthRatio), HEIGHT / 2))
.widget(
new DrawableWidget().setDrawable(overlay)
.setPos(WIDTH / 4, HEIGHT / 4)
.setSize(WIDTH / 2, HEIGHT / 2))
.widget(
new MultiChildWidget()
.addChild(
new TextWidget(translateToLocal("fog.upgrade.tt." + (currentUpgradeID)))
.setTextAlignment(Alignment.Center)
.setDefaultColor(EnumChatFormatting.GOLD)
.setSize(WIDTH - 15, 30)
.setPos(9, 5))
.addChild(
new TextWidget(translateToLocal("fog.upgrade.text." + (currentUpgradeID)))
.setTextAlignment(Alignment.CenterLeft)
.setDefaultColor(EnumChatFormatting.WHITE)
.setSize(WIDTH - 15, LORE_POS - 30)
.setPos(9, 30))
.addChild(
new TextWidget(
EnumChatFormatting.ITALIC + translateToLocal("fog.upgrade.lore." + (currentUpgradeID)))
.setTextAlignment(Alignment.Center)
.setDefaultColor(0xbbbdbd)
.setSize(WIDTH - 15, (int) (HEIGHT * 0.9) - LORE_POS)
.setPos(9, LORE_POS))
.addChild(
new TextWidget(
translateToLocal("gt.blockmachines.multimachine.FOG.shardcost") + " "
+ EnumChatFormatting.BLUE
+ gravitonShardCost).setTextAlignment(Alignment.Center)
.setScale(0.7f)
.setMaxWidth(70)
.setDefaultColor(0x9c9c9c)
.setPos(11, HEIGHT - 25))
.addChild(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.availableshards"))
.setTextAlignment(Alignment.Center)
.setScale(0.7f)
.setMaxWidth(90)
.setDefaultColor(0x9c9c9c)
.setPos(WIDTH - 87, HEIGHT - 25))
.addChild(
TextWidget.dynamicText(this::gravitonShardAmount)
.setTextAlignment(Alignment.Center)
.setScale(0.7f)
.setMaxWidth(90)
.setDefaultColor(0x9c9c9c)
.setPos(WIDTH - 27, HEIGHT - 18)))
.setSize(WIDTH, HEIGHT)
.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
int unlockedPrereqUpgrades = 0;
int unlockedSplitUpgrades = 0;
if (!upgrades[currentUpgradeID]) {
for (int prereqUpgrade : prereqUpgrades[currentUpgradeID]) {
if (upgrades[prereqUpgrade]) {
unlockedPrereqUpgrades++;
}
}
if (!doesCurrentUpgradeRequireExtraMats
|| materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(currentUpgradeID)]) {
if (allPrereqRequired[currentUpgradeID]) {
if (unlockedPrereqUpgrades == prereqUpgrades[currentUpgradeID].length
&& gravitonShardsAvailable >= gravitonShardCost) {
gravitonShardsAvailable -= gravitonShardCost;
gravitonShardsSpent += gravitonShardCost;
upgrades[currentUpgradeID] = true;
}
} else if (unlockedPrereqUpgrades > 0 || prereqUpgrades[currentUpgradeID].length == 0) {
if (isUpradeSplitStart) {
for (int splitUpgrade : FIRST_SPLIT_UPGRADES) {
if (upgrades[splitUpgrade]) {
unlockedSplitUpgrades++;
}
}
unlockedSplitUpgrades -= (ringAmount - 1);
}
if (unlockedSplitUpgrades <= 0 && gravitonShardsAvailable >= gravitonShardCost) {
gravitonShardsAvailable -= gravitonShardCost;
gravitonShardsSpent += gravitonShardCost;
upgrades[currentUpgradeID] = true;
}
}
}
} else {
int unlockedFollowupUpgrades = 0;
int unlockedNeighboringUpgrades = 0;
boolean doesFollowupRequireAllPrereqs = false;
boolean canFollowupSpareAConnection = true;
for (int followupUpgrade : followupUpgrades) {
if (upgrades[followupUpgrade]) {
unlockedFollowupUpgrades++;
}
if (allPrereqRequired[followupUpgrade]) {
doesFollowupRequireAllPrereqs = true;
}
int[] currentPrereqs = prereqUpgrades[followupUpgrade];
for (int prereqUpgrade : currentPrereqs) {
if (upgrades[prereqUpgrade]) {
unlockedNeighboringUpgrades++;
}
}
if (unlockedNeighboringUpgrades <= 1) {
canFollowupSpareAConnection = false;
}
unlockedNeighboringUpgrades = 0;
}
if (!doesFollowupRequireAllPrereqs && followupUpgrades.length > 0 && canFollowupSpareAConnection) {
unlockedFollowupUpgrades = 0;
}
if (unlockedFollowupUpgrades == 0) {
gravitonShardsAvailable += gravitonShardCost;
gravitonShardsSpent -= gravitonShardCost;
upgrades[currentUpgradeID] = false;
}
}
})
.setSize(40, 15)
.setBackground(() -> {
if (upgrades[currentUpgradeID]) {
return new IDrawable[] { GTUITextures.BUTTON_STANDARD_PRESSED };
} else {
return new IDrawable[] { GTUITextures.BUTTON_STANDARD };
}
})
.dynamicTooltip(this::constructionStatus)
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.addChild(
TextWidget.dynamicText(this::constructionStatusText)
.setTextAlignment(Alignment.Center)
.setScale(0.7f)
.setMaxWidth(36)
.setPos(3, 5))
.setPos(WIDTH / 2 - 21, (int) (HEIGHT * 0.9)));
if (Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.contains(currentUpgradeID)) {
builder.widget(createMaterialInputButton(currentUpgradeID, WIDTH / 2 - 40, (int) (HEIGHT * 0.9), builder));
}
return builder.build();
}
private Widget createMaterialInputButton(int upgradeID, int xCoord, int yCoord, IWidgetBuilder<?> builder) {
return new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient() && doesCurrentUpgradeRequireExtraMats) {
widget.getContext()
.openSyncedWindow(MANUAL_INSERTION_WINDOW_ID);
widget.getContext()
.closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
widget.getContext()
.closeWindow(UPGRADE_TREE_WINDOW_ID);
}
})
.setPlayClickSound(doesCurrentUpgradeRequireExtraMats)
.setBackground(() -> {
if (doesCurrentUpgradeRequireExtraMats) {
if (materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(upgradeID)]) {
return new IDrawable[] { TecTechUITextures.BUTTON_BOXED_CHECKMARK_18x18 };
} else {
return new IDrawable[] { TecTechUITextures.BUTTON_BOXED_EXCLAMATION_POINT_18x18 };
}
} else {
return new IDrawable[] { GTUITextures.TRANSPARENT };
}
})
.setPos(xCoord, yCoord)
.setSize(15, 15)
.dynamicTooltip(this::upgradeMaterialRequirements)
.addTooltip(EnumChatFormatting.GRAY + translateToLocal("fog.button.materialrequirements.tooltip.clickhere"))
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(
() -> materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(upgradeID)],
val -> materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(upgradeID)] = val),
builder);
}
/**
* @param upgradeID ID of the upgrade
* @param colorCode Number deciding which colored background to use, 0 for blue, 1 for purple, 2 for
* orange and 3 for green
* @param milestone Number deciding which milestone symbol to display in the background, 0 for charge,
* 1 for conversion, 2 for catalyst and 3 for composition
* @param prerequisiteUpgradeIDs IDs of the prior upgrades directly connected to the current one
* @param requireAllPrerequisites Decides how many connected prerequisite upgrades have to be unlocked to be able to
* unlock this one. True means ALL, False means AT LEAST ONE
* @param followingUpgradeIDs IDs of the following upgrades directly connected to the current one
* @param isStartOfSplit Whether this upgrade is one of the initial split upgrades
* @param requiresExtraMaterials Whether this upgrade requires materials other than graviton shards to unlock
* @param shardCost How many graviton shards are needed to unlock this upgrade
* @param pos Position of the upgrade inside the scrollableWidget
*/
private Widget createUpgradeBox(int upgradeID, int colorCode, int milestone, int[] prerequisiteUpgradeIDs,
boolean requireAllPrerequisites, int[] followingUpgradeIDs, boolean isStartOfSplit,
boolean requiresExtraMaterials, int shardCost, Pos2d pos, IWidgetBuilder<?> builder) {
prereqUpgrades[upgradeID] = prerequisiteUpgradeIDs;
allPrereqRequired[upgradeID] = requireAllPrerequisites;
return new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
currentUpgradeID = upgradeID;
currentColorCode = colorCode;
currentMilestoneBG = milestone;
gravitonShardCost = shardCost;
followupUpgrades = followingUpgradeIDs;
isUpradeSplitStart = isStartOfSplit;
doesCurrentUpgradeRequireExtraMats = requiresExtraMaterials;
if (!widget.isClient()) {
// unfortunately this is the easiest way to prevent this window desyncing. it causes the window to
// reposition itself on the screen which would be a good thing to not do.
if (widget.getContext()
.isWindowOpen(INDIVIDUAL_UPGRADE_WINDOW_ID)) {
widget.getContext()
.closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
}
widget.getContext()
.openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
}
})
.setSize(40, 15)
.setBackground(() -> {
if (upgrades[upgradeID]) {
return new IDrawable[] { TecTechUITextures.BUTTON_SPACE_PRESSED_32x16 };
} else {
return new IDrawable[] { TecTechUITextures.BUTTON_SPACE_32x16 };
}
})
.addTooltip(translateToLocal("fog.upgrade.tt." + upgradeID))
.setTooltipShowUpDelay(TOOLTIP_DELAY))
.addChild(
new TextWidget(translateToLocal("fog.upgrade.tt.short." + upgradeID)).setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.Center)
.setSize(34, 9)
.setPos(3, 4))
.setPos(pos)
.attachSyncer(
new FakeSyncWidget.BooleanSyncer(() -> upgrades[upgradeID], val -> upgrades[upgradeID] = val),
builder);
}
private Widget createUpgradeConnectorLine(Pos2d pos, int length, float rotationAngle, int colorCode,
int startUpgradeID, int endUpgradeID) {
return new DrawableWidget()
.setDrawable(
() -> (upgrades[startUpgradeID] && upgrades[endUpgradeID])
? coloredLine(colorCode, true).withRotationDegree(rotationAngle)
: coloredLine(colorCode, false).withRotationDegree(rotationAngle))
.setPos(pos)
.setSize(6, length);
}
private IDrawable coloredLine(int colorCode, boolean opaque) {
IDrawable line;
switch (colorCode) {
case 1 -> {
line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE_OPAQUE
: TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE;
}
case 2 -> {
line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE_OPAQUE
: TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE;
}
case 3 -> {
line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN_OPAQUE
: TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN;
}
case 4 -> {
line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED_OPAQUE
: TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED;
}
default -> {
line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE_OPAQUE
: TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE;
}
}
return line;
}
protected ModularWindow createManualInsertionWindow(final EntityPlayer player) {
ItemStack[] inputs = godforgeUpgradeMats.get(currentUpgradeID);
final int WIDTH = 189;
final int HEIGHT = 106;
final int PARENT_WIDTH = getGUIWidth();
final int PARENT_HEIGHT = getGUIHeight();
final MultiChildWidget columns = new MultiChildWidget();
final DynamicPositionedColumn column1 = new DynamicPositionedColumn();
final DynamicPositionedColumn column2 = new DynamicPositionedColumn();
final DynamicPositionedColumn column3 = new DynamicPositionedColumn();
final DynamicPositionedColumn column4 = new DynamicPositionedColumn();
final DynamicPositionedColumn column5 = new DynamicPositionedColumn();
final DynamicPositionedColumn column6 = new DynamicPositionedColumn();
List<DynamicPositionedColumn> columnList = Arrays.asList(column1, column2, column3, column4, column5, column6);
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT);
builder.setGuiTint(getGUIColorization());
builder.setDraggable(true);
builder.setPos(
(size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT))
.add(Alignment.TopRight.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT)))
.subtract(5, 0)
.add(0, 4));
builder.widget(
SlotGroup.ofItemHandler(inputSlotHandler, 4)
.startFromSlot(0)
.endAtSlot(15)
.phantom(false)
.background(getGUITextureSet().getItemSlot())
.build()
.setPos(112, 6));
builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient()) {
widget.getWindow()
.closeWindow();
widget.getContext()
.openSyncedWindow(UPGRADE_TREE_WINDOW_ID);
widget.getContext()
.openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID);
}
})
.setBackground(ModularUITextures.VANILLA_BACKGROUND, new Text("x"))
.setPos(179, 0)
.setSize(10, 10));
builder.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> {
if (!widget.isClient()) {
ArrayList<ItemStack> list = new ArrayList<>(inputSlotHandler.getStacks());
list.removeIf(Objects::isNull);
int foundInputs = 0;
int[] foundInputIndices = new int[inputs.length];
for (ItemStack inputStack : list) {
for (ItemStack requiredStack : inputs) {
if (ItemStack.areItemStacksEqual(requiredStack, inputStack)) {
foundInputIndices[foundInputs] = inputSlotHandler.getStacks()
.indexOf(inputStack);
foundInputs++;
}
}
}
if (foundInputs == inputs.length) {
for (int index : foundInputIndices) {
inputSlotHandler.extractItem(index, inputSlotHandler.getStackInSlot(index).stackSize, false);
}
materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(currentUpgradeID)] = true;
}
}
})
.setPlayClickSound(true)
.setBackground(GTUITextures.BUTTON_STANDARD)
.setSize(179, 18))
.addChild(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.consumeUpgradeMats"))
.setTextAlignment(Alignment.Center)
.setScale(0.75f)
.setPos(0, 1)
.setSize(179, 18))
.setPos(5, 82)
.setSize(179, 16));
IItemHandlerModifiable upgradeMatsHandler = new ItemStackHandler(12);
int uniqueItems = inputs.length;
for (int i = 0; i < 12; i++) {
int index = i;
int cleanDiv4 = index / 4;
if (i < uniqueItems) {
ItemStack stack = inputs[index];
if (stack != null) {
stack = stack.copy();
stack.stackSize = 1;
upgradeMatsHandler.setStackInSlot(index, stack);
}
builder.widget(
new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_PRESSED)
.setPos(5 + cleanDiv4 * 36, 6 + index % 4 * 18)
.setSize(18, 18));
columnList.get(cleanDiv4)
.addChild(
new SlotWidget(upgradeMatsHandler, index).setAccess(false, false)
.disableInteraction());
columnList.get(cleanDiv4 + 3)
.addChild(
new TextWidget("x" + inputs[i].stackSize).setTextAlignment(Alignment.CenterLeft)
.setScale(0.8f)
.setSize(18, 8));
} else {
builder.widget(
new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_DISABLED)
.setPos(5 + cleanDiv4 * 36, 6 + index % 4 * 18)
.setSize(18, 18));
}
}
int counter = 0;
for (DynamicPositionedColumn column : columnList) {
int spacing = 0;
int xCord = counter * 36;
int yCord = 0;
if (counter > 2) {
spacing = 10;
xCord = 19 + (counter - 3) * 36;
yCord = 5;
}
columns.addChild(
column.setSpace(spacing)
.setAlignment(MainAxisAlignment.SPACE_BETWEEN)
.setSize(16, 72)
.setPos(xCord, yCord));
counter++;
}
builder.widget(
columns.setSize(108, 72)
.setPos(5, 6));
return builder.build();
}
protected ModularWindow createGeneralInfoWindow(final EntityPlayer player) {
final Scrollable scrollable = new Scrollable().setVerticalScroll();
final int WIDTH = 300;
final int HEIGHT = 300;
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setDraggable(true);
scrollable.widget(
new TextWidget(EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.introduction"))
.setDefaultColor(EnumChatFormatting.DARK_PURPLE)
.setTextAlignment(Alignment.TopCenter)
.setPos(7, 13)
.setSize(280, 15))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.introductioninfotext"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 30)
.setSize(280, 50))
.widget(
new TextWidget(
EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.tableofcontents"))
.setDefaultColor(EnumChatFormatting.AQUA)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 80)
.setSize(150, 15))
.widget(
new ButtonWidget().setOnClick((clickData, widget) -> scrollable.setVerticalScrollOffset(150))
.setBackground(
new Text(EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.fuel"))
.alignment(Alignment.CenterLeft)
.color(0x55ffff))
.setPos(7, 95)
.setSize(150, 15))
.widget(
new ButtonWidget().setOnClick((clickData, widget) -> scrollable.setVerticalScrollOffset(434))
.setBackground(
new Text(
EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.modules"))
.alignment(Alignment.CenterLeft)
.color(0x55ffff))
.setPos(7, 110)
.setSize(150, 15))
.widget(
new ButtonWidget().setOnClick((clickData, widget) -> scrollable.setVerticalScrollOffset(1088))
.setBackground(
new Text(
EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.upgrades"))
.alignment(Alignment.CenterLeft)
.color(0x55ffff))
.setPos(7, 125)
.setSize(150, 15))
.widget(
new ButtonWidget().setOnClick((clickData, widget) -> scrollable.setVerticalScrollOffset(1412))
.setBackground(
new Text(
EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.FOG.milestones"))
.alignment(Alignment.CenterLeft)
.color(0x55ffff))
.setPos(7, 140)
.setSize(150, 15))
.widget(
TextWidget.dynamicText(this::inversionHeaderText)
.setDefaultColor(EnumChatFormatting.WHITE)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 155)
.setSize(150, 15))
.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
if (inversion) {
scrollable.setVerticalScrollOffset(1766);
}
})
.setPlayClickSound(inversion)
.setPos(7, 155)
.setSize(150, 15)
.attachSyncer(new FakeSyncWidget.BooleanSyncer(() -> inversion, (val) -> inversion = val), scrollable))
.widget(
new TextWidget(
EnumChatFormatting.BOLD + "§N" + translateToLocal("gt.blockmachines.multimachine.FOG.fuel"))
.setDefaultColor(EnumChatFormatting.DARK_PURPLE)
.setTextAlignment(Alignment.TopCenter)
.setPos(127, 160)
.setSize(40, 15))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.fuelinfotext"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 177)
.setSize(280, 250))
.widget(
new TextWidget(
EnumChatFormatting.BOLD + "§N" + translateToLocal("gt.blockmachines.multimachine.FOG.modules"))
.setDefaultColor(EnumChatFormatting.DARK_PURPLE)
.setTextAlignment(Alignment.TopCenter)
.setPos(7, 440)
.setSize(280, 15))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.moduleinfotext"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 461)
.setSize(280, 620))
.widget(
new TextWidget(
EnumChatFormatting.BOLD + "§N" + translateToLocal("gt.blockmachines.multimachine.FOG.upgrades"))
.setDefaultColor(EnumChatFormatting.DARK_PURPLE)
.setTextAlignment(Alignment.TopCenter)
.setPos(7, 1098)
.setSize(280, 15))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.upgradeinfotext"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 1115)
.setSize(280, 290))
.widget(
new TextWidget(
EnumChatFormatting.BOLD + "§N" + translateToLocal("gt.blockmachines.multimachine.FOG.milestones"))
.setDefaultColor(EnumChatFormatting.DARK_PURPLE)
.setTextAlignment(Alignment.TopCenter)
.setPos(7, 1422)
.setSize(280, 15))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.milestoneinfotext"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 1439)
.setSize(280, 320))
.widget(
TextWidget.dynamicText(this::inversionHeaderText)
.setDefaultColor(EnumChatFormatting.WHITE)
.setTextAlignment(Alignment.TopCenter)
.setPos(7, 1776)
.setSize(280, 15))
.widget(
TextWidget.dynamicText(this::inversionInfoText)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 1793)
.setSize(280, 160))
.widget(
new TextWidget("").setPos(7, 1965)
.setSize(10, 10));
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.BACKGROUND_GLOW_WHITE)
.setPos(0, 0)
.setSize(300, 300))
.widget(
scrollable.setSize(292, 292)
.setPos(4, 4))
.widget(
ButtonWidget.closeWindowButton(true)
.setPos(284, 4));
return builder.build();
}
protected ModularWindow createSpecialThanksWindow(final EntityPlayer player) {
final int WIDTH = 200;
final int HEIGHT = 200;
ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT);
builder.setBackground(TecTechUITextures.BACKGROUND_GLOW_RAINBOW);
builder.setDraggable(true);
builder.widget(
ButtonWidget.closeWindowButton(true)
.setPos(184, 4))
.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_GODFORGE_THANKS)
.setPos(50, 50)
.setSize(100, 100))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.contributors"))
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.Center)
.setScale(1f)
.setPos(0, 5)
.setSize(200, 15))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lead"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 30)
.setSize(60, 10))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.cloud")).setScale(0.8f)
.setDefaultColor(EnumChatFormatting.AQUA)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 40)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.programming"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 55)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.DARK_AQUA + translateToLocal("gt.blockmachines.multimachine.FOG.teg")
+ " "
+ EnumChatFormatting.RESET
+ translateToLocal("gt.blockmachines.multimachine.FOG.serenybiss")).setScale(0.8f)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 67)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.textures"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 85)
.setSize(100, 10))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.ant")).setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GREEN)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 95)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.rendering"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 110)
.setSize(100, 10))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.bucket")).setScale(0.8f)
.setDefaultColor(EnumChatFormatting.WHITE)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 120)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lore"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 135)
.setSize(100, 10))
.widget(
delenoName().setSpace(-1)
.setAlignment(MainAxisAlignment.SPACE_BETWEEN)
.setPos(7, 145)
.setSize(60, 10))
.widget(
new TextWidget(
EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.playtesting"))
.setScale(0.8f)
.setDefaultColor(EnumChatFormatting.GOLD)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 160)
.setSize(100, 10))
.widget(
new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.misi")).setScale(0.8f)
.setDefaultColor(0xffc26f)
.setTextAlignment(Alignment.CenterLeft)
.setPos(7, 170)
.setSize(60, 10))
.widget(
new TextWidget(EnumChatFormatting.ITALIC + translateToLocal("gt.blockmachines.multimachine.FOG.thanks"))
.setScale(0.8f)
.setDefaultColor(0xbbbdbd)
.setTextAlignment(Alignment.Center)
.setPos(90, 140)
.setSize(100, 60));
return builder.build();
}
private DynamicPositionedRow delenoName() {
DynamicPositionedRow nameRow = new DynamicPositionedRow();
String deleno = translateToLocal("gt.blockmachines.multimachine.FOG.deleno");
int[] colors = new int[] { 0xffffff, 0xf6fff5, 0xecffec, 0xe3ffe2, 0xd9ffd9, 0xd0ffcf };
for (int i = 0; i < 6; i++) {
nameRow.addChild(
new TextWidget(Character.toString(deleno.charAt(i))).setDefaultColor(colors[i])
.setScale(0.8f)
.setTextAlignment(Alignment.CenterLeft));
}
return nameRow;
}
@Override
public MultiblockTooltipBuilder createTooltip() {
final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
tt.addMachineType("Stellar Forge")
.addInfo(EnumChatFormatting.ITALIC + "Also known as Godforge or Gorge for short.")
.addInfo(TOOLTIP_BAR)
.addInfo("Controller block for the Godforge, a massive structure harnessing the thermal,")
.addInfo("gravitational and kinetic energy of a stabilised neutron star for material processing.")
.addInfo(
"This multiblock can house " + EnumChatFormatting.RED
+ "up to 16 modules "
+ EnumChatFormatting.GRAY
+ "which utilize the star to energize materials")
.addInfo("to varying degrees, ranging from regular smelting to matter degeneration.")
.addInfo(TOOLTIP_BAR)
.addInfo(
"This multiblock has an " + EnumChatFormatting.GOLD
+ "extensive upgrade tree "
+ EnumChatFormatting.GRAY
+ "which influences all of its functions,")
.addInfo(
"such as " + EnumChatFormatting.GOLD
+ "unlocking new module types, increasing heat levels "
+ EnumChatFormatting.GRAY
+ "and "
+ EnumChatFormatting.GOLD
+ "granting")
.addInfo(
EnumChatFormatting.GOLD + "various processing speed bonuses. "
+ EnumChatFormatting.GRAY
+ "These upgrades can be unlocked by reaching")
.addInfo("certain milestones and/or spending materials.")
.addInfo(TOOLTIP_BAR)
.addInfo(
EnumChatFormatting.GREEN
+ "Clicking on the logo in the controller gui opens an extensive information window,")
.addInfo("explaining everything there is to know about this multiblock.")
.addInfo(TOOLTIP_BAR)
.beginStructureBlock(126, 29, 186, false)
.addStructureInfo("The structure is too complex! See schematic for details.")
.addStructureInfo(
"Total blocks needed for the structure with " + EnumChatFormatting.DARK_PURPLE
+ "1"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "2"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "3"
+ EnumChatFormatting.GRAY
+ " rings:")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "3943"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "7279"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "11005"
+ EnumChatFormatting.GRAY
+ " Transcendentally Amplified Magnetic Confinement Casing")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "2819"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "4831"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "6567"
+ EnumChatFormatting.GRAY
+ " Singularity Reinforced Stellar Shielding Casing")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "272"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "512"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "824"
+ EnumChatFormatting.GRAY
+ " Celestial Matter Guidance Casing")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "130"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "144"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "158"
+ EnumChatFormatting.GRAY
+ " Boundless Gravitationally Severed Structure Casing")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "9"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "54"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "155"
+ EnumChatFormatting.GRAY
+ " Spatially Transcendent Gravitational Lens Block")
.addStructureInfo(
EnumChatFormatting.DARK_PURPLE + "345"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "357"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "397"
+ EnumChatFormatting.DARK_PURPLE
+ " Remote"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.DARK_GREEN
+ "Medial"
+ EnumChatFormatting.GRAY
+ "/"
+ EnumChatFormatting.AQUA
+ "Central"
+ EnumChatFormatting.GRAY
+ " Graviton Flow Modulator")
.addStructureInfo(
EnumChatFormatting.GOLD + "36" + EnumChatFormatting.GRAY + " Stellar Energy Siphon Casing")
.addStructureInfo("--------------------------------------------")
.addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Hatch")
.addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus (ME)")
.addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Bus")
.addStructureInfo("--------------------------------------------")
.toolTipFinisher(CommonValues.GODFORGE_MARK);
return tt;
}
@Override
public boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) {
return true;
}
@Override
public String[] getStructureDescription(ItemStack stackSize) {
return new String[] { EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":",
translateToLocal("gt.blockmachines.multimachine.FOG.hint.0"),
translateToLocal("gt.blockmachines.multimachine.FOG.hint.1") };
}
public int getFuelType() {
return selectedFuelType;
}
private void setFuelType(int fuelType) {
selectedFuelType = fuelType;
}
public int getFuelFactor() {
return fuelConsumptionFactor;
}
public boolean isUpgradeActive(int upgradeID) {
return upgrades[upgradeID];
}
public int getRingAmount() {
return ringAmount;
}
public int getTotalActiveUpgrades() {
int totalUpgrades = 0;
for (boolean upgrade : upgrades) {
if (upgrade) {
totalUpgrades++;
}
}
return totalUpgrades;
}
private Text fuelUsage() {
return new Text(fuelConsumption + " L/5s");
}
private Text gravitonShardAmount() {
EnumChatFormatting enoughGravitonShards = EnumChatFormatting.RED;
if (gravitonShardsAvailable >= gravitonShardCost) {
enoughGravitonShards = EnumChatFormatting.GREEN;
}
return new Text(enoughGravitonShards + Integer.toString(gravitonShardsAvailable));
}
private Text storedFuel() {
if (internalBattery == 0) {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.storedstartupfuel") + " "
+ stellarFuelAmount
+ "/"
+ neededStartupFuel);
}
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.storedfuel") + " "
+ internalBattery
+ "/"
+ maxBatteryCharge);
}
private void checkInversionStatus() {
int inversionChecker = 0;
for (int progress : milestoneProgress) {
if (progress < 7) {
break;
}
inversionChecker++;
}
inversion = inversionChecker == 4;
}
private Text inversionStatusText() {
String inversionStatus = "";
if (inversion) {
inversionStatus = EnumChatFormatting.BOLD
+ translateToLocal("gt.blockmachines.multimachine.FOG.inversionactive");
}
return new Text(inversionStatus);
}
private void determineCompositionMilestoneLevel() {
int[] uniqueModuleCount = new int[5];
int smelting = 0;
int molten = 0;
int plasma = 0;
int exotic = 0;
int exoticMagmatter = 0;
for (MTEBaseModule module : moduleHatches) {
if (module instanceof MTESmeltingModule) {
uniqueModuleCount[0] = 1;
smelting++;
continue;
}
if (module instanceof MTEMoltenModule) {
uniqueModuleCount[1] = 1;
molten++;
continue;
}
if (module instanceof MTEPlasmaModule) {
uniqueModuleCount[2] = 1;
plasma++;
continue;
}
if (module instanceof MTEExoticModule) {
if (!((MTEExoticModule) module).isMagmatterModeOn()) {
uniqueModuleCount[3] = 1;
exotic++;
} else {
uniqueModuleCount[4] = 1;
exoticMagmatter++;
}
}
}
totalExtensionsBuilt = Arrays.stream(uniqueModuleCount)
.sum() + ringAmount
- 1;
if (inversion) {
totalExtensionsBuilt += (smelting - 1
+ (molten - 1) * 2
+ (plasma - 1) * 3
+ (exotic - 1) * 4
+ (exoticMagmatter - 1) * 5) / 5f;
}
milestoneProgress[3] = (int) Math.floor(totalExtensionsBuilt);
}
private void determineMilestoneProgress() {
int closestRelevantSeven;
float rawProgress;
float actualProgress;
if (milestoneProgress[0] < 7) {
powerMilestonePercentage = (float) max(
(log((totalPowerConsumed.divide(BigInteger.valueOf(POWER_MILESTONE_CONSTANT))).longValue())
/ POWER_LOG_CONSTANT + 1),
0) / 7;
milestoneProgress[0] = (int) floor(powerMilestonePercentage * 7);
}
if (inversion) {
rawProgress = (totalPowerConsumed.divide(POWER_MILESTONE_T7_CONSTANT)
.floatValue() - 1) / 7;
closestRelevantSeven = (int) floor(rawProgress);
actualProgress = rawProgress - closestRelevantSeven;
milestoneProgress[0] = 7 + (int) floor(rawProgress * 7);
if (closestRelevantSeven % 2 == 0) {
invertedPowerMilestonePercentage = actualProgress;
powerMilestonePercentage = 1 - invertedPowerMilestonePercentage;
} else {
powerMilestonePercentage = actualProgress;
invertedPowerMilestonePercentage = 1 - powerMilestonePercentage;
}
}
if (milestoneProgress[1] < 7) {
recipeMilestonePercentage = (float) max(
(log(totalRecipesProcessed * 1f / RECIPE_MILESTONE_CONSTANT) / RECIPE_LOG_CONSTANT + 1),
0) / 7;
milestoneProgress[1] = (int) floor(recipeMilestonePercentage * 7);
}
if (inversion) {
rawProgress = (((float) totalRecipesProcessed / RECIPE_MILESTONE_T7_CONSTANT) - 1) / 7;
closestRelevantSeven = (int) floor(rawProgress);
actualProgress = rawProgress - closestRelevantSeven;
milestoneProgress[1] = 7 + (int) floor(rawProgress * 7);
if (closestRelevantSeven % 2 == 0) {
invertedRecipeMilestonePercentage = actualProgress;
recipeMilestonePercentage = 1 - invertedRecipeMilestonePercentage;
} else {
recipeMilestonePercentage = actualProgress;
invertedRecipeMilestonePercentage = 1 - recipeMilestonePercentage;
}
}
if (milestoneProgress[2] < 7) {
fuelMilestonePercentage = (float) max(
(log(totalFuelConsumed * 1f / FUEL_MILESTONE_CONSTANT) / FUEL_LOG_CONSTANT + 1),
0) / 7;
milestoneProgress[2] = (int) floor(fuelMilestonePercentage * 7);
}
if (inversion) {
rawProgress = (((float) totalFuelConsumed / FUEL_MILESTONE_T7_CONSTANT) - 1) / 7;
closestRelevantSeven = (int) floor(rawProgress);
actualProgress = rawProgress - closestRelevantSeven;
milestoneProgress[2] = 7 + (int) floor(rawProgress * 7);
if ((closestRelevantSeven % 2) == 0) {
invertedFuelMilestonePercentage = actualProgress;
fuelMilestonePercentage = 1 - invertedFuelMilestonePercentage;
} else {
fuelMilestonePercentage = actualProgress;
invertedFuelMilestonePercentage = 1 - fuelMilestonePercentage;
}
}
if (milestoneProgress[3] <= 7) {
structureMilestonePercentage = totalExtensionsBuilt / 7f;
}
if (inversion) {
rawProgress = (totalExtensionsBuilt - 7) / 7f;
closestRelevantSeven = (int) floor(rawProgress);
actualProgress = rawProgress - closestRelevantSeven;
if ((closestRelevantSeven % 2) == 0) {
invertedStructureMilestonePercentage = actualProgress;
structureMilestonePercentage = 1 - invertedStructureMilestonePercentage;
} else {
structureMilestonePercentage = actualProgress;
invertedStructureMilestonePercentage = 1 - structureMilestonePercentage;
}
}
}
private void determineGravitonShardAmount() {
int sum = 0;
for (int progress : milestoneProgress) {
if (!inversion) {
progress = Math.min(progress, 7);
}
sum += progress * (progress + 1) / 2;
}
gravitonShardsAvailable = sum - gravitonShardsSpent;
}
private void ejectGravitonShards() {
if (mOutputBusses.size() == 1) {
while (gravitonShardsAvailable >= 64) {
addOutput(GTOreDictUnificator.get(OrePrefixes.gem, MaterialsUEVplus.GravitonShard, 64));
gravitonShardsAvailable -= 64;
}
addOutput(
GTOreDictUnificator.get(OrePrefixes.gem, MaterialsUEVplus.GravitonShard, gravitonShardsAvailable));
gravitonShardsAvailable = 0;
}
}
private Text gravitonShardAmountText(int milestoneID) {
int sum;
int progress = milestoneProgress[milestoneID];
if (!inversion) {
progress = Math.min(progress, 7);
}
sum = progress * (progress + 1) / 2;
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.shardgain") + ": " + EnumChatFormatting.GRAY + sum);
}
private Text totalMilestoneProgress(int milestoneID) {
long progress;
BigInteger bigProgress;
String suffix;
switch (milestoneID) {
case 1 -> {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.recipes");
progress = totalRecipesProcessed;
}
case 2 -> {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.fuelconsumed");
progress = totalFuelConsumed;
}
case 3 -> {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.extensions");
progress = milestoneProgress[3];
}
default -> {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.power");
bigProgress = totalPowerConsumed;
if (!noFormatting && (totalPowerConsumed.compareTo(BigInteger.valueOf(1_000L)) > 0)) {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.totalprogress") + ": "
+ EnumChatFormatting.GRAY
+ toExponentForm(bigProgress)
+ " "
+ suffix);
} else {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.totalprogress") + ": "
+ EnumChatFormatting.GRAY
+ bigProgress
+ " "
+ suffix);
}
}
}
if (!noFormatting) {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.totalprogress") + ": "
+ EnumChatFormatting.GRAY
+ formatNumbers(progress)
+ " "
+ suffix);
} else {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.totalprogress") + ": "
+ EnumChatFormatting.GRAY
+ progress
+ " "
+ suffix);
}
}
private Text currentMilestone(int milestoneID) {
return new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.milestoneprogress") + ": "
+ EnumChatFormatting.GRAY
+ milestoneProgress[milestoneID]);
}
private Text milestoneProgressText(int milestoneID, boolean formatting) {
long max;
BigInteger bigMax;
String suffix;
String progressText = translateToLocal("gt.blockmachines.multimachine.FOG.progress");
Text done = new Text(translateToLocal("gt.blockmachines.multimachine.FOG.milestonecomplete"));
if (noFormatting) {
formatting = false;
done = new Text(
translateToLocal("gt.blockmachines.multimachine.FOG.milestonecomplete") + EnumChatFormatting.DARK_RED
+ "?");
}
switch (milestoneID) {
case 0:
if (milestoneProgress[0] < 7 || inversion) {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.power");
if (inversion) {
bigMax = POWER_MILESTONE_T7_CONSTANT.multiply(BigInteger.valueOf(milestoneProgress[0] - 5));
} else {
bigMax = BigInteger.valueOf(LongMath.pow(9, milestoneProgress[0]))
.multiply(BigInteger.valueOf(LongMath.pow(10, 15)));
}
if (formatting && (totalPowerConsumed.compareTo(BigInteger.valueOf(1_000L)) > 0)) {
return new Text(
progressText + ": " + EnumChatFormatting.GRAY + toExponentForm(bigMax) + " " + suffix);
} else {
return new Text(progressText + ": " + EnumChatFormatting.GRAY + bigMax + " " + suffix);
}
} else {
return done;
}
case 1:
if (milestoneProgress[1] < 7 || inversion) {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.recipes");
if (inversion) {
max = RECIPE_MILESTONE_T7_CONSTANT * (milestoneProgress[1] - 5);
} else {
max = LongMath.pow(6, milestoneProgress[1]) * LongMath.pow(10, 7);
}
break;
} else {
return done;
}
case 2:
if (milestoneProgress[2] < 7 || inversion) {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.fuelconsumed");
if (inversion) {
max = FUEL_MILESTONE_T7_CONSTANT * (milestoneProgress[2] - 5);
} else {
max = LongMath.pow(3, milestoneProgress[2]) * LongMath.pow(10, 4);
}
break;
} else {
return done;
}
case 3:
if (milestoneProgress[3] < 7 || inversion) {
suffix = translateToLocal("gt.blockmachines.multimachine.FOG.extensions");
max = milestoneProgress[3] + 1;
break;
} else {
return done;
}
default:
return new Text("Error");
}
if (formatting) {
return new Text(progressText + ": " + EnumChatFormatting.GRAY + formatNumbers(max) + " " + suffix);
} else {
return new Text(progressText + ": " + EnumChatFormatting.GRAY + max + " " + suffix);
}
}
private Text inversionHeaderText() {
return inversion
? new Text(
EnumChatFormatting.BOLD + "§k2"
+ EnumChatFormatting.RESET
+ EnumChatFormatting.WHITE
+ EnumChatFormatting.BOLD
+ translateToLocal("gt.blockmachines.multimachine.FOG.inversion")
+ EnumChatFormatting.BOLD
+ "§k2")
: new Text("");
}
private Text inversionInfoText() {
return inversion ? new Text(translateToLocal("gt.blockmachines.multimachine.FOG.inversioninfotext"))
: new Text("");
}
private Text constructionStatusText() {
return upgrades[currentUpgradeID] ? new Text(translateToLocal("fog.upgrade.respec"))
: new Text(translateToLocal("fog.upgrade.confirm"));
}
private List<String> constructionStatus() {
if (upgrades[currentUpgradeID]) {
return ImmutableList.of(translateToLocal("fog.upgrade.respec"));
}
return ImmutableList.of(translateToLocal("fog.upgrade.confirm"));
}
private List<String> upgradeMaterialRequirements() {
if (materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION)
.indexOf(currentUpgradeID)]) {
return ImmutableList.of(translateToLocal("fog.button.materialrequirementsmet.tooltip"));
}
return ImmutableList.of(translateToLocal("fog.button.materialrequirements.tooltip"));
}
private void increaseBattery(int amount) {
if ((internalBattery + amount) <= maxBatteryCharge) {
internalBattery += amount;
} else {
internalBattery = maxBatteryCharge;
batteryCharging = false;
}
}
public void reduceBattery(int amount) {
if (internalBattery - amount <= 0) {
internalBattery = 0;
if (moduleHatches.size() > 0) {
for (MTEBaseModule module : moduleHatches) {
module.disconnect();
}
}
destroyRenderer();
} else {
internalBattery -= amount;
totalFuelConsumed += amount;
}
}
public int getBatteryCharge() {
return internalBattery;
}
public int getMaxBatteryCharge() {
return maxBatteryCharge;
}
public void addTotalPowerConsumed(BigInteger amount) {
totalPowerConsumed = totalPowerConsumed.add(amount);
}
public void addTotalRecipesProcessed(long amount) {
totalRecipesProcessed += amount;
}
@Override
protected void setHatchRecipeMap(MTEHatchInput hatch) {}
@Override
public void setItemNBT(NBTTagCompound NBT) {
NBT.setInteger("selectedFuelType", selectedFuelType);
NBT.setInteger("fuelConsumptionFactor", fuelConsumptionFactor);
NBT.setInteger("internalBattery", internalBattery);
NBT.setBoolean("batteryCharging", batteryCharging);
NBT.setInteger("batterySize", maxBatteryCharge);
NBT.setInteger("gravitonShardsAvailable", gravitonShardsAvailable);
NBT.setInteger("gravitonShardsSpent", gravitonShardsSpent);
NBT.setByteArray("totalPowerConsumed", totalPowerConsumed.toByteArray());
NBT.setLong("totalRecipesProcessed", totalRecipesProcessed);
NBT.setLong("totalFuelConsumed", totalFuelConsumed);
NBT.setInteger("starFuelStored", stellarFuelAmount);
NBT.setBoolean("gravitonShardEjection", gravitonShardEjection);
// Store booleanArrays of all upgrades
NBTTagCompound upgradeBooleanArrayNBTTag = new NBTTagCompound();
int upgradeIndex = 0;
for (Boolean upgrade : upgrades) {
upgradeBooleanArrayNBTTag.setBoolean("upgrade" + upgradeIndex, upgrade);
upgradeIndex++;
}
NBT.setTag("upgrades", upgradeBooleanArrayNBTTag);
NBTTagCompound upgradeMaterialBooleanArrayNBTTag = new NBTTagCompound();
int upgradeMaterialIndex = 0;
for (Boolean upgrade : materialPaidUpgrades) {
upgradeBooleanArrayNBTTag.setBoolean("upgradeMaterial" + upgradeMaterialIndex, upgrade);
upgradeMaterialIndex++;
}
NBT.setTag("upgradeMaterials", upgradeMaterialBooleanArrayNBTTag);
super.saveNBTData(NBT);
}
@Override
public void saveNBTData(NBTTagCompound NBT) {
NBT.setInteger("selectedFuelType", selectedFuelType);
NBT.setInteger("fuelConsumptionFactor", fuelConsumptionFactor);
NBT.setInteger("internalBattery", internalBattery);
NBT.setBoolean("batteryCharging", batteryCharging);
NBT.setInteger("batterySize", maxBatteryCharge);
NBT.setInteger("gravitonShardsAvailable", gravitonShardsAvailable);
NBT.setInteger("gravitonShardsSpent", gravitonShardsSpent);
NBT.setByteArray("totalPowerConsumed", totalPowerConsumed.toByteArray());
NBT.setLong("totalRecipesProcessed", totalRecipesProcessed);
NBT.setLong("totalFuelConsumed", totalFuelConsumed);
NBT.setInteger("starFuelStored", stellarFuelAmount);
NBT.setBoolean("gravitonShardEjection", gravitonShardEjection);
NBT.setBoolean("isRenderActive", isRenderActive);
NBT.setInteger("ringAmount", ringAmount);
// Store booleanArray of all upgrades
NBTTagCompound upgradeBooleanArrayNBTTag = new NBTTagCompound();
int upgradeIndex = 0;
for (boolean upgrade : upgrades) {
upgradeBooleanArrayNBTTag.setBoolean("upgrade" + upgradeIndex, upgrade);
upgradeIndex++;
}
NBT.setTag("upgrades", upgradeBooleanArrayNBTTag);
NBTTagCompound upgradeMaterialBooleanArrayNBTTag = new NBTTagCompound();
int upgradeMaterialIndex = 0;
for (boolean upgrade : materialPaidUpgrades) {
upgradeMaterialBooleanArrayNBTTag.setBoolean("upgradeMaterial" + upgradeMaterialIndex, upgrade);
upgradeMaterialIndex++;
}
NBT.setTag("upgradeMaterials", upgradeMaterialBooleanArrayNBTTag);
super.saveNBTData(NBT);
}
@Override
public void loadNBTData(NBTTagCompound NBT) {
selectedFuelType = NBT.getInteger("selectedFuelType");
fuelConsumptionFactor = NBT.getInteger("fuelConsumptionFactor");
internalBattery = NBT.getInteger("internalBattery");
batteryCharging = NBT.getBoolean("batteryCharging");
maxBatteryCharge = NBT.getInteger("batterySize");
gravitonShardsAvailable = NBT.getInteger("gravitonShardsAvailable");
gravitonShardsSpent = NBT.getInteger("gravitonShardsSpent");
totalPowerConsumed = new BigInteger(NBT.getByteArray("totalPowerConsumed"));
totalRecipesProcessed = NBT.getLong("totalRecipesProcessed");
totalFuelConsumed = NBT.getLong("totalFuelConsumed");
stellarFuelAmount = NBT.getInteger("starFuelStored");
gravitonShardEjection = NBT.getBoolean("gravitonShardEjection");
isRenderActive = NBT.getBoolean("isRenderActive");
ringAmount = NBT.getInteger("ringAmount");
NBTTagCompound tempBooleanTag = NBT.getCompoundTag("upgrades");
for (int upgradeIndex = 0; upgradeIndex < 31; upgradeIndex++) {
boolean upgrade = tempBooleanTag.getBoolean("upgrade" + upgradeIndex);
upgrades[upgradeIndex] = upgrade;
}
tempBooleanTag = NBT.getCompoundTag("upgradeMaterials");
for (int upgradeIndex = 0; upgradeIndex < 7; upgradeIndex++) {
boolean upgrade = tempBooleanTag.getBoolean("upgradeMaterial" + upgradeIndex);
materialPaidUpgrades[upgradeIndex] = upgrade;
}
super.loadNBTData(NBT);
}
@Override
public boolean getDefaultHasMaintenanceChecks() {
return false;
}
}
|